Description
Yes, you can reset a Nios II processor within your software application by using a function pointer set to the reset address of your processor. A software reset is illustrated in the code segment shown below:
#include <stdio.h> #include "system.h" #include "nios2.h" #define HAL_PLATFORM_RESET() NIOS2_WRITE_STATUS(0); NIOS2_WRITE_IENABLE(0); ((void (*) (void)) NIOS2_RESET_ADDR) () int main() { printf("Hello from Nios II!\n"); HAL_PLATFORM_RESET(); return 0; }
The HAL_PLATFORM_RESET macro disables interrupts and then calls a pointer to a function set to the reset address. This causes the processor to jump to the hardware reset address.