bsps/atsam: Add NULL pointer protection

This commit is contained in:
Christian Mauderer
2022-12-09 10:20:17 +01:00
parent 26050b5fb4
commit 7b968a2eb4
9 changed files with 55 additions and 4 deletions

View File

@@ -296,6 +296,8 @@ links:
uid: optmck
- role: build-dependency
uid: optnocachesz
- role: build-dependency
uid: optnullsz
- role: build-dependency
uid: optoscmain
- role: build-dependency

View File

@@ -2,7 +2,8 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
build-type: config-file
content: |
MEMORY {
ITCM : ORIGIN = 0x00000000, LENGTH = ${ATSAM_MEMORY_TCM_SIZE}
NULL : ORIGIN = 0x00000000, LENGTH = ${ATSAM_MEMORY_NULL_SIZE}
ITCM : ORIGIN = ${ATSAM_MEMORY_NULL_SIZE}, LENGTH = ((${ATSAM_MEMORY_TCM_SIZE} > ${ATSAM_MEMORY_NULL_SIZE}) ? (${ATSAM_MEMORY_TCM_SIZE} - ${ATSAM_MEMORY_NULL_SIZE}) : 0)
INTFLASH : ORIGIN = 0x00400000, LENGTH = ${ATSAM_MEMORY_INTFLASH_SIZE}
DTCM : ORIGIN = 0x20000000, LENGTH = ${ATSAM_MEMORY_TCM_SIZE}
INTSRAM : ORIGIN = 0x20400000, LENGTH = ${ATSAM_MEMORY_INTSRAM_SIZE} - 2 * ${ATSAM_MEMORY_TCM_SIZE} - ${ATSAM_MEMORY_NOCACHE_SIZE}
@@ -13,6 +14,10 @@ content: |
/* Must be used only for MPU definitions */
atsam_memory_null_begin = ORIGIN (NULL);
atsam_memory_null_end = ORIGIN (NULL) + LENGTH (NULL);
atsam_memory_null_size = LENGTH (NULL);
atsam_memory_itcm_begin = ORIGIN (ITCM);
atsam_memory_itcm_end = ORIGIN (ITCM) + LENGTH (ITCM);
atsam_memory_itcm_size = LENGTH (ITCM);

View File

@@ -0,0 +1,17 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
actions:
- get-integer: null
- env-assign: null
build-type: option
default: 0
default-by-variant: []
enabled-by: true
format: '{:#010x}'
links: []
name: ATSAM_MEMORY_NULL_SIZE
description: |
Size of the NULL pointer protection area in bytes. This memory area reduces
the size of the ITCM available to the application.
type: build
copyrights:
- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)

View File

@@ -9,7 +9,8 @@ copyrights:
default: 0
default-by-variant: []
description: |
size of tightly coupled memories (TCM) in bytes
Size of tightly coupled memories (TCM) in bytes. Note that the ITCM is
reduced by the ATSAM_MEMORY_NULL_SIZE option. DTCM is unaffected.
enabled-by: true
format: '{:#010x}'
links: []