2021-02-11 12:57 PM
Hello everyone!
I am trying to debug some code but there are some flags in flash that keep getting set when I exit debug and it enters run mode (or when I power up the sensor. Basically, anytime it gets a chance to run before I can get it in debug mode).
This had me wondering, is there a compile time debug command I can run that wouldn't run on the microcontroller unless I was in debug mode? Something like #DEBUG or something to that effect?
Tried searching the forums but it turns out, the word "debug" is very popular . . . heh. Any help you can give me would be appreciated. Thanks!
2021-02-11 01:27 PM
You could add a breakpoint instruction (BKPT), or loop on a GPIO state.
Put external pull-downs on I2C pins so that the device operated differently when you want to debug it, or have it output diagnostic telemetry.
2021-02-12 01:56 AM
Crossworks used to have an infinite loop in their debug startup code that waited for a debugger to connect.
Perhaps you can emulate that with your setup, possobly using TeslaDeLorean's suggested methods.