From d3f7a0a84b1b5f8bceb98d38d01b02de102f3957 Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Wed, 14 Aug 2024 16:24:47 +0300 Subject: [PATCH] Sync PlatformIO build script Compile USBDevice library by default if USB is enabled Signed-off-by: Valerii Koval --- tools/platformio/platformio-build.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/platformio/platformio-build.py b/tools/platformio/platformio-build.py index 0f0b2642aa..fcda858ca8 100644 --- a/tools/platformio/platformio-build.py +++ b/tools/platformio/platformio-build.py @@ -109,6 +109,18 @@ def process_usb_configuration(cpp_defines): ] ) + if any( + d in env.Flatten(env.get("CPPDEFINES", [])) + for d in ( + "USBD_USE_CDC", + "USBD_USE_HID_COMPOSITE", + ) + ): + env.BuildSources( + join("$BUILD_DIR", "USBDevice"), + join(FRAMEWORK_DIR, "libraries", "USBDevice") + ) + if any(f in env["CPPDEFINES"] for f in ("USBD_USE_CDC", "USBD_USE_HID_COMPOSITE")): env.Append(CPPDEFINES=["HAL_PCD_MODULE_ENABLED"])