this post was submitted on 20 May 2025
6 points (87.5% liked)

MICROCONTROLLERS

848 readers
1 users here now

Everything microcontrollers: projects, questions, new releases, etc.

dragontamer's Beginner Guides:

Beginner Series I: What is a Microcontroller?

Beginner Series II: The "Generic" Microcontroller

Beginner Sidenote: Microchip's Signal Chain Design Guide

Beginner Series III: Skills and Complexity Tiers

Beginner Series IV: Deep Dive into Microchip's AVR EA

founded 2 years ago
MODERATORS
 

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 Where bluepill_ocd.cfg is /usr/share/openocd/scripts/target/stm32f1x.cfg with the line set _CPUTAPID 0x1ba01477 changed to set _CPUTAPID 0x0 which disables checking the CPU ID which the clone has different from the original.
  • Delete __HAL_AFIO_REMAP_SWJ_NOJTAG() within stm32f1xx_hal_msp.c or it will enter a reset loop after calling HAL_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.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here