How can I use flash program memory to store large read only data?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How can I use flash program memory to store large read only data?

1,945件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by yssong on Fri Jul 20 20:41:29 MST 2012
I am a user of lpc11u14 which has 32kb flash program memory and 4kb data sram.

If I have large read only data (ex. bitmap font pixel data array) in my program, 4kb data sram may be insufficient. Thus I want to use 32kb flash program memory to store large read only data instead of small data sram.

Case of other mcu, these are supported by program library.
For example, AVR mcu uses prog_uint8_t variable declaration and pgm_read_byte() function to store data in flash memory and read it.

How can I do that in my lpc11u14 board?

If I should modify linker script manually, could I get some example codes?
(I am not good at embedded programming yet :( )

Help me, plz. :)
0 件の賞賛
返信
6 返答(返信)

1,889件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gbm on Thu Sep 13 12:05:45 MST 2012
Compilers for MCUs with single address space treat place constants in Flash. All ARM-based chips, Texas MSP430 family, Renesas R8C, M16C, SH series, RX series and many others belong to this category.

This is not so easy for some 8-bit MCUs with many address spaces, like AVR, PIC and 51 family. In these cases special keywords or pragmas are used to force placement of costant data into ROM.
0 件の賞賛
返信

1,889件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by 21-50 on Wed Sep 12 13:08:54 MST 2012
Does this rule apply to all Cortex-M MCU or only NXP?
Isn't it instruction for compiler how to access and for linker where to put data and if so do all Cortex-M compilers/linkers support "const" as a flash location?

Thanks.
0 件の賞賛
返信

1,889件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by yssong on Sat Jul 21 01:34:37 MST 2012

Quote: Zero
Or just store them as const in flash :confused:

const unsigned char table[20]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
 
const unsigned int c_value = 1234;
See:  http://knowledgebase.nxp.com/showthread.php?t=1692



Thank you.

It seems to work well.
0 件の賞賛
返信

1,889件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Jul 21 01:11:57 MST 2012
Or just store them as const in flash :confused:

const unsigned char table[20]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
 
const unsigned int c_value = 1234;
See:  http://knowledgebase.nxp.com/showthread.php?t=1692
0 件の賞賛
返信

1,889件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by yssong on Sat Jul 21 00:43:50 MST 2012
Thank you.

But where can I get related files of this AN11008 ? (flash_nvol.c etc.)
0 件の賞賛
返信

1,889件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by yanvasilij on Fri Jul 20 23:48:53 MST 2012
See http://www.nxp.com/documents/applica...te/AN11008.pdf for storing variables in flash memory.
0 件の賞賛
返信