ROM with LPC1114

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

ROM with LPC1114

1,072 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dirtyBits on Sun Sep 11 05:36:43 MST 2011
How to store data in [B]Program memory[/B] as [B]Read Only[/B]?
I have an array(look-up table) of 6144 x 8 bits of data, that need to be read during program.
unsigned char Array[24][256]


I'm using LPCXpresso with LPC1114.
Is there anything in LPCXpresso which is like [B]PROGMEM[/B] for Arduino?
:confused:
0 Kudos
Reply
5 Replies

1,020 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ToBeFrank on Sun Sep 11 16:19:14 MST 2011

Quote: Zero
Try:
volatile const unsigned char ....
or as described in core_cm0.h
#define     __I     volatile const          /*!< defines 'read only' permissions      */
just:
__I unsigned char ...





You don't want to use volatile in this case.
0 Kudos
Reply

1,020 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dirtyBits on Mon Sep 12 22:29:41 MST 2011
Thank you [B]Zero,[/B]
It works perfectly!!
:D
0 Kudos
Reply

1,020 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Sep 12 00:48:45 MST 2011
Watch  your build log and just add 'const' :)

Your array is moving from 'data' to 'text' :eek:

See: http://support.code-red-tech.com/CodeRedWiki/FlashRamSize

Look at your project map file and you will find your array in .rodata section :D

So your array is in ROM now and no RAM is wasted. Isn't this what you wanted?
0 Kudos
Reply

1,020 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dirtyBits on Sun Sep 11 22:37:50 MST 2011
@ Zero

Do you mean [SIZE=3][B]const unsigned char[/B][/SIZE] should be fine?
I'll try that in the evening.

Thanks
0 Kudos
Reply

1,020 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sun Sep 11 05:49:42 MST 2011
Try:
volatile const unsigned char ....
or as described in core_cm0.h
#define     __I     volatile const          /*!< defines 'read only' permissions      */
just:
__I unsigned char ...


Unfortunately that's not working as expected. A simple:
const unsigned char ...

is moving your array in text (=ROM) section.
0 Kudos
Reply