Openocd-setup
This local page for notes on `openocd` configuration and use in remote debugging tasks.
Contents
^ openocd Site Documentation
- https://openocd.org/doc/html/index.html#SEC_Contents
- https://openocd.org/doc/html/Config-File-Guidelines.html#JTAG-Clock-Rate
- https://openocd.org/doc/html/Reset-Configuration.html#Types-of-Reset
^ First Page Entry 2021 Q1
On the Linux side, openocd set up on Debian type distros follows more or less the 2021 Q1 'getting started' instructions for the toolchain needed by Oresat firmware developers. There were some small differences getting full working cross-compiling and debugging toolchain installed on an Ubuntu 20.04 LTS system, to be documented here soon. One of the more difficult pieces was to obtain a version of arm-none-eabi-gcc which did not produce warnings about a known bug with ticket in the 86000 range.
Alternately on Windows 10 hosts, a similar toolchain can be installed via the following steps, and not strictly in the order of these steps:
- install 'Git for Windows', provides 'gitbash'
- install arm-none-eabi-gcc toolchain
( https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads )
- install chocolatey package manager for Windows
- install GNU 'make' for Windows ( https://community.chocolatey.org/packages/make )
- install openocd
Key download sites include:
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/download https://chocolatey.org/ https://community.chocolatey.org/packages/make https://gnutoolchains.com/arm-eabi/openocd/
This short notes page a work in progress and more to come.
^ openocd Use
- http://openocd.org/doc/html/Debug-Adapter-Configuration.html
- https://community.platformio.org/t/choosing-stlink-v2-programmer/10716/2
Successful programming of Oresat ACS card:
ted@localhost ~/projects/psas/oresat-firmware/src/f0/app_imu $ sudo make write [sudo] password for ted: openocd -s ../../../boards/ORESAT_ACS_V4 -f oocd.cfg -c "hla_serial ; program ./build/app_imu.hex verify reset exit" Open On-Chip Debugger 0.11.0-rc2+dev-00001-g5c17ce5-dirty (2021-01-25-00:53) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD Error: expected exactly one argument to hl_serial <serial-number> Info : clock speed 1000 kHz Info : STLINK V3J3M2 (API v3) VID:PID 0483:374E Info : Target voltage: 3.258964 Info : stm32f0x.cpu: hardware has 4 breakpoints, 2 watchpoints Info : starting gdb server for stm32f0x.cpu on 3333 Info : Listening on port 3333 for gdb connections target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0x08000190 msp: 0x20000200 ** Programming Started ** Info : device id = 0x10006442 Info : flash size = 256kbytes ** Programming Finished ** ** Verify Started ** ** Verified OK ** ** Resetting Target ** shutdown command invoked ted@localhost ~/projects/psas/oresat-firmware/src/f0/app_imu $
^ Openocd and Multiple Programmers
Looks like a very good, short tutorial and article on how to specify to openocd the serial number of a specific STLINK programmer, when two or more are attached to a given server:
guest@localhost:/dev/serial/by-id$ ls -l total 0 lrwxrwxrwx 1 root root 13 Jul 21 00:43 usb-STMicroelectronics_STM32_STLink_066CFF343334434257144338-if02 -> ../../ttyACM0 lrwxrwxrwx 1 root root 13 Jul 21 00:50 usb-STMicroelectronics_STM32_STLink_066FFF535455886687124209-if02 -> ../../ttyACM1 guest@localhost:/dev/serial/by-id$
^ stm32wlx.cfg