Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12612 Discussions

Reset address pointing to SRAM

Altera_Forum
Honored Contributor II
1,124 Views

Hello *, 

 

I am a bit confused about the NIOS booting procedure. 

 

I have external hardware connected to my NIOS system which should give a reset to the processor - like if the reset button is pressed. During development cycles of the "C" program I let the reset address point to SRAM (offset 0x0) where the program code resides. I expected this to work but the system crashes after pressing the button and does not start the program again in the way "nios-download [...] -g" did after loading. What is fundamental error? I thought "crt0" is executed at offset 0x0 of SRAM which should handle the instruction cache correctly and start main(). Any suggestions? 

 

Thanx - 

dj5ba
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
415 Views

Where is your read/write data stored? 

 

nios2-download will set up the initial values of the text, rodata and rwdata sections before starting the processor. 

 

If you reconfigure the FPGA (as happens at powerup) then the initial values of the text, rodata and rwdata sections will be loaded from the configuration device (they're part of the SOF file). 

 

But if you just reset the processor then this just sets the program counter to the reset address. The text and rodata sections should not have been changed so they'll be OK, but the rwdata section will have been modified by your program from the expected initial values. This is probably what's causing the problem.
0 Kudos
Altera_Forum
Honored Contributor II
415 Views

 

--- Quote Start ---  

originally posted by wombat@Feb 21 2005, 12:09 PM 

where is your read/write data stored? 

 

nios2-download will set up the initial values of the text, rodata and rwdata sections before starting the processor. 

 

if you reconfigure the fpga (as happens at powerup) then the initial values of the text, rodata and rwdata sections will be loaded from the configuration device (they're part of the sof file). 

 

but if you just reset the processor then this just sets the program counter to the reset address.  the text and rodata sections should not have been changed so they'll be ok, but the rwdata section will have been modified by your program from the expected initial values.  this is probably what's causing the problem. 

--- Quote End ---  

 

Thanks wombat for your answer. 

 

Everything is stored in one sram data section. At the very beginning of my program it just prints a message to uart stdout but even this fails after resetting the processor manually. So could the uart be the problem? 

 

The only way I got this to work is by programing the flash rom and directing the reset address to flash. The final program should boot from there as well so if the reset address points to the flash boot copier routine everything is initialized correctly. This works for the DSP development board.
0 Kudos
Reply