Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

NIOS II Call Stack

Hi.

Earlier I compiled and ran the memory tester example program and during testing the program consistently deviated into a function trying to recieve a character from the UART.

I suspected stack corruption and sure enough when I start the debugger and check the SP register, its sitting just inside the boundary of the SDRAM which is about to be overwritten.

My question is, how is it decided where the stack will begin, and how do I ensure the stack starts in the on chip RAM I created for this test?

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Depending on the flow you're using, it's either an option available via the command line (SBT flow), in the System Library options (legacy IDE flow) or in the BSP settings editor (SBT/SBT GUI flow). Using any of these methods, you can choose where your stack, heap and a variety of other code sections will reside.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Found it. Thanks alot Slacker! I was having horrible images of having to rejig my address mapping in SOPC for bit then.