Is it possible to get the state of the uC without being connected to it at the moment of crash?
Is it possible to get the state of the uC without being connected to it at the moment of crash?
That rather depends by what you mean by crash. If you're going to your error handler or ending up in the hardfault handler, then yes you just implement an error handler or hardfault handler which finds the stack, gets the registers and dumps the last state of them to
If you have a loop-forever error handler, you may not even need to save state, you can connect to the chip whilst it's busy-looping and read the state right from where it left off.
If you're going to write state to flash then you don't want to use ANY of the library code, just write the registers to clear the pages you want and write them again to dump the data.
Could you go into the second part a bit more? How exactly do I "connect"? Just starting a new debug session restarts the processor.
Could you go into the second part a bit more? How exactly do I "connect"? Just starting a new debug session restarts the processor.