Merge pull request #2440 from cesanta/h723

Fix H723 FreeRTOS example failing on some compiler versions with optimizer on
This commit is contained in:
Sergey Lyubka 2023-10-30 17:55:29 +00:00 committed by GitHub
commit ef16a733d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View File

@ -219,8 +219,8 @@ jobs:
run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi
- if: ${{ env.GO == 1 }} - if: ${{ env.GO == 1 }}
run: make -C examples/stm32/nucleo-h723zg-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}} run: make -C examples/stm32/nucleo-h723zg-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
# - if: ${{ env.GO == 1 }} - if: ${{ env.GO == 1 }}
# WIP run: make -C examples/stm32/nucleo-h723zg-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}} run: make -C examples/stm32/nucleo-h723zg-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
test_h5: test_h5:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -35,4 +35,4 @@
#define vPortSVCHandler SVC_Handler #define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler #define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler //#define xPortSysTickHandler SysTick_Handler

View File

@ -7,6 +7,14 @@
#define BLINK_PERIOD_MS 1000 // LED blinking period in millis #define BLINK_PERIOD_MS 1000 // LED blinking period in millis
// workaround optimizer somehow causing SysTick to fire before FreeRTOS has
// fully initialized
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 void mg_random(void *buf, size_t len) { // Use on-board RNG
for (size_t n = 0; n < len; n += sizeof(uint32_t)) { for (size_t n = 0; n < len; n += sizeof(uint32_t)) {
uint32_t r = rng_read(); uint32_t r = rng_read();
@ -67,7 +75,7 @@ int main(void) {
uart_init(UART_DEBUG, 115200); // Initialise UART uart_init(UART_DEBUG, 115200); // Initialise UART
// Start tasks. NOTE: stack sizes are in 32-bit words // Start tasks. NOTE: stack sizes are in 32-bit words
xTaskCreate(blinker, "blinker", 128, ":)", configMAX_PRIORITIES - 1, NULL); xTaskCreate(blinker, "blinker", 128, ":)", configMAX_PRIORITIES - 2, NULL);
xTaskCreate(server, "server", 2048, 0, configMAX_PRIORITIES - 1, NULL); xTaskCreate(server, "server", 2048, 0, configMAX_PRIORITIES - 1, NULL);
vTaskStartScheduler(); // This blocks vTaskStartScheduler(); // This blocks