We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
When a watchdog timeout occurs, it could be the result of many causes. The code could be 'out in space' due to a bad pointer corrupting anything it wants to. It could be due to a fault condition that did not affect data space. Who knows?
Since the watchdog reset is considered a 'hard reset' we know where it will then start execution from.
If I want to save existing data ram into flash prior to executing __main() I would think the place to do this would be here:
; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT __main LDR R0, =__main BX R0 ENDP
I could jump into a routine which calls an IAP command to save RAM to flash and then return to finish the startup.
I would have to EXPORT the routine I want to jump to as well as load the LR with the return value. Is there anything else that I am missing?
BTW: the processor is a Cortex M3 core.
Thanks.
My bad.
Same .asm code is used for both. Did open my damn eyes enough.
__asm void SVC_Handler(void) { IMPORT SVC_Handler_C TST lr, #4 MRSEQ r0, MSP MRSNE r0, PSP B SVC_Handler_C } __asm void HardFault_Handler(void) { IMPORT HardFault_Handler_C TST LR, #4 MRSEQ R0, MSP MRSNE R0, PSP B HardFault_Handler_C }
FYI: The above code seems to work fine - so far.