CubeIDE does some checks which means clone bluepill boards don’t work with it - you can’t flash or debug. The methods I found online to get around this didn’t help except for a stackexchange answer that got me most of the way. I figured I’d rewrite the answer with some small changes and add in a few details I needed to make it work.
The gdb and OpenOCD that CubeIDE uses do the verification checks, so an alternative is to install separate versions of these and get CubeIDE to use them instead.
- Install
Eclipse CDT
from the Eclipse store within CubeIDE. - Install OpenOCD and
gdb-multiarch
(using whatever package manager your OS has). - Under “Debug Configurations”, choose “GDB OpenOCD Debugging” to create a new debug profile. See this image from the stackexchange answer and check that the debug profile looks like it.
- Config options for OpenOCD:
-f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /path/to/bluepill_ocd.cfg
Wherebluepill_ocd.cfg
is/usr/share/openocd/scripts/target/stm32f1x.cfg
with the lineset _CPUTAPID 0x1ba01477
changed toset _CPUTAPID 0x0
which disables checking the CPU ID which the clone has different from the original. - Delete
__HAL_AFIO_REMAP_SWJ_NOJTAG()
withinstm32f1xx_hal_msp.c
or it will enter a reset loop after callingHAL_Init()
. Not really sure why the reset loop happens. You’ll have to delete this line every time you generate code from the device configuration tool (CubeMX).
Debugging should work now.
You must log in or register to comment.