From 7b968a2eb4358f958e4be3aedf462e250ba1749b Mon Sep 17 00:00:00 2001 From: Christian Mauderer Date: Fri, 9 Dec 2022 10:20:17 +0100 Subject: bsps/atsam: Add NULL pointer protection --- spec/build/bsps/arm/atsam/bspatsam.yml | 2 ++ spec/build/bsps/arm/atsam/linkcmds.yml | 7 ++++++- spec/build/bsps/arm/atsam/optnullsz.yml | 17 +++++++++++++++++ spec/build/bsps/arm/atsam/opttcmsz.yml | 3 ++- 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 spec/build/bsps/arm/atsam/optnullsz.yml (limited to 'spec/build/bsps/arm') diff --git a/spec/build/bsps/arm/atsam/bspatsam.yml b/spec/build/bsps/arm/atsam/bspatsam.yml index 6716bea248..679889d253 100644 --- a/spec/build/bsps/arm/atsam/bspatsam.yml +++ b/spec/build/bsps/arm/atsam/bspatsam.yml @@ -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 diff --git a/spec/build/bsps/arm/atsam/linkcmds.yml b/spec/build/bsps/arm/atsam/linkcmds.yml index fe6211f82f..d475b6a245 100644 --- a/spec/build/bsps/arm/atsam/linkcmds.yml +++ b/spec/build/bsps/arm/atsam/linkcmds.yml @@ -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); diff --git a/spec/build/bsps/arm/atsam/optnullsz.yml b/spec/build/bsps/arm/atsam/optnullsz.yml new file mode 100644 index 0000000000..d992c286e7 --- /dev/null +++ b/spec/build/bsps/arm/atsam/optnullsz.yml @@ -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) diff --git a/spec/build/bsps/arm/atsam/opttcmsz.yml b/spec/build/bsps/arm/atsam/opttcmsz.yml index 7e8b1121e8..da3e575f55 100644 --- a/spec/build/bsps/arm/atsam/opttcmsz.yml +++ b/spec/build/bsps/arm/atsam/opttcmsz.yml @@ -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: [] -- cgit v1.2.3