[En-Nut-Discussion] how to get GCC linker to relocate RAM sections?

Nic Cave-Lynch nic at tymar.com
Mon Aug 14 02:26:03 CEST 2006


Hi all

Slightly off-topic (it's not an NutOS problem), but I really hope someone can 
help before I tear the rest of my hair out....

I have an AVR application which I want to test on an Ethernut 1.3f board (it'll 
eventually go on something with an ATMega1280). .bss is about 700 bytes, .data 
about 3.5k, and malloc'd space is about 25k. If I use unmodified WinAVR to link, 
the .bss and .data end up stomping on the stack, which doesn't work very well...

The obvious answer is to relocate something to external RAM, and there is the 
problem. I'd like to just move .bss to external, and have malloc'd RAM after 
that, leaving .data in internal RAM (faster access for some procesor intensive 
routines). Problem is, I can't make any sort of relocation work. I've tried many 
combinations of linker commands and got nowhere. What seemed most like it should 
work is:

-Tdata=0x800100,-Tbss=0x801100,--defsym=__heap_end=0x807fff,--defsym=__heap_start=0x802100

but it experiments indicate that anything that moves the .bss section breaks 
malloc.

Any ideas how to solve this? Should I give up on WinAVR/avr-gcc and try a 
commercial compiler?

Thanks for any insights

Nic C-L




More information about the En-Nut-Discussion mailing list