How to transfer this RP2040/RTOS program from Arduino IDE to Platformio?

I have in the Arduino IDE a RPI Pico RP2040 sketch that imports FreeRTOS. How do I do the same with platformio? Currently the build in platformio fails on an unknown inclusion of FreeRTOS.

My platformio.ini

[env:pico]
platform = raspberrypi
board = pico
framework = arduino

Error under platformio

Board definitions for Arduino IDE:
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

Sketch in Arduino IDE

Board selection in Arduino IDE

You are using the https://github.com/earlephilhower/arduino-pico core in the Arduino IDE, but by default, platform = raspberrypi will use https://github.com/arduino/ArduinoCore-mbed. That core doesn’t support FreeRTOS, but it has Keil RTX5 as its RTOS that you could use, wrapped by the mbed-os API.

In fact, PlatformIO’s raspberrypi platform does not support the arduino-pico core. I had to add support for it myself. See https://arduino-pico.readthedocs.io/en/latest/platformio.html for installation and usage instructions.

Since you are on Mac OS, none of those instructions are important and you can just straight up use

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower
board_build.filesystem_size = 0.5m

as your platformio.ini. This will take some time to download the packages, but after that your FreeRTOS program should compile and run fine.

Thanks @maxgerhardt, I was able to build. Next will try to SWD debug using a picoprobe.

How do I configure the freertos features? For example, enabling statically allocated of RTOS objects?

FreeRTOS config file is in the library itself and I didn’t quickly see a way to redirect it. However, the config already has pretty much everything turned on already.

Thanks @maxgerhardt. This core looks very good. In the past I used wizio’s pico SDK but this Arduino core looks well maintained, rich, and flexible enough.

Hi @maxgerhardt, I played with the earlephilhower core and it’s very promising, with FreeRTOS and such, but it seems that the deployment for plamtree was optimized for the core library developers rather than users. For example, it surfaces a large number of local repositories per the screenshot below, and it takes long time for fetching all the underlying repositories.

It would be great if it can be migrated to the standard platformio experience.

We can save some space by creating an extra package for it that doesn’t include some of the deeper submodules (e.g. lots of TinyUSB in the pico-sdk), but a lot of it will be autoresolved by the next pico-sdk update (including the picosdk update). TinyUSB is the main “big chunk” in that.