summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mauderer <christian.mauderer@embedded-brains.de>2021-05-11 13:46:56 +0200
committerChristian Mauderer <christian.mauderer@embedded-brains.de>2021-05-17 09:06:41 +0200
commit691fec407a0faae379cab23679ec8456ace9fb06 (patch)
treed557e4a15157126bcb2e8c6fb54c33f7769b4218
parentbsps/imxrt: Add addresses and interrupts to dts (diff)
downloadrtems-691fec407a0faae379cab23679ec8456ace9fb06.tar.bz2
bsps/imxrt: Fix OCRAM, ITCM and DTCM sizes
The sizes are configurable via fuses or per software via some registers. At the moment the registers are not changed. Changing the registers destroys data stored in the RAM areas (like application code or data). So either the fuses or some bootloader should be used to set them before the application starts. This also adds an OCRAM only linker command file. Update #4180
Diffstat (limited to '')
-rw-r--r--bsps/arm/imxrt/include/imxrt/memory.h4
-rw-r--r--bsps/arm/imxrt/start/linkcmds.ocram23
-rw-r--r--bsps/arm/imxrt/start/mpu-config.c6
-rw-r--r--spec/build/bsps/arm/imxrt/bspimxrt.yml9
-rw-r--r--spec/build/bsps/arm/imxrt/linkcmdsmemory.yml11
-rw-r--r--spec/build/bsps/arm/imxrt/optlinkcmds.yml3
-rw-r--r--spec/build/bsps/arm/imxrt/optmemdtcmsz.yml17
-rw-r--r--spec/build/bsps/arm/imxrt/optmemitcmsz.yml17
-rw-r--r--spec/build/bsps/arm/imxrt/optmemocramnocachesz.yml16
-rw-r--r--spec/build/bsps/arm/imxrt/optmemocramsz.yml17
10 files changed, 119 insertions, 4 deletions
diff --git a/bsps/arm/imxrt/include/imxrt/memory.h b/bsps/arm/imxrt/include/imxrt/memory.h
index 5a6b457aa6..8185f713cc 100644
--- a/bsps/arm/imxrt/include/imxrt/memory.h
+++ b/bsps/arm/imxrt/include/imxrt/memory.h
@@ -48,6 +48,10 @@ extern char imxrt_memory_ocram_begin[];
extern char imxrt_memory_ocram_end[];
extern char imxrt_memory_ocram_size[];
+extern char imxrt_memory_ocram_nocache_begin[];
+extern char imxrt_memory_ocram_nocache_end[];
+extern char imxrt_memory_ocram_nocache_size[];
+
extern char imxrt_memory_peripheral_begin[];
extern char imxrt_memory_peripheral_end[];
extern char imxrt_memory_peripheral_size[];
diff --git a/bsps/arm/imxrt/start/linkcmds.ocram b/bsps/arm/imxrt/start/linkcmds.ocram
new file mode 100644
index 0000000000..6df3c917b1
--- /dev/null
+++ b/bsps/arm/imxrt/start/linkcmds.ocram
@@ -0,0 +1,23 @@
+INCLUDE linkcmds.memory
+
+REGION_ALIAS ("REGION_START", OCRAM);
+REGION_ALIAS ("REGION_VECTOR", OCRAM);
+REGION_ALIAS ("REGION_TEXT", OCRAM);
+REGION_ALIAS ("REGION_TEXT_LOAD", OCRAM);
+REGION_ALIAS ("REGION_RODATA", OCRAM);
+REGION_ALIAS ("REGION_RODATA_LOAD", OCRAM);
+REGION_ALIAS ("REGION_DATA", OCRAM);
+REGION_ALIAS ("REGION_DATA_LOAD", OCRAM);
+REGION_ALIAS ("REGION_FAST_TEXT", OCRAM);
+REGION_ALIAS ("REGION_FAST_TEXT_LOAD", OCRAM);
+REGION_ALIAS ("REGION_FAST_DATA", OCRAM);
+REGION_ALIAS ("REGION_FAST_DATA_LOAD", OCRAM);
+REGION_ALIAS ("REGION_BSS", OCRAM);
+REGION_ALIAS ("REGION_WORK", OCRAM);
+REGION_ALIAS ("REGION_STACK", OCRAM);
+REGION_ALIAS ("REGION_NOCACHE", OCRAM_NOCACHE);
+REGION_ALIAS ("REGION_NOCACHE_LOAD", OCRAM);
+
+bsp_vector_table_in_start_section = 1;
+
+INCLUDE linkcmds.armv7m
diff --git a/bsps/arm/imxrt/start/mpu-config.c b/bsps/arm/imxrt/start/mpu-config.c
index 31c39bc16f..683b26d45b 100644
--- a/bsps/arm/imxrt/start/mpu-config.c
+++ b/bsps/arm/imxrt/start/mpu-config.c
@@ -56,6 +56,12 @@ BSP_START_DATA_SECTION const ARMV7M_MPU_Region_config
| ARMV7M_MPU_RASR_TEX(0x2)
| ARMV7M_MPU_RASR_ENABLE,
}, {
+ .begin = imxrt_memory_ocram_nocache_begin,
+ .end = imxrt_memory_ocram_nocache_end,
+ .rasr = ARMV7M_MPU_RASR_AP(0x3)
+ | ARMV7M_MPU_RASR_TEX(0x2)
+ | ARMV7M_MPU_RASR_ENABLE,
+ }, {
.begin = imxrt_memory_peripheral_begin,
.end = imxrt_memory_peripheral_end,
.rasr = ARMV7M_MPU_RASR_XN
diff --git a/spec/build/bsps/arm/imxrt/bspimxrt.yml b/spec/build/bsps/arm/imxrt/bspimxrt.yml
index 07f6bcef39..f543a14394 100644
--- a/spec/build/bsps/arm/imxrt/bspimxrt.yml
+++ b/spec/build/bsps/arm/imxrt/bspimxrt.yml
@@ -109,6 +109,7 @@ install:
- destination: ${BSP_LIBDIR}
source:
- bsps/arm/imxrt/start/linkcmds.flexspi
+ - bsps/arm/imxrt/start/linkcmds.ocram
- bsps/arm/imxrt/start/linkcmds.sdram
links:
- role: build-dependency
@@ -124,14 +125,22 @@ links:
- role: build-dependency
uid: optlinkcmds
- role: build-dependency
+ uid: optmemdtcmsz
+- role: build-dependency
uid: optmemflashcfgsz
- role: build-dependency
uid: optmemflashivtsz
- role: build-dependency
uid: optmemflexspisz
- role: build-dependency
+ uid: optmemitcmsz
+- role: build-dependency
uid: optmemnullsz
- role: build-dependency
+ uid: optmemocramsz
+- role: build-dependency
+ uid: optmemocramnocachesz
+- role: build-dependency
uid: optmemsdrambase
- role: build-dependency
uid: optmemsdramsz
diff --git a/spec/build/bsps/arm/imxrt/linkcmdsmemory.yml b/spec/build/bsps/arm/imxrt/linkcmdsmemory.yml
index 86dc37c3bd..3f7885c589 100644
--- a/spec/build/bsps/arm/imxrt/linkcmdsmemory.yml
+++ b/spec/build/bsps/arm/imxrt/linkcmdsmemory.yml
@@ -2,9 +2,10 @@ build-type: config-file
content: |
MEMORY {
NULL : ORIGIN = 0x00000000, LENGTH = ${IMXRT_MEMORY_NULL_SIZE:#010x}
- ITCM : ORIGIN = ${IMXRT_MEMORY_NULL_SIZE:#010x}, LENGTH = 512k - ${IMXRT_MEMORY_NULL_SIZE:#010x}
- DTCM : ORIGIN = 0x20000000, LENGTH = 512k
- OCRAM : ORIGIN = 0x20200000, LENGTH = 512k
+ ITCM : ORIGIN = ${IMXRT_MEMORY_NULL_SIZE:#010x}, LENGTH = ${IMXRT_MEMORY_ITCM_SIZE:#010x} - ${IMXRT_MEMORY_NULL_SIZE:#010x}
+ DTCM : ORIGIN = 0x20000000, LENGTH = ${IMXRT_MEMORY_DTCM_SIZE:#010x}
+ OCRAM : ORIGIN = 0x20200000, LENGTH = ${IMXRT_MEMORY_OCRAM_SIZE:#010x} - ${IMXRT_MEMORY_OCRAM_NOCACHE_SIZE:#010x}
+ OCRAM_NOCACHE : ORIGIN = 0x20200000 + ${IMXRT_MEMORY_OCRAM_SIZE:#010x} - ${IMXRT_MEMORY_OCRAM_NOCACHE_SIZE:#010x}, LENGTH = ${IMXRT_MEMORY_OCRAM_NOCACHE_SIZE:#010x}
PERIPHERAL : ORIGIN = 0x40000000, LENGTH = 0x20000000
FLEXSPI_CONFIG : ORIGIN = 0x60000000, LENGTH = ${IMXRT_MEMORY_FLASH_CFG_SIZE:#010x}
FLEXSPI_IVT : ORIGIN = 0x60000000 + ${IMXRT_MEMORY_FLASH_CFG_SIZE:#010x}, LENGTH = ${IMXRT_MEMORY_FLASH_IVT_SIZE:#010x}
@@ -30,6 +31,10 @@ content: |
imxrt_memory_ocram_end = ORIGIN (OCRAM) + LENGTH (OCRAM);
imxrt_memory_ocram_size = LENGTH (OCRAM);
+ imxrt_memory_ocram_nocache_begin = ORIGIN (OCRAM_NOCACHE);
+ imxrt_memory_ocram_nocache_end = ORIGIN (OCRAM_NOCACHE) + LENGTH (OCRAM_NOCACHE);
+ imxrt_memory_ocram_nocache_size = LENGTH (OCRAM_NOCACHE);
+
imxrt_memory_peripheral_begin = ORIGIN (PERIPHERAL);
imxrt_memory_peripheral_end = ORIGIN (PERIPHERAL) + LENGTH (PERIPHERAL);
imxrt_memory_peripheral_size = LENGTH (PERIPHERAL);
diff --git a/spec/build/bsps/arm/imxrt/optlinkcmds.yml b/spec/build/bsps/arm/imxrt/optlinkcmds.yml
index ba20c3838f..4349ad332e 100644
--- a/spec/build/bsps/arm/imxrt/optlinkcmds.yml
+++ b/spec/build/bsps/arm/imxrt/optlinkcmds.yml
@@ -9,7 +9,8 @@ format: '{}'
links: []
name: IMXRT_DEFAULT_LINKCMDS
description: |
- The default linker command file. Must be linkcmds.sdram or linkcmds.flexspi.
+ The default linker command file. Must be linkcmds.sdram, linkcmds.ocram or
+ linkcmds.flexspi.
type: build
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
diff --git a/spec/build/bsps/arm/imxrt/optmemdtcmsz.yml b/spec/build/bsps/arm/imxrt/optmemdtcmsz.yml
new file mode 100644
index 0000000000..1bd57fac08
--- /dev/null
+++ b/spec/build/bsps/arm/imxrt/optmemdtcmsz.yml
@@ -0,0 +1,17 @@
+actions:
+- get-integer: null
+- env-assign: null
+build-type: option
+default: 0x20000
+default-by-variant: []
+enabled-by: true
+format: '{:#010x}'
+links: []
+name: IMXRT_MEMORY_DTCM_SIZE
+description: |
+ Size of the DTCM in bytes. Note that these sizes depend on fuses or software
+ settings done by a bootloader (together with ITCM and OCRAM).
+type: build
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
diff --git a/spec/build/bsps/arm/imxrt/optmemitcmsz.yml b/spec/build/bsps/arm/imxrt/optmemitcmsz.yml
new file mode 100644
index 0000000000..195d519889
--- /dev/null
+++ b/spec/build/bsps/arm/imxrt/optmemitcmsz.yml
@@ -0,0 +1,17 @@
+actions:
+- get-integer: null
+- env-assign: null
+build-type: option
+default: 0x20000
+default-by-variant: []
+enabled-by: true
+format: '{:#010x}'
+links: []
+name: IMXRT_MEMORY_ITCM_SIZE
+description: |
+ Size of the ITCM in bytes. Note that these sizes depend on fuses or software
+ settings done by a bootloader (together with DTCM and OCRAM).
+type: build
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
diff --git a/spec/build/bsps/arm/imxrt/optmemocramnocachesz.yml b/spec/build/bsps/arm/imxrt/optmemocramnocachesz.yml
new file mode 100644
index 0000000000..8e68a08708
--- /dev/null
+++ b/spec/build/bsps/arm/imxrt/optmemocramnocachesz.yml
@@ -0,0 +1,16 @@
+actions:
+- get-integer: null
+- env-assign: null
+build-type: option
+default: 0
+default-by-variant: []
+enabled-by: true
+format: '{:#010x}'
+links: []
+name: IMXRT_MEMORY_OCRAM_NOCACHE_SIZE
+description: |
+ Size of the nocache area at the end of the OCRAM in bytes.
+type: build
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
diff --git a/spec/build/bsps/arm/imxrt/optmemocramsz.yml b/spec/build/bsps/arm/imxrt/optmemocramsz.yml
new file mode 100644
index 0000000000..4498435aa6
--- /dev/null
+++ b/spec/build/bsps/arm/imxrt/optmemocramsz.yml
@@ -0,0 +1,17 @@
+actions:
+- get-integer: null
+- env-assign: null
+build-type: option
+default: 0x40000
+default-by-variant: []
+enabled-by: true
+format: '{:#010x}'
+links: []
+name: IMXRT_MEMORY_OCRAM_SIZE
+description: |
+ Size of the OCRAM in bytes. Note that these sizes depend on fuses or software
+ settings done by a bootloader (together with ITCM and DTCM).
+type: build
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)