Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Tasks dont resume after preempted

I succesfully compiled microC/OS to be run on an ARM7TDMI processor. I create a task like this one;

void task1(void* pdata)
{
  while (1)
  {
     vs_printf("Hello from task1\n");
    OSTimeDlyHMSM(0, 0, 0, 5);
  }
}
void task2(void*  pdata)
{
  while (1)
  {
    vs_printf("Hello from  task2\n");
    //OSTimeDlyHMSM(0, 0, 0, 5);
    OSTimeDly(3);
   }
}
void task3(void* pdata)
{
  while (1)
  {
     vs_printf("Hello from task3\n");
    OSTimeDlyResume(4);
     OSTimeDlyHMSM(0, 0, 0, 5);
  }
}
int main(void)
{
   CVPTESTPlatform platform;
  platform.FullPlatformInit();
   OSInit();
  OSTaskCreate(task1, (void *)0,  &task1_stk, TASK1_PRIORITY);
  OSTaskCreate(task2, (void *)0, &task2_stk,  TASK2_PRIORITY);
  OSTaskCreate(task3, (void *)0,  &task3_stk, TASK3_PRIORITY);
  OSStart();
   return 0;
}

The output of this code is


Hello from task1
Hello from  task2
Hello from task3
Hello from task1

And it stops here. Anyone have any idea on this problem?

Thanks for your time,

Kind regards,

Fairuz

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    This forum is about the uc/OS operating system running on the Nios II platform. You should ask your question to a more generic uc/OS II forum, or an ARM forum...

    My guess would be that either vs_printf or the system console driver isn't thread-safe.

    Is there a reason why you use vs_printf instead of the regular printf?