新手入门
- 积分
- 2
- 金钱
- 2
- 注册时间
- 2020-5-6
- 在线时间
- 0 小时
|
发表于 2020-5-6 22:43:15
|
显示全部楼层
类似问题,同上方法偿试。问题依旧。
freeRTOS在LPC1788上仿真问题
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(); /* 启动任务,开启调度 */
}
}
|
|