From e466fd025c46d07102046fdc3d277247da83f112 Mon Sep 17 00:00:00 2001
From: Per Lindgren <per.lindgren@ltu.se>
Date: Tue, 23 Feb 2021 13:19:43 +0100
Subject: [PATCH] rtic_blinky, add instructions to terminal based debugging

---
 CHANGELOG.md            |  4 ++++
 Cargo.toml              |  2 +-
 examples/rtic_blinky.rs | 11 ++++++++++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a4fc0b1..9c59723 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Changelog
 
+## 2021-02-23
+
+- examples/rtic_blinky.rs, added instructions to terminal based debugging
+  
 ## 2021-02-22
 
 - memory.x, reduced flash size to 128k to match light-weight target
diff --git a/Cargo.toml b/Cargo.toml
index 92e4bd9..c20f8ac 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ panic-halt = "0.2.0"
 panic-rtt-target = { version = "0.1.1", features = ["cortex-m"] }
 
 # Uncomment for the semihosting examples.
-#panic-semihosting = "0.5.6"
+panic-semihosting = "0.5.6"
 
 # Tracing
 rtt-target = { version = "0.3.0", features = ["cortex-m"] }
diff --git a/examples/rtic_blinky.rs b/examples/rtic_blinky.rs
index 6828905..7d48c31 100644
--- a/examples/rtic_blinky.rs
+++ b/examples/rtic_blinky.rs
@@ -1,3 +1,12 @@
+// run with gdb, either from terminal or in vscode
+//
+// from terminal:
+// start openocd in separate terminal
+// > openocd -f openocd.cfg
+//
+// start gdb
+// > arm-none-eabi-gdb target/thumbv7em-none-eabihf/debug/examples/rtic_blinky -x openocd.gdb
+
 #![deny(unsafe_code)]
 #![deny(warnings)]
 #![no_main]
@@ -5,7 +14,7 @@
 
 use cortex_m::peripheral::DWT;
 use cortex_m_semihosting::hprintln;
-use panic_rtt_target as _;
+use panic_semihosting as _;
 use rtic::cyccnt::{Instant, U32Ext as _};
 use stm32f4xx_hal::stm32;
 
-- 
GitLab