Having gotten to the point of compiling the snake example in my previous post, it is time to move on to the hello world example in the guide on Pimoroni. The only initial change I made was naming my project hello_world
instead of ourproject
. After setting up the example code, I found I had some warnings and an error when trying to run cmake
.

The first warning:
No project() command is present. The top-level CMakeLists.txt file must
contain a literal, direct call to the project() command. Add a line of
code such as
project(ProjectName)
near the top of the file, but after cmake_minimum_required().
CMake is pretending there is a "project(Project)" command on the first
line.
I addressed this by adding the following line (based on looking at the PicoSystem SDK CMakeLists.txt
file):
project(hello_world C CXX ASM)
The second warning:
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.16)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
I addressed this by adding the following line (again, based on looking at the PicoSystem SDK CMakeLists.txt
file):
cmake_minimum_required(VERSION 3.12)
Finally, the error:
CMake Error at CMakeLists.txt:14 (pico_add_extra_outputs):
Unknown CMake command "pico_add_extra_outputs".
-- Configuring incomplete, errors occurred!
I addressed this by doing three things. First, I copied pico-sdk/external/pico_sdk_import.cmake
to my project directory hello_world
. Second, I added these lines to my CMakeLists.txt
file:
# Pull in PICO SDK (must be before project)
include(pico_sdk_import.cmake)
# ...
find_package(PICOSYSTEM REQUIRED)
Finally, I used the following cmake
command:
cmake -DPICOSYSTEM_DIR:PATH=~/picosystem ..
This got me to a point where I can run cmake
without warnings or errors; however, running make
does result in errors:
/vagrant/hello_world/hello_world.cpp: In function 'void draw()':
/vagrant/hello_world/hello_world.cpp:12:3: error: 'pen' was not declared in this scope; did you mean 'picosystem::pen'?
12 | pen(0, 0, 0);
| ^~~
| picosystem::pen
In file included from /vagrant/hello_world/hello_world.cpp:1:
/home/vagrant/picosystem/libraries/picosystem.hpp:49:15: note: 'picosystem::pen' declared here
49 | void pen(color_t p);
| ^~~
/vagrant/hello_world/hello_world.cpp:13:3: error: 'clear' was not declared in this scope; did you mean 'picosystem::clear'?
13 | clear();
| ^~~~~
| picosystem::clear
In file included from /vagrant/hello_world/hello_world.cpp:1:
/home/vagrant/picosystem/libraries/picosystem.hpp:57:15: note: 'picosystem::clear' declared here
57 | void clear();
| ^~~~~
/vagrant/hello_world/hello_world.cpp:16:3: error: 'text' was not declared in this scope; did you mean 'picosystem::text'?
16 | text("Hello, world!", 0, 0);
| ^~~~
| picosystem::text
In file included from /vagrant/hello_world/hello_world.cpp:1:
/home/vagrant/picosystem/libraries/picosystem.hpp:78:15: note: 'picosystem::text' declared here
78 | void text(const std::string &t);
| ^~~~
make[2]: *** [CMakeFiles/hello_world.dir/build.make:63: CMakeFiles/hello_world.dir/hello_world.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:1544: CMakeFiles/hello_world.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
I addressed this by adding the following to hello_world.cpp
(based on snake.cpp
):
using namespace picosystem;
Which got to the next error:
/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: CMakeFiles/hello_world.dir/home/vagrant/picosystem/libraries/picosystem.cpp.obj: in function `main':
picosystem.cpp:(.text.startup.main+0xf8): undefined reference to `update(unsigned long)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/hello_world.dir/build.make:852: hello_world.elf] Error 1
make[1]: *** [CMakeFiles/Makefile2:1544: CMakeFiles/hello_world.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Which I addressed by changing the signature of the update method like so:
void update(uint32_t tick) {
}
At this point, I was able to compile and produce a uf2
file. I’m including the current working version of my files below in case they are useful to others:
CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
# Pull in PICO SDK (must be before project)
include(pico_sdk_import.cmake)
project(hello_world C CXX ASM)
find_package(PICOSYSTEM REQUIRED)
add_definitions(-DPIXEL_DOUBLE)
add_executable(
hello_world
hello_world.cpp
)
target_link_libraries(hello_world picosystem)
pico_add_extra_outputs(hello_world)
hello_world.cpp
:
#include "picosystem.hpp"
using namespace picosystem;
void init() {
}
void update(uint32_t tick) {
}
void draw() {
pen(0, 0, 0);
clear();
pen(15, 15, 15);
text("Hello, world!", 0, 0);
}