在UCOS-II多任务实验中,两个LED闪烁任务运行没问题,当三个LED闪烁任务同时运行时,程序就卡死在void HardFault_Handler(void)
了,请教大神,有人知道是什么问题吗?
*************************************************************************
int main(void)
{
BSP_Init();
OSInit();
OSTaskCreate(Task_Start,(void *)0,
&startup_task_stk[STARTUP_TASK_STK_SIZE-1],STARTUP_TASK_PRIO);
OSStart();
return 0;
}
**********************************************************************
void Task_Start(void *p_arg)
{
(void)p_arg;
OSTaskCreate(Task_LED1,(void *)0,
&task_led1_stk[TASK_LED1_STK_SIZE-1],
TASK_LED1_PRIO);
OSTaskCreate(Task_LED2,(void *)0,
&task_led2_stk[TASK_LED2_STK_SIZE-1],
TASK_LED2_PRIO);
OSTaskCreate(Task_LED3,(void *)0,
&task_led2_stk[TASK_LED3_STK_SIZE-1],
TASK_LED3_PRIO);
while(1)
{
OSTimeDlyHMSM(0,0,0,50);
}
}
void Task_LED1(void *p_arg)
{
(void)p_arg;
while(1)
{
LED1(ON);
OSTimeDlyHMSM(0,0,0,100);
LED1(OFF);
OSTimeDlyHMSM(0,0,0,100);
}
}
void Task_LED2(void *p_arg)
{
(void)p_arg;
while(1)
{
LED2(ON);
OSTimeDlyHMSM(0,0,0,200);
LED2(OFF);
OSTimeDlyHMSM(0,0,0,200);
}
}
void Task_LED3(void *p_arg)
{
(void)p_arg;
while(1)
{
LED3(ON);
OSTimeDlyHMSM(0,0,0,300);
LED3(OFF);
OSTimeDlyHMSM(0,0,0,300);
}
}
**************************************************************************
#ifndef __APP_CFG_H__
#define __APP_CFG_H__
#define STARTUP_TASK_PRIO 4
#define TASK_LED1_PRIO 5
#define TASK_LED2_PRIO 6
#define TASK_LED3_PRIO 7
#define STARTUP_TASK_STK_SIZE 80
#define TASK_LED1_STK_SIZE 80
#define TASK_LED2_STK_SIZE 80
#define TASK_LED3_STK_SIZE 80
#endif |