Placing Flash ROM code from C using gcc

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

Placing Flash ROM code from C using gcc

1,092 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by robin48gx on Tue Sep 30 09:05:42 MST 2014
I wish to place a signature series of bytes in high flash ROM, so that a post build script can find them and
overwrite them with new values.
How do I tell the linker to place a const array of bytes into a given high flash location.

Ideally I would like something like

static const unsigned char []={ 0x31, 0x41 } = 0x17800;

to put the data into flash rom at 0x17800;

Do I need to define a custom section in the C code and add to the linker scripts? If so
does anyone know the syntax?
标签 (1)
0 项奖励
回复
1 回复

1,037 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Oct 01 01:24:45 MST 2014
You don't say which actual toolchain you are using (as opposed to just GCC).

But if you are using LPCXpresso then the simplest way to do this would probably be to use the memory configuration editor (described in the LPCXpresso user guide) to split the Flash into two. You can then use the macros described in the below FAQ to place your array at the appropriate address:

http://www.lpcware.com/content/faq/lpcxpresso/coderodata-different-flash-blocks

For additional information, please also see:

http://www.lpcware.com/content/faq/lpcxpresso/placing-data-address

I would advise trying to align your signature onto a flash sector boundary though - will make life easier and prevent possible complications.

Also, note the information in this FAQ too about memory requirements for writing to flash from your program:

http://www.lpcware.com/content/faq/lpcxpresso/reserving-ram-iap

Regards,
LPCXpresso Support
0 项奖励
回复