LPC1768 CM3 移植uCOS开机之后进入HardFault_Handler\
贴代码INT32S main (void)
{
CPU_INT08Uos_err;
os_err = os_err; /* prevent warning... */
/* Note:由于使用UCOS, 在OS运行之前运行,注意别使能任何中断. */
IntDisAll(); /* Disable all ints until we are ready to accept them.*/
OSInit(); /* Initialize "uC/OS-II, The Real-Time Kernel". */
os_err = OSTaskCreateExt((void (*)(void *)) App_TaskStart,/* Create the start task. */
(void * ) 0,
(OS_STK * )&App_TaskStartStk,
(INT8U ) APP_TASK_START_PRIO,
(INT16U ) APP_TASK_START_PRIO,
(OS_STK * )&App_TaskStartStk,
(INT32U ) APP_TASK_START_STK_SIZE,
(void * )0,
(INT16U )(OS_TASK_OPT_STK_CLR | OS_TASK_OPT_STK_CHK));
#if OS_TASK_NAME_EN > 0
OSTaskNameSet(APP_TASK_START_PRIO, (CPU_INT08U *)"Start Task", &os_err);
#endif
OSStart(); /* Start multitasking (i.e. give control to uC/OS-II).*/
return (0);
}
/*
*********************************************************************************************************
* App_TaskStart()
*
* Description : The startup task.The uC/OS-II ticker should only be initialize once multitasking starts.
*
* Argument(s) : p_arg Argument passed to 'App_TaskStart()' by 'OSTaskCreate()'.
*
* Return(s) : none.
*
* Caller(s) : This is a task.
*
* Note(s) : none.
*********************************************************************************************************
*/
staticvoidApp_TaskStart (void *p_arg)
{
(void)p_arg;
/***************Init hardware ***************/
OS_CPU_SysTickInit(SystemCoreClock/1000); /* Initialize the SysTick. */
#if (OS_TASK_STAT_EN > 0)
OSStatInit(); /* Determine CPU capacity. */
#endif
App_TaskCreate(); /* Create application tasks. */
for(;;)
{
OSTimeDlyHMSM(0, 1, 0, 0); /* Delay One minute */
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
staticvoidApp_TaskCreate (void)
{
#if (OS_VIEW_MODULE == DEF_ENABLED)
App_OSViewTaskCreate();
#endif
App_UCGUI_TaskCreate();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
voidApp_UCGUI_TaskCreate (void)
{
CPU_INT08Uos_err;
os_err = os_err;
os_err = OSTaskCreate((void (*)(void *)) uctsk_UCGUI,
(void * ) 0,
(OS_STK * )&App_Task_UCGUI_Stk,
(INT8U ) APP_TASK_UCGUI_PRIO);
#if OS_TASK_NAME_EN > 0
OSTaskNameSet(APP_TASK_UCGUI_PRIO, "Task UCGUI", &os_err);
#endif
/*
os_err = OSTaskCreate((void (*)(void *)) uctsk_TouchPanel,
(void * ) 0,
(OS_STK * )&App_Task_TouchPanel_Stk,
(INT8U ) APP_TASK_TouchPanel_PRIO);
#if OS_TASK_NAME_EN > 0
OSTaskNameSet(APP_TASK_TouchPanel_PRIO, "TASK TouchPanel Messages", &os_err);
#endif
*/
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static void uctsk_UCGUI (void)
{
GUI_Init();
// _ExecCalibration(); /* 触摸屏校准 */
for(;;)
{
MainTask();
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainTask(void) {
//GUI_Init();
while(1) {
GUIDEMO_main();
}
}
{:shy:}{:cry:}{:cry:}{:cry:}{:cry:} 看样子是要沉啊……
页:
[1]