Using FreeRTOS in XIAO BLE Sense Seeed Board v1.0.0

I am using board version 1.0.0 and would like to use the xTaskCreate() function from FreeRTOS. I found this example from Arduino_FreeRTOS_Library/Blink_AnalogRead.ino at master · feilipu/Arduino_FreeRTOS_Library · GitHub

#include <Arduino_FreeRTOS.h>

// define two tasks for Blink & AnalogRead
void TaskBlink( void *pvParameters );
void TaskAnalogRead( void *pvParameters );

// the setup function runs once when you press reset or power the board
void setup() {
  
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB, on LEONARDO, MICRO, YUN, and other 32u4 based boards.
  }

  // Now set up two tasks to run independently.
  xTaskCreate(
    TaskBlink
    ,  "Blink"   // A name just for humans
    ,  128  // This stack size can be checked & adjusted by reading the Stack Highwater
    ,  NULL
    ,  2  // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest.
    ,  NULL );

  xTaskCreate(
    TaskAnalogRead
    ,  "AnalogRead"
    ,  128  // Stack size
    ,  NULL
    ,  1  // Priority
    ,  NULL );

  // Now the task scheduler, which takes over control of scheduling individual tasks, is automatically started.
}

void loop()
{
  // Empty. Things are done in Tasks.
}

/*--------------------------------------------------*/
/*---------------------- Tasks ---------------------*/
/*--------------------------------------------------*/

void TaskBlink(void *pvParameters)  // This is a task.
{
  (void) pvParameters;

  // initialize digital LED_BUILTIN on pin 13 as an output.
  pinMode(LED_BUILTIN, OUTPUT);

  for (;;) // A Task shall never return or exit.
  {
    digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
    vTaskDelay( 1000 / portTICK_PERIOD_MS ); // wait for one second
    digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
    vTaskDelay( 1000 / portTICK_PERIOD_MS ); // wait for one second
  }
}

void TaskAnalogRead(void *pvParameters)  // This is a task.
{
  (void) pvParameters;
  
/*
  AnalogReadSerial
  Reads an analog input on pin 0, prints the result to the serial monitor.
  Graphical representation is available using serial plotter (Tools > Serial Plotter menu)
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

  This example code is in the public domain.
*/

  for (;;)
  {
    // read the input on analog pin 0:
    int sensorValue = analogRead(A0);
    // print out the value you read:
    Serial.println(sensorValue);
    vTaskDelay(1);  // one tick delay (15ms) in between reads for stability
  }
}

However I am getting these errors even when I remove the #include <Arduino_FreeRTOS.h>

C:\Users\***\AppData\Local\Temp\arduino_modified_sketch_28173\Blink_AnalogRead.ino: In function 'void TaskBlink(void*)':
C:\Users\***\AppData\Local\Temp\arduino_modified_sketch_28173\Blink_AnalogRead.ino:80:22: warning: division by zero [-Wdiv-by-zero]
   80 |     vTaskDelay( 1000 / portTICK_PERIOD_MS ); // wait for one second
C:\Users\***\AppData\Local\Temp\arduino_modified_sketch_28173\Blink_AnalogRead.ino:82:22: warning: division by zero [-Wdiv-by-zero]
   82 |     vTaskDelay( 1000 / portTICK_PERIOD_MS ); // wait for one second
c:/users/***/appdata/local/arduino15/packages/seeeduino/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: sketch\Blink_AnalogRead.ino.cpp.o: in function `TaskAnalogRead(void*)':
C:\Users\***\AppData\Local\Temp\arduino_modified_sketch_28173/Blink_AnalogRead.ino:99: undefined reference to `Serial'
c:/users/***/appdata/local/arduino15/packages/seeeduino/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: sketch\Blink_AnalogRead.ino.cpp.o: in function `setup':
C:\Users\***\AppData\Local\Temp\arduino_modified_sketch_28173/Blink_AnalogRead.ino:11: undefined reference to `Adafruit_USBD_CDC::begin(unsigned long)'
c:/users/***/appdata/local/arduino15/packages/seeeduino/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\***\AppData\Local\Temp\arduino_modified_sketch_28173/Blink_AnalogRead.ino:13: undefined reference to `Adafruit_USBD_CDC::operator bool()'
c:/users/***/appdata/local/arduino15/packages/seeeduino/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\***\AppData\Local\Temp\arduino_modified_sketch_28173/Blink_AnalogRead.ino:35: undefined reference to `Serial'
collect2.exe: error: ld returned 1 exit status

I thought I could use freeRTOS as I found the freeRTOS library in the package: C:\Users\ ***\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.0.0\cores\nRF5\freertos but it doesn’t seem to work.

Looking for some insight into this, thank you

Please try our FreeRTOS library.

Hi, I am using XIAO BLE SENSE module. The Basic_RTOS_Example from the library doesn’t seem to work for me. Any tips?

Board manager: Seeed nRF52 Boards->Seeed XIAO nRF52840 Sense

Okay, so the last viable option. You can find out if adafruit has written an RTOS support library for the nrf52840, otherwise there may not be support.