dc/hbj11: init with flasher
This brings in the flashing infrastructure for HBJ11 (bluepill&web).
Change-Id: I480855689f849c24712d58a0ccbce6e91c34f8bd
diff --git a/dc/hbj11/flasher/bluepill/src/print.rs b/dc/hbj11/flasher/bluepill/src/print.rs
new file mode 100644
index 0000000..3693b00
--- /dev/null
+++ b/dc/hbj11/flasher/bluepill/src/print.rs
@@ -0,0 +1,40 @@
+// Wrappers around hprint(ln) that get disabled during release builds. This prevents us from
+// getting stuck in an hprint when a debugger is detached.
+
+#[cfg(debug_assertions)]
+#[macro_export]
+macro_rules! hprint {
+ ($s:expr) => {
+ cortex_m_semihosting::export::hstdout_str($s)
+ };
+ ($($tt:tt)*) => {
+ cortex_m_semihosting::export::hstdout_fmt(format_args!($($tt)*))
+ };
+}
+#[cfg(debug_assertions)]
+#[macro_export]
+macro_rules! hprintln {
+ () => {
+ cortex_m_semihosting::export::hstdout_str("\n")
+ };
+ ($s:expr) => {
+ cortex_m_semihosting::export::hstdout_str(concat!($s, "\n"))
+ };
+ ($s:expr, $($tt:tt)*) => {
+ cortex_m_semihosting::export::hstdout_fmt(format_args!(concat!($s, "\n"), $($tt)*))
+ };
+}
+
+#[cfg(not(debug_assertions))]
+#[macro_export]
+macro_rules! hprint {
+ () => { Result::<(), ()>::Ok(()) };
+ ($s:expr, $($tt:tt)*) => { Result::<(), ()>::Ok(()) };
+}
+#[cfg(not(debug_assertions))]
+#[macro_export]
+macro_rules! hprintln {
+ () => { Result::<(), ()>::Ok(()) };
+ ($s:expr) => { Result::<(), ()>::Ok(()) };
+ ($s:expr, $($tt:tt)*) => { Result::<(), ()>::Ok(()) };
+}