bsps/imsrt: Make flash config more flexible

The flash configuration is something very board specific. So move the
file to a board specific location. Beneath that, not all controllers and
configurations need the flash config right at the address 0 of the
flash. For example on the i.MXRT11xx, the config has an offset for some
flash types.
This commit is contained in:
Christian Mauderer
2023-07-13 10:53:34 +02:00
parent 5bfcad2641
commit 780149bc38
11 changed files with 62 additions and 30 deletions

View File

@@ -56,6 +56,10 @@ extern char imxrt_memory_peripheral_begin[];
extern char imxrt_memory_peripheral_end[];
extern char imxrt_memory_peripheral_size[];
extern char imxrt_memory_flash_raw_begin[];
extern char imxrt_memory_flash_raw_end[];
extern char imxrt_memory_flash_raw_size[];
extern char imxrt_memory_flash_config_begin[];
extern char imxrt_memory_flash_config_end[];
extern char imxrt_memory_flash_config_size[];

View File

@@ -30,7 +30,7 @@
#include <bspopts.h>
const BOOT_DATA_T imxrt_boot_data = {
.start = (uint32_t) imxrt_memory_flash_config_begin,
.start = (uint32_t) imxrt_memory_flash_raw_begin,
.size = IMXRT_MEMORY_FLASH_SIZE,
.plugin = PLUGIN_FLAG,
.placeholder = 0xFFFFFFFF,

View File

@@ -44,8 +44,8 @@ BSP_START_DATA_SECTION const ARMV7M_MPU_Region_config
| ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
| ARMV7M_MPU_RASR_ENABLE,
}, {
.begin = imxrt_memory_flash_config_begin,
.end = imxrt_memory_flash_end,
.begin = imxrt_memory_flash_raw_begin,
.end = imxrt_memory_flash_raw_end,
.rasr = ARMV7M_MPU_RASR_AP(0x3)
| ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
| ARMV7M_MPU_RASR_ENABLE,

View File

@@ -25,6 +25,7 @@ links:
source:
- bsps/arm/imxrt/boards/evkbimxrt1050/clock_config.c
- bsps/arm/imxrt/boards/evkbimxrt1050/flash-dcd.c
- bsps/arm/imxrt/boards/evkbimxrt1050/flash-flexspi-config.c
- bsps/arm/imxrt/boards/evkbimxrt1050/pin_mux.c
- bsps/arm/imxrt/boards/evkbimxrt1050/clock-arm-pll-config.c
- bsps/arm/imxrt/dts/imxrt1050-evkb.c

View File

@@ -33,7 +33,9 @@ links:
- role: build-dependency
uid: optmemextramsz
- role: build-dependency
uid: optmemflashcfgsz
uid: optmemflashcfgoffset
- role: build-dependency
uid: optmemflashivtoffset
- role: build-dependency
uid: optmemflashivtsz
- role: build-dependency

View File

@@ -5,12 +5,13 @@ content: |
NULL : ORIGIN = 0x00000000, LENGTH = ${IMXRT_MEMORY_NULL_SIZE:#010x}
ITCM : ORIGIN = ${IMXRT_MEMORY_NULL_SIZE:#010x}, LENGTH = ${IMXRT_MEMORY_ITCM_SIZE:#010x}
DTCM : ORIGIN = 0x20000000, LENGTH = ${IMXRT_MEMORY_DTCM_SIZE:#010x}
OCRAM : ORIGIN = ${IMXRT_MEMORY_OCRAM_ORIGIN}, LENGTH = ${IMXRT_MEMORY_OCRAM_SIZE:#010x} - ${IMXRT_MEMORY_OCRAM_NOCACHE_SIZE:#010x}
OCRAM_NOCACHE : ORIGIN = ${IMXRT_MEMORY_OCRAM_ORIGIN} + ${IMXRT_MEMORY_OCRAM_SIZE:#010x} - ${IMXRT_MEMORY_OCRAM_NOCACHE_SIZE:#010x}, LENGTH = ${IMXRT_MEMORY_OCRAM_NOCACHE_SIZE:#010x}
OCRAM : ORIGIN = ${IMXRT_MEMORY_OCRAM_ORIGIN:#010x}, LENGTH = ${IMXRT_MEMORY_OCRAM_SIZE:#010x} - ${IMXRT_MEMORY_OCRAM_NOCACHE_SIZE:#010x}
OCRAM_NOCACHE : ORIGIN = ${IMXRT_MEMORY_OCRAM_ORIGIN:#010x} + ${IMXRT_MEMORY_OCRAM_SIZE:#010x} - ${IMXRT_MEMORY_OCRAM_NOCACHE_SIZE:#010x}, LENGTH = ${IMXRT_MEMORY_OCRAM_NOCACHE_SIZE:#010x}
PERIPHERAL : ORIGIN = 0x40000000, LENGTH = 0x20000000
FLASH_CONFIG : ORIGIN = ${IMXRT_MEMORY_FLASH_ORIGIN:#010x}, LENGTH = ${IMXRT_MEMORY_FLASH_CFG_SIZE:#010x}
FLASH_IVT : ORIGIN = ${IMXRT_MEMORY_FLASH_ORIGIN:#010x} + ${IMXRT_MEMORY_FLASH_CFG_SIZE:#010x}, LENGTH = ${IMXRT_MEMORY_FLASH_IVT_SIZE:#010x}
FLASH : ORIGIN = ${IMXRT_MEMORY_FLASH_ORIGIN:#010x} + ${IMXRT_MEMORY_FLASH_CFG_SIZE:#010x} + ${IMXRT_MEMORY_FLASH_IVT_SIZE:#010x}, LENGTH = ${IMXRT_MEMORY_FLASH_SIZE:#010x} - ${IMXRT_MEMORY_FLASH_CFG_SIZE:#010x} - ${IMXRT_MEMORY_FLASH_IVT_SIZE:#010x}
FLASH_RAW : ORIGIN = ${IMXRT_MEMORY_FLASH_ORIGIN:#010x}, LENGTH = ${IMXRT_MEMORY_FLASH_SIZE:#010x}
FLASH_CONFIG : ORIGIN = ${IMXRT_MEMORY_FLASH_ORIGIN:#010x} + ${IMXRT_MEMORY_FLASH_CFG_OFFSET:#010x}, LENGTH = ${IMXRT_MEMORY_FLASH_IVT_OFFSET:#010x} - ${IMXRT_MEMORY_FLASH_CFG_OFFSET:#010x}
FLASH_IVT : ORIGIN = ${IMXRT_MEMORY_FLASH_ORIGIN:#010x} + ${IMXRT_MEMORY_FLASH_IVT_OFFSET:#010x}, LENGTH = ${IMXRT_MEMORY_FLASH_IVT_SIZE:#010x}
FLASH : ORIGIN = ${IMXRT_MEMORY_FLASH_ORIGIN:#010x} + ${IMXRT_MEMORY_FLASH_IVT_OFFSET:#010x} + ${IMXRT_MEMORY_FLASH_IVT_SIZE:#010x}, LENGTH = ${IMXRT_MEMORY_FLASH_SIZE:#010x} - ${IMXRT_MEMORY_FLASH_IVT_OFFSET:#010x} - ${IMXRT_MEMORY_FLASH_IVT_SIZE:#010x}
EXTRAM : ORIGIN = ${IMXRT_MEMORY_EXTRAM_ORIGIN:#010x}, LENGTH = ${IMXRT_MEMORY_EXTRAM_SIZE:#010x} - ${IMXRT_MEMORY_EXTRAM_NOCACHE_SIZE:#010x}
EXTRAM_NOCACHE : ORIGIN = ${IMXRT_MEMORY_EXTRAM_ORIGIN:#010x} + ${IMXRT_MEMORY_EXTRAM_SIZE:#010x} - ${IMXRT_MEMORY_EXTRAM_NOCACHE_SIZE:#010x}, LENGTH = ${IMXRT_MEMORY_EXTRAM_NOCACHE_SIZE:#010x}
}
@@ -39,6 +40,10 @@ content: |
imxrt_memory_peripheral_end = ORIGIN (PERIPHERAL) + LENGTH (PERIPHERAL);
imxrt_memory_peripheral_size = LENGTH (PERIPHERAL);
imxrt_memory_flash_raw_begin = ORIGIN (FLASH_RAW);
imxrt_memory_flash_raw_end = ORIGIN (FLASH_RAW) + LENGTH (FLASH_RAW);
imxrt_memory_flash_raw_size = LENGTH (FLASH_RAW);
imxrt_memory_flash_config_begin = ORIGIN (FLASH_CONFIG);
imxrt_memory_flash_config_end = ORIGIN (FLASH_CONFIG) + LENGTH (FLASH_CONFIG);
imxrt_memory_flash_config_size = LENGTH (FLASH_CONFIG);

View File

@@ -41,7 +41,6 @@ source:
- bsps/arm/imxrt/start/bspstart.c
- bsps/arm/imxrt/start/bspstarthooks.c
- bsps/arm/imxrt/start/flash-boot-data.c
- bsps/arm/imxrt/start/flash-flexspi-config.c
- bsps/arm/imxrt/start/flash-ivt.c
- bsps/arm/imxrt/start/imxrt-ffec-init.c
- bsps/arm/imxrt/start/mpu-config.c

View File

@@ -0,0 +1,21 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
actions:
- get-integer: null
- env-assign: null
build-type: option
copyrights:
- Copyright (C) 2023 embedded brains GmbH (http://www.embedded-brains.de)
default:
- enabled-by: arm/imxrt1166-cm7-saltshaker
value: 0x00000400
- enabled-by: true
value: 0x00000000
description: |
Ofset of the flash configuration area from the start of the FlexSPI / SEMC
flash in bytes. The example link files for the i.MX RT1050 set that to 0. On
the i.MX RT1166, it's 0x400.
enabled-by: true
format: '{:#010x}'
links: []
name: IMXRT_MEMORY_FLASH_CFG_OFFSET
type: build

View File

@@ -1,20 +0,0 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
actions:
- get-integer: null
- env-assign: null
build-type: option
copyrights:
- Copyright (C) 2020 embedded brains GmbH & Co. KG
default:
- enabled-by: true
value: 0x00001000
description: |
Size of the flash configuration area at the start of the FlexSPI / SEMC flash
in bytes. Either 4 KByte for FlexSPI NOR / SEMC NOR or 1 Kbyte for most other.
Take a look at the i.MX RT1050 Processor Reference Manual chapter 9.7 "Program
image" for details.
enabled-by: true
format: '{:#010x}'
links: []
name: IMXRT_MEMORY_FLASH_CFG_SIZE
type: build

View File

@@ -0,0 +1,20 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
actions:
- get-integer: null
- env-assign: null
build-type: option
copyrights:
- Copyright (C) 2023 embedded brains GmbH (http://www.embedded-brains.de)
default:
- enabled-by: true
value: 0x00001000
description: |
Offset of the image vector table in flash in bytes. Either 4 KByte for FlexSPI
NOR / SEMC NOR or 1 KByte for most others (on i.MXRT1050). Take a look at the
i.MXRT1050 / i.MXRT1166 Processor Reference Manual chapter "System Boot" /
"Program image" for details.
enabled-by: true
format: '{:#010x}'
links: []
name: IMXRT_MEMORY_FLASH_IVT_OFFSET
type: build