NIOS II With uCOSII

1、如果使用uCOS,那么Qsys中Nios II核就不能使用外部中断控制器(EIC)。
2、遇到很迷惑的问题,运行uCOSII的实例代码,总是在第二个OSTimeDlyHMSM(0, 0, 3, 0);出错。
单步调试后,发现代码在执行到NIOS2_WRITE_STATUS (status);汇编代码为ldw r2,-8(fp)时出错,暂停程序运行后,程序指向00000000:Call 0x0处。

void task1(void* pdata)
{
  while (1)
  { 
    printf("Hello from task1\n");
    OSTimeDlyHMSM(0, 0, 3, 0);
  }
}
/* Prints "Hello World" and sleeps for three seconds */
void task2(void* pdata)
{
  while (1)
  { 
    printf("Hello from task2\n");
    OSTimeDlyHMSM(0, 0, 3, 0);
  }
}
/* The main function creates two task and starts multi-tasking */
int main(void)
{
  
  OSTaskCreateExt(task1,
                  NULL,
                  (void *)&task1_stk[TASK_STACKSIZE-1],
                  TASK1_PRIORITY,
                  TASK1_PRIORITY,
                  task1_stk,
                  TASK_STACKSIZE,
                  NULL,
                  0);
              
               
  OSTaskCreateExt(task2,
                  NULL,
                  (void *)&task2_stk[TASK_STACKSIZE-1],
                  TASK2_PRIORITY,
                  TASK2_PRIORITY,
                  task2_stk,
                  TASK_STACKSIZE,
                  NULL,
                  0);
  OSStart();
  return 0;
}

posted on 2017-05-07 15:01  LQ120150  阅读(292)  评论(0编辑  收藏  举报

导航