diff --git a/components/freertos/port/esp8266/include/freertos/portmacro.h b/components/freertos/port/esp8266/include/freertos/portmacro.h index c312c589..1aa7014a 100644 --- a/components/freertos/port/esp8266/include/freertos/portmacro.h +++ b/components/freertos/port/esp8266/include/freertos/portmacro.h @@ -236,6 +236,8 @@ bool interrupt_is_disable(void); /* Get tick rate per second */ uint32_t xPortGetTickRateHz(void); +void _xt_enter_first_task(void); + #ifdef __cplusplus } #endif diff --git a/components/freertos/port/esp8266/os_cpu_a.S b/components/freertos/port/esp8266/os_cpu_a.S index 95783769..a3e41eae 100644 --- a/components/freertos/port/esp8266/os_cpu_a.S +++ b/components/freertos/port/esp8266/os_cpu_a.S @@ -444,3 +444,26 @@ _xt_clear_ints: RET(16) + + .section .text._xt_enter_first_task, "ax" + .globl _xt_enter_first_task + .type _xt_enter_first_task, @function + .align 4 +_xt_enter_first_task: + movi sp, pxCurrentTCB + l32i sp, sp, 0 + l32i sp, sp, 0 + + movi a14, pxCurrentTCB + l32i a14, a14, 0 + addi a15, sp, XT_STK_FRMSZ + s32i a15, a14 ,0 + + movi a0, _xt_context_restore + callx0 a0 + + l32i a14, sp, XT_STK_A14 + l32i a15, sp, XT_STK_A15 + + l32i a0, sp, XT_STK_EXIT + ret diff --git a/components/freertos/port/esp8266/port.c b/components/freertos/port/esp8266/port.c index cb0ced32..aa9fc757 100644 --- a/components/freertos/port/esp8266/port.c +++ b/components/freertos/port/esp8266/port.c @@ -210,7 +210,7 @@ portBASE_TYPE xPortStartScheduler(void) vTaskSwitchContext(); /* Restore the context of the first task that is going to run. */ - XT_RTOS_INT_EXIT(); + _xt_enter_first_task(); /* Should not get here as the tasks are now running! */ return pdTRUE;