From 43904acea8b2087fdf9f283c0f8ce7d92d16e605 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 13 Mar 2024 12:17:20 +1100 Subject: [PATCH] mimxrt: Define the MICROPY_HW_ENABLE_USBDEV macro. Previously USB was always enabled, but this created some conflicts when adding guards to other files on other ports. Note the configuration with USB disabled hasn't been tested and probably won't build or run without further work. Signed-off-by: Angus Gratton --- ports/mimxrt/main.c | 2 ++ ports/mimxrt/mpconfigport.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ports/mimxrt/main.c b/ports/mimxrt/main.c index 761c491742..dddf44e605 100644 --- a/ports/mimxrt/main.c +++ b/ports/mimxrt/main.c @@ -115,7 +115,9 @@ int main(void) { // Execute user scripts. int ret = pyexec_file_if_exists("boot.py"); + #if MICROPY_HW_ENABLE_USBDEV mp_usbd_init(); + #endif if (ret & PYEXEC_FORCED_EXIT) { goto soft_reset_exit; diff --git a/ports/mimxrt/mpconfigport.h b/ports/mimxrt/mpconfigport.h index 637c38f432..a4c6d6e206 100644 --- a/ports/mimxrt/mpconfigport.h +++ b/ports/mimxrt/mpconfigport.h @@ -147,6 +147,8 @@ uint32_t trng_random_u32(void); #define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-mimxrt" #endif +#define MICROPY_HW_ENABLE_USBDEV (1) + // Hooks to add builtins #if defined(IOMUX_TABLE_ENET)