Skip to content

Commit

Permalink
Fix H743 FreeRTOS early SysTick crash
Browse files Browse the repository at this point in the history
  • Loading branch information
scaprile committed Nov 2, 2023
1 parent 107e303 commit 1dda8b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@

#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler
//#define xPortSysTickHandler SysTick_Handler
7 changes: 7 additions & 0 deletions examples/stm32/nucleo-h743zi-make-freertos-builtin/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@

#define BLINK_PERIOD_MS 1000 // LED blinking period in millis

// workaround SysTick firing before FreeRTOS has fully initialized (startup)
extern void xPortSysTickHandler(void);
void SysTick_Handler(void) {
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
xPortSysTickHandler();
}

void mg_random(void *buf, size_t len) { // Use on-board RNG
for (size_t n = 0; n < len; n += sizeof(uint32_t)) {
uint32_t r = rng_read();
Expand Down

0 comments on commit 1dda8b9

Please sign in to comment.