AnsweredAssumed Answered

How to use __RODATA macro from <cr_section_macros.h>?

Question asked by Matt Schrader on May 31, 2018
Latest reply on Jun 6, 2018 by Matt Schrader

Working with the LPC54608 and I'm attempting to place const data into the external board flash (SPIFI). In my end application, this will be used mostly for graphics data. I am attempting to use the __RODATA macro from <cr_section_macros.h>, as described here:

Placing code/rodata into different FLASH blocks 

So far this has not been successful. What am I missing?



  • LPCXpresso54608 OM13092
  • MCUXpresso IDE v10.2.0
  • I've modified the "hello world" example from the SDK v2.4 (project files attached)
  • I've tried using both available drivers "LPC5460x_SPIFI_GENERIC.cfx" and "LPC546xx_SPIFI_SFDP.cfx"


According to the build output, it shows up under the "BOARD_FLASH" section:

Memory region               Used Size      Region Size      %age Used
PROGRAM_FLASH:         16308 B             512 KB               3.11%
BOARD_FLASH:                     40 B              16 MB               0.00%
SRAM_0_1_2_3:                 8536 B            160 KB                5.21%
SRAMX:                                  0 GB              32 KB                0.00%
USB_RAM:                             0 GB                8 KB                0.00%
BOARD_SDRAM:                   0 GB             16 MB                0.00%
Finished building target: lpcxpresso54608_hello_world.axf


Debug console indicates it is being written:

Inspected v.2 On-chip Flash Memory LPC5460x_512K.cfx
Image 'LPC5460x (512K Flash) Aug 23 2017 12:13:28'
Inspected v.2 External Flash Device on SPI LPC5460x_SPIFI_GENERIC.cfx
Image 'LPC5460x Generic SPIFI Sep 25 2017 16:15:07'
Opening flash driver LPC5460x_SPIFI_GENERIC.cfx
Sending VECTRESET to run flash driver
flash variant 'MT25QL128AB' detected (16MB = 256*64K at 0x10000000)
Closing flash driver LPC5460x_SPIFI_GENERIC.cfx
NXP: LPC54608J512
Connected: was_reset=true. was_stopped=false
Awaiting telnet connection to port 3330 ...
GDB nonstop mode enabled
Opening flash driver LPC5460x_512K.cfx
Sending VECTRESET to run flash driver
Writing 16308 bytes to address 0x00000000 in Flash
Erased/Wrote page 0-0 with 16308 bytes in 193msec
Closing flash driver LPC5460x_512K.cfx
Flash Write Done
Opening flash driver LPC5460x_SPIFI_GENERIC.cfx
Sending VECTRESET to run flash driver
Writing 40 bytes to address 0x10000000 in Flash
Erased/Wrote page 0-0 with 40 bytes in 191msec
Closing flash driver LPC5460x_SPIFI_GENERIC.cfx
Flash Write Done
Flash Program Summary: 16348 bytes in 0.38 seconds (41.47 KB/sec)
Starting execution using system reset and halt target


Yet when I debug, I cannot see the data in the Memory monitor (address 0x10000000), and a simple printf of the data does not show the expected result.


I'm also seeing that this program gets stuck in SPIFI_ResetCommand() as called by SPIFI_Init(). This makes me think the h/w is being left in a bad state after programming?