From 7b8b66cb4c976b44a79cd981641bd6ce03936220 Mon Sep 17 00:00:00 2001 From: Jonathan Caicedo Date: Fri, 28 Aug 2026 04:07:40 -0400 Subject: [PATCH] build: enable USB CDC companion transport for ESP32-S3 boards (#77) * build: enable USB CDC companion transport for ESP32-S3 boards * build: detect USB CDC companion support from board overlay Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- build.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index c61c089..ba28eca 100644 --- a/build.sh +++ b/build.sh @@ -272,8 +272,27 @@ if [[ $1 == "esp32" ]]; then if [[ $2 == "companions" ]]; then # build ESP32 companions (production is the default) + # + # ESP32-S3 boards that include esp32s3_usb_otg.dtsi in their overlay + # get the USB CDC-ACM companion transport enabled via esp32s3_usb.conf. + # This gives the full companion protocol over native USB (Web Serial / + # app.meshcore.io) in addition to BLE. Boards without the OTG DTSI + # (Heltec V3/CP2102, Wireless Tracker V1, C3/C6, classic ESP32) are + # unaffected — they use BLE or serial_companion instead. + usb_conf="" + board_stem="${board%%/*}" + overlay="zephcore/boards/esp32/${board_stem}/board.overlay" + if [[ $board =~ esp32s3 && -f "$overlay" ]] && grep -q 'esp32s3_usb_otg\.dtsi' "$overlay"; then + usb_conf="boards/common/esp32s3_usb.conf" + fi + echo "Now building $board companion" - west build -b "$board" zephcore --pristine --sysbuild + if [[ -n "$usb_conf" ]]; then + echo " USB CDC companion: enabled ($usb_conf)" + west build -b "$board" zephcore --pristine --sysbuild -- -DEXTRA_CONF_FILE="$usb_conf" + else + west build -b "$board" zephcore --pristine --sysbuild + fi FLASH_SIZE=$( python3 -c ' import re