FreeRTOS lpc3250移植

时间:2017-10-12 11:35:21

标签: arm freertos

我尝试在LPC3250上移植FreeRTOS,但我的端口工作不稳定。我尝试使用托马斯·金德勒的端口,它是可用的here我和我的端口捕获了相同的行为。我尝试执行以下内容:

void task1(void *) {
  BOOL_8 blink1 = TRUE;
  TickType_t xLastWakeTime;
  const TickType_t xFrequency = 500;
  xLastWakeTime = xTaskGetTickCount();
  while(true) {
      if (blink1)
          cpld_set_bits(ECPLDLeds, CPLD_LED_1);
      else
          cpld_clear_bits(ECPLDLeds, CPLD_LED_1);
      blink1 = (~blink1) & 0x1;
      //      for (volatile int i=0; i < 8000000; ++i);
      //      vTaskDelay(500 / portTICK_PERIOD_MS);
      vTaskDelayUntil( &xLastWakeTime, xFrequency );
   }
}

void task2(void *) {
  BOOL_8 blink2 = FALSE;
  TickType_t xLastWakeTime;
  const TickType_t xFrequency = 500;
  xLastWakeTime = xTaskGetTickCount();
  while(true) {
    if (blink2)
        cpld_set_bits(ECPLDLeds, CPLD_LED_2);
    else
        cpld_clear_bits(ECPLDLeds, CPLD_LED_2);
    blink2 = (~blink2) & 0x1;
    //      for (volatile int i=0; i < 8000000; ++i);
    //      vTaskDelay(500 / portTICK_PERIOD_MS);
    vTaskDelayUntil( &xLastWakeTime, xFrequency );
  }
}

extern "C" int c_entry()
{
  bool blink5 = true;
  isens_board_init();

BaseType_t result = xTaskCreate(
    task1,
    "task1",
    configMINIMAL_STACK_SIZE,
    NULL,
    tskIDLE_PRIORITY + 1,
    &task1Handle
);
(void)result;

BaseType_t result2 = xTaskCreate(
    task2,
    "task2",
    configMINIMAL_STACK_SIZE,
    NULL,
    tskIDLE_PRIORITY + 1,
    &task2Handle
);
(void)result2;

vTaskStartScheduler();

while(true) {
    if (blink5)
        cpld_set_bits(ECPLDLeds, CPLD_LED_0);
    else
        cpld_clear_bits(ECPLDLeds, CPLD_LED_0);
    blink5 = !blink5;
    for (volatile int i=0; i < 16000000; ++i);
}
return 0;
}

如果我运行延迟了for()循环的任务 - 它可以正常工作。如果我运行由vTaskDelay或vTaskDelayUntil函数延迟的任务 - 它运行不好。我看到了下面的行为:两次转换得很好,但是后来任务1停止了。几秒钟后(5-10)再次点亮,然后在随机周期后再次关闭。 Task2的指示灯以500毫秒的周期稳定闪烁。

也许这是不正确的初创公司的影响?或者mmu的使用不好(我使用现金使用mmu)?我必须使用支持mmu的FreeRTOS吗?

Startups avaliable here.

谢谢。

0 个答案:

没有答案
相关问题