Hi,
I have the following code:
file1.h
extern const unsigned char c1;
file1.c
const unsigned char c1 = 25;
file2.c
const unsigned char c2 = c1 + 25;
According to the documentation www.keil.com/.../armccref_ciabaidh.htm both variables should be placed in ROM but this doesn't happen.
I found that the variable c2 is not put in ROM and RW-data increases by 4 bytes.
but when c1 is in the same module(same .c file) as c2, RW-data doesn't increase and RO-data increases instead.
Am I missing something ?
Thanks in advance :)
The normal way for this would be:
enum { C1_VAL = 25, C2_VAL = C1_VAL + 25, };
And then _maybe_ create the c1 and c2 const variables but more likely just make use of the enum values.