This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Soft Reset

I have an STM32F205 processor in a battery backed up circuit.
The battery is normally non connected, it can be connected via switch or GPIO.
The problem is that if the IWD (Independent Watch Dog) fires whilst the system is running on battery, the GPIO goes low, the battery gets disconnected and the system turns off.

So, I'd like a soft reset, leave the GPIO high, but reset everything else.
The IWG will fire after 16 seconds, I've setup a standard timer to run for 15 seconds, both get reset by the standard WD kick.
This all works fine, But I now need the timer ISR to do this software reset.

I've tried duplicating the standard 'Reset_Handler' as 'SoftReset_Handler', adding SP init at start. This works ok, runs through SystemInit, runs through main().
Then it encounters os_sys_init_user() that calls os_set_env() all registers and all values in os_set_env() are the same between hard and soft reset with hard, BX LR ends up in SVC_Handler with soft, BX LR ends up in HardFaultHandler

Within the ISR, I've disabled all interrupts in NVIC and cleared all pending interrupts in NVIC.

Because I'm kicking this off from ISR, I'm in 'Handler' Mode instead of 'Thread' Mode, but this is the only difference I can see, other than doing something horrible like putting address of SoftResetHandler on stack and returning, I can't find a way of changing this.

Any ideas?