This is a report of one cryptic symptom (and possible) fixes you might encounter when you are embedded programming. I report it because I have experienced it more than once and always forget what it means.
When you are trying to flash your embedded mcu, the debugger seems to download to the chip, the debugger starts and then stops showing a stack trace something like this:
Usually you expect the debugger to stop at main() and wait for you to tell the debugger to run (but that depends on whether you have configured your IDE and debugger to breakpoint at main.)
It might mean (not a program bug, a process error):
- your linker script <foo>.ld describes the memory of your chip incorrectly
- you haven’t erased the chip’s ROM yet
About the latter. I am not sure, but modules you buy might already be flashed with a program such as a DFU bootloader, and are configured to protect a debugger from overwriting that code in ROM. For example, on the Nordic NRF51, to remove the protection and erase all of ROM so that you can then use the debugger:
nrfjprog --recover --family NRF51