aboutsummaryrefslogtreecommitdiff
path: root/debug.cpp
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-01-02 21:13:31 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2016-01-02 21:13:31 +0100
commitbaedda497d16c5096971eee83a0c467fe663fe6d (patch)
tree2f8925c68d94aed7d5fc7022462abbb359200b9e /debug.cpp
parent9129af503c8211d713c8a160a3b6f3f86b328639 (diff)
downloadstm32f103-playground-baedda497d16c5096971eee83a0c467fe663fe6d.tar.gz
stm32f103-playground-baedda497d16c5096971eee83a0c467fe663fe6d.tar.bz2
stm32f103-playground-baedda497d16c5096971eee83a0c467fe663fe6d.tar.xz
stm32f103-playground-baedda497d16c5096971eee83a0c467fe663fe6d.zip
o Moving around a lot of files.
Diffstat (limited to 'debug.cpp')
-rw-r--r--debug.cpp44
1 files changed, 0 insertions, 44 deletions
diff --git a/debug.cpp b/debug.cpp
deleted file mode 100644
index 40f2169..0000000
--- a/debug.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "debug.h"
-#include "tinyprintf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static void append_char(void *v, char c) {
- *(*((char **) v))++ = c;
-}
-
-void dbg_printf(const char *fmt, ...) {
- char msg[100];
- msg[0] = 0;
-
- va_list va;
- va_start(va, fmt);
- char *a = msg;
- char **b = &a;
- tfp_format(b, append_char, fmt, va);
- va_end(va);
- append_char(b, '\0');
-
- send_command(SYS_WRITE0, msg);
-}
-
-void dbg_putc(void *, char c) {
- char cc = c;
- send_command(SYS_WRITEC, &cc);
-}
-
-void send_command(enum SemihostingCmd command, void *message) {
- int c = command;
-
- __asm volatile (
- "mov r0, %[cmd];"
- "mov r1, %[msg];"
- "bkpt #0xAB" : : [cmd] "r"(c), [msg] "r"(message) : "r0", "r1", "memory"
- );
-}
-
-#ifdef __cplusplus
-};
-#endif