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

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.