ucos porting problem

:frowning:

Hi, everybody

These days when I ported UCOSII to LPC2138 I had met the some

problem.I used the port of ucosII downlaoded from the J.J.Labrosse’s

Web----AN1138, and the IAR EWARM 4.40A and ucosII2.80 were used.

I also created two tasks to blink the led on my 2138 board and

debuged in the ram. The led keeped blinky until I clicked the stop

running button. But after I clicked the run button the led never

blinked again.I found the program stay at the IdleTask routine forever !

I try to figure it out,could you give me some help?

Thanks a lot!

could you might to post your code?

I just create two tasks: task0 and task1, and I put the time ticker in the task0. The debug tool I use is Wiggler plus H-JTAG. The original code from J.J.Labrosse’s Web----AN1138 puts the time ticker initializaing function in a startup task. I don’t kown if this difference cause the problem. The following is my

app.c, including main() funtion.

Thanks a lot!

Sorry for wasting your time :frowning:

/*


  • uC/OS-II

  • The Real-Time Kernel

  • (c) Copyright 1998-2005, Micrium, Weston, FL

  • All Rights Reserved

  • ARM Sample code

  • File : APP.C

  • By : Jean J. Labrosse


*/

#include “includes.h”

/*


  • CONSTANTS

*/

#define LED (1 << 24 )

#define TASK_STK_SIZE 128

#define TASK_START_PRIO 5

/*


  • VARIABLES

*/

OS_STK TaskStk0[TASK_STK_SIZE]; //Define the Task0 stack

OS_STK TaskStk1[TASK_STK_SIZE]; //Define the Task1 stack

OS_STK AppStartTaskStk[TASK_STK_SIZE];

/*


  • FUNCTION PROTOTYPES

*/

void Task0(void *pdata); //Task0

void Task1(void *pdata); //Task0

#if OS_VIEW_MODULE > 0

static void AppTerminalRx(INT8U rx_data);

#endif

/*


  • main()

  • Description : This is the standard entry point for C code. It is assumed that your code will call

  • main() once you have performed all necessary 68HC12 and C initialization.

  • Arguments : none


*/

void main (void)

{

INT8U err;

BSP_IntDisAll(); /* Disable all interrupts until we are ready to accept them */

OSInit(); /* Initialize “uC/OS-II, The Real-Time Kernel” */

OSTaskCreateExt (Task0,(void *)0, (OS_STK *)&TaskStk0[TASK_STK_SIZE - 1],

6,6,(OS_STK *)&TaskStk0[0],

TASK_STK_SIZE,

(void *)0,

OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);

OSTaskNameSet(6,“Task0”,&err);

OSTaskCreateExt (Task1,(void *)0, (OS_STK *)&TaskStk1[TASK_STK_SIZE - 1],

7,7,(OS_STK *)&TaskStk1[0],

TASK_STK_SIZE,

(void *)0,

OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR );

OSTaskNameSet(7,“Task1”,&err);

OSStart(); /* Start multitasking (i.e. give control to uC/OS-II) */

}

/$PAGE/

/*


  • STARTUP TASK

  • Description : This is an example of a startup task. As mentioned in the book’s text, you MUST

  • initialize the ticker only once multitasking has started.

  • Arguments : p_arg is the argument passed to ‘AppStartTask()’ by ‘OSTaskCreate()’.

  • Notes : 1) The first line of code is used to prevent a compiler warning because ‘p_arg’ is not

  • used. The compiler should not generate any code for this statement.

    1. Interrupts are enabled once the task start because the I-bit of the CCR register was
  • set to 0 by ‘OSTaskCreate()’.


*/

//static void AppStartTask (void *p_arg)

//{

// (void)p_arg;

// BSP_Init(); /* Initialize BSP functions */

//#if OS_TASK_STAT_EN > 0

// OSStatInit(); /* Determine CPU capacity */

//#endif

//#if OS_VIEW_MODULE > 0

// OSView_Init(38400);

// OSView_TerminalRxSetCallback(AppTerminalRx);

// OSView_RxIntEn(); /* Enable Rx Interrupts */

//#endif

// LED_Off(0); /* Turn OFF all the LEDs */

//while (TRUE) { /* Task body, always written as an infinite loop. */

// OSTimeDly(1);

// OSTaskSuspend(OS_PRIO_SELF);

//}

//}

/$PAGE/

/*


  • TERMINAL WINDOW CALLBACK

*/

#if OS_VIEW_MODULE > 0

static void AppTerminalRx (INT8U rx_data)

{

}

#endif

void Task0 (void *pdata)

{

pdata = pdata;

BSP_Init();

while (1)

{

IO1CLR = 1 << 24;

OSTimeDly(20);

}

}

void Task1 (void *pdata)

{

pdata = pdata;

while (1)

{

IO1SET = 1 <<24;

OSTimeDly(100);

}

}