pico_enable_stdio_usb(test 1)①
pico_enable_stdio_uart(test 1)②
pico_add_extra_outputs(test)
target_link_libraries(test pico_stdlib)
1. This will enable serial output via USB.
2. This will enable serial output via UART.
Then copy the
pico_sdk_import.cmake file from the external folder in your pico-sdk installation to your test project folder.
$ cp ../pico-sdk/external/pico_sdk_import.cmake .
You should now have something that looks like this,
$ ls -la
total 24
drwxr-xr-x 5 aa staff 160 6 Apr 10:46 ./
drwxr-xr-x 7 aa staff 224 6 Apr 10:41 ../
-rw-r--r--@ 1 aa staff 394 6 Apr 10:37 CMakeLists.txt
-rw-r--r-- 1 aa staff 2744 6 Apr 10:40 pico_sdk_import.cmake
-rw-r--r-- 1 aa staff 383 6 Apr 10:37 test.c
and can build it as we did before with our "Hello World" example.
$ mkdir build
$ cd build
$ export PICO_SDK_PATH=../../pico-sdk
$ cmake ..
$ make
The make process will produce a number of different files. The important ones are shown in the following table.
File extension Description
.bin Raw binary dump of the program code and data
.elf The full program output, possibly including debug information
.uf2 The program code and data in a UF2 form that you can drag-and-drop on to the RP2040
board when it is mounted as a USB drive
.dis A disassembly of the compiled binary
.hex Hexdump of the compiled binary
.map A map file to accompany the .elf file describing where the linker has arranged segments
in memory
Getting started with Raspberry Pi Pico
Chapter 8. Creating your own Project 31