Skip to content

Commit c8f71e4

Browse files
authored
Merge branch 'raspberrypi:master' into master
2 parents aee3de9 + 84e8d48 commit c8f71e4

File tree

36 files changed

+1381
-49
lines changed

36 files changed

+1381
-49
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="gcc-arm-embedded" version="10.2.1" />
4-
<package id="cmake" version="3.31.0" installArguments="ADD_CMAKE_TO_PATH=System" />
54
<package id="mingw" version="12.2.0" />
65
<package id="ninja" version="1.11.1" />
76
</packages>

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ _deps
33
cmake-*
44
build
55
build-*
6+
build_*
67
.DS_Store

README.md

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
# Raspberry Pi RP2350 Pico SDK Examples - Early Access
1+
# Raspberry Pi Pico SDK Examples
22

3-
## RP2350 Instructions
3+
## Getting started
44

5-
Everything below this section is from the stock pico-examples, so ignore URLs etc., but generally instructions are the same.
5+
See [Getting Started with the Raspberry Pi Pico](https://rptl.io/pico-get-started) and the README in the [pico-sdk](https://github.com/raspberrypi/pico-sdk) for information
6+
on getting up and running.
67

7-
The Pico SDK default continues to be to build for RP2040 (PICO_PLATFORM=rp2040), so to build for RP2350, you need to pass
8-
`-DPICO_PLATFORM=rp2350` to CMake (or `-DPICO_PLATFORM=rp2350-riscv` for RISC-V).
8+
##### Notes on different boards and platforms (RP2040 / RP2350)
99

10-
Most, but not all examples, currently work on RP2350 however you should be able to do a full build with any of the above platforms (PICO_PLATFORM=host however currently fails on some examples)
10+
The majority of examples are applicable to both RP2040 and RP2350 based boards,
11+
however certain examples that use chip-specific functionality will only build on that platform.
12+
Similarly, Wi-Fi and Bluetooth examples will only build on a board that includes Wi-Fi and Bluetooth support.
1113

12-
For RISC-V compilation, you should take a compiler from here: https://www.embecosm.com/resources/tool-chain-downloads/#riscv-stable
14+
Platform and board information are passed to the CMake build via the `PICO_PLATFORM` and `PICO_BOARD` variables.
1315

14-
# Original pico-examples docs
16+
By default, the Pico SDK targets builds for RP2040 (`PICO_PLATFORM=rp2040`). To build for RP2350 instead, pass
17+
`-DPICO_PLATFORM=rp2350` to CMake (or `-DPICO_PLATFORM=rp2350-riscv` for RISC-V). Alternatively, in many cases, you can rely
18+
on the board configuration to set the platform for you. For example, passing `-DPICO_BOARD=pico2` will automatically select `PICO_PLATFORM=rp2350`.
1519

16-
## Getting started
20+
For more information see the "Platform and Board Configuration" chapter of
21+
the [Raspberry Pi Pico-series C/C++ SDK](https://rptl.io/pico-c-sdk) book.
1722

18-
See [Getting Started with the Raspberry Pi Pico](https://rptl.io/pico-get-started) and the README in the [pico-sdk](https://github.com/raspberrypi/pico-sdk) for information
19-
on getting up and running.
23+
Information on which examples are not being built is displayed during the CMake configuration step.
2024

2125
### First Examples
2226

@@ -47,7 +51,7 @@ App|Description
4751
[blink_any](binary_info/blink_any) | Uses `bi_ptr` variables to create a configurable blink binary - see the separate [README](binary_info/README.md) for more details
4852
[hello_anything](binary_info/hello_anything) | Uses `bi_ptr` variables to create a configurable hello_world binary - see the separate [README](binary_info/README.md) for more details
4953

50-
### Bootloaders (RP2350 Only)
54+
### Bootloaders (RP235x Only)
5155
App|Description
5256
---|---
5357
[enc_bootloader](bootloaders/encrypted) | A bootloader which decrypts binaries from flash into SRAM. See the separate [README](bootloaders/encrypted/README.md) for more information
@@ -67,7 +71,7 @@ App|Description
6771
---|---
6872
[build_variants](cmake/build_variants) | Builds two version of the same app with different configurations
6973

70-
### DCP
74+
### DCP (RP235x Only)
7175

7276
App|Description
7377
---|---
@@ -82,11 +86,11 @@ App|Description
8286
[channel_irq](dma/channel_irq) | Use an IRQ handler to reconfigure a DMA channel, in order to continuously drive data through a PIO state machine.
8387
[sniff_crc](dma/sniff_crc) | Use the DMA engine's 'sniff' capability to calculate a CRC32 on a data buffer.
8488

85-
### HSTX
89+
### HSTX (RP235x Only)
8690

8791
App|Description
8892
---|---
89-
[dvi_out_hstx_encoder](dvi_out_hstx_encoder) `RP2350`| Use the HSTX to output a DVI signal with 3:3:2 RGB
93+
[dvi_out_hstx_encoder](hstx/dvi_out_hstx_encoder) | Use the HSTX to output a DVI signal with 3:3:2 RGB
9094

9195
### Flash
9296

@@ -157,11 +161,11 @@ App|Description
157161
[multicore_runner](multicore/multicore_runner) | Set up the second core to accept, and run, any function pointer pushed into its mailbox FIFO. Push in a few pieces of code and get answers back.
158162
[multicore_doorbell](multicore/multicore_doorbell) | Claims two doorbells for signaling between the cores. Counts how many doorbell IRQs occur on the second core and uses doorbells to coordinate exit.
159163

160-
### OTP
164+
### OTP (RP235x Only)
161165

162166
App|Description
163167
---|---
164-
[hello_otp](otp/hello_otp) | Demonstrate reading and writing from the OTP on RP2350, along with some of the features of OTP (error correction and page locking).
168+
[hello_otp](otp/hello_otp) | Demonstrate reading and writing from the OTP on RP235x, along with some of the features of OTP (error correction and page locking).
165169

166170
### Pico Board
167171

@@ -191,6 +195,7 @@ App|Description
191195
[picow_httpd](pico_w/wifi/httpd) | Runs a LWIP HTTP server test app
192196
[picow_http_client](pico_w/wifi/http_client) | Demonstrates how to make http and https requests
193197
[picow_http_client_verify](pico_w/wifi/http_client) | Demonstrates how to make a https request with server authentication
198+
[picow_mqtt_client](pico_w/wifi/mqtt) | Demonstrates how to implement a MQTT client application
194199

195200
#### FreeRTOS examples
196201

@@ -305,6 +310,7 @@ App|Description
305310
[uart_tx](pio/uart_tx) | Implement the transmit component of a UART serial port, and print hello world.
306311
[ws2812](pio/ws2812) | Examples of driving WS2812 addressable RGB LEDs.
307312
[addition](pio/addition) | Add two integers together using PIO. Only around 8 billion times slower than Cortex-M0+.
313+
[uart_pio_dma](pio/uart_pio_dma) | Send and receive data from a UART implemented using the PIO and DMA
308314

309315
### PWM
310316

@@ -328,7 +334,7 @@ App|Description
328334
[rtc_alarm](rtc/rtc_alarm) | Set an alarm on the RTC to trigger an interrupt at a date/time 5 seconds into the future.
329335
[rtc_alarm_repeat](rtc/rtc_alarm_repeat) | Trigger an RTC interrupt once per minute.
330336

331-
### SHA-256
337+
### SHA-256 (RP235x Only)
332338

333339
App|Description
334340
---|---
@@ -430,6 +436,14 @@ App|Description
430436
---|---
431437
[dev_lowlevel](usb/device/dev_lowlevel) | A USB Bulk loopback implemented with direct access to the USB hardware (no TinyUSB)
432438

439+
#### Custom CDC with SDK stdio
440+
441+
This example demonstrates how to use the TinyUSB CDC device library to create two USB serial ports, and assign one of them to the SDK for stdio.
442+
443+
App|Description
444+
---|---
445+
[dev_multi_cdc](usb/device/dev_multi_cdc) | A USB CDC device example with two serial ports, one of which is used for stdio. The example exposes two serial ports over USB to the host. The first port is used for stdio, and the second port is used for a simple echo loopback. You can connect to the second port and send some characters, and they will be echoed back on the first port while you will receive a "OK\r\n" message on the second port indicating that the data was received.
446+
433447
### USB Host
434448

435449
All the USB host examples come directly from the TinyUSB host examples directory [here](https://github.com/hathach/tinyusb/tree/master/examples/host).

blink_simple/blink_simple.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#define LED_DELAY_MS 250
1111
#endif
1212

13+
#ifndef PICO_DEFAULT_LED_PIN
14+
#warning blink_simple example requires a board with a regular LED
15+
#endif
16+
1317
// Initialize the GPIO for the LED
1418
void pico_led_init(void) {
1519
#ifdef PICO_DEFAULT_LED_PIN

bootloaders/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
if (TARGET pico_mbedtls)
2-
add_subdirectory_exclude_platforms(encrypted host rp2040 rp2350-riscv)
2+
# older clang seem to have a segment overlap issue that confuses picotool
3+
if (PICO_C_COMPILER_IS_CLANG AND CMAKE_C_COMPILER_VERSION VERSION_LESS "17.0.0")
4+
message("Skipping encrypted bootloader example on LLVM/Clang version < 17; please use GCC or newer LLVM/Clang")
5+
else()
6+
add_subdirectory_exclude_platforms(encrypted host rp2040 rp2350-riscv)
7+
endif()
38
else()
49
# Assume picotool has no signing support, if no pico_mbedtls available
510
message("Skipping encrypted bootloader example as pico_mbedtls unavailable")

gpio/hello_gpio_irq/hello_gpio_irq.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "pico/stdlib.h"
99
#include "hardware/gpio.h"
1010

11+
#define GPIO_WATCH_PIN 2
12+
1113
static char event_str[128];
1214

1315
void gpio_event_string(char *buf, uint32_t events);
@@ -23,7 +25,8 @@ int main() {
2325
stdio_init_all();
2426

2527
printf("Hello GPIO IRQ\n");
26-
gpio_set_irq_enabled_with_callback(2, GPIO_IRQ_EDGE_RISE | GPIO_IRQ_EDGE_FALL, true, &gpio_callback);
28+
gpio_init(GPIO_WATCH_PIN);
29+
gpio_set_irq_enabled_with_callback(GPIO_WATCH_PIN, GPIO_IRQ_EDGE_RISE | GPIO_IRQ_EDGE_FALL, true, &gpio_callback);
2730

2831
// Wait forever
2932
while (1);
@@ -56,4 +59,4 @@ void gpio_event_string(char *buf, uint32_t events) {
5659
}
5760
}
5861
*buf++ = '\0';
59-
}
62+
}

i2c/lis3dh_i2c/lis3dh_i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
const int ADDRESS = 0x18;
2828
const uint8_t CTRL_REG_1 = 0x20;
2929
const uint8_t CTRL_REG_4 = 0x23;
30-
const uint8_t TEMP_CFG_REG = 0xC0;
30+
const uint8_t TEMP_CFG_REG = 0x1F;
3131

3232
#ifdef i2c_default
3333

interp/hello_interp/hello_interp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void texture_mapping_setup(uint8_t *texture, uint texture_width_bits, uint textu
215215
uint uv_fractional_bits) {
216216
interp_config cfg = interp_default_config();
217217
// set add_raw flag to use raw (un-shifted and un-masked) lane accumulator value when adding
218-
// it to the the lane base to make the lane result
218+
// it to the lane base to make the lane result
219219
interp_config_set_add_raw(&cfg, true);
220220
interp_config_set_shift(&cfg, uv_fractional_bits);
221221
interp_config_set_mask(&cfg, 0, texture_width_bits - 1);
@@ -288,4 +288,4 @@ int main() {
288288
texture_mapping();
289289

290290
return 0;
291-
}
291+
}

multicore/multicore_runner/multicore_runner.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@
1212

1313
#define FLAG_VALUE 123
1414

15+
typedef int32_t (*func_ptr_t)(int32_t);
16+
1517
void core1_entry() {
1618
while (1) {
1719
// Function pointer is passed to us via the FIFO
1820
// We have one incoming int32_t as a parameter, and will provide an
1921
// int32_t return value by simply pushing it back on the FIFO
2022
// which also indicates the result is ready.
21-
int32_t (*func)() = (int32_t(*)()) multicore_fifo_pop_blocking();
23+
func_ptr_t func = (func_ptr_t) multicore_fifo_pop_blocking();
2224
int32_t p = multicore_fifo_pop_blocking();
23-
int32_t result = (*func)(p);
25+
int32_t result = func(p);
2426
multicore_fifo_push_blocking(result);
2527
}
2628
}

pico_w/wifi/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ else()
1818
add_subdirectory_exclude_platforms(tcp_server)
1919
add_subdirectory_exclude_platforms(udp_beacon)
2020
add_subdirectory_exclude_platforms(http_client)
21+
add_subdirectory_exclude_platforms(mqtt)
2122

2223
if (NOT PICO_MBEDTLS_PATH)
2324
message("Skipping tls examples as PICO_MBEDTLS_PATH is not defined")

0 commit comments

Comments
 (0)