EasyManua.ls Logo

Raspberry Pi RP2040 User Manual

Raspberry Pi RP2040
77 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #73 background imageLoading...
Page #73 background image
#define bi_program_url(url) bi_string(BINARY_INFO_TAG_RASPBERRY_PI, BINARY_INFO_ID_RP_PROGRAM_URL,
url)
You then either use bi_decl(bi_blah(…)) for unconditional inclusion of the binary info blah, or
bi_decl_if_func_used(bi_blah(…)) for binary information that may be stripped if the enclosing function is not included in
the binary by the linker (think
--gc-sections).
For example,
Ê1 #include <stdio.h>
Ê2 #include "pico/stdlib.h"
Ê3 #include "hardware/gpio.h"
Ê4 #include "pico/binary_info.h"
Ê5
Ê6
const uint LED_PIN = 25;
Ê7
Ê8
int main() {
Ê9
10 bi_decl(bi_program_description(
"This is a test binary."));
11 bi_decl(bi_1pin_with_name(LED_PIN,
"On-board LED"));
12
13 setup_default_uart();
14 gpio_set_function(LED_PIN, GPIO_FUNC_PROC);
15 gpio_set_dir(LED_PIN, GPIO_OUT);
16
while (1) {
17 gpio_put(LED_PIN,
0);
18 sleep_ms(
250);
19 gpio_put(LED_PIN,
1);
20 puts(
"Hello World\n");
21 sleep_ms(
1000);
22 }
23 }
when queried with
picotool,
$ sudo picotool info -a test.uf2
File test.uf2:
Program Information
Êname: test
Êdescription: This is a test binary.
Êfeatures: stdout to UART
Êbinary start: 0x10000000
Êbinary end: 0x100031f8
Fixed Pin Information
Ê0: UART0 TX
Ê1: UART0 RX
Ê25: On-board LED
Build Information
Êbuild date: Jan 4 2021
shows our information strings in the output.
Getting started with Raspberry Pi Pico
Binary Information 72

Table of Contents

Question and Answer IconNeed help?

Do you have a question about the Raspberry Pi RP2040 and is the answer not in the manual?

Raspberry Pi RP2040 Specifications

General IconGeneral
ProcessorDual-core Arm Cortex-M0+
Clock Speed133 MHz
SRAM264 KB
GPIO30
USBUSB 1.1 Host/Device
PWM16 channels
UART2
SPI2
I2C2
Temperature Range-20°C to +85°C
Operating Voltage1.8V to 3.3V
FlashExternal QSPI flash
I/O InterfacesSPI, I2C, UART, PWM
ADC4 × 12-bit ADC channels

Summary

Chapter 1. Quick Pico Setup

Quick Pico Setup

Steps to quickly set up your development environment for Raspberry Pi Pico, including script execution.

Chapter 2. The SDK

Get the SDK and examples

Instructions for downloading and cloning the Raspberry Pi Pico SDK and example repositories.

Install the Toolchain

Steps to install necessary tools like CMake and the GNU Embedded Toolchain for Arm.

Chapter 3. Blinking an LED in C

Build, Load, and Run 'Blink'

Steps to build, load, and run the 'Blink' example program on the Raspberry Pi Pico.

Chapter 4. Saying 'Hello World' in C

Serial Input and Output

Explains how serial input/output works on the Pico via UART or USB CDC.

Build and Run 'Hello World'

Steps to build, flash, and run the 'Hello World' example.

Chapter 5. Flash Programming with SWD

Install OpenOCD

Instructions for installing OpenOCD, a debug translator for SWD.

SWD Port Wiring and Loading

Details on wiring the SWD port and loading programs via OpenOCD.

Chapter 6. Debugging with SWD

Debug Build and GDB Installation

Creating a debug build and installing GNU Debugger (GDB) for interactive debugging.

Chapter 7. Using Visual Studio Code

Chapter 8. Creating Your Own Project

Appendix A: Using Picoprobe

Related product manuals