Skip to content

Commit 036bd81

Browse files
pi-anldpgeorge
authored andcommitted
stm32: Fix mboot build with TinyUSB-enabled boards.
usbd_conf.c unconditionally includes shared/tinyusb/mp_usbd.h which pulls in tusb.h when MICROPY_HW_ENABLE_USBDEV is set. The BUILDING_MBOOT guard that disables TinyUSB comes after the include, so mboot builds fail with missing tusb.h. Guard the include with !BUILDING_MBOOT. Also add forward declaration of mp_usbd_ll_init() next to the MICROPY_HW_TINYUSB_LL_INIT macro in mpconfigboard_common.h, since the function is used in an inline function in mp_usbd.h but only declared in the port-specific usbd_conf.h. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
1 parent 50348ce commit 036bd81

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

ports/stm32/mpconfigboard_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@
262262
#ifndef MICROPY_HW_ENABLE_USBDEV
263263
#define MICROPY_HW_ENABLE_USBDEV (1)
264264
#define MICROPY_HW_TINYUSB_LL_INIT mp_usbd_ll_init
265+
void mp_usbd_ll_init(void);
265266
#endif
266267

267268
#ifndef MICROPY_HW_USB_CDC

ports/stm32/usbd_conf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
#include "usbd_core.h"
3333
#include "py/obj.h"
3434
#include "py/mphal.h"
35+
#if !BUILDING_MBOOT
3536
#include "shared/tinyusb/mp_usbd.h"
37+
#endif
3638
#include "irq.h"
3739
#include "usb.h"
3840

0 commit comments

Comments
 (0)