1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-23 16:25:26 +03:00

[MAKE/LOG] Add support for semihosting

Semihosting allows printing debug messages via SWD
This commit is contained in:
Alberto García Hierro 2019-10-27 18:35:05 +00:00
parent b9311541e4
commit 987c7bb73e
3 changed files with 37 additions and 3 deletions

View file

@ -20,6 +20,10 @@
#include <stdarg.h>
#include <ctype.h>
#if defined(SEMIHOSTING)
#include <stdio.h>
#endif
#include "build/version.h"
#include "drivers/serial.h"
@ -103,6 +107,18 @@ static void logPutcp(void *p, char ch)
static void logPrint(const char *buf, size_t size)
{
#if defined(SEMIHOSTING)
static bool semihostingInitialized = false;
extern void initialise_monitor_handles(void);
if (!semihostingInitialized) {
initialise_monitor_handles();
semihostingInitialized = true;
}
for (size_t ii = 0; ii < size; ii++) {
fputc(buf[ii], stdout);
}
#endif
if (logPort) {
// Send data via UART (if configured & connected - a safeguard against zombie VCP)
if (serialIsConnected(logPort)) {