Debugging of STM32F103 clone "BluePill" board, wrong idcode

Oh right, because the init cmds still go to GDB and not openOCD before it. There still multiple ways to do it.

  1. By using a custom board JSON file with an expanded openocd_extra_args. Copy-paste the bluepill JSON file into the boards/ folder of the project as a new name (e.g. cs32_bluepill.json), extend the openocd_extra_args by two entries for the CPUTAPID and use board = cs32_bluepill.
  2. Directly modify the openOCD debug server invocation in the platformio.ini to have the right flags. E.g.
debug_server =
  C:\Users\Maxi\.platformio\packages\tool-openocd\bin\openocd.exe
  -s C:\Users\Maxi\.platformio\packages\tool-openocd\scripts
  -f interface\stlink.cfg
  -c "transport select hla_swd"
  -c "set CPUTAPID 0x2ba01477"
  -f target\stm32f1x.cfg
  -c "reset_config none"

(use adapted path information)
3. Permanently modify C:\Users\Maxi\.platformio\packages\tool-openocd\scripts\target\stm32f1x.cfg line 42 to have the “corrected” ID for the chinese clone.

5 Likes