From bf901aff49a5290049a59fb92a0f2b50eaa0753f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 9 Jul 2018 07:39:55 +1000 Subject: [PATCH] AP_Bootloader: support building without USB this allows for a bootloader on a board with no USB pins defined in hwdef.dat --- Tools/AP_Bootloader/support.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Tools/AP_Bootloader/support.cpp b/Tools/AP_Bootloader/support.cpp index 79ca46dd91..d8a9c08ab8 100644 --- a/Tools/AP_Bootloader/support.cpp +++ b/Tools/AP_Bootloader/support.cpp @@ -242,12 +242,14 @@ extern "C" { // printf to USB for debugging void uprintf(const char *fmt, ...) { +#if HAL_USE_SERIAL_USB == TRUE char msg[200]; va_list ap; va_start(ap, fmt); uint32_t n = vsnprintf(msg, sizeof(msg), fmt, ap); va_end(ap); chnWriteTimeout(&SDU1, (const uint8_t *)msg, n, MS2ST(100)); +#endif } // generate a pulse sequence forever, for debugging @@ -327,7 +329,7 @@ void lock_bl_port(void) */ void init_uarts(void) { -#ifdef HAL_USE_SERIAL_USB +#if HAL_USE_SERIAL_USB == TRUE sduObjectInit(&SDU1); sduStart(&SDU1, &serusbcfg); @@ -341,7 +343,7 @@ void init_uarts(void) sercfg.speed = BOOTLOADER_BAUDRATE; for (uint8_t i=0; i