Can anyone help?
I am creating a simple but long table of RAM addresses in ROM.
static const void* addressTableInROM[]=
{
&variable,
&another,
&etc,
&etc_
};
This is fine except each address on the ARM is 32bit
and begins with the same 2 bytes 0x2000, e.g. 0x200009A4. Target is
Str71x.
How can I store this table more efficiently;-
a) in ROM
b) with global persistence
by say storing only the 2 least significant bytes of each address?
Interestingly it is possible to create such a table in RAM
without global persistence like this;-
void function(void)
{
const unsigned short addressTableInROM[]=
{
(unsigned long)&variable,
(unsigned long)&another,
(unsigned long)&etc,
(unsigned long)&etc_
};
};
but putting static before const produces the wrong result that is;-
a) all the entries are 0 and
b) no compiler or linker error is produced.
Also the table is smaller but presumably an initial image goes in ROM.
note
1 I am using the latest winarm/gnu distribution 06062006 for arm7tdmi
str71x
on a ranasonse reva eval board.
2. Casting initialisers is disallowed on other compilers.
3. Arithmetic on pointer initializers is allowed on (older)IAR
compilers.
4. In the first example above, any cast or arithmetic on the initializer
turns the value to 0.
5. Using Optimizer level 1, .cpp files, no thumb/thumb-interworking.
bobz