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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

1,170 次查看
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.

标签 (1)
标记 (1)
0 项奖励
回复
2 回复数

1,164 次查看
antoniohsu888
Contributor II

looks like add const is OK.

const unsigned char __20_mp3[]

0 项奖励
回复

1,157 次查看
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 项奖励
回复