Forum Discussion
Altera_Forum
Honored Contributor
21 years agoThe problem here is that you've added the flags as compiler rather than linker flags. It is a little confusing that gcc is being used as the front end to both the compiler and the linker, however when you have flags that you want to use at link time then you need to specify them as linker flags rather than compiler flags.
In any case, if you want to override the linker script being used by the IDE to build HAL projects then you should instead go to the system library properties page and select "custom linker script". You can then specify the linker script you want to use in the box provided (note the file has to be in the project to be locatable). That said, there is an even easier way to go about this. Rather than creating a custom linker script, you can free up memory by simply moving the start of the stack downwards. The stack is defined to grow downwards from the address __alt_data_end. This symbol is defined in the linker script. You can override this definition by using the linker flag: -Wl,--defsym,__alt_data_end=0x300000 where 0x300000 is the address you now want the stack to grow down from. Memory above this will be unused by the HAL, and so you're free to use it for whatever you want. You can even use this to locate the stack in a memory other than the one used to hold the .rwdata section (which is the default action of the linker script).