Missing Pico SDK functions in official PlatformIO framework for RPI Pico

Good morning,

Word of warning, I’m not really (not at all actually) a SW developer, merely an educated HW engineer trying to do something with a Pico.

I’m really struggling with the various options to get sample Pico SDK code running on RPI Pico Zero from waveshare, using either the included Arduino framework, or Baremetal with Wizio-SDK

I would prefer, because of library availabilities, to use the Arduino framework

To that end, I have configured my platform.io as follows:

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

monitor_port = COM6
monitor_speed = 115200

lib_deps = 

build_flags =

From there, I can easily create a simple sketch that will use WS2812FX library to drive WS2812 ledstrip, it works as planned, with serial enabled.

I then wanted to move to use PIO. As a starting point, I ported over to Arduino framework the WS2812 PIO sample from the RPI Pico SDK.

At this point, I hit two issues:

  • The statement “stdio_init_all()” is not recognized by the linker, I get this error when compiling in the linker output “undefined reference to `stdio_init_all’”. I need to remove it. Not sure it’s needed, since I do get USB serial working anyway even without it, but would welcome comments.

  • The function “puts” which is present in the sample WS2812 code from the PIO, while recognized and compile, simply hangs the Pico. No activity, no serial, USB device not recognized, I have to enter Bootsel to recover

If I replace these “puts” functions by regular Serial.printf calls it works as planned, ie I can use PIO to control WS2812 ledstrips from the sample code.

So, moving to more advanced stuff, I started looking into porting the logic analyzer sample code (again from the Pico SDK samples) - that was actually my primary goal.

And here, it’s (at least) the “hard_assert” statement which is not working properly (just like the puts function, it hangs the Pico).

If I remove this call, I can compile and the Pico does not hang, and USB serial is operational. It’s not working as it should (meaning I don’t get any output in the serial), but that might be something else that I’ll figure out later, or simply also because this hard_assert function is actually useful in the scope of the logic analyzer code.

Thing is, I can’t find any documentation on what this function does, the only reference I found is here:
Raspberry Pi Pico SDK: pico_base/include/pico/assert.h Source File

From there I can’t figure out if this call is really required for proper operation of the logic analyzer function.

I would therefore welcome comments on:

  • Are there known issues with some Pico SDK functions in the current Arduino framework port
  • Are “stdio_init_all” and “hard_assert” crucial for operation
  • Would anyone knowledgeable have already ported the logic analyzer code to Arduino framework on PlatformIO with the default environnement ?

Thanks !

I’m not a Pico expert, but this function sets up the stdio library “stuff” so that it will work correctly when you puts() or printf() etc. Output is directed to USB, and back to the host PC, or to the USART, or both but this is done in the cmake parameter files for the project.

Probably because you didn’t call stdio_init_all(). :cry:


OK that makes sense. Except that I can’t link the stdio_init_all() function, so I don’t really have a choice, I need to remove it…

Not really a problem, I can live with it now that I know.

The hard_assert() function however is much more of a mystery

for Arduino this function is not used.
Arduino not have stdio printf
In WizIO-Pico for printf, you can redirect stdio printf for SerialN as
Serial.begin(115200, true)