Frohe Weihnachten,
ich wollte ein kleines Projekt für Koroutinen/Tasks mit FreeRTOS schreiben. Ich habe mich gestern Mal an die Variante für die Koroutinen gesetzt und den folgenden Code dem der Hilfe von FreeRTOS unter:
zusammen geschrieben:
#include <Arduino_FreeRTOS.h>
#include <LiquidCrystal.h>
#include <croutine.h>
//define coroutine
void vApplicationIdleHook();
void vaCoDisplayRoutine(CoRoutineHandle_t xHandle, UBaseType_t uxHandle);
//globales
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
//the setup function runs once when you press reset or power the board
void setup() {
TaskHandle_t xHandle;
UBaseType_t uxIndex;
// Create two co-routines at priority 1.
for( uxIndex = 0; uxIndex < 2; uxIndex++ )
{
xCoRoutineCreate( vaCoDisplayRoutine, 1, uxIndex);
}
vApplicationIdleHook();
}
void loop()
{
// Empty. Things are done in Tasks.
}
void vaCoDisplayRoutine(CoRoutineHandle_t xHandle, UBaseType_t uxHandle){
static const uint32_t xDelayTime = 200 / portTICK_PERIOD_MS;
crSTART(xHandle);
lcd.begin(16,1);
for(;;) {
lcd.clear();
lcd.print("Co-routine " + uxHandle);
crDELAY( xHandle, xDelayTime);
}
crEND();
}
void vApplicationIdleHook()
{
vCoRoutineSchedule();
}
Hierbei kommt es allerdings immer zu den Fehlermeldungen beim Linken:
tmp/cckH14rG.ltrans0.ltrans.o: In function
vaCoDisplayRoutine(void*, unsigned char)': FreeRTOS.ino:43: undefined reference to
vCoRoutineAddToDelayedList'
/tmp/cckH14rG.ltrans0.ltrans.o: In functionvApplicationIdleHook': FreeRTOS.ino:51: undefined reference to
vCoRoutineSchedule'
/tmp/cckH14rG.ltrans0.ltrans.o: In functionsetup': FreeRTOS.ino:24: undefined reference to
xCoRoutineCreate'
FreeRTOS.ino:24: undefined reference toxCoRoutineCreate' /tmp/cckH14rG.ltrans0.ltrans.o: In function
vApplicationIdleHook':
FreeRTOS.ino:51: undefined reference to `vCoRoutineSchedule'
collect2: error: ld returned 1 exit status
Bibliothek FreeRTOS in Version 10.0.0-3 im Ordner: FreeRTOS wird verwendet
Bibliothek LiquidCrystal in Version 1.0.7 im Ordner: arduino-1.8.5/libraries/LiquidCrystal wird verwendet
exit status 1
Fehler beim Kompilieren für das Board Arduino/Genuino Uno.
Weiß jemand woran dies liegen kann? Warum werden die entsprechenden Funktionen nicht eingebunden?
Frohe Weihnachten!