--- Quote Start ---
originally posted by banx@Nov 14 2006, 05:05 AM
hi jskjoet,
i have a section of nvr like yours and use the __attribute__ to put stuff into it like this:
unsigned short fred __attribute__ ....
if i then try to use fred from another file with:
extern unsigned short fred;
then i get the same "can't reach...".
you have to tell the compiler that the variable is in the nvr section, which may be far away:
extern unsigned short fred __attribute__ ....
banx.
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=19421)
--- quote end ---
--- Quote End ---
Hi Banx
Thank you for the reply.
In my case the varibles are used from within the same module only - so no extern declaration.
Initially I found that outputting the nv_sram section after the bss segment caused a crash. This was due to a conflict with the heap that starts at the _end symbol.
After inelegantly replacing
.flash : AT (LOADADDR (.bss) + SIZEOF (.bss)
with
.flash : AT (LOADADDR (.bss) + SIZEOF (.bss) + SIZEOF (.nv_sram))
in the linker script it now works nicely as this moved the _end symbol too. Note that moving the flash segment is probably not the way to go if you're using any kind of software that rely in this.
Regards Jacob