I have some Const array tables that i want place in the flash/code memory of ARM controller. we can place array in code memory of C51 using "code" keyword. but how to place const array in ARM?
Whew. I read the response and was wondering whether I was missing some important knowledge.
Putting const puts the tables into a code segment. If the code is in flash, then so are the tables.
I wrote a small program to Test the keywords, here the results are
with
const unsigned char a[3] __attribute__( (at(0x0010) ) )={'1','2','3'};
Result is: Program Size: Code=5126 RO-data=66 RW-data=16 ZI-data=560
const unsigned char a[3]={'1','2','3'};
Result is: Program Size: Code=5130 RO-data=66 RW-data=16 ZI-data=560
unsigned char a[3]={'1','2','3'};
Result: Program Size: Code=5130 RO-data=62 RW-data=20 ZI-data=556
if both attribute keyword and const keyword do the same thing, then why there is the variation in Code size?
Because they do not "do the same thing"!
They achieve the same end, but by doing different things!
Look again at those numbers, carefully: it's not just the code size that changes, is it...?