搭建了一个简单的BIOS演示系统,注册两个任务SYS_BootTask(优先级高)与SYS_AppTask(优先级低),对应的任务代码如下,其中函数“UART_DbgPrintf”是串口发送数据(非中断,采用polling方式,uart驱动是自己写的,已经在非BIOS模式下测试正常)。函数“System_printf”与“System_flush”是sysbios提供的系统输出接口(输出在console上显示)。
void SYS_BootTask(UArg arg1, UArg arg2)
{
while(1)
{
Semaphore_pend(semBoot, BIOS_WAIT_FOREVER);
UART_DbgPrintf(DSP_DBG_UART, "SYS_BootTask\r\n");
//System_printf("SYS_BootTask\r\n");
//System_flush();
gCnt++;
Task_sleep(DLY_CONST);
Semaphore_post(semApp);
}
}
void SYS_AppTask(UArg arg1, UArg arg2)
{
while(1)
{
Semaphore_pend(semApp, BIOS_WAIT_FOREVER);
UART_DbgPrintf(DSP_DBG_UART, "SYS_MeterTask\r\n");
Task_sleep(DLY_CONST);
Semaphore_post(semBoot);
}
}
问题出现在:通过仿真器将程序下载到板子上(DDR2内),使用函数“System_printf”与“System_flush”时系统能正常运行,两个任务能交替切换并输出打印信息,但是一旦将输出函数替换为函数“UART_DbgPrintf”,则会在打印字符串“SYS_BootTas”后出现异常跳转,还有字符串“k\r\n”没有通过串口输出(串口波特率115200,clock tick周期设置为1ms,用的是timer0)。出错的函数调用层次与具体的中断代码如下:
能否提供一些调试的思路?

