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 Marco
链接已复制
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.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.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. UrmelYes 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.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.
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.
Ok guys, thanks for your replies, I agree with you. Now I'm focusing on how to run uClinux from flash. I followed the wiki's article "Flash Programmer", but it doesn't work. I was able to store .sof in flash and it works. The problem is when i try to store zImage.
Step followed: 1. nios2-configure-sof <file>.sof 2. sof2flash --offset=0xC00000 --input=<file>.sof --output=<file>.flash 3. nios2-flash-programmer --base=0x02000000 <file>.flash 4. elf2flash --base=0x02000000 --end=0x02ffffff --reset=0x02000000 --input=zImage --output=ext_flash.flash --boot =SOPC_KIT_NIOS2/components/altera_nios2/boot_loader_cfi.srec 5. nios2-flash-programmer --base=0x02000000 ext_flash.flash My Flash base address is 0x02000000 and its size is 16 MBytes. In vendor_hwselect i selected sdram in "Please select device to execute kernel from", the Reset Vector is located in ext_flash at the base address (0x02000000), exception vector in sdram (0x00000020). The problem is that kernel doesn't start. If i press CPU reset botton i can see the LEDs on the LAN turn off and on again after a certain period, so it seems to be right because i set up LAN in rc file, but i can't ping the board and i cannot see anything on hyperterminal.