Cannot open files "freeRTOS.h" , "task.h" , "queue.h" , "timers.h" from timers.c in PlatformIO

Hi, I am trying to fix these problems from \.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\Source.

I have try several ways to fix them like removing .platformio\packages\framework-arduinoespressif32 because it maybe got messed up but not work.

Then I added

lib_deps = feilipu/FreeRTOS into platform.ini

After that, add #include <avr/io.h> into ‘main.cpp’ and ‘timers.c’ but it is not working.

Then I replace ‘#Include <Arduino_FreeRTOS.h>’ with ‘#Include <freeRTOS.h>’ and then not work.

Even include “main.h” and include “imu.h” into main.cpp. Not work at all.

In platformio.ini

[env:wiscore_rak4631]
platform = nordicnrf52
board = wiscore_rak4631
framework = arduino
lib_deps =
   beegee-tokyo/sx126x-arduino
   sparkfun/SparkFun SHTC3 Humidity and Temperature Sensor Library
   ClosedCube/ClosedCube OPT3001
   arduino-libraries/Arduino_LPS22HB
   adafruit/Adafruit BME280 Library
   sabas1080/CayenneLPP
   feilipu/FreeRTOS
debug_speed = 10000
upload_protocol = jlink
monitor_speed = 115200
debug_tool = jlink
debug_init_break = tbreak setup

In main.cpp

#include <Adafruit_BME280.h>

#include <CayenneLPP.h>

#include <Adafruit_TinyUSB.h>

#include <Arduino.h>

#include <LoRaWan-RAK4630.h> //Click here to get the library: http://librarymanager/All#SX126x

#include <SPI.h>

#include <Wire.h>

#include <Arduino_LPS22HB.h> /

#include "SparkFun_SHTC3.h" /

#include <ClosedCube_OPT3001.h>

In timers.c

#include <Arduino_FreeRTOS.h>

#include "task.h"

#include "queue.h"

#include "timers.h"

Finally, how can I fix <cannot open source file “freeRTOS.h” , “task.h” , “queue.h” , “timers.h” from timers.c>? Are there any mistakes during the ways I tried?

Thank you.

Intellisense in the core files being unresolved may just be a visual bug. Does the project compile? The Adafruit nRF52 core should have FreeRTOS builtin. feilipu/FreeRTOS should definitely be removed from lib_deps. What’s the compile error then?

I tried adding lib_deps = feilipu/FreeRTOS but not work.

Even I add include <avr/io.h>
image

Where is the board definition for wiscore_rak4631? This seems to be a custom board.

Come with some errors.
image

image

That screenshot still shows that it’s trying to use the FreeRTOS configuration from .libdeps, aka the feilipu library. Delete the whole .pio folder of the project and build again for a clean build.

What do you mean by " Delete the whole .pio folder of the project"?
Where should I start from to delete the folder?
Or which specific folder should I do?
Is it “/.platformio/”?

The project folder should have a (hidden) .pio folder in it. VSCode’s file explorer sideview should show it. It’s where the libaries indicated by lib_deps and the build artifacts are stored.

If you can’t find it, project task → General → FULL CLEAN will do it as well.

I deleted the folder of project and built agian but It did not fix.

Or do I need to fix file “avr/io.h”?
image

It’s still using that feilipu/FreeRTOS library. Are you sure you’ve deleted it from lib_deps, saved the platformio.ini and deleted the .pio folder?

I deleted feilipu/FreeRTOS library.
image

Deleted and built folder again. But how can I fix these problems?

image

I can build this firmware just fine.

With only

[env:wiscore_rak4631]
platform = nordicnrf52
board = wiscore_rak4631
framework = arduino

as my platformio.ini and installing the RAK boards via https://github.com/RAKWireless/WisBlock/blob/master/PlatformIO/RAK_PATCH.zip.

Also intellisense works fine.

Did you add the framework-arduinoadafruitnrf52 folder to the VSCode workspace maybe? If so, you must also copy the .vscode folder from the firmware project to framework-arduinoadafruitnrf52 for intellisense to work correctly.

Also this text suggests you’re using an older version of the Adafruit nRF52 Arduino core. I based my work on the latest platform + packages version.

PLATFORM: Nordic nRF52 (10.5.0) > WisCore RAK4631 Board
HARDWARE: NRF52840 64MHz, 243KB RAM, 796KB Flash       
DEBUG: Current (jlink) External (jlink, stlink)        
PACKAGES:
 - framework-arduinoadafruitnrf52 @ 1.10601.0 (1.6.1)  
 - framework-cmsis @ 2.50700.210515 (5.7.0)
 - tool-adafruit-nrfutil @ 1.503.0 (5.3)
 - tool-sreccat @ 1.164.0 (1.64)
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)        

so you might have to reinstall the latest version of those packages and platform.

I think it is olber version. How can I install the version of framework-arduino adafruit nrf52 @ 1.10601.0 (1.6.1)?

PLATFORM: Nordic nRF52 (10.4.0) > WisCore RAK4631 Board
HARDWARE: NRF52840 64MHz, 243KB RAM, 796KB Flash
DEBUG: Current (jlink) External (jlink, stlink)
PACKAGES:

  • framework-arduinoadafruitnrf52 @ 1.10600.0 (1.6.0)
  • framework-cmsis @ 2.50700.210515 (5.7.0)
  • tool-adafruit-nrfutil @ 1.503.0 (5.3)
  • tool-bossac-nordicnrf52 @ 1.10901.201022 (1.9.1)
  • tool-jlink @ 1.78811.0 (7.88.11)
  • tool-openocd @ 3.1200.0 (12.0)
  • tool-sreccat @ 1.164.0 (1.64)
  • toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)

Well one way: Open a CLI and

pio pkg update -g -p nordicnrf52
pio pkg update -g -t framework-arduinoadafruitnrf52 

then install the board JSON file and the variant folder rat the right place again via WisBlock/PlatformIO at master · RAKWireless/WisBlock · GitHub.