From 183c5ef02794bc26117a1115346580e606567f1f Mon Sep 17 00:00:00 2001
From: Thomas Rubin
Date: Fri, 21 Nov 2025 14:23:47 +0100
Subject: [PATCH 1/8] Fix in multiple example codes, wrong descriptor length
was taken for tusb_desc_device_qualifier_t.
Signed-off-by: Thomas Rubin
---
examples/device/audio_test_multi_rate/src/usb_descriptors.c | 2 +-
examples/device/cdc_dual_ports/src/usb_descriptors.c | 2 +-
examples/device/uac2_speaker_fb/src/usb_descriptors.c | 2 +-
examples/device/video_capture/src/usb_descriptors.c | 2 +-
examples/device/video_capture_2ch/src/usb_descriptors.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/examples/device/audio_test_multi_rate/src/usb_descriptors.c b/examples/device/audio_test_multi_rate/src/usb_descriptors.c
index 471eb4f2e..fa07d33fd 100644
--- a/examples/device/audio_test_multi_rate/src/usb_descriptors.c
+++ b/examples/device/audio_test_multi_rate/src/usb_descriptors.c
@@ -119,7 +119,7 @@ TU_VERIFY_STATIC(sizeof(desc2_uac2_configuration) == CONFIG_UAC2_TOTAL_LEN, "Inc
// device qualifier is mostly similar to device descriptor since we don't change configuration based on speed
tusb_desc_device_qualifier_t const desc_device_qualifier = {
- .bLength = sizeof(tusb_desc_device_t),
+ .bLength = sizeof(tusb_desc_device_qualifier_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = 0x0200,
diff --git a/examples/device/cdc_dual_ports/src/usb_descriptors.c b/examples/device/cdc_dual_ports/src/usb_descriptors.c
index dd0aefaea..5fe83af76 100644
--- a/examples/device/cdc_dual_ports/src/usb_descriptors.c
+++ b/examples/device/cdc_dual_ports/src/usb_descriptors.c
@@ -153,7 +153,7 @@ static uint8_t const desc_hs_configuration[] = {
// device qualifier is mostly similar to device descriptor since we don't change configuration based on speed
static tusb_desc_device_qualifier_t const desc_device_qualifier = {
- .bLength = sizeof(tusb_desc_device_t),
+ .bLength = sizeof(tusb_desc_device_qualifier_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = USB_BCD,
diff --git a/examples/device/uac2_speaker_fb/src/usb_descriptors.c b/examples/device/uac2_speaker_fb/src/usb_descriptors.c
index 697e51483..40fe9198b 100644
--- a/examples/device/uac2_speaker_fb/src/usb_descriptors.c
+++ b/examples/device/uac2_speaker_fb/src/usb_descriptors.c
@@ -174,7 +174,7 @@ TU_VERIFY_STATIC(sizeof(desc_uac2_configuration) == CONFIG_UAC2_TOTAL_LEN, "Inco
// device qualifier is mostly similar to device descriptor since we don't change configuration based on speed
tusb_desc_device_qualifier_t const desc_device_qualifier = {
- .bLength = sizeof(tusb_desc_device_t),
+ .bLength = sizeof(tusb_desc_device_qualifier_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = 0x0200,
diff --git a/examples/device/video_capture/src/usb_descriptors.c b/examples/device/video_capture/src/usb_descriptors.c
index 114dd5722..851ebb297 100644
--- a/examples/device/video_capture/src/usb_descriptors.c
+++ b/examples/device/video_capture/src/usb_descriptors.c
@@ -385,7 +385,7 @@ static uint8_t * get_hs_configuration_desc(void) {
// device qualifier is mostly similar to device descriptor since we don't change configuration based on speed
static tusb_desc_device_qualifier_t const desc_device_qualifier = {
- .bLength = sizeof(tusb_desc_device_t),
+ .bLength = sizeof(tusb_desc_device_qualifier_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = USB_BCD,
diff --git a/examples/device/video_capture_2ch/src/usb_descriptors.c b/examples/device/video_capture_2ch/src/usb_descriptors.c
index 024d16e07..24b5823e6 100644
--- a/examples/device/video_capture_2ch/src/usb_descriptors.c
+++ b/examples/device/video_capture_2ch/src/usb_descriptors.c
@@ -552,7 +552,7 @@ static uint8_t * get_hs_configuration_desc(void) {
// device qualifier is mostly similar to device descriptor since we don't change configuration based on speed
static tusb_desc_device_qualifier_t const desc_device_qualifier = {
- .bLength = sizeof(tusb_desc_device_t),
+ .bLength = sizeof(tusb_desc_device_qualifier_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = USB_BCD,
From d76ddc695f9706a211f95ed7b3a17761bb2fd1fa Mon Sep 17 00:00:00 2001
From: HiFiPhile
Date: Fri, 21 Nov 2025 22:11:52 +0100
Subject: [PATCH 2/8] Also fix bDescriptorType
Signed-off-by: HiFiPhile
---
examples/device/audio_test_multi_rate/src/usb_descriptors.c | 2 +-
examples/device/cdc_dual_ports/src/usb_descriptors.c | 2 +-
examples/device/uac2_speaker_fb/src/usb_descriptors.c | 2 +-
examples/device/video_capture/src/usb_descriptors.c | 2 +-
examples/device/video_capture_2ch/src/usb_descriptors.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/examples/device/audio_test_multi_rate/src/usb_descriptors.c b/examples/device/audio_test_multi_rate/src/usb_descriptors.c
index fa07d33fd..505936fdb 100644
--- a/examples/device/audio_test_multi_rate/src/usb_descriptors.c
+++ b/examples/device/audio_test_multi_rate/src/usb_descriptors.c
@@ -120,7 +120,7 @@ TU_VERIFY_STATIC(sizeof(desc2_uac2_configuration) == CONFIG_UAC2_TOTAL_LEN, "Inc
// device qualifier is mostly similar to device descriptor since we don't change configuration based on speed
tusb_desc_device_qualifier_t const desc_device_qualifier = {
.bLength = sizeof(tusb_desc_device_qualifier_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
+ .bDescriptorType = TUSB_DESC_DEVICE_QUALIFIER,
.bcdUSB = 0x0200,
.bDeviceClass = TUSB_CLASS_MISC,
diff --git a/examples/device/cdc_dual_ports/src/usb_descriptors.c b/examples/device/cdc_dual_ports/src/usb_descriptors.c
index 5fe83af76..e6011c35a 100644
--- a/examples/device/cdc_dual_ports/src/usb_descriptors.c
+++ b/examples/device/cdc_dual_ports/src/usb_descriptors.c
@@ -154,7 +154,7 @@ static uint8_t const desc_hs_configuration[] = {
// device qualifier is mostly similar to device descriptor since we don't change configuration based on speed
static tusb_desc_device_qualifier_t const desc_device_qualifier = {
.bLength = sizeof(tusb_desc_device_qualifier_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
+ .bDescriptorType = TUSB_DESC_DEVICE_QUALIFIER,
.bcdUSB = USB_BCD,
.bDeviceClass = TUSB_CLASS_MISC,
diff --git a/examples/device/uac2_speaker_fb/src/usb_descriptors.c b/examples/device/uac2_speaker_fb/src/usb_descriptors.c
index 40fe9198b..c5a161a1e 100644
--- a/examples/device/uac2_speaker_fb/src/usb_descriptors.c
+++ b/examples/device/uac2_speaker_fb/src/usb_descriptors.c
@@ -175,7 +175,7 @@ TU_VERIFY_STATIC(sizeof(desc_uac2_configuration) == CONFIG_UAC2_TOTAL_LEN, "Inco
// device qualifier is mostly similar to device descriptor since we don't change configuration based on speed
tusb_desc_device_qualifier_t const desc_device_qualifier = {
.bLength = sizeof(tusb_desc_device_qualifier_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
+ .bDescriptorType = TUSB_DESC_DEVICE_QUALIFIER,
.bcdUSB = 0x0200,
.bDeviceClass = TUSB_CLASS_MISC,
diff --git a/examples/device/video_capture/src/usb_descriptors.c b/examples/device/video_capture/src/usb_descriptors.c
index 851ebb297..b3382c82d 100644
--- a/examples/device/video_capture/src/usb_descriptors.c
+++ b/examples/device/video_capture/src/usb_descriptors.c
@@ -386,7 +386,7 @@ static uint8_t * get_hs_configuration_desc(void) {
// device qualifier is mostly similar to device descriptor since we don't change configuration based on speed
static tusb_desc_device_qualifier_t const desc_device_qualifier = {
.bLength = sizeof(tusb_desc_device_qualifier_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
+ .bDescriptorType = TUSB_DESC_DEVICE_QUALIFIER,
.bcdUSB = USB_BCD,
.bDeviceClass = TUSB_CLASS_MISC,
diff --git a/examples/device/video_capture_2ch/src/usb_descriptors.c b/examples/device/video_capture_2ch/src/usb_descriptors.c
index 24b5823e6..8dc986da6 100644
--- a/examples/device/video_capture_2ch/src/usb_descriptors.c
+++ b/examples/device/video_capture_2ch/src/usb_descriptors.c
@@ -553,7 +553,7 @@ static uint8_t * get_hs_configuration_desc(void) {
// device qualifier is mostly similar to device descriptor since we don't change configuration based on speed
static tusb_desc_device_qualifier_t const desc_device_qualifier = {
.bLength = sizeof(tusb_desc_device_qualifier_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
+ .bDescriptorType = TUSB_DESC_DEVICE_QUALIFIER,
.bcdUSB = USB_BCD,
.bDeviceClass = TUSB_CLASS_MISC,
From 50a7d923dd66cbb996c5587db4821fc52a307902 Mon Sep 17 00:00:00 2001
From: milek7
Date: Sun, 23 Nov 2025 00:00:10 +0100
Subject: [PATCH 3/8] stm32_fsdev: Fix missed cases in single-buffered
isochronous endpoint support.
---
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
index 381aa0b40..6276f0f07 100644
--- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
+++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
@@ -293,7 +293,11 @@ static void handle_ctr_tx(uint32_t ep_id) {
return;
}
xfer->iso_in_sending = false;
+#if FSDEV_USE_SBUF_ISO == 0
uint8_t buf_id = (ep_reg & USB_EP_DTOG_TX) ? 0 : 1;
+#else
+ uint8_t buf_id = BTABLE_BUF_TX;
+#endif
btable_set_count(ep_id, buf_id, 0);
}
@@ -774,7 +778,12 @@ static bool edpt_xfer(uint8_t rhport, uint8_t ep_num, tusb_dir_t dir) {
uint16_t cnt = tu_min16(xfer->total_len, xfer->max_packet_size);
- if (ep_is_iso(ep_reg)) {
+#if FSDEV_USE_SBUF_ISO == 0
+ bool const dbl_buf = ep_is_iso(ep_reg);
+#else
+ bool const dbl_buf = false;
+#endif
+ if (dbl_buf) {
btable_set_rx_bufsize(ep_idx, 0, cnt);
btable_set_rx_bufsize(ep_idx, 1, cnt);
} else {
From e59b2c40fc9e655918629d73cc8c54b86b4a70c1 Mon Sep 17 00:00:00 2001
From: Zixun LI
Date: Tue, 25 Nov 2025 10:49:07 +0100
Subject: [PATCH 4/8] Fix N6 build
Signed-off-by: Zixun LI
---
examples/build_system/cmake/cpu/cortex-m55.cmake | 2 ++
hw/bsp/stm32n6/family.cmake | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/examples/build_system/cmake/cpu/cortex-m55.cmake b/examples/build_system/cmake/cpu/cortex-m55.cmake
index a7a57957c..d5f6fa74a 100644
--- a/examples/build_system/cmake/cpu/cortex-m55.cmake
+++ b/examples/build_system/cmake/cpu/cortex-m55.cmake
@@ -13,6 +13,7 @@ elseif (TOOLCHAIN STREQUAL "clang")
--target=arm-none-eabi
-mcpu=cortex-m55
-mfpu=fpv5-d16
+ -mcmse
)
set(FREERTOS_PORT GCC_ARM_CM55_NTZ_NONSECURE CACHE INTERNAL "")
@@ -20,6 +21,7 @@ elseif (TOOLCHAIN STREQUAL "iar")
set(TOOLCHAIN_COMMON_FLAGS
--cpu cortex-m55
--fpu VFPv5_D16
+ --cmse
)
set(FREERTOS_PORT IAR_ARM_CM55_NTZ_NONSECURE CACHE INTERNAL "")
diff --git a/hw/bsp/stm32n6/family.cmake b/hw/bsp/stm32n6/family.cmake
index 76763937e..89e4989ad 100644
--- a/hw/bsp/stm32n6/family.cmake
+++ b/hw/bsp/stm32n6/family.cmake
@@ -52,11 +52,11 @@ function(add_board_target BOARD_TARGET)
set(STARTUP_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/startup_${MCU_VARIANT}.s)
if(NOT DEFINED LD_FILE_GNU)
- set(LD_FILE_GNU ${ST_CMSIS}/Source/Templates/gcc/linker/${MCU_VARIANT}_flash.ld)
+ set(LD_FILE_GNU ${ST_CMSIS}/Source/Templates/gcc/linker/${MCU_VARIANT}_axisram2_fsbl.ld)
endif()
set(LD_FILE_Clang ${LD_FILE_GNU})
if(NOT DEFINED LD_FILE_IAR)
- set(LD_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/linker/${MCU_VARIANT}_flash.icf)
+ set(LD_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/linker/${MCU_VARIANT}_axisram2_fsbl.icf)
endif()
add_library(${BOARD_TARGET} STATIC
From 4632a78883daeb0d6355542c2daa008bfc4d4cc3 Mon Sep 17 00:00:00 2001
From: Zixun LI
Date: Tue, 25 Nov 2025 16:03:21 +0100
Subject: [PATCH 5/8] dcd/fsdev: re-enable SBUF for STM32U0, no more issue
---
src/portable/st/stm32_fsdev/fsdev_stm32.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/portable/st/stm32_fsdev/fsdev_stm32.h b/src/portable/st/stm32_fsdev/fsdev_stm32.h
index 30ffadc35..e7a57aca0 100644
--- a/src/portable/st/stm32_fsdev/fsdev_stm32.h
+++ b/src/portable/st/stm32_fsdev/fsdev_stm32.h
@@ -202,8 +202,7 @@
#include "stm32u0xx.h"
#define FSDEV_PMA_SIZE (1024u)
#define FSDEV_BUS_32BIT
- // Disable SBUF_ISO on U0 for now due to bad performance (audio glitching)
- #define FSDEV_HAS_SBUF_ISO 0
+ #define FSDEV_HAS_SBUF_ISO 1
#define USB USB_DRD_FS
#define USB_EP_CTR_RX USB_EP_VTRX
From 8221ea220bb523b3d8c6bab915a968477a228a16 Mon Sep 17 00:00:00 2001
From: Zixun LI
Date: Tue, 25 Nov 2025 15:54:45 +0100
Subject: [PATCH 6/8] bsp: Disable SysTick ISR if FreeRTOS is enabled
---
hw/bsp/at32f402_405/family.c | 15 ++++++++-------
hw/bsp/at32f435_437/family.c | 4 +++-
hw/bsp/imxrt/family.c | 3 ++-
hw/bsp/kinetis_k/family.c | 2 ++
hw/bsp/kinetis_kl/family.c | 2 ++
hw/bsp/lpc11/family.c | 2 ++
hw/bsp/lpc13/family.c | 2 ++
hw/bsp/lpc15/family.c | 6 ++++--
hw/bsp/lpc17/family.c | 2 ++
hw/bsp/lpc18/family.c | 2 ++
hw/bsp/lpc40/family.c | 2 ++
hw/bsp/lpc43/family.c | 2 ++
hw/bsp/lpc51/family.c | 2 ++
hw/bsp/lpc54/family.c | 6 ++++--
hw/bsp/lpc55/family.c | 2 +-
hw/bsp/maxim/family.c | 2 ++
hw/bsp/mcx/family.c | 2 ++
hw/bsp/mm32/family.c | 5 +++++
hw/bsp/msp432e4/family.c | 2 ++
hw/bsp/nuc100_120/family.c | 3 +++
hw/bsp/ra/family.c | 3 +++
hw/bsp/samd11/family.c | 5 +++++
hw/bsp/samd2x_l2x/family.c | 3 +++
hw/bsp/samd5x_e5x/family.c | 6 ++++++
hw/bsp/same7x/family.c | 5 +++++
hw/bsp/samg/family.c | 2 ++
hw/bsp/stm32c0/family.c | 2 +-
hw/bsp/stm32f0/family.c | 2 +-
hw/bsp/stm32f1/family.c | 3 ++-
hw/bsp/stm32f2/family.c | 3 +++
hw/bsp/stm32f3/family.c | 7 +++++--
hw/bsp/stm32f4/family.c | 2 +-
hw/bsp/stm32f7/family.c | 2 +-
hw/bsp/stm32g0/family.c | 2 +-
hw/bsp/stm32g4/family.c | 2 +-
hw/bsp/stm32h5/family.c | 2 +-
hw/bsp/stm32h7/family.c | 2 +-
hw/bsp/stm32h7rs/family.c | 2 +-
hw/bsp/stm32l0/family.c | 2 +-
hw/bsp/stm32l4/family.c | 2 ++
hw/bsp/stm32n6/family.c | 2 +-
hw/bsp/stm32u0/family.c | 8 ++++++++
hw/bsp/stm32u5/family.c | 3 +++
hw/bsp/stm32wb/family.c | 2 +-
hw/bsp/stm32wba/family.c | 2 +-
hw/bsp/tm4c/family.c | 2 ++
hw/bsp/xmc4000/family.c | 2 +-
47 files changed, 117 insertions(+), 31 deletions(-)
diff --git a/hw/bsp/at32f402_405/family.c b/hw/bsp/at32f402_405/family.c
index beac1a7f8..a6c2217fe 100644
--- a/hw/bsp/at32f402_405/family.c
+++ b/hw/bsp/at32f402_405/family.c
@@ -75,16 +75,17 @@ void board_init(void)
/* vbus ignore */
board_vbus_sense_init();
- /* configure systick */
- SysTick_Config(system_core_clock / 1000);
-
- #if CFG_TUSB_OS == OPT_OS_FREERTOS
+ #if CFG_TUSB_OS == OPT_OS_NONE
+ /* configure systick */
+ SysTick_Config(system_core_clock / 1000);
+ NVIC_SetPriority(OTGHS_IRQn, 0);
+ NVIC_SetPriority(OTGFS1_IRQn, 0);
+ #elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(OTGHS_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(OTGFS1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
- #else
- NVIC_SetPriority(OTGHS_IRQn, 0);
- NVIC_SetPriority(OTGFS1_IRQn, 0);
#endif
/* config led and key */
diff --git a/hw/bsp/at32f435_437/family.c b/hw/bsp/at32f435_437/family.c
index 4bd6ee73c..01dd429f8 100644
--- a/hw/bsp/at32f435_437/family.c
+++ b/hw/bsp/at32f435_437/family.c
@@ -74,12 +74,14 @@ void board_init(void) {
/* vbus ignore */
board_vbus_sense_init();
- SysTick_Config(SystemCoreClock / 1000);
#if CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(OTGFS1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(OTGFS2_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#else
+ SysTick_Config(SystemCoreClock / 1000);
NVIC_SetPriority(OTGFS1_IRQn, 0);
NVIC_SetPriority(OTGFS2_IRQn, 0);
#endif
diff --git a/hw/bsp/imxrt/family.c b/hw/bsp/imxrt/family.c
index 84b083e29..18833da80 100644
--- a/hw/bsp/imxrt/family.c
+++ b/hw/bsp/imxrt/family.c
@@ -120,8 +120,9 @@ void board_init(void) {
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
-
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB_OTG1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#ifdef USBPHY2
diff --git a/hw/bsp/kinetis_k/family.c b/hw/bsp/kinetis_k/family.c
index 816c5c87e..98ef52739 100644
--- a/hw/bsp/kinetis_k/family.c
+++ b/hw/bsp/kinetis_k/family.c
@@ -61,6 +61,8 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
diff --git a/hw/bsp/kinetis_kl/family.c b/hw/bsp/kinetis_kl/family.c
index 000006372..c257f4b2b 100644
--- a/hw/bsp/kinetis_kl/family.c
+++ b/hw/bsp/kinetis_kl/family.c
@@ -59,6 +59,8 @@ void board_init(void)
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
diff --git a/hw/bsp/lpc11/family.c b/hw/bsp/lpc11/family.c
index b5371632c..c9f18bd2f 100644
--- a/hw/bsp/lpc11/family.c
+++ b/hw/bsp/lpc11/family.c
@@ -74,6 +74,8 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
diff --git a/hw/bsp/lpc13/family.c b/hw/bsp/lpc13/family.c
index 1faa54485..e212c6a63 100644
--- a/hw/bsp/lpc13/family.c
+++ b/hw/bsp/lpc13/family.c
@@ -54,6 +54,8 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
diff --git a/hw/bsp/lpc15/family.c b/hw/bsp/lpc15/family.c
index e23fdec43..5f22df175 100644
--- a/hw/bsp/lpc15/family.c
+++ b/hw/bsp/lpc15/family.c
@@ -77,10 +77,12 @@ void board_init(void)
{
SystemCoreClockUpdate();
+#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
-
-#if CFG_TUSB_OS == OPT_OS_FREERTOS
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
diff --git a/hw/bsp/lpc17/family.c b/hw/bsp/lpc17/family.c
index 1edab6cd4..ba59fccca 100644
--- a/hw/bsp/lpc17/family.c
+++ b/hw/bsp/lpc17/family.c
@@ -54,6 +54,8 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
diff --git a/hw/bsp/lpc18/family.c b/hw/bsp/lpc18/family.c
index 0db5c83b6..6c02c711f 100644
--- a/hw/bsp/lpc18/family.c
+++ b/hw/bsp/lpc18/family.c
@@ -83,6 +83,8 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USB1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
diff --git a/hw/bsp/lpc40/family.c b/hw/bsp/lpc40/family.c
index b8bc99452..5ea95e9b8 100644
--- a/hw/bsp/lpc40/family.c
+++ b/hw/bsp/lpc40/family.c
@@ -89,6 +89,8 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif
diff --git a/hw/bsp/lpc43/family.c b/hw/bsp/lpc43/family.c
index 591090c36..f440fb119 100644
--- a/hw/bsp/lpc43/family.c
+++ b/hw/bsp/lpc43/family.c
@@ -100,6 +100,8 @@ void board_init(void)
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif
diff --git a/hw/bsp/lpc51/family.c b/hw/bsp/lpc51/family.c
index c963b76bd..bec86f87f 100644
--- a/hw/bsp/lpc51/family.c
+++ b/hw/bsp/lpc51/family.c
@@ -57,6 +57,8 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
diff --git a/hw/bsp/lpc54/family.c b/hw/bsp/lpc54/family.c
index 094866d9b..7bb73afbc 100644
--- a/hw/bsp/lpc54/family.c
+++ b/hw/bsp/lpc54/family.c
@@ -108,10 +108,12 @@ void board_init(void) {
// Init 96 MHz clock
BootClockFROHF96M();
+#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
-
-#if CFG_TUSB_OS == OPT_OS_FREERTOS
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
diff --git a/hw/bsp/lpc55/family.c b/hw/bsp/lpc55/family.c
index f1ef58926..ad0e502b5 100644
--- a/hw/bsp/lpc55/family.c
+++ b/hw/bsp/lpc55/family.c
@@ -147,7 +147,7 @@ void board_init(void) {
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/maxim/family.c b/hw/bsp/maxim/family.c
index 92b5adb6d..7ad7d6ff9 100644
--- a/hw/bsp/maxim/family.c
+++ b/hw/bsp/maxim/family.c
@@ -66,6 +66,8 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif
diff --git a/hw/bsp/mcx/family.c b/hw/bsp/mcx/family.c
index e1accf941..3b91678b1 100644
--- a/hw/bsp/mcx/family.c
+++ b/hw/bsp/mcx/family.c
@@ -68,6 +68,8 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
#if CFG_TUSB_MCU == OPT_MCU_MCXN9
NVIC_SetPriority(USB0_FS_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
diff --git a/hw/bsp/mm32/family.c b/hw/bsp/mm32/family.c
index 979efb6ca..663c30818 100644
--- a/hw/bsp/mm32/family.c
+++ b/hw/bsp/mm32/family.c
@@ -70,8 +70,13 @@ void board_init(void) {
// usb clock
USB_DeviceClockInit();
+#if CFG_TUSB_OS == OPT_OS_NONE
SysTick_Config(SystemCoreClock / 1000);
NVIC_SetPriority(SysTick_IRQn, 0x0);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
+#endif
RCC_AHBPeriphClockCmd(RCC_AHBENR_GPIOA, ENABLE);
diff --git a/hw/bsp/msp432e4/family.c b/hw/bsp/msp432e4/family.c
index 9a3b48b66..0e1b0528a 100644
--- a/hw/bsp/msp432e4/family.c
+++ b/hw/bsp/msp432e4/family.c
@@ -85,6 +85,8 @@ void board_init(void)
#if CFG_TUSB_OS == OPT_OS_NONE
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
diff --git a/hw/bsp/nuc100_120/family.c b/hw/bsp/nuc100_120/family.c
index d04dc6657..752af2a56 100644
--- a/hw/bsp/nuc100_120/family.c
+++ b/hw/bsp/nuc100_120/family.c
@@ -72,6 +72,9 @@ void board_init(void)
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(48000000 / 1000);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
#endif
GPIO_SetMode(LED_PORT, 1UL << LED_PIN, GPIO_PMD_OUTPUT);
diff --git a/hw/bsp/ra/family.c b/hw/bsp/ra/family.c
index 0fd24e493..1f75b47c1 100644
--- a/hw/bsp/ra/family.c
+++ b/hw/bsp/ra/family.c
@@ -118,6 +118,9 @@ void board_init(void) {
#if CFG_TUSB_OS == OPT_OS_NONE
SysTick_Config(SystemCoreClock / 1000);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
#endif
board_led_write(false);
diff --git a/hw/bsp/samd11/family.c b/hw/bsp/samd11/family.c
index 62e060c8e..6cbf02412 100644
--- a/hw/bsp/samd11/family.c
+++ b/hw/bsp/samd11/family.c
@@ -86,7 +86,12 @@ void board_init(void)
// 1ms tick timer (samd SystemCoreClock may not correct)
SystemCoreClock = CONF_CPU_FREQUENCY;
+#if CFG_TUSB_OS == OPT_OS_NONE
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
+#endif
// Led init
gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
diff --git a/hw/bsp/samd2x_l2x/family.c b/hw/bsp/samd2x_l2x/family.c
index 67da1294e..a2dc8a8d4 100644
--- a/hw/bsp/samd2x_l2x/family.c
+++ b/hw/bsp/samd2x_l2x/family.c
@@ -154,6 +154,9 @@ void board_init(void) {
SystemCoreClock = CONF_CPU_FREQUENCY;
#if CFG_TUSB_OS == OPT_OS_NONE
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
#endif
// Led init
diff --git a/hw/bsp/samd5x_e5x/family.c b/hw/bsp/samd5x_e5x/family.c
index df6f19d0f..5a7105894 100644
--- a/hw/bsp/samd5x_e5x/family.c
+++ b/hw/bsp/samd5x_e5x/family.c
@@ -103,7 +103,13 @@ void board_init(void) {
// Update SystemCoreClock since it is hard coded with asf4 and not correct
// Init 1ms tick timer (samd SystemCoreClock may not correct)
SystemCoreClock = CONF_CPU_FREQUENCY;
+
+#if CFG_TUSB_OS == OPT_OS_NONE
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
+#endif
// Led init
gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
diff --git a/hw/bsp/same7x/family.c b/hw/bsp/same7x/family.c
index 572c83588..6feefa3b5 100644
--- a/hw/bsp/same7x/family.c
+++ b/hw/bsp/same7x/family.c
@@ -129,6 +129,11 @@ void board_init(void) {
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer (SystemCoreClock may not be correct after init)
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
+ // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
+ NVIC_SetPriority((IRQn_Type) ID_USBHS, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif
// Enable USB clock
diff --git a/hw/bsp/samg/family.c b/hw/bsp/samg/family.c
index 234dc0ec0..5c5fc3c14 100644
--- a/hw/bsp/samg/family.c
+++ b/hw/bsp/samg/family.c
@@ -88,6 +88,8 @@ void board_init(void) {
// 1ms tick timer (samd SystemCoreClock may not correct)
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
NVIC_SetPriority(UDP_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif
diff --git a/hw/bsp/stm32c0/family.c b/hw/bsp/stm32c0/family.c
index 09704b527..ba8b14dd1 100644
--- a/hw/bsp/stm32c0/family.c
+++ b/hw/bsp/stm32c0/family.c
@@ -68,7 +68,7 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/stm32f0/family.c b/hw/bsp/stm32f0/family.c
index ea1373e6c..b99b0a8cc 100644
--- a/hw/bsp/stm32f0/family.c
+++ b/hw/bsp/stm32f0/family.c
@@ -62,7 +62,7 @@ void board_init(void) {
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/stm32f1/family.c b/hw/bsp/stm32f1/family.c
index 29785397f..3147061cf 100644
--- a/hw/bsp/stm32f1/family.c
+++ b/hw/bsp/stm32f1/family.c
@@ -77,8 +77,9 @@ void board_init(void) {
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
-
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB_HP_CAN1_TX_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USB_LP_CAN1_RX0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
diff --git a/hw/bsp/stm32f2/family.c b/hw/bsp/stm32f2/family.c
index c1333382a..8ea8ec5a5 100644
--- a/hw/bsp/stm32f2/family.c
+++ b/hw/bsp/stm32f2/family.c
@@ -56,6 +56,9 @@ void board_init(void) {
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
+ #elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
#endif
all_rcc_clk_enable();
diff --git a/hw/bsp/stm32f3/family.c b/hw/bsp/stm32f3/family.c
index 84612d416..95bcc7882 100644
--- a/hw/bsp/stm32f3/family.c
+++ b/hw/bsp/stm32f3/family.c
@@ -68,10 +68,13 @@ void USBWakeUp_RMP_IRQHandler(void) {
void board_init(void) {
SystemClock_Config();
- #if CFG_TUSB_OS == OPT_OS_NONE
+#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
- #endif
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
+#endif
// Remap the USB interrupts
__HAL_RCC_SYSCFG_CLK_ENABLE();
diff --git a/hw/bsp/stm32f4/family.c b/hw/bsp/stm32f4/family.c
index 6e02b0575..025f6a08c 100644
--- a/hw/bsp/stm32f4/family.c
+++ b/hw/bsp/stm32f4/family.c
@@ -102,7 +102,7 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/stm32f7/family.c b/hw/bsp/stm32f7/family.c
index 38dfaa3bc..ac22c606f 100644
--- a/hw/bsp/stm32f7/family.c
+++ b/hw/bsp/stm32f7/family.c
@@ -105,7 +105,7 @@ void board_init(void) {
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/stm32g0/family.c b/hw/bsp/stm32g0/family.c
index 67b0b3f1c..7b86aedb4 100644
--- a/hw/bsp/stm32g0/family.c
+++ b/hw/bsp/stm32g0/family.c
@@ -65,7 +65,7 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/stm32g4/family.c b/hw/bsp/stm32g4/family.c
index 49ef86db9..d8afa0f95 100644
--- a/hw/bsp/stm32g4/family.c
+++ b/hw/bsp/stm32g4/family.c
@@ -77,7 +77,7 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/stm32h5/family.c b/hw/bsp/stm32h5/family.c
index 26ba34ac3..983944b1c 100644
--- a/hw/bsp/stm32h5/family.c
+++ b/hw/bsp/stm32h5/family.c
@@ -88,7 +88,7 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/stm32h7/family.c b/hw/bsp/stm32h7/family.c
index 7b618b2e4..054d7855f 100644
--- a/hw/bsp/stm32h7/family.c
+++ b/hw/bsp/stm32h7/family.c
@@ -130,7 +130,7 @@ void board_init(void) {
SysTick_Config(SystemCoreClock / 1000u);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1UL;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/stm32h7rs/family.c b/hw/bsp/stm32h7rs/family.c
index 6192f7a40..784c92465 100644
--- a/hw/bsp/stm32h7rs/family.c
+++ b/hw/bsp/stm32h7rs/family.c
@@ -304,7 +304,7 @@ void board_init(void) {
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/stm32l0/family.c b/hw/bsp/stm32l0/family.c
index b28903e00..6aeab1259 100644
--- a/hw/bsp/stm32l0/family.c
+++ b/hw/bsp/stm32l0/family.c
@@ -54,7 +54,7 @@ void board_init(void) {
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/stm32l4/family.c b/hw/bsp/stm32l4/family.c
index 114a6a483..e69ae8e3b 100644
--- a/hw/bsp/stm32l4/family.c
+++ b/hw/bsp/stm32l4/family.c
@@ -78,6 +78,8 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
#if defined(USB_OTG_FS)
NVIC_SetPriority(OTG_FS_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
diff --git a/hw/bsp/stm32n6/family.c b/hw/bsp/stm32n6/family.c
index 58be4867d..567bb7294 100644
--- a/hw/bsp/stm32n6/family.c
+++ b/hw/bsp/stm32n6/family.c
@@ -140,7 +140,7 @@ void board_init(void) {
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/stm32u0/family.c b/hw/bsp/stm32u0/family.c
index bf2503865..50b513d8f 100644
--- a/hw/bsp/stm32u0/family.c
+++ b/hw/bsp/stm32u0/family.c
@@ -70,6 +70,14 @@ void board_init(void) {
#endif
__HAL_RCC_PWR_CLK_ENABLE();
+#if CFG_TUSB_OS == OPT_OS_NONE
+ // 1ms tick timer
+ SysTick_Config(SystemCoreClock / 1000);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
+#endif
+
// LED
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = LED_PIN;
diff --git a/hw/bsp/stm32u5/family.c b/hw/bsp/stm32u5/family.c
index 032c01f34..0af497366 100644
--- a/hw/bsp/stm32u5/family.c
+++ b/hw/bsp/stm32u5/family.c
@@ -90,6 +90,9 @@ void board_init(void) {
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
#endif
GPIO_InitTypeDef GPIO_InitStruct;
diff --git a/hw/bsp/stm32wb/family.c b/hw/bsp/stm32wb/family.c
index 93aba02fa..153d10a09 100644
--- a/hw/bsp/stm32wb/family.c
+++ b/hw/bsp/stm32wb/family.c
@@ -64,7 +64,7 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/stm32wba/family.c b/hw/bsp/stm32wba/family.c
index 923ea197c..8dc6547ae 100644
--- a/hw/bsp/stm32wba/family.c
+++ b/hw/bsp/stm32wba/family.c
@@ -131,7 +131,7 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
diff --git a/hw/bsp/tm4c/family.c b/hw/bsp/tm4c/family.c
index 4e5491005..ee1fa2a3c 100644
--- a/hw/bsp/tm4c/family.c
+++ b/hw/bsp/tm4c/family.c
@@ -77,6 +77,8 @@ void board_init(void) {
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
+ SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
diff --git a/hw/bsp/xmc4000/family.c b/hw/bsp/xmc4000/family.c
index 1acce024b..6fef53025 100644
--- a/hw/bsp/xmc4000/family.c
+++ b/hw/bsp/xmc4000/family.c
@@ -78,7 +78,7 @@ void board_init(void) {
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
- // Explicitly disable systick to prevent its ISR runs before scheduler start
+ // Explicitly disable systick to prevent its ISR from running before scheduler start
SysTick->CTRL &= ~1U;
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
From 91c3b338b2efe2c1341be1baec2620dbab181728 Mon Sep 17 00:00:00 2001
From: Zixun LI
Date: Tue, 25 Nov 2025 16:10:10 +0100
Subject: [PATCH 7/8] example: fix audio_debug glitch on Windows
---
examples/device/uac2_speaker_fb/src/audio_debug.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/examples/device/uac2_speaker_fb/src/audio_debug.py b/examples/device/uac2_speaker_fb/src/audio_debug.py
index 05b49baf6..1c6035a44 100755
--- a/examples/device/uac2_speaker_fb/src/audio_debug.py
+++ b/examples/device/uac2_speaker_fb/src/audio_debug.py
@@ -2,13 +2,15 @@
# Install python3 HID package https://pypi.org/project/hid/
# Install python3 matplotlib package https://pypi.org/project/matplotlib/
-from ctypes import *
+from ctypes import Structure, c_uint32, c_uint8, c_int8, c_int16, c_uint16
+import signal
try:
import hid
import matplotlib.pyplot as plt
import matplotlib.animation as animation
except:
print("Missing import, please try 'pip install hid matplotlib' or consult your OS's python package manager.")
+ exit(1)
# Example must be compiled with CFG_AUDIO_DEBUG=1
VID = 0xcafe
@@ -29,6 +31,7 @@ class audio_debug_info_t (Structure):
dev = hid.Device(VID, PID)
if dev:
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
# Create figure for plotting
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
@@ -61,10 +64,10 @@ if dev:
ax.set_ylim(bottom=0, top=info.fifo_size)
# Format plot
- plt.title('FIFO information')
- plt.grid()
+ ax.set_title('FIFO information')
+ ax.grid(True)
print(f'Sample rate:{info.sample_rate} | Alt settings:{info.alt_settings} | Volume:{info.volume[:]}')
- ani = animation.FuncAnimation(fig, animate, interval=10)
- plt.show()
+ ani = animation.FuncAnimation(fig, animate, interval=10, cache_frame_data=False) # type: ignore
+ plt.show(block=True)
From 3f0d2668f1acbda95fa6d8b341c6ade8b56ee02b Mon Sep 17 00:00:00 2001
From: Zixun LI
Date: Tue, 25 Nov 2025 16:12:20 +0100
Subject: [PATCH 8/8] fifo: fix IAR Warning[Pa082]: undefined behavior: the
order of volatile accesses is undefined
---
src/common/tusb_fifo.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/common/tusb_fifo.h b/src/common/tusb_fifo.h
index 9d8b864e9..2fb4f37d4 100644
--- a/src/common/tusb_fifo.h
+++ b/src/common/tusb_fifo.h
@@ -175,7 +175,9 @@ bool tu_fifo_full(const tu_fifo_t *f);
bool tu_fifo_overflowed(const tu_fifo_t *f);
TU_ATTR_ALWAYS_INLINE static inline bool tu_fifo_empty(const tu_fifo_t *f) {
- return f->wr_idx == f->rd_idx;
+ uint16_t wr_idx = f->wr_idx;
+ uint16_t rd_idx = f->rd_idx;
+ return wr_idx == rd_idx;
}
TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_fifo_depth(const tu_fifo_t *f) {