GNU Linker (LD) PowerPC stack definition

Jul 10, 2005 0 Replies

I have not been able to use the ADDR() and SIZEOF() with MEMORY defintions. These functions appear to work with SECTIONS definitions only. With the Diab linker, I use these functions to define stack, heap, and small data area pointers. Here are a couple of examples. Not all details are shown to save space.


Diab Example - assume MPC565 internal memory:



MEMORY { rom1 : org = 0x0, len = 512K rom2 : org = 0x80000, len = 512K ram : org = 0x3F7000, len = 20K stack : org = 0x3FC000, len = 16K }



_SP_INIT = ADDR(stack) + SIZEOF(stack);


This technique doesn't work with GNU LD. The ADDR() and SIZEOF() functions can only take SECTIONS definitions as arguments. Therefore, a stack section needs to be defined.



GNU Example:



MEMORY { rom1 : org = 0x0, len = 512K rom2 : org = 0x80000, len = 512K ram : org = 0x3F7000, len = 20K stack : org = 0x3FC000, len = 16K }



SECTIONS { .stack { .start = . ; . += 16K; .end = . ; } }



_SP_INIT = ADDR(.stack) + SIZEOF(.stack);


Does anyone know if the Diab method is possible with GNU?


Thanks in advance your advice,



Tony Barrett



Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required