From d15e930649b798b2e4781b9c1620c7585004e91f Mon Sep 17 00:00:00 2001 From: Paul Mathieu Date: Tue, 10 Jun 2025 23:48:29 -0700 Subject: [PATCH] mbv: some debug stuff --- mbv/apps/app.ld | 5 +++++ mbv/hal/debug.cc | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 mbv/hal/debug.cc diff --git a/mbv/apps/app.ld b/mbv/apps/app.ld index decf721..c513779 100644 --- a/mbv/apps/app.ld +++ b/mbv/apps/app.ld @@ -5,6 +5,11 @@ MEMORY _vector_table = 0x0; +BiosUartRead = 0x0d4; +BiosUartWrite = 0x22c; +BiosWozmon = 0x340; +BiosUartWriteNibble = 0x324; + SECTIONS { .text : diff --git a/mbv/hal/debug.cc b/mbv/hal/debug.cc new file mode 100644 index 0000000..d2c976a --- /dev/null +++ b/mbv/hal/debug.cc @@ -0,0 +1,26 @@ +#include + +extern "C" { + +uint8_t BiosUartRead(); +void BiosUartWrite(uint8_t); +void BiosWozmon(); +void BiosUartWriteNibble(uint8_t n); + +__attribute__((used)) +void UartWriteU32(uint32_t a) { + for (int i = 0; i < 8; i++) { + BiosUartWriteNibble(a >> 28); + a <<= 4; + } +} + +__attribute__((used)) +void UartWriteString(const char* s) { + while (*s) { + BiosUartWrite(*s); + s++; + } +} + +}