File tree Expand file tree Collapse file tree 32 files changed +101
-15
lines changed Expand file tree Collapse file tree 32 files changed +101
-15
lines changed Original file line number Diff line number Diff line change @@ -75,16 +75,17 @@ void board_init(void)
7575 /* vbus ignore */
7676 board_vbus_sense_init ();
7777
78- /* configure systick */
79- SysTick_Config (system_core_clock / 1000 );
80-
81- #if CFG_TUSB_OS == OPT_OS_FREERTOS
78+ #if CFG_TUSB_OS == OPT_OS_NONE
79+ /* configure systick */
80+ SysTick_Config (system_core_clock / 1000 );
81+ NVIC_SetPriority (OTGHS_IRQn , 0 );
82+ NVIC_SetPriority (OTGFS1_IRQn , 0 );
83+ #elif CFG_TUSB_OS == OPT_OS_FREERTOS
84+ // Explicitly disable systick to prevent its ISR runs before scheduler start
85+ SysTick -> CTRL &= ~1U ;
8286 // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
8387 NVIC_SetPriority (OTGHS_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
8488 NVIC_SetPriority (OTGFS1_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
85- #else
86- NVIC_SetPriority (OTGHS_IRQn , 0 );
87- NVIC_SetPriority (OTGFS1_IRQn , 0 );
8889 #endif
8990
9091 /* config led and key */
Original file line number Diff line number Diff line change @@ -76,6 +76,8 @@ void board_init(void) {
7676
7777 SysTick_Config (SystemCoreClock / 1000 );
7878#if CFG_TUSB_OS == OPT_OS_FREERTOS
79+ // Explicitly disable systick to prevent its ISR runs before scheduler start
80+ SysTick -> CTRL &= ~1U ;
7981 // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
8082 NVIC_SetPriority (OTGFS1_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
8183 NVIC_SetPriority (OTGFS2_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
Original file line number Diff line number Diff line change @@ -120,8 +120,9 @@ void board_init(void) {
120120#if CFG_TUSB_OS == OPT_OS_NONE
121121 // 1ms tick timer
122122 SysTick_Config (SystemCoreClock / 1000 );
123-
124123#elif CFG_TUSB_OS == OPT_OS_FREERTOS
124+ // Explicitly disable systick to prevent its ISR runs before scheduler start
125+ SysTick -> CTRL &= ~1U ;
125126 // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
126127 NVIC_SetPriority (USB_OTG1_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
127128 #ifdef USBPHY2
Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ void board_init(void) {
6161 // 1ms tick timer
6262 SysTick_Config (SystemCoreClock / 1000 );
6363#elif CFG_TUSB_OS == OPT_OS_FREERTOS
64+ // Explicitly disable systick to prevent its ISR runs before scheduler start
65+ SysTick -> CTRL &= ~1U ;
6466 // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
6567 NVIC_SetPriority (USB0_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
6668#endif
Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ void board_init(void)
5959 // 1ms tick timer
6060 SysTick_Config (SystemCoreClock / 1000 );
6161#elif CFG_TUSB_OS == OPT_OS_FREERTOS
62+ // Explicitly disable systick to prevent its ISR runs before scheduler start
63+ SysTick -> CTRL &= ~1U ;
6264 // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
6365 NVIC_SetPriority (USB0_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
6466#endif
Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ void board_init(void) {
7474 // 1ms tick timer
7575 SysTick_Config (SystemCoreClock / 1000 );
7676#elif CFG_TUSB_OS == OPT_OS_FREERTOS
77+ // Explicitly disable systick to prevent its ISR runs before scheduler start
78+ SysTick -> CTRL &= ~1U ;
7779 // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
7880 NVIC_SetPriority (USB0_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
7981#endif
Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ void board_init(void) {
5454 // 1ms tick timer
5555 SysTick_Config (SystemCoreClock / 1000 );
5656#elif CFG_TUSB_OS == OPT_OS_FREERTOS
57+ // Explicitly disable systick to prevent its ISR runs before scheduler start
58+ SysTick -> CTRL &= ~1U ;
5759 // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
5860 NVIC_SetPriority (USB0_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
5961#endif
Original file line number Diff line number Diff line change @@ -77,10 +77,12 @@ void board_init(void)
7777{
7878 SystemCoreClockUpdate ();
7979
80+ #if CFG_TUSB_OS == OPT_OS_NONE
8081 // 1ms tick timer
8182 SysTick_Config (SystemCoreClock / 1000 );
82-
83- #if CFG_TUSB_OS == OPT_OS_FREERTOS
83+ #elif CFG_TUSB_OS == OPT_OS_FREERTOS
84+ // Explicitly disable systick to prevent its ISR runs before scheduler start
85+ SysTick -> CTRL &= ~1U ;
8486 // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
8587 NVIC_SetPriority (USB0_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
8688#endif
Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ void board_init(void) {
5454 // 1ms tick timer
5555 SysTick_Config (SystemCoreClock / 1000 );
5656#elif CFG_TUSB_OS == OPT_OS_FREERTOS
57+ // Explicitly disable systick to prevent its ISR runs before scheduler start
58+ SysTick -> CTRL &= ~1U ;
5759 // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
5860 NVIC_SetPriority (USB_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
5961#endif
Original file line number Diff line number Diff line change @@ -83,6 +83,8 @@ void board_init(void) {
8383 // 1ms tick timer
8484 SysTick_Config (SystemCoreClock / 1000 );
8585#elif CFG_TUSB_OS == OPT_OS_FREERTOS
86+ // Explicitly disable systick to prevent its ISR runs before scheduler start
87+ SysTick -> CTRL &= ~1U ;
8688 // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
8789 NVIC_SetPriority (USB0_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
8890 NVIC_SetPriority (USB1_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
You can’t perform that action at this time.
0 commit comments