summaryrefslogtreecommitdiff
path: root/examples/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-06-11 20:14:31 +0700
committerhathach <[email protected]>2026-06-11 20:14:31 +0700
commit4f5be18911c4d5dd4c3b097cb4ff18e2b7bf2543 (patch)
tree7215ed281d513583e23d3056231cc689dacd8eb0 /examples/device
parent264472e380bbca90aebabc6457fc53d372fcb66e (diff)
parent629e805e08575398070d0a9ac2087a853c93d290 (diff)
Merge remote-tracking branch 'origin/master' into musb_ep0_race
# Conflicts: # test/hil/hil_test.py
Diffstat (limited to 'examples/device')
-rw-r--r--examples/device/audio_4_channel_mic_freertos/CMakeLists.txt5
-rw-r--r--examples/device/audio_test_freertos/CMakeLists.txt5
-rw-r--r--examples/device/board_test/CMakeLists.txt5
-rw-r--r--examples/device/board_test/src/main.c26
-rw-r--r--examples/device/cdc_msc_freertos/CMakeLists.txt5
-rw-r--r--examples/device/cdc_msc_freertos/src/main.c2
-rw-r--r--examples/device/hid_composite_freertos/CMakeLists.txt5
-rw-r--r--examples/device/midi2_device/CMakeLists.txt4
-rw-r--r--examples/device/midi2_device/src/main.c2
-rw-r--r--examples/device/msc_dual_lun/src/main.c2
-rw-r--r--examples/device/net_lwip_webserver/src/tusb_config.h2
-rw-r--r--examples/device/printer_to_cdc/CMakePresets.json6
12 files changed, 57 insertions, 12 deletions
diff --git a/examples/device/audio_4_channel_mic_freertos/CMakeLists.txt b/examples/device/audio_4_channel_mic_freertos/CMakeLists.txt
index d43a72e58..66ef19fbc 100644
--- a/examples/device/audio_4_channel_mic_freertos/CMakeLists.txt
+++ b/examples/device/audio_4_channel_mic_freertos/CMakeLists.txt
@@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
+# Need to set Espressif defaults before project() is called
+if(FAMILY STREQUAL "espressif")
+ list(APPEND SDKCONFIG_DEFAULTS "${CMAKE_CURRENT_LIST_DIR}/sdkconfig.defaults")
+endif()
+
project(audio_4_channel_mic_freertos C CXX ASM)
# Checks this example is valid for the family and initializes the project
diff --git a/examples/device/audio_test_freertos/CMakeLists.txt b/examples/device/audio_test_freertos/CMakeLists.txt
index 71d65eccc..a39e56822 100644
--- a/examples/device/audio_test_freertos/CMakeLists.txt
+++ b/examples/device/audio_test_freertos/CMakeLists.txt
@@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
+# Need to set Espressif defaults before project() is called
+if(FAMILY STREQUAL "espressif")
+ list(APPEND SDKCONFIG_DEFAULTS "${CMAKE_CURRENT_LIST_DIR}/sdkconfig.defaults")
+endif()
+
project(audio_test_freertos C CXX ASM)
# Checks this example is valid for the family and initializes the project
diff --git a/examples/device/board_test/CMakeLists.txt b/examples/device/board_test/CMakeLists.txt
index bd7b8e0ca..f14d72c08 100644
--- a/examples/device/board_test/CMakeLists.txt
+++ b/examples/device/board_test/CMakeLists.txt
@@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
+# Need to set Espressif defaults before project() is called
+if(FAMILY STREQUAL "espressif")
+ list(APPEND SDKCONFIG_DEFAULTS "${CMAKE_CURRENT_LIST_DIR}/sdkconfig.defaults")
+endif()
+
project(board_test C CXX ASM)
# Checks this example is valid for the family and initializes the project
diff --git a/examples/device/board_test/src/main.c b/examples/device/board_test/src/main.c
index 71e7e1da7..96dc1bd30 100644
--- a/examples/device/board_test/src/main.c
+++ b/examples/device/board_test/src/main.c
@@ -54,6 +54,19 @@ void tusb_time_delay_ms_api(uint32_t ms) {
//
//--------------------------------------------------------------------+
+// CI_BUILD (defined for all CI builds, see hw/bsp/family_support.cmake) skips the
+// blink/echo loop below: after HIL tests, this firmware is flashed to park the
+// board in a quiet, low-power idle state (no USB, LED, or UART activity).
+#ifdef CI_BUILD
+int main(void) {
+ while (1) {
+ #if defined(ESP_PLATFORM)
+ vTaskDelay(portMAX_DELAY);
+ #endif
+ }
+}
+
+#else
// Task parameter type: ULONG for ThreadX, void* for FreeRTOS and noos
#if CFG_TUSB_OS == OPT_OS_THREADX
#define RTOS_PARAM ULONG
@@ -122,12 +135,6 @@ int main(void) {
return 0;
}
-#ifdef ESP_PLATFORM
-void app_main(void) {
- main();
-}
-#endif
-
//--------------------------------------------------------------------+
// FreeRTOS
//--------------------------------------------------------------------+
@@ -173,3 +180,10 @@ void tx_application_define(void *first_unused_memory) {
1, 1, TX_NO_TIME_SLICE, TX_AUTO_START);
}
#endif
+#endif // CI_BUILD
+
+#ifdef ESP_PLATFORM
+void app_main(void) {
+ main();
+}
+#endif
diff --git a/examples/device/cdc_msc_freertos/CMakeLists.txt b/examples/device/cdc_msc_freertos/CMakeLists.txt
index 429000427..1eafd529a 100644
--- a/examples/device/cdc_msc_freertos/CMakeLists.txt
+++ b/examples/device/cdc_msc_freertos/CMakeLists.txt
@@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
+# Need to set Espressif defaults before project() is called
+if(FAMILY STREQUAL "espressif")
+ list(APPEND SDKCONFIG_DEFAULTS "${CMAKE_CURRENT_LIST_DIR}/sdkconfig.defaults")
+endif()
+
project(cdc_msc_freertos C CXX ASM)
# Checks this example is valid for the family and initializes the project
diff --git a/examples/device/cdc_msc_freertos/src/main.c b/examples/device/cdc_msc_freertos/src/main.c
index f2f71d089..4a920c90b 100644
--- a/examples/device/cdc_msc_freertos/src/main.c
+++ b/examples/device/cdc_msc_freertos/src/main.c
@@ -88,7 +88,7 @@ int main(void) {
#else
xTaskCreate(led_blinking_task, "blinky", BLINKY_STACK_SIZE, NULL, 1, NULL);
xTaskCreate(usb_device_task, "usbd", USBD_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL);
- xTaskCreate(cdc_task, "cdc", CDC_STACK_SZIE, NULL, configMAX_PRIORITIES - 2, NULL);
+ xTaskCreate(cdc_task, "cdc", CDC_STACK_SIZE, NULL, configMAX_PRIORITIES - 2, NULL);
#endif
#ifndef ESP_PLATFORM
diff --git a/examples/device/hid_composite_freertos/CMakeLists.txt b/examples/device/hid_composite_freertos/CMakeLists.txt
index b52373011..2081a7782 100644
--- a/examples/device/hid_composite_freertos/CMakeLists.txt
+++ b/examples/device/hid_composite_freertos/CMakeLists.txt
@@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
+# Need to set Espressif defaults before project() is called
+if(FAMILY STREQUAL "espressif")
+ list(APPEND SDKCONFIG_DEFAULTS "${CMAKE_CURRENT_LIST_DIR}/sdkconfig.defaults")
+endif()
+
project(hid_composite_freertos C CXX ASM)
# Checks this example is valid for the family and initializes the project
diff --git a/examples/device/midi2_device/CMakeLists.txt b/examples/device/midi2_device/CMakeLists.txt
index 295af6550..f1fe09db2 100644
--- a/examples/device/midi2_device/CMakeLists.txt
+++ b/examples/device/midi2_device/CMakeLists.txt
@@ -30,4 +30,6 @@ target_include_directories(${PROJECT_NAME} PUBLIC
family_configure_device_example(${PROJECT_NAME} noos)
# Suppress pre-existing warning in usbd.c (uint8_t comparison always true/false)
-target_compile_options(${PROJECT_NAME} PRIVATE -Wno-type-limits)
+if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ target_compile_options(${PROJECT_NAME} PRIVATE -Wno-type-limits)
+endif()
diff --git a/examples/device/midi2_device/src/main.c b/examples/device/midi2_device/src/main.c
index 62741ac41..ce052a20b 100644
--- a/examples/device/midi2_device/src/main.c
+++ b/examples/device/midi2_device/src/main.c
@@ -715,6 +715,4 @@ int main(void) {
}
}
}
-
- return 0;
}
diff --git a/examples/device/msc_dual_lun/src/main.c b/examples/device/msc_dual_lun/src/main.c
index a4ade6f9b..1d764f12c 100644
--- a/examples/device/msc_dual_lun/src/main.c
+++ b/examples/device/msc_dual_lun/src/main.c
@@ -71,7 +71,7 @@ static void usb_device_init(void) {
board_init_after_tusb();
}
-#if CFG_TUSB_OS != OPT_OS_NONE && CFG_TUSB_OS != OPT_OS_PICO
+#if CFG_TUSB_OS_HAS_SCHEDULER
static void usb_device_task(RTOS_PARAM param) {
(void) param;
usb_device_init();
diff --git a/examples/device/net_lwip_webserver/src/tusb_config.h b/examples/device/net_lwip_webserver/src/tusb_config.h
index c594d1ebd..d94a87c99 100644
--- a/examples/device/net_lwip_webserver/src/tusb_config.h
+++ b/examples/device/net_lwip_webserver/src/tusb_config.h
@@ -102,7 +102,7 @@ extern "C" {
#if TU_CHECK_MCU(OPT_MCU_MAX32650, OPT_MCU_MAX32666, OPT_MCU_MAX32690, OPT_MCU_MAX78002) || \
TU_CHECK_MCU(OPT_MCU_STM32F2, OPT_MCU_STM32F4, OPT_MCU_STM32F7) || \
TU_CHECK_MCU(OPT_MCU_STM32H5, OPT_MCU_STM32H7, OPT_MCU_STM32H7RS) || \
- TU_CHECK_MCU(OPT_MCU_STM32U5, OPT_MCU_STM32N6) || \
+ TU_CHECK_MCU(OPT_MCU_STM32C5, OPT_MCU_STM32U5, OPT_MCU_STM32N6) || \
TU_CHECK_MCU(OPT_MCU_RP2040, OPT_MCU_CH32V307) || \
TU_CHECK_MCU(OPT_MCU_MIMXRT1XXX) || \
TU_CHECK_MCU(OPT_MCU_NRF5X)
diff --git a/examples/device/printer_to_cdc/CMakePresets.json b/examples/device/printer_to_cdc/CMakePresets.json
new file mode 100644
index 000000000..5cd8971e9
--- /dev/null
+++ b/examples/device/printer_to_cdc/CMakePresets.json
@@ -0,0 +1,6 @@
+{
+ "version": 6,
+ "include": [
+ "../../../hw/bsp/BoardPresets.json"
+ ]
+}