Forum Discussion
Problem rebooting Nios II from uClinux
Dear all,
I need to reset Nios II from uClinux. I tried to use "reboot" app from sash but it didn't work. The response isRestarting system and then system freezes. I'm working on a Stratix II EP2S60. I tried to reset using "CPU RESET" button, but with the same result. I tested the button on a simple program without OS and it works, so it's a uClinux problem. I hope you can help me, thanks in advance Marco14 Replies
- Altera_Forum
Honored Contributor
Is your uClinux system flashed on the board or do you upload it through jtag each time?
When you release the reset button, the CPU will jump to it's reset address. Depending on the hardware configuration this may be a flash, a bootloader or the RAM. It may try to run a different software than the one you expect. - Altera_Forum
Honored Contributor
I upload it through jtag each time. The reset vector is located in RAM. Is it possible than this issue depends from the fact that a decompression of the kernel when i run "nios2-terminal" overwrite something?
I mean: "nios2-download -g zImage" loads the compressed image of the kernel in RAM and "nios2-terminal" decompress it before execute. What happens when i press CPU reset? I think that CPU tries to decompress one more time the kernel, but zImage is already decompressed and CPU can't find it. Am i right? Probably i can resolve the problem if i put uClinux on flash. - Altera_Forum
Honored Contributor
Hi,
correct me if i am false, but i don't think that this will work on RAM. I don't know exactly what the reboot command does, but after its execution the RAM probably gets erased. It definitely works when having the image in flash. Urmel - Altera_Forum
Honored Contributor
Yes I agree. Putting a system in flash and having the CPU's reset vector to the flash should make it work after a reset.
Also note that even if the CPU's reset vector is on flash, you can still upload a software image through jtag and run it on the CPU. But if you reset it it will revert to the flash image. - Altera_Forum
Honored Contributor
Ok, thanks guys. I will put the system on the flash.
Best regards Marco - Altera_Forum
Honored Contributor
Sorry guys, but there's something strange. I'm not sure, but i think that soft cpu reset using reboot can't erase RAM. I'm sure that it doesn't happen with CPU Reset button. So put the system on flash is the solution, but i'm curious to know how reset doesn't work with the actual configuration.
- Altera_Forum
Honored Contributor
Instead of "reboot", try "shutdown -r now". I've also found random problems trying to reboot with the "reboot" application.
Cheers, Ricardo. - Altera_Forum
Honored Contributor
Already done, same problem.
- Altera_Forum
Honored Contributor
When you load the kernel image via JTAG, it loads the compressed image to the link address offset in RAM. Then the image decompresses itself to the beginning of RAM and the jumps there. The compressed image is then erased or overwritten (or at least so I assume, it'd be a horrible waste of memory otherwise). So if you have the processor reset at the link address, that won't work. I don't know if it's possible to get it to reset from the same place the image decompresses to or if there is some other code that needs to be at reset that is not preserved.
- Altera_Forum
Honored Contributor
Yes I agree, this is must probably be happening. For the software reset to work you would need to jump to the cade after the kernel decompression, and I don't know if this is possible