I am working on a product that utilizes an STM32f102R6 processor and am having difficulty setting the device up with uVision 5.25.2.0 for debug. I am using an ST-Link/V2 for this purpose (firmware V2.J29.S7). I am able to compile and flash the code to the device ad have verified this by validating the flash data with the ST-Link utility. When I enter debug mode, I am able to step through the disassembly window, but am unable to step through the C-code. I was previously able to debug using an PE-multilink universal, but it would occasionally crash, so I moved to the ST-Link/V2 with the hope that I could resolve the crashing issues. Here is my configuration:
Boot0 is pulled high and Boot1 is pulled low.
If I do not do this, the SW Device indicates an “internal command error”. This seems odd to me as I must then run out of the system memory. The address space in the disassembly window is indicative that the program never leaves the system memory.
Optimization is set to level 0
The system uses an 8MHz external crystal and a 48MHz system clock.
Make sure you code isn't reconfiguring the GPIOA bank, or PA13/PA14 used by the debugger, or remapping functionality. If the core powers down it will also be difficult to talk too.
That you can access when using ROM, it suggests something wrong with the user code. Perhaps start trimming it and bisecting until you identify the offending code.
Try a large spin loop in the Reset_Handler, or in main(). Watch also what you are doing in the SystemInit() function.
Try unchecking "run to main()" and stepping in.
I am still having difficulties. I rebuilt a blank project using cubeMX and changed hardware and the results are the same. I can run out of ROM, but that's it. Once running in ROM, is it supposed to automatically jump to flash? It appears to just repeatedly run three lines of system memory from the disassembler.