目前总共会在以下两种异常中切换
timer
ecall
timer
Source/portable/GCC/RISC-V/portASM.S
handle_asynchronous:
test_if_mtimer
jal xTaskIncrementTick
流1 :
beqz a0, processed_source // 不调度,直接退出
流2:
jal vTaskSwitchContext
j processed_source
ecall
我们从 这里能看到 freertos 实现了 两种异常 ecall 和 mtimer
我们从 这里的"ecall 后的 freertos_risc_v_trap_handler" 能看到 ecall 后发生了 切换
那什么时候 才会切换呢 ? 调用 portYIELD的时候
调度的调试
watch pxCurrentTCB