Forum Discussion
Altera_Forum
Honored Contributor
15 years agoLook at the linker script, and/or the asm code that calls alt_main (which will setup %sp).
At a guess, the stack starts at the top of physical memory (the main memory block), and the heap just after the BSS. I use a custom build - which doesn't have a heap and initialieses %sp (and %gp) from code added directly by the linker script (in hex). (Actually I only need a stack because gcc insists on generating a function prologue! and won't let me reassign %sp as a general purpose register!)