From 5e8bf0e765ccfbb6512eb354486ff46fca7a085b Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 7 Dec 2020 00:21:09 +0100 Subject: [PATCH] README: add Debugging and Flashing Fixes Gitea issue #10 --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ab3ce6a..c970405 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,26 @@ cargo build --release The resulting ELF file will be located under `target/thumbv7em-none-eabihf/release/thermostat` +## Debugging + +Connect SWDIO/SWCLK/RST/GND to a programmer such as ST-Link v2.1. Run OpenOCD: +```shell +openocd -f interface/stlink-v2-1.cfg -f target/stm32f4x.cfg +``` + +You may need to power up the programmer before powering the device. +Leave OpenOCD running. Run the GNU debugger: +```shell +gdb target/thumbv7em-none-eabihf/release/thermostat + +(gdb) source openocd.gdb +``` + +## Flashing + +```shell +openocd -f interface/stlink-v2-1.cfg -f target/stm32f4x.cfg -c "program target/thumbv7em-none-eabihf/release/thermostat verify reset;exit" +``` ## Network @@ -87,7 +107,7 @@ with logging via semihosting.) **Caveat:** This logging does not flush its output. Doing so would hang indefinitely if the output is not read by the USB host. Therefore -output will be truncated once buffers are full. +output will be truncated when USB buffers are full. ## Temperature measurement