U
usenet
Hello,
I am running my code on an embedded platform without OS. I have defined some
data in a section called .eeprom. The section is defined by the linker
script and starts at address zero. The symbol __eeprom_end is defined by the
linker script as well, and lies at the end of this section. The address of
__eeprom_end is thus equal to the number of bytes in the .eeprom section.
My problem : I want to declare an array in .bss with the same size of this
section. My naive approch was :
extern void *_eeprom;
char eeprom_shadow[(int)&_eeprom_end];
This fails miserably, ofcourse : the compiler doesn't know the address of
__eeprom before the linker is done, so it can not declare the array.
Is there a trick to allocate the memory for this array at compile time ? I'd
rather not use malloc() and friends, since I am working on a platform with a
very small amount of memory, and don't like using dynamic memory here.
Thanks,
I am running my code on an embedded platform without OS. I have defined some
data in a section called .eeprom. The section is defined by the linker
script and starts at address zero. The symbol __eeprom_end is defined by the
linker script as well, and lies at the end of this section. The address of
__eeprom_end is thus equal to the number of bytes in the .eeprom section.
My problem : I want to declare an array in .bss with the same size of this
section. My naive approch was :
extern void *_eeprom;
char eeprom_shadow[(int)&_eeprom_end];
This fails miserably, ofcourse : the compiler doesn't know the address of
__eeprom before the linker is done, so it can not declare the array.
Is there a trick to allocate the memory for this array at compile time ? I'd
rather not use malloc() and friends, since I am working on a platform with a
very small amount of memory, and don't like using dynamic memory here.
Thanks,