@@ -218,6 +218,16 @@ bootloader_api_entry_t *g_bootloaderTree;
218218#define LUT_SEQ_IDX_14 (0x38U) /* RESERVED */
219219#define LUT_SEQ_IDX_15 (0x3CU) /* Dummy */
220220
221+ #ifdef TARGET_library
222+ /* For wolfBoot as library (built from application) the flash configuration
223+ * can be located anywhere */
224+ #define FLASH_CONFIG_SECTION
225+ #else
226+ /* For wolfBoot this flash configuration needs to be placed at start of
227+ * flash. See imx_rt.ld */
228+ #define FLASH_CONFIG_SECTION __attribute__((section(".flash_config")))
229+ #endif
230+
221231/** Flash configuration in the .flash_config section of flash **/
222232#ifdef CPU_MIMXRT1064DVL6A
223233 #define CONFIG_FLASH_SIZE (4 * 1024 * 1024) /* 4MBytes */
@@ -226,7 +236,7 @@ bootloader_api_entry_t *g_bootloaderTree;
226236 #define CONFIG_FLASH_BLOCK_SIZE (64 * 1024) /* 64KBytes */
227237 #define CONFIG_FLASH_UNIFORM_BLOCKSIZE false
228238 #define CONFIG_SERIAL_CLK_FREQ kFlexSpiSerialClk_100MHz
229- const flexspi_nor_config_t __attribute__(( section ( ".flash_config" ))) qspiflash_config = {
239+ const flexspi_nor_config_t FLASH_CONFIG_SECTION qspiflash_config = {
230240 .memConfig =
231241 {
232242 .tag = FLEXSPI_CFG_BLK_TAG ,
@@ -258,7 +268,7 @@ const flexspi_nor_config_t __attribute__((section(".flash_config"))) qspiflash_c
258268 #define CONFIG_FLASH_BLOCK_SIZE (64 * 1024) /* 64KBytes */
259269 #define CONFIG_FLASH_UNIFORM_BLOCKSIZE false
260270 #define CONFIG_SERIAL_CLK_FREQ kFlexSpiSerialClk_100MHz
261- const flexspi_nor_config_t __attribute__(( section ( ".flash_config" ))) qspiflash_config = {
271+ const flexspi_nor_config_t FLASH_CONFIG_SECTION qspiflash_config = {
262272 .memConfig =
263273 {
264274 .tag = FLEXSPI_CFG_BLK_TAG ,
@@ -333,7 +343,7 @@ const flexspi_nor_config_t __attribute__((section(".flash_config"))) qspiflash_c
333343 #define CONFIG_FLASH_UNIFORM_BLOCKSIZE true
334344 #define CONFIG_SERIAL_CLK_FREQ kFlexSpiSerialClk_133MHz
335345
336- const flexspi_nor_config_t __attribute__(( section ( ".flash_config" ))) qspiflash_config = {
346+ const flexspi_nor_config_t FLASH_CONFIG_SECTION qspiflash_config = {
337347 .memConfig = {
338348 .tag = FLEXSPI_CFG_BLK_TAG ,
339349 .version = FLEXSPI_CFG_BLK_VERSION ,
@@ -472,7 +482,7 @@ const flexspi_nor_config_t __attribute__((section(".flash_config"))) qspiflash_c
472482
473483 /* QSPI boot header */
474484 /* Credit to: https://community.nxp.com/t5/i-MX-RT/RT1050-Debugging-with-QSPI-flash-on-secondary-pinmux/m-p/934745 */
475- const flexspi_nor_config_t __attribute__(( section ( ".flash_config" ))) qspiflash_config = {
485+ const flexspi_nor_config_t FLASH_CONFIG_SECTION qspiflash_config = {
476486 .memConfig = {
477487 .tag = FLEXSPI_CFG_BLK_TAG ,
478488 .version = FLEXSPI_CFG_BLK_VERSION ,
0 commit comments