Is it possible to compile const array data into flash, not on SRAM?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it possible to compile const array data into flash, not on SRAM?

717 Views
antoniohsu888
Contributor II

I am using RT1060 EVKB.

I have some mp3 files which transformed to c header file.

Here is the example:

static unsigned char __20_mp3[] = {
0x49, 0x44, 0x33, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x54, 0x53,
0x53, 0x45, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x03, 0x4c, 0x61, 0x76,

...

};

and I build it with MCUXpresso,

looks like the data array is on SRAM memory and it is out of SRAM size.

Memory region Used Size Region Size %age Used
BOARD_FLASH: 1683764 B 8 MB 20.07%
SRAM_DTC: 235296 B 128 KB 179.52%
SRAM_ITC: 29568 B 128 KB 22.56%
SRAM_OC: 751648 B 768 KB 95.58%
BOARD_SDRAM: 0 GB 30 MB 0.00%
NCACHE_REGION: 0 GB 2 MB 0.00%
collect2.exe: error: ld returned 1 exit status

How can I put the mp3 .h files into flash, not on the SRAM?

Which is the easy way to implement it? 

Via compiler or need to use flash tool to bun in mp3 files into flash and load in code ?

Thanks you.

Labels (1)
Tags (1)
0 Kudos
Reply
2 Replies

711 Views
antoniohsu888
Contributor II

looks like add const is OK.

const unsigned char __20_mp3[]

0 Kudos
Reply

704 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @antoniohsu888 ,

   Yes, you are right, just use the constant, it will help you to assign to the flash range directly.

  So, you can use your const array.

 

Wish it helps you!

Best Regards,

kerry

0 Kudos
Reply