Different board/debugger combo - how?

I’d like to try uploading code for a new target, with a different debugger.

My target is a “genericSTM32F407VGT6”, which supports stlink and dfu out of the box. However, I’d like to try uploading (and debugging) it through the “olimex-arm-usb-tiny-h” debugger.

I can build, and upload manually through arm-none-eabi-gdb + openocd, so the basics of the toolchain and code are ok.

Do I need to create a custom board definition? I couldn’t find info on how to do this, after a (very) cursory look around the documentation site. A quick pointer would be great.

-jcw

How do you run it? Could you provide a command? What it is your wiring connection? See Olimex ARM-USB-TINY-H — PlatformIO latest documentation

Thx - for manual upload, openocd is started as:

openocd -f interface/ftdi/olimex-arm-usb-tiny-h.cfg -f target/stm32f4x.cfg

And then, with “arm-none-eabi-gdb .pioenvs/gold_dragon/firmware.elf”, I do:

tar rem :3333       (to connect to openocd)
load                (to upload)
c                   (to start running)

I’m not sure this helps - my Q was really about how to tell PIO to do the above.

-jcw

Could you try this example? Custom — PlatformIO latest documentation

[env:debug]
platform = ststm32
board = genericSTM32F407VGT6
debug_tool = custom
debug_server =
  $PLATFORMIO_HOME_DIR/packages/tool-openocd/bin/openocd
  -f
  $PLATFORMIO_HOME_DIR/packages/tool-openocd/scripts/interface/ftdi/olimex-arm-usb-tiny-h.cfg
  -f
  $PLATFORMIO_HOME_DIR/packages/tool-openocd/scripts/target/stm32f4x.cfg

Ah, I understand - it should work, but something is different and failing - here’s the output of my own command:

$ openocd -f interface/ftdi/olimex-arm-usb-tiny-h.cfg -f target/stm32f4x.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
none separate
cortex_m reset_config sysresetreq
Info : clock speed 2000 kHz
Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
Info : DAP transaction stalled (WAIT) - slowing down
Info : DAP transaction stalled (WAIT) - slowing down
Info : DAP transaction stalled (WAIT) - slowing down
Info : stm32f4x.cpu: hardware has 1 breakpoints, 1 watchpoints

And here’s what pio run -t upload -v shows:

openocd -s /Users/jcw/.platformio/packages/tool-openocd -f scripts/interface/stlink.cfg -c "transport select hla_swd" -f scripts/target/stm32f4x.cfg -c "reset_config none" -c "program {{.pioenvs/debug/firmware.elf}}  verify reset; shutdown;"
GNU MCU Eclipse 64-bits Open On-Chip Debugger 0.10.0+dev-00392-gbe9ef0b0 (2018-01-12-16:51)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
none separate
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Error: open failed
in procedure 'program'
in procedure 'init' called at file "embedded:startup.tcl", line 495
in procedure 'ocd_bouncer'
** OpenOCD init failed **
shutdown command invoked

I’m not familiar enough with openocd to understand the differences, unfortunately.

-jcw

Just override default upload tool with a custom. See Redirecting...