Notes on the Hello World Example for PicoSystem

I recently got a PicoSystem and worked through the tutorial Getting started with PicoSystem and C++. I ran into a couple challenges along the way and thought I’d share how I resolved them in case others also encounter them.

Installed build-essential along with the listed libraries.

When running cmake on the PicoSystem SDK, added the following option (currently issue 4 on the PicoSystem SDK project):

cmake -DPICOSYSTEM_DIR:PATH=~/picosystem ..

Copied pico-sdk/external/pico_sdk_import.cmake to the project directory.

Added the following to the example project’s CMakeLists.txt:

# Pull in PICO SDK (must be before project)
include(pico_sdk_import.cmake)

find_package(PICOSYSTEM REQUIRED)

Used the above mentioned options when running cmake on the example project:

cmake -DPICOSYSTEM_DIR:PATH=~/picosystem ..

Added the following to the .cpp file:

using namespace picosystem;

Changed the function signature on the update method to:

void update(uint32_t tick) {
}

The above got me up and running the Hello World example, hope this helps others. Or, if other folks have figured out better approaches, interested in learning them.

-Dan

1 Like

I created a bit of a quick and dirty boilerplate to get people going here. Probably should only be used in the meantime until someone can come up with a better solution

2 Likes

Thanks both, I should hopefully have fixed the tutorial now 🤞

2 Likes

Following the tutorial using a clean install with the most recent changes to the PicoSystem SDK, I encountered a new issue when running cmake:

CMake Error at /home/vagrant/picosystem/libraries/picosystem.cmake:3 (pico_generate_pio_header):
  Unknown CMake command "pico_generate_pio_header".
Call Stack (most recent call first):
  /home/vagrant/picosystem/picosystem-config.cmake:1 (include)
  CMakeLists.txt:10 (find_package)


-- Configuring incomplete, errors occurred!

I was able to work around this by adding a call to pico_sdk_init() in the project’s CMakeLists.txt like so:

...
set(CMAKE_CXX_STANDARD 17)

# Initialize the SDK
pico_sdk_init()

find_package(PICOSYSTEM REQUIRED)
...

I still can’t get it to work :(

With recent changes to the SDK, I was getting this error:

/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: CMakeFiles/ourproject.dir/home/vagrant/picosystem/libraries/picosystem.cpp.obj: in function `main':
picosystem.cpp:(.text.startup.main+0xd0): undefined reference to `draw(unsigned long)'
collect2: error: ld returned 1 exit status

And had to update the signature of the draw method to add a tick parameter like so:

void draw(uint32_t tick) {
  pen(0, 0, 0);
  clear();

  pen(15, 15, 15);
  text("Hello, world!", 0, 0);
}

Thanks, I’m trying this now, I’ll let you know if it works!

Woohoo! finally, thanks!

1 Like

You’re welcome, glad that helped :)