Ê .
Ê .
-- Build files have been written to: /home/pi/pico/pico-examples/build
NOTE
cmake will default to a Release build with compiler optimisations enabled and debugging information removed. To
build a debug version, run
cmake -DCMAKE_BUILD_TYPE=Debug ... We will explore this later in Section 6.1.
CMake has now prepared a build area for the pico-examples tree. From here, it is possible to type make to build all example
applications. However, as we are building
blink we will only build that application for now by changing directory into the
blink directory before typing make.
TIP
Invoking make with -j4 will run four make jobs in parallel to speed it up. A Raspberry Pi 4 has 4 cores so -j4 is a
reasonable number.
$ cd blink
$ make -j4
Scanning dependencies of target ELF2UF2Build
Scanning dependencies of target boot_stage2_original
[ 0%] Creating directories for 'ELF2UF2Build'
Ê .
Ê .
Ê .
[100%] Linking CXX executable blink.elf
[100%] Built target blink
Amongst other targets, we have now built:
•
blink.elf, which is used by the debugger
•
blink.uf2, which can be dragged onto the RP2040 USB Mass Storage Device
This binary will blink the on-board LED of the Raspberry Pi Pico which is connected to GPIO25 of RP2040.
More detail on the example code?
This document shows how to build software and load it onto your Raspberry Pi Pico. A lot goes on
behind the scenes to turn our
blink application into a binary program, and the Raspberry Pi Pico C/C++
SDK
book pulls back the curtain and shows some of the machinery involved. If you aren’t worried about
this kind of thing yet, read on!
3.2. Load and run "Blink"
The fastest method to load software onto a RP2040-based board for the first time is by mounting it as a USB Mass
Storage Device. Doing this allows you to drag a file onto the board to program the flash. Go ahead and connect the
Raspberry Pi Pico to your Raspberry Pi using a micro-USB cable, making sure that you hold down the
BOOTSEL button
(
Figure 1) as you do so, to force it into USB Mass Storage Mode.
Getting started with Raspberry Pi Pico
3.2. Load and run "Blink" 9