【发布时间】:2016-07-12 16:19:20
【问题描述】:
我最近安装了带有 Arduino 插件“Visual Micro”的 MS Visual Studio 2015。 一切正常,上传草图等。除非我在使用 FreeRTOS 时尝试编译我的代码。我通过 Arduino IDE(库管理器)下载了 FreeRTOS 库。因此(在 MS VS 2015 中)我可以选择将库包含在 MS VS 2015 中。所以我将库包含在我的一个草图中。下面你会看到我的代码示例。在 Arduino IDE 中我可以编译代码并将其上传到设备,但在 MS VS 中会出现一些错误。
#include <timers.h>
#include <task.h>
#include <StackMacros.h>
#include <semphr.h>
#include <queue.h>
#include <projdefs.h>
#include <portmacro.h>
#include <portable.h>
#include <mpu_wrappers.h>
#include <list.h>
#include <FreeRTOSVariant.h>
#include <FreeRTOSConfig.h>
#include <event_groups.h>
#include <croutine.h>
#include <Arduino_FreeRTOS.h>
//define Tasks
void TaskBlinkSlow(void *pvParameters);
void TaskBlinkFast(void *pvParameters);
void setup()
{
/* add setup code here */
xTaskCreate(TaskBlinkSlow, "TaskSlow", 128, NULL, 1, NULL);
xTaskCreate(TaskBlinkFast, "TaskFast", 128, NULL, 2, NULL);
pinMode(13, OUTPUT);
}
void loop()
{
//Empty, things are done in tasks!!!
}
void TaskBlinkSlow(void * pvParameters)
{
for (;;) {
for (int i = 0; i < 8; i++) {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
vTaskDelay(5000 / portTICK_PERIOD_MS);
}
}
void TaskBlinkFast(void * pvParameters)
{
for (;;) {
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
}
}
在这篇文章的最后,您会找到编译器错误日志的简短 sn-p。也许有人已经解决了同样的问题并快速解决了问题。
已创建示例调试器断点。切换演示 断点关闭,取消选择 Visual Micro>Tutorial Mode。
为“Arduino/Genuino Uno”编译“FreeRTOS”调试版本 FreeRTOS.ino:在 timers.h:75:3 中包含的文件中:错误:#error “包含 Arduino_FreeRTOS.h 必须在包含之前出现在源文件中 timers.h" :#error "include Arduino_FreeRTOS.h 必须出现在源代码中 包含 timers.h 之前的文件” timers.h:在包含的文件中 FreeRTOS.ino:from task.h:75:3: 错误: #error "include Arduino_FreeRTOS.h 必须在包含 task.h 之前出现在源文件中” :#error "include Arduino_FreeRTOS.h 必须出现在源文件中之前 包括 task.h" task.h:在包含在 timers.h:from 的文件中 FreeRTOS.ino:from list.h:99:3: error: #error Arduino_FreeRTOS.h 必须 在 list.h 之前包含:#error Arduino_FreeRTOS.h 必须包含在内 在 list.h FreeRTOS.ino 之前:在 semphr.h:74:3 中包含的文件中:错误:
错误“include Arduino_FreeRTOS.h”必须出现在“include semphr.h”之前的源文件中:#error“include Arduino_FreeRTOS.h”必须出现在
"include semphr.h" semphr.h 之前的源文件:在包含的文件中 FreeRTOS.ino:from queue.h:75:3: error: #error "include Arduino_FreeRTOS.h" 必须出现在源文件中的 "include queue.h" :#error "include Arduino_FreeRTOS.h" 必须出现在源代码中 “include queue.h” FreeRTOS.ino 之前的文件:在包含的文件中 list.h:99:3: error: #error Arduino_FreeRTOS.h 必须包含在之前 list.h :#error Arduino_FreeRTOS.h 必须包含在 list.h 之前 task.h:在 timers.h 中包含的文件中:来自 FreeRTOS.ino:来自 list.h:184:22:错误:“TickType_t”没有命名类型 :configLIST_VOLATILE TickType_t xItemValue; *
【问题讨论】:
-
我可以建议您将飞利浦的答案标记为解决方案吗?或者你的,我猜,如果你觉得那更清楚?