freeRTOS移植到LPC1788上,KEIL5.14 編譯無錯。
單步運行,RTOS可運行正常。
但全速仿真和下韌體均不運行,點RUN立即停止。
通過排查鎖定,發現問題點在prvStartFirstTask。
仿真方式:
斷點設在A,此函式前,從main開始可全速run至斷點A。
斷點設在B,此函式后,點run后立即立即,繼續點單步也不可仿真。RTOS不運行。
斷點設在A和B,RUN至A后,單步跳過prvStartFirstTask可以。RTOS正常運行。
韌體方式:
將HEX韌體通過isp固化進cpu。上電os不啟動。
各種償試:
將斷點前后加固定延時,問題依舊。
FreeRTOS V9.0.0的port.c
__asm void prvStartFirstTask( void )
{
PRESERVE8
/* Use the NVIC offset register to locate the stack. */
ldr r0, =0xE000ED08
ldr r0, [r0]
ldr r0, [r0]
/* Set the msp back to the start of the stack. */
msr msp, r0
/* Globally enable interrupts. */
cpsie i
cpsie f
dsb
isb
/* Call SVC to start the first task. */
svc 0
nop
nop
}
BaseType_t xPortStartScheduler( void )
{
// <-斷點A
/* Start the first task. */
prvStartFirstTask();
// <-斷點B
}
void vTaskStartScheduler( void )
{
if( xPortStartScheduler() != pdFALSE )
{
/* Should not reach here as if the scheduler is running the function will not return. */
}
//---------------------------------------------
int main(void)
{
/* 啟動任務調度 */
if(pdPASS == xReturn)
{
vTaskStartScheduler(); /* 啟動任務,開啟調度 */
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/35618.html
標籤:驅動開發/核心開發
上一篇:求助大佬們 51單片機實作2FSK和2DPSK調制調制
下一篇:stm32 使用cubemax設定串口二之后,使用fputc重定義printf函式以后,列印到串口除錯助手上的全是亂碼
