My notes on debugging a arduino Due with a cheap stm32 in ubuntu 16.04, for future reference, and to help whoever needs to do the same.
- Arduino Due.
- stm32 arduino board (~2$) with stlink v2 programmer (~2$) from aliexpress.
- Micro USB cables.
- Connectors.
Get Mitek's wonderfull stm32 CMSIS-DAP firmware: https://github.com/x893/CMSIS-DAP
Download the .hex file in "CMSIS-DAP/Firmware/STM32/hex/CMSIS-DAP-V1-F103.hex"
$ arm-none-eabi-objcopy -I ihex --output-target=binary CMSIS-DAP-V1-F103.hex firmware.bin
-
Install stlink: https://github.com/texane/stlink
-
$ make release
-
(for system wide install)
$ cd build/Release; sudo make install
-
upload using stlink or platformio
$ st-flash --format ihex write CMSIS-DAP-V1-F103.hex
$ cd ..
$ cd due
$ sh upload.sh
https://github.com/ataradov/edbg
$ make all
$ ./edbg -p -t atmel_cm3 -f myduefirmware.bin
$ ./edbg -v -t atmel_cm3
$ apt install openocd
$ openocd -c "interface cmsis-dap" -f due.cfg
$ arm-none-eabi-gdb example.elf
(gdb) target remote localhost:3333
Remote debugging using localhost:3333