Releases: raspberrypi/pico-sdk
2.2.0
This is a minor release of the SDK with many bug fixes and documentation improvements, along with some new features.
Highlights are listed below, or you can see the full list of individual commits here, and the full list of resolved issues here.
Board Support
The following board configurations have been added and may be specified via PICO_BOARD:
adafruit_feather_rp2040_adaloggeradafruit_fruit_jameelectronicparts_picomini_2mbeelectronicparts_picomini_4mbeelectronicparts_picomini_8mbeelectronicparts_picomini_16mbolimex_rp2350_xlolimex_rp2350_xxlsparkfun_iotredboard_rp2350sparkfun_xrp_controlleruugear_wittypi5_hat_pluswaveshare_rp2350_usb_aweact_studio_rp2350b_corewiznet_w5100s_evb_pico2
The following board configurations have been modified:
hellbender_2350A_devboard- Updated for release version of the board
New Features
Encrypted binaries
Support has been added for creating self-decrypting binaries, to make creating and using binaries
with secret/private code easier.
A self-decrypting binary is an encrypted binary with an embedded bootloader that decrypts the main application into SRAM at runtime, and can be utilized via use of pico_encrypt_binary in your CMakeLists.txt file.
See the hello_encrypted and hello_encrypted_mbedtls examples, and section 4.2 of the C/C++ SDK book for more details.
There are two choices of embedded bootloader:
- A slower, hardened one with side-channel resistance
- A faster one based on Mbed TLS
NOTE: This feature introduces a breaking change to the pico_encrypt_binary function which now requires an IVFILE in addition to the AESFILE. If you invoke it without an IVFILE (as was the case prior to this release) then you will get the CMake error pico_encrypt_binary Function invoked with incorrect arguments.
Wi-Fi Firmware Partition Support
Support has been added for storing Wi-Fi firmware in a separate partition on RP2350 based boards such as Pico 2 W.
The main binary and the Wi-Fi firmware blob are kept as separate UF2s, to reduce the size of the main UF2 file. This avoids copying the whole Wi-Fi firmware blob on every UF2 upload.
This feature can be enabled by calling pico_use_wifi_firmware_partition in your CMakeLists.txt file. For more details see the documentation for that function in the C/C++ SDK book
New Library
pico_status_led
Most RP2-series microcontroller boards come with either a single-color LED, a multicolored WS2812 LED, or both. The pico_status_led library has been added to simplify dealing with both types of LED, and the complications of the single-color LED being attached to the Wi-Fi chip - not a regular GPIO - on boards like Pico W and Pico 2 W.
- Added
status_led_init(),status_led_init_with_context()andstatus_led_deinit()to perform initialization and cleanup - Added
status_led_supported()to determine if the single-color status LED APIs are available. Note that the single-color status LED is the one specified viaPICO_DEFAULT_LED_PINor the one attached to the WiFi chip on Pico 2 or Pico 2 W - Added
status_let_set_state()to turn the single-color status LED on and/off - Added
status_led_get_state()to get the on/off state of the single-color status LED - Added
status_led_via_colored_state()to determine if the single-color status LED API functionsstatus_let_set_state()andstatus_let_get_state()can be used to control the multicolor status LED (as is the default on boards with a multicolor LED but no single-color LED) - Added
colored_status_led_supported()to determine if the multicolor status LED APIs are available. Note that the multicolor status LED is the one specified viaPICO_DEFAULT_WS2812_PIN - Added
colored_status_let_set_state()to turn the multicolor status LED on and/off - Added
colored_status_led_get_state()to get the on/off state of the single-color status LED - Added
colored_status_led_set_on_with_color()to turn on the multicolored LED and set the color - Added
colored_status_led_get_on_color()to get the multicolored LED "on" color - Note: pico_status_led is available on
PLATFORM=hosttoo, though does nothing
Notable Library Changes/Improvements
hardware_dma
- Added
channel_config_set_read_address_update_type()andchannel_config_set_write_address_update_type()to surface all four RP2350 address update modes (none, increment, increment_by_two, decrement). The method may be used on RP2040 to set either of the first two modes - Re-implemented
channel_config_set_read_incrementandchannel_config_set_write_incrementusing these new methods. This is a minor functional change from the previous release, in that these methods now clear the additional configuration bit added in RP2350 that selects the new increment_by_two and decrement modes) - Prefer type name
dma_channel_config_toverdma_channel_configfor consistency with other libraries - Updated the documentation for
dma_channel_set_transfer_count(),dma_channel_configure(),dma_channel_transfer_from_buffer_nowanddma_channel_transfer_tobuffer_nowto make it explicit that these methods take a 4 bit mode and 28 bit transfer_count on RP2350 vs a 32 bit transfer_count on RP2040 - Added
dma_encode_transfer_count(),dma_encode_transfer_count_with_self_trigger()anddma_encode_endless_transfer_count()as convenience methods to safely encode theencoded_transfer_countargument to these functions
hardware_gpio
gpio_acknowledge_irqhas been made inline to improve performance
hardware_irq
- Added Arm Cortex-M33 specific interrupt stubs (weak) that the application can override (
isr_memmanage,isr_busfault,isr_usagefault,isr_securefault,isr_debugmonitor) - Added code to (re-)enable interrupts during runtime initialization on RP2350 (in case a previous bootloader stage disabled them)
- Made
irq_has_handler()available even whenPICO_DISABLE_SHARED_IRQ_HANDLERS=1 - Added
PICO_MINIMAL_STORED_VECTOR_TABLE, which can be set to 1 to save space by only storing a minimal vector table in the binary. In this case, add any exception or IRQ handlers to the RAM vector table at runtime - Added
PICO_NUM_IRQ_HANDLERS, which can be set to the number of IRQ handlers you want in either vector table. This can save space in the vector table if you know that you don't need higher numbered IRQs
hardware_flash
flash_range_erase,flash_range_programandflash_do_cmdnow preserve the QSPI pad state over flash access calls- Added
flash_start_xip()to explicitly perform a first-time XIP setup (including initialising pads) similar to that which would be done when entering a flash binary via the bootrom. This is mostly useful forno_flashbinaries that access an attached external flash
hardware_pio
- Allowed
pio_encode_sideset_opt(0, value)which is a valid instruction encoding
hardware_powman
- Fixed a bug that made
powman_timer_set_1khz_tick_source_gpio()andpowman_timer_enable_gpio_1hz_sync()work incorrectly depending on which GPIO was used - Fixed a bug in
powman_get_power_state()which meant that the state bits were returned inverted - Fixed a bug in
powman_timer_set_1khz_tick_source_lposc_with_hz()andpowman_timer_set_1khz_tick_source_xosc_with_hz()which caused them to mangle the low 3 decimal digits of the specified source frequency - Improved the validation and handling of various
powman_configure_wakeup_state()state transitions
hardware_rcp
- Added
rcp_is_true()which is safe on code that might run on RISC-V as opposed tovalue == RCP_MASK_TRUEwhich isn't
hardware_watchdog
- Added
watchdog_get_time_remaining_us()to complementwatchdog_get_time_remaining_ms() - Fixed
watchdog_get_time_remaining_ms()to return milliseconds instead of microseconds
pico_aon_timer
- Fixed a bug in
aon_timer_get_time()on RP2040 related to handling of Daylight Savings Time which meant that time could randomly be off by one hour
pico_async_context
- Fixed an incorrect assertion when using
pico_async_context_threadsafe_backgroundfrom both cores - Fixed a race condition in
async_context_execute_sync()when usingpico_async_context_threadsafe_backgroundthat might cause an assertion - Fixed a race condition in
async_context_deinit()when usingpico_async_context_freertosthat might cause an assertion - Added support for FreeRTOS'
configSUPPORT_STATIC_ALLOCATION=1when usingpico_async_context_freertos
pico_binary_info
- Fixed compilation when used by C++ code
pico_bootrom
- Add
rom_pick_ab_partition_during_updatefunction to provide a wrapper aroundrom_pick_ab_partition, which is safe to call before callingrom_explicit_buyduring a Flash Update boot or TBYB boot. During development,rom_pick_ab_partition_during_updatewas namedrom_pick_ab_update_partition; backwards compatibility with this name isn't preserved
pico_bootsel_via_double_reset
- Fixed the implementation on RP2350
pico_btstack
- Added
CYBT_ERROR_ENABLED,CYBT_INFO_ENABLED,CYBT_DEBUG_ENABLEDfor finer logging control - Fixed
btstack_cyw43_deinit()to properly clean up the underlyingasync_contextvia a newbtstack_run_loop_async_context_deinit()method - Moved the default location for Bluetooth-related flash storage backwards one flash sector from the end of flash so that it no longer uses the last sector of flash, which can be overwritten by the workaround for erratum RP2350-E10
...
2.1.1
This is a minor release of the SDK with many bug fixes and documentation improvements, along with some new features.
Highlights are listed below, or you can see the full list of individual commits here, and the full list of resolved issues here.
Board Support
The following boards have been added and may be specified via PICO_BOARD:
sparkfun_iotnode_lorawan_rp2350waveshare_pico_cam_awaveshare_rp2040_blewaveshare_rp2040_ethwaveshare_rp2040_geekwaveshare_rp2040_matrixwaveshare_rp2040_pizerowaveshare_rp2040_power_management_hat_bwaveshare_rp2040_tinywaveshare_rp2040_touch_lcd_1.28waveshare_rp2350_ethwaveshare_rp2350_geekwaveshare_rp2350_lcd_0.96waveshare_rp2350_lcd_1.28waveshare_rp2350_onewaveshare_rp2350_plus_4mbwaveshare_rp2350_plus_16mbwaveshare_rp2350_tinywaveshare_rp2350_touch_lcd_1.28waveshare_rp2350_zero
The following board configurations have been modified:
adafruit_feather_rp2350- Increased the XOSC startup delayseeed_xiao_rp2350- Increased the default SPI clock dividerwaveshare_rp2040_lcd_0.96- RenamedWAVESHARE_RP2040_LCD_*constants toWAVESHARE_LCD_*waveshare_rp2040_lcd_1.28- RenamedWAVESHARE_RP2040_LCD_*constants toWAVESHARE_LCD_*
Note: the default PICO_XOSC_STARTUP_DELAY_MULTIPLIER (unless specified by a board header file) has been changed from 1 to 6, meaning a delay of 6ms, as testing of the recommended crystal shows it can take up to this long to stabilize.
200Mhz Clock Support for RP2040
RP2040 has now been certified to run at a system clock of 200Mhz when using a regulator voltage of at least 1.15 volts.
The SDK by default performs clock setup for you before your program enters main(). If you haven't customized the clock configuration in any way, it will attempt to configure the system clock based on the value of SYS_CLK_MHZ (or SYS_CLK_KHZ/SYS_CLK_HZ if specified instead). Without further information from you, it can only do this for specific clock frequencies.
In prior versions of the SDK, only one specific clock frequency was defined per platform, 125Mhz for RP2040 and 150Mhz for RP2350, which also happen to be the default values for SYS_CLK_MHZ
With this version of the SDK, you can now select a 200Mhz clock for RP2040 simply by setting SYS_CLK_MHZ=200 via preprocessor define. The regulator voltage will automatically be raised for you if necessary.
We may certify new frequencies for the different platforms in the future. The original SYS_CLK_MHZ defaults are left unchanged because not all programs would function correctly at a different system clock frequency. If, however, your project would always benefit from the fastest clock, you may now define PICO_USE_FASTEST_SUPPORTED_CLOCK=1 via CMake variable or as a preprocessor define, and it will always use the fastest supported system clock frequency for the platform in the future.
Notable Library Changes/Improvements
hardware_clocks
- Corrected documentation and implementation of
clock_configure()supporting the full range of clock dividers - Added
PICO_USE_FASTEST_SUPPORTED_CLOCKand PLL configuration for 200Mhz on RP2040
hardware_flash
- Move internal flash helper function to run from RAM instead of flash, so it was supported in builds other than
COPY_TO_RAM
hardware_irq
- Added significantly improved documentation around IRQ handlers when using both cores
- Added
enable_interrupts()anddisable_interrupts()methods for when you don't care about saving or restoring the current interrupt state - Added
irq_has_handler()method to tell if a handler is installed for a particular IRQ number
hardware_pio
- Fixed support for
WAIT gpiowith GPIO number >= 32
pico_aon_timer
- Added a 2 RTC-clock propagation delay at the end of
aon_timer_set_time_calendar()on RP2040, such that reading back the time immediately afterwards will return the right value
pico_bootrom
- Added
rom_data_lookup_inline()to complementrom_data_lookup()
pico_btstack
- Updated BTStack to 1.6.2 from 1.6.1
- Updated Raspberry Pi BTStack license to cover Pico 2 W, Pico 2 WH, and RM2
pico_cyw43_driver
- Updated
cyw43_driverto revisionc1075d4b - Fixed rare issue when loading firmware
pico_double
- Major cleanup, with much improved documentation
- Implemented the full complement of double conversion functions defined in
pico/double.hacross both RP2040 and RP2350 variants ofpico_double_pico
pico_float
- Major cleanup, with much improved documentation
- RP2350
pico_float_pico_dcpvariant now enables-msoft-float, since if you've chosen to use DCP instead of VFP for single-precision floating-point, you probably don't want the compiler emitting inline VFP instructions either - Implemented the full complement of float conversion functions defined in
pico/float.hacross RP2040 and all RP2350 variants ofpico_float_pico
pico_flash
- Fixed a build error when using FreeRTOS with
configSUPPORT_DYNAMIC_ALLOCATION=0
pico_lwip
- Fixed build with
PPP_SUPPORT=1when usingpico_lwip_nosys
pico_mbedtls
- Added correct cleanup of RP2350 SHA256 state during
mbedtls_sha256_free()
pico_multicore
- Added
multicore_lockout_victim_deinit() multicore_reset_core1()now marks Core 1 as de-initialized w.r.t.multicore_lockout_victim_functions, allowingmulticore_lockout_victim_init()to perform correctly after the reset
pico_runtime_init
- Added
SYS_CLK_VREG_VOLTAGE_AUTO_ADJUSTto indicate the voltage regular should be set toSYS_CLK_VREG_VOLTAGE_MINduring default clock setup in order to support the configured system clock frequency
pico_sha256
- Added
pico_sha256_cleanup()to clean up from an in-progress SHA256 operation which was not completed viapico_sha256_finish()
pico_stdio_usb
- Allow user to override
CFG_TUD_CDC_RX_BUFSIZE,
CFG_TUD_CDC_TX_BUFSIZEandCFG_TUD_CDC_EP_BUFSIZEdefines to increase performance
pico_time
- Fixed a rare race condition that could cause alarms/repeating timers to get "lost"
TinyUSB
- Updated TinyUSB to 0.18.0 from 0.17.0
FreeRTOS
- FreeRTOS support for RP2350 (Arm/RISC-V) has been upstreamed to https://github.com/FreeRTOS/FreeRTOS-Kernel, however is not yet in any official release, so you should use the latest from the
mainbranch there and make sure you initialize the submodules as RP2350 support is actually in a submodule - If your project embeds
FreeRTOS_Kernel_import.cmake, you should update to the latest version here which works for both RP2040 and RP2350
Pioasm
- Fixed encoding of
WAIT GPIOwith GPIO number >= 32 - Python output now correctly emits
word(x)for all PIO version 1 (RP2350) PIO instructions
SVD
- Fixed access type for DMA
CHAN_ABORTregister to be read-write (with clear-on-write) for both RP2040 and RP2350
Build
- GCC 14 is now supported
- LLVM Embedded Toolchain For Arm 19.x is now supported
- Multiple .pio files now supported in
pico_generate_pio_header() .DISfiles for builds using LLVM/Clang on RP2350 now contain correct disassembly for VFP floating point instructions- Fixed some newer CMake version deprecation warnings
- Added explicit license to
pico_sdk_import.cmakeas it is copied into external projects
Bazel Build
- Updated LLVM/Clang toolchain to fix stack overflow issue with
fma()related math functions
New Examples
These are in the pico_examples repository.
Added in 2.1.0 timeframe
These examples were added in the 2.1.0 timeframe but were not listed in the release notes then:
| Example | Description |
|---|---|
| binary_info/blink_any | Uses bi_ptr variables to create a configurable blink binary - see the separate readme for mote details |
| binary_info/hello_anything | Uses bi_ptr variables to create a configurable hello_world binary - see the separate readme for more details |
| i2c/slave_mem_i2c_burst | i2c slave example where the slave implements a 256 byte memory. This version inefficiently writes each byte in a separate call to demonstrate read and write burst mode. |
| pico_w/wifi/picow_blink_slow_clock | Blinks the on-board LED (which is connected via the WiFi chip) with a slower system clock to show how to reconfigure communication with the WiFi chip at run time under those circumstances |
| pico_w/wifi/picow_blink_fast_clock | Blinks the on-board LED (which is connected via the WiFi chip) with a faster system clock to show how to reconfigure communication with the WiFi chip at build time under those circumstances |
| pico_w/wifi/picow_http_client | Demonstrates how to make http and https requests |
| ... |
2.1.0
This is a minor release of the SDK with many bug fixes and documentation improvements, along with some new features.
Highlights are listed below, or you can see the full list of individual commits here, and the full list of resolved issues here.
Board Support
The following board has been added and may be specified via PICO_BOARD:
adafruit_feather_rp2350datanoisetv_rp2350_dsphellbender_0001machdyne_werkzeugpico2_wpimoroni_pico_plus2_w_rp2350sparkfun_thingplus_rp2350
The following board configurations have been modified:
pimoroni_plasma2350- corrected flash size, renamed SPICE to SPCEpimoroni_tiny2350- corrected flash size
Notable Library Changes/Improvements
Clock dividers in general
- A variety of methods which set clock dividers using an integer part and a fractional part, which might have been
hardware_xxx_set_clkdiv_int_frac(uint16_t div_int, uint8_t div_frac)have been modified tohardware_xx_set_clkdiv_int_frac8(uint32_t div_int, uint8_t div_frac). This has been done for consistency and to make the APIs more resistant to hardware changes. The old APIs are preserved for backwards compatibility. - Previously, when converting from floating-point clock divider values to the fixed point use by the hardware, the floating-point value was rounded down. The new default (as configured by
PICO_CLKDIV_ROUND_NEAREST) is to round to the nearest achievable value. This minor change in behavior was deemed better in general, which is why the default was changed. You may setPICO_CLKDIV_ROUND_NEAREST=0to restore the previous beahvior by default (note that individual libraries have their own configuration values which can be used to change the behavior on a per-library basis).
cmsis
- Fixed exception renaming for RP2350
hardware_adc
- Added
PICO_ADC_CLKDIV_ROUND_NEARESTfor controlling rounding of floating-point clock dividers
hardware_clocks
- Corrected spelling of
PICO_CLOCK_AJDUST_PERI_CLOCK_WITH_SYS_CLOCKtoPICO_CLOCK_ADJUST_PERI_CLOCK_WITH_SYS_CLOCK. The former is still supported. vco_calc.pynow outputsSYS_CLK_HZin the CMake output, which is required forclock_get_hz(clk_sys)to return the correct value- Renamed
clock_gpio_init_int_frac()toclock_gpio_init_int_frac8()to be clear that it takes an 8-bit fraction; the old name is still supported. - Added
clock_gpio_init_int_frac16()to specify the fraction with 16-bit precision (RP2350 has 16 bits of precision). This method can still be called on RP2040 in which case the low 8-bits are ignored. - Added
PICO_CLOCK_GPIO_CLKDIV_ROUND_NEARESTfor controlling rounding of floating-point clock dividers
hardware_dma
- Fixed
dma_channel_cleanup()to disable the channel with the new DMA IRQs added in RP2350
hardware_exception
- Added missing Cortex-M33 exception numbers
hardware_flash
- Prevented flash functions
flash_range_eraae(),flash_range_program()andflash_do_cmd()from trashing the user's CS1 QMI configuration on RP2350 - Fixed issue with
flash_safe_executeon FreeRTOS SMP
hardware_i2c
- Added
i2c_write_burst_blockingandi2c_read_burst_blockingto send/receive multiple bytes without intervening stops. - Fixed rare hang during
i2c_read_blocking
hardware_interp
- Renamed
interp_add_accumulater()tointerp_add_accumulator(). The old incorrect spelling is still supported.
hardware_pio
- Added
pio_sm_set_pins64(),pio_sm_set_pins_with_mask64()andpio_sm_set_pindirs_with_mask64()to allow setting of >32 pins. - Much improved documentation of how GPIO numbers > 32 are handled.
- Fixed a bug in the use of a "jmp pin" > 32.
- Fixed implementation of
sm_config_set_in_pin_count() - Renamed
sm_config_set_clkdiv_int_frac()tosm_config_set_clkdiv_int_frac8()to be clear that it takes an 8-bit fraction; the old name is still supported. Note that "int" part in the new method is 32-bit not 16-bit for consistency with otherclkdivmethods. - Renamed
pio_calculate_clkdiv_from_float()topio_calculate_clkdiv8_from_float()to be clear that it produces an 8-bit fraction; the old name is still supported. Note that "int" part in the new method is 32-bit not 16-bit for consistency with otherclkdivmethods. - Added
PICO_PIO_CLKDIV_ROUND_NEARESTfor controlling rounding of floating-point clock dividers
hardware_pwm
- Renamed
pwm_config_set_clkdiv_int_frac()topwm_config_set_clkdiv_int_frac4()to be clear that it takes an 4-bit fraction; the old name is still supported. Note that "int" part in the new method is 32-bit not 8-bit for consistency with otherclkdivmethods. - Added
PICO_PWM_CLKDIV_ROUND_NEARESTfor controlling rounding of floating-point clock dividers
hardware_timer
- Fixed bug with alarms when using RP2350's new TIMER1
- Corrected signature of
hardware_alarm_get_irq_num()method added in SDK2.0.0. The variant that takes (and uses) a timer instance is calledtimer_hardware_alarm_get_irq_num().
pico_aon_timer
-
Added
aon_timer_start_calendar(),aon_timer_set_time_calendar(),aon_timer_get_time_calendar()andaon_timer_enable_alarm_calendar()methods. These are equivalent to the non-_calendar()variants except they deal in calendar (date/) time, rather than time intervals.These new variants are preferred on RP2040 since otherwise a date/time conversion must be performed which pulls in a lot of C library code. For the same reason, the pre-existing variants are preferred on RP2350. This discrepancy results from the different hardware used for the AON timer on RP2040 and RP2350.
pico_atomic
- Fixed atomic use between core 0 and core 1
pico_async_context
- Fixed possible HardFault in
execute_sync()on FreeRTOS
pico_binary_info
bi_Xpins_with_names()macros now work correctly when pin numbers are not in order
pico_bootrom
- Added
rom_reset_usb_boot_extra()which supports an "activity" GPIO pin > 32 and GPIO pin inversion (active low). - Bootrom methods that may write to flash are now protected with
flash_safe_execute(). This affectsrom_flash_op()and rom_explicit_buy()`
pico_bootsel_via_double_reset
- Fixed implementation on RP2350. Note the RP2350 bootrom also provides this support if enabled via OTP, however this library can be used when that is not enabled.
pico_crt0
__HeapLimitis now correctly set by the default linker scripts again- Fixed linker option
-Wl,--print-memory-usageshowing 100% RAM used
pico_clib_interface
- Made Some small improvements to
picolibcintegration
pico_cyw43_driver
- Allow user configuration of Wi-Fi pins (including pin numbers >32) and SPI clock, including dynamic SPI clock configuration at runtime.
- Updated
cye43_driverto revisioncf924bb - Renamed
cyw43_set_pio_clkdiv_int_frac()tocyw43_set_pio_clkdiv_int_frac8()to be clear that it takes an 8-bit fraction; the old name is still supported. Note that "int" part in the new method is 32-bit not 16-bit for consistency with otherclkdivmethods - Renamed
CYW43_PIO_CLOCK_DIV_FRAC8toCYW43_PIO_CLOCK_DIV_FRAC. The old name is still supported - RISC-V is now supported
- Added
PICO_BTSTACK_CYW43_MAX_HCI_PROCESS_LOOP_COUNTconfiguration option, which can be used to prevent starvation in high frequency Bluetooth scenarios.
pico_flash
- Support serial flash with >8 byte unique id, using the last 8 bytes rather than the first
pico_float
- Added optimized add/sub/mul implemtations for Hazard3 for better floating point speed
pico_malloc
- Fixed deadlock in
calloc()andrealloc()withpicolibc
pico_platform
- Added
pico_default_asm_volatile_goto()
pico_standard_binary_info
- Added back
boot_stage2binary info (missing in SDK 2.0.0)
pico_stdio_uart
- Fixed
stdio_flush()when used withstdio_uart_init_full() - Fixed race condition in
stdio_set_chars_available_callback()
pico_stdio_usb
- Fixed Windows issue with the device not showing up if the reset interface is disabled
- Added support for resetting to USB boot with an activity LED pin > 32 or with the LED active low (on RP2350)
- Added
PICO_STDIO_USB_RESET_BOOTSEL_FIXED_ACTIVITY_LED_ACTIVE_LOWsetting for RP2350
pico_time
- Fixed race condition which could cause alarms to be lost
- Fixed continuous wakeup in
best_effort_wfe_or_timeout()on RP2350
pico_util
- Added
datetime_to_tm()andtm_to_datetime()for converting C library date/times to/from RP2040 RTC date/times - Added
pico_localtime_r()andpico_mktime()for use bypico_utiltime conversion code. These methods cass the equivalent C library function, but are defined weakly so the user can provide their own
TinyUSB
- Updated TinyUSB to 0.17.0
New Libraries
boot_bootrom_headers
Split out the headers defining the bootrom interface - that might be used outside the SDK - from pico_bootrom which is focused on calling the bootrom from the SDK, and has non-trivial dependencies.
hardware_xip_cache
Provides XIP cache maintenance APIs:
- RP2040 support for cache invalidation
- RP2350 support for cache invalidation/cleaning/pinning
Miscellaneous
- Numerous documentation corrections/improvements
- Various build warnings fixed in exotic compiler configuratons
- RP2350 A0/A1 silicon are no longer supported
Pioasm
- Fixed disassembly of
mov rx_fifo, ...andmov ..., rx_fifoinstructions
Build...
SDK 2.0.0
This is a major release which adds support for the new RP2350 and for compiling RISC-V code in addition to Arm.
- There is a lot of new functionality in the RP2350 microcontroller, it is recommended that you read the RP2350 Datasheet
- There is a lot of new functionality in the SDK, it is also worth reading the Raspberry Pi Pico C/C++ SDK book. This also includes documentation for RP2040 and RP2350 APIs, along with much more complete documentation of SDK
#definesandCMakebuild variables.
Notices
- You should delete/recreate all build directories when upgrading from previous versions of the Raspberry Pi Pico SDK
Major New Features
Support for RP2350
Many programs you have written for RP2040 (say a Raspberry Pi Pico) should work unmodified on RP2350 (say a Raspberry Pi Pico 2) even when compiled for RISC-V.
- You can now specify
rp2350-arm-s(Arm Secure) orrp2350-riscv(RISC-V) as well as the previousrp2040(default) andhost. - Setting
PICO_BOARD=some_boardwill now setPICO_PLATFORMif one is specified insome_board.hsince most boards either use exclusively RP2040 or RP2350. PICO_PLATFORMalso supportsrp2350but this gets replaced with the valuePICO_DEFAULT_RP2350_PLATFORMwhich you can set in your environment orCMakeLists.txt. Many of the boards for RP2350 - includingpico2- selectrp2350as thePICO_BOARDto honour your preference.- NOTE: This release of the SDK does not support writing Arm Non-Secure binaries to run under the wing of an Arm Secure binary. This support will be added in a subsequent release.
Security and Code Signing
- The RP2350 bootrom contains support for signed images and a variety of other security features. The SDK supports building signed images etc. as part of the CMake build. For further information, please read RP2350 Datasheet "Bootrom Concepts" section, and also the Raspberry Pi Pico C/C++ SDK book for details on configuring your build to sign code. Note that signed code is only applicable to chips that have been locked down for security, but you can also hash your image for integrity checking.
Board Support
The following boards have been added and may be specified via PICO_BOARD:
defcon32_badgegen4_rp2350_24gen4_rp2350_24ctgen4_rp2350_24tgen4_rp2350_28gen4_rp2350_28ctgen4_rp2350_28tgen4_rp2350_32gen4_rp2350_32ctgen4_rp2350_32tgen4_rp2350_35gen4_rp2350_35ctgen4_rp2350_35thellbender_2350A_devboardilabs_challenger_rp2350_bconnectilabs_challenger_rp2350_wifi_blemelopero_perpetuo_rp2350_loraphyx_rick_tny_rp2350pico2pimoroni_pga2350pimoroni_pico_plus2_rp2350pimoroni_plasma2350pimoroni_tiny2350seeed_xiao_rp2350solderparty_rp2350_stampsolderparty_rp2350_stamp_xlsparkfun_promicro_rp2350switchscience_picossci2_conta_baseswitchscience_picossci2_dev_boardswitchscience_picossci2_microswitchscience_picossci2_rp2350_breakoutswitchscience_picossci2_tinytinycircuits_thumby_color_rp2350
New Libraries
hardware_boot_lock (RP2350)
- New library for accessing the BOOT locks from secure code.
hardware_dcp (RP2350 Arm)
- Contains assembler macros for individual DCP (Double Co-Processor) instructions
- Contains assembler macros for canned instruction sequences for higher-level operations
HAS_DOUBLE_COPROCESSORdefine indicates hardware support
hardware_hazard3 (RP2350 RISC-V)
- Assembler macros and inline functions for accessing Hazard3 extensions
hardware_powman (RP2350)
- Hardware APIs for the Power Management hardware.
HAS_POWMAN_TIMERdefine indicates hardware support.
hardware_rcp (RP2350 Arm)
- Contains inline functions and assembler macros for the RCP (Redundancy Co-Processor) instructions.
HAS_REDUNDANCY_COPROCESSORdefine indicates hardware support.
hardware_riscv_platform_timer (RP2350)
- Hardware APIs for the RISC-V Platform Timer (which is also made available on Arm).
hardware_sha256 (RP2350)
- Hardware APIs for the SHA256 hashing hardware.
hardware_ticks
- Hardware APIs for the RP2350 tick generators.
- On RP2040 the same API is used, but only one tick generator
TICK_WATCHDOGis used, which is backed by the hardware in the RP2040 WatchDog hardware.
pico_aon_timer
- Abstraction for a hardware timer that is "Always-On", and can wake the processor up even from a low power state at a given time.
- On RP2040 this uses the RTC.
- On RP2350 this uses the Powman Timer.
pico_atomic
- Additional support for C11 atomic functions using spin lock number
PICO_SPINLOCK_ID_ATOMIC. - On RP2040, all functions are implemented via spinlock.
- On RP2350, only 64-bit or arbitrary-sized atomics are implemented via spin lock; the reset user processor exclusive/atomic instructions.
- Note on
ACTLR.EXTEXCLALLmust be set to 1 on each processor for the exclusive instructions to work. This is done automatically in the SDK by one of the per-core initializers inpico_runtime_init.
- Note on
- Included by
pico_runtimeby default.
pico_boot_lock (RP2350)
- Support for acquiring and releasing locks to prevent concurrent use of hardware resources used by bootrom functions.
- Enabled via
PICO_BOOTROM_LOCKING_ENABLEDwhich defaults to 1 on RP2350. - Some bootrom functions use shared resources such as the single SHA256 or put hardware such as the OTP or XIP interface into a state that cannot execute concurrently with certain other code. The bootrom supports checking that the resource is owned, and this library turns that checking on.
- The bootrom function wrappers in
pico_bootromcall the functions inpico_boot_lockaround affects bootrom functions, and thus will take and release locks ifPICO_BOOTROM_LOCKING_ENABLED=1. NUM_BOOT_LOCKSdefine indicates the number of boot locks (8 on 'RP2350', 0 on 'RP2040').
pico_clib_interface
- New library to encapsulate the interface between the SDK and the C library.
- Supports
- newlib (full).
- picolibc (preview).
- llvm-libc(preview).
- Included by
pico_runtimeby default.
pico_crt0
- New library split out of
pico_standard_linkto encapsulate the earliest startup code before the runtime initialisation, and shutdown code after the runtime. - Repository for the default RP2040 and RP2350 linker scripts.
- The flash size specified in the board header is now used when linking which is handy if you have >2M of flash and >2M of code/data.
- Note: The linker scripts have changed since the previous release of the SDK. If you have custom linker scripts, it is recommended that you update them to match.
- In particular the new linker scripts include an "embedded block" which is required for a binary to boot on RP2350.
- __HeapLimit is now defined to be the end of RAM rather than the end of a
PICO_HEAP_SIZEchunk, to better match the standard behaviour.PICO_HEAP_SIZEis the minimum heap size required, and space is required for it at link time.sbrkin the previous SDK ignored it anyway and used the end of RAM so there is no functional change there.
- Included by
pico_runtimeby default
pico_cxx_options
- New library split out of
pico_standard_linkto configure C++ options. - Included by
pico_standard_linkby default.
pico_platform_compiler
- New library split out of
pico_platformwith the functions/macros related to the compiler. - Included by
pico_platformby default.
pico_platform_panic
- New library split out of
pico_platformwith the panic function implementation. - Included by
pico_platformby default.
pico_platform_sections
- New library split out of
pico_platformwith the section macros such as__not_in_flash_func. - Included by
pico_platformby default.
pico_runtime_init
- Contains the standard initialisers that should get run before main, or per core.
- Unlike in the previous SDK version where
runtime_init()was a monolithic function which also called some__preinit_arrayinitialisers, the new runtime_init library: - Separates each initialiser out individually, for say initialiser "foo".
- Defines
PICO_RUNTIME_INIT_FOOwhich is a "12345" line number ordering of the initialiser with respect to others. - Declares
runtime_init_foo()which is the actual initialiser. - If
PICO_RUNTIME_SKIP_INIT_FOOis not set, it adds the initialiser entry to callruntime_init_foo()beforemain(or per core initialisation). - If
PICO_RUNTIME_NO_INIT_FOOis not set, it adds the (weak) implementation ofruntime_init_foo().
- Defines
- This gives the user full control to customise runtime initialisation, either skipping or replacing parts.
- Included by
pico_runtimeby default.
pico_sha256
- High level APIs for generating SHA256 hashes both synchronously and asynchronously
pico_standard_binary_info
- New library split out of
pico_standard_linkthat adds the "common" binary info items to the binary. - Included by
pico_standard_linkby default.
Library Changes / Improvements
Note that all hardware libraries now support the increased number of GPIOs on RP2350B in APIs that take a GPIO number; this is not noted for every library.
pico_base
- More error return codes were added to
pico/error.h, mostly because these are the same values returned by RP2350 bootrom API functions, but also a number of new SDK APIs also return meaningful errors. - In
pico/types.h, by popular demand,absolute_time_tnow always defaults touint64_tregardless of the type of build. You can set `PICO_OPAQUE_ABSOLUTE_TIME_...
SDK 1.5.1
This release is largely a bug fix release, however it also makes Bluetooth support official and adds some new libraries and functionality.
Highlights are listed below, or you can see the full list of individual commits here, and the full list of resolved issues here.
Board Support
The following board has been added and may be specified via PICO_BOARD:
pololu_3pi_2040_robot
The following board configurations have been modified:
adafruit_itsybitsy_rp2040- corrected the mismatchedPICO_DEFAULT_I2Cbus number (favors the breadboard pins not the stemma connector).sparkfun_thingplus- added WS2812 pin config.
Library Changes/Improvements
hardware_dma
- Added
dma_channel_cleanup()function that can be used to clean up a dynamically claimed DMA channel after use, such that it won't be in a surprising state for the next user, making sure that any in-flight transfer is aborted, and no interrupts are left pending.
hardware_spi
- The
spi_set_format,spi_set_slave,spi_set_baudratefunctions that modify the configuration of an SPI instance, now disable the SPI while changing the configuration as specified in the data sheet.
pico_async_context
- Added
user_datamember toasync_when_pending_worker_tto matchasync_at_time_worker_t.
pico_cyw43_arch
- Added
cyw43_arch_disable_sta_mode()function to complementcyw43_arch_enable_sta_mode(). - Added
cyw43_arch_disable_ap_mode()function to complementcyw43_arch_enable_ap_mode().
pico_stdio_usb
- The 20-character limit for descriptor strings
USBD_PRODUCTandUSBD_MANUFACTURERcan now be extended by defining
USBD_DESC_STR_MAX. PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MSis now supported in the build as well as compiler definitions; if it is set in the build, it is added to the compile definitions.
pico_rand
- Fixed poor randomness when
PICO_RAND_ENTROPY_SRC_BUS_PERF_COUNTER=1.
PLL and Clocks
- The
set_sys_clock_pllandset_sys_clock_khzmethods now reference a pre-processor definePICO_CLOCK_AJDUST_PERI_CLOCK_WITH_SYS_CLOCK. If set to1, the peripheral clock is updated to match the new system clock, otherwise the preexisting behavior (of setting the peripheral clock to a safe 48Mhz) is preserved. - Support for non-standard crystal frequencies, and compile-time custom clock configurations:
- The new define
XOSC_KHZis used in preference to the preexistingXOSC_MHZto define the crystal oscillator frequency. This value is now also correctly plumbed through the various clock setup functions, such that they behave correctly with a crystal frequency other than 12Mhz.XOSC_MHZwill be automatically defined for backwards compatibility ifXOSC_KHZis an exact multiple of 1000 Khz. Note that eitherXOSC_MHZorXOSC_KHZmay be specified by the user, but not both. - The new define
PLL_COMMON_REFDIVcan be specified to override the default reference divider of 1. - The new defines
PLL_SYS_VCO_FREQ_KHZ,PLL_SYS_POSTDIV1andPLL_SYS_POSTDIV2are used to configure the system clock PLL during runtime initialization. These are defaulted for you ifSYS_CLK_KHZ=125000,XOSC_KHZ=12000andPLL_COMMON_REFDIV=1. You can modify these values in yourCMakeLists.txtif you want to configure a different system clock during runtime initialization, or are using a non-standard crystal. - The new defines
PLL_USB_VCO_FREQ_KHZ,PLL_USB_POSTDIV1andPLL_USB_POSTDIV2are used to configure the USB clock PLL during runtime initialization. These are defaulted for you ifUSB_CLK_KHZ=48000,XOSC_KHZ=12000andPLL_COMMON_REFDIV=1. You can modify these values in yourCMakeLists.txtif you want to configure a different USB clock if you are using a non-standard crystal. - The new define
PICO_PLL_VCO_MIN_FREQ_KHZis used in preference to the pre-existingPICO_PLL_VCO_MIN_FREQ_MHZ, though specifying either is supported. - The new define
PICO_PLL_VCO_MAX_FREQ_KHZis used in preference to the pre-existingPICO_PLL_VCO_MAX_FREQ_MHZ, though specifying either is supported.
- The new define
New Libraries
pico_flash
- This is a new higher level library than
hardware_flash. It provides helper functions to facilitate getting into a
state where it is safe to write to flash (the default implementation disables interrupts on the current core, and if
necessary, makes sure the other core is running from RAM, and has interrupts disabled). - Adds a
flash_safe_execute()function to execute a callback function while in the "safe" state. - Adds a
flash_safe_execute_core_init()function which must be called from the "other core" when usingpico_multicoreto enable the cooperative support for entering a "safe" state. - Supports user override of the mechanism by overriding the
get_flash_safety_helper()function.
Miscellaneous
- All assembly (including inline) in the SDK now uses the
unifiedsyntax.- New C macros
pico_default_asm( ... )andpico_default_asm_volatile( ... )are provided that are equivalent to__asmand__asm volatileblocks, but with a.syntax unifiedat the beginning.
- New C macros
- A new assembler macro
pico_default_asm_setupis provided to configure the correct CPU and dialect. - Some code cleanup to make the SDK code at least compile cleanly on Clang and IAR.
Build
-
PICO_BOARDandPICO_BOARD_HEADER_DIRSnow correctly use the latest environment variable value if present. -
A CMake performance regression due to repeated calls to
find_packagehas been fixed. -
Experimental support is provided for compiling with Clang. As an example, you can build with the
LLVM Embedded Toolchain for Arm, noting however that currently only version 14.0.0 works, as later versions usepicolibrather thannewlib.- Note that if you are using TinyUSB you need to use the latest master to compile with Clang.
mkdir clang_build cd clang_build cmake -DPICO_COMPILER=pico_arm_clang -DPICO_TOOLCHAIN_PATH=/path/to/arm-embedded-llvm-14.0.0 .. make
Bluetooth Support for Pico W
The support is now official. Please find examples in pico-examples.
- The Bluetooth API is provided by BTstack.
- The following libraries are provided that expose core BTstack functionality:
pico_btstack_ble- Adds Bluetooth Low Energy (LE) support.pico_btstack_classic- Adds Bluetooth Classic support.pico_btstack_sbc_encoder- Adds Bluetooth Sub Band Coding (SBC) encoder support.pico_btstack_sbc_decoder- Adds Bluetooth Sub Band Coding (SBC) decoder support.pico_btstack_bnep_lwip- Adds Bluetooth Network Encapsulation Protocol (BNEP) support using LwIP.pico_btstack_bnep_lwip_sys_freertos- Adds Bluetooth Network Encapsulation Protocol (BNEP) support using LwIP with FreeRTOS forNO_SYS=0.
- The following integration libraries are also provided:
pico_btstack_run_loop_async_context- provides a commonasync_contextbacked implementation of a BTstack "run loop" that can be used for all BTstack use with thepico-sdk.pico_btstack_flash_bank- provides a sample implementation for storing required Bluetooth state in flash.pico_btstack_cyw43- integrates BTstack with the CYW43 driver.
- The
CMakefunctionpico_btstack_make_gatt_headercan be used to run the BTstackcompile_gatttool to make a GATT header file from a BTstackGATTfile. pico_cyw43_driverandcyw43_drivernow support HCI communication for Bluetooth.cyw43_driver_picownow supports Pico W specific HCI communication for Bluetooth over SPI.cyw43_arch_init()andcyw43_arch_deinit()automatically handle Bluetooth support ifCYW43_ENABLE_BLUETOOTHis1(as it will be automatically if you depend onpico_btstack_cyw43).
Key changes since 1.5.0:
- Added Raspberry Pi specific BTstack license.
- The storage offset in flash for
pico_btstack_flash_bankcan be specified at runtime by definingpico_flash_bank_get_storage_offset_functo your own function to return the offset within flash. pico_btstack_flash_bankis now safe for multicore / FreeRTOS SMP use, as it uses the newpico_flashlibrary to make sure the other core is not accessing flash during flash updates. If you are usingpico_multicoreyou must have calledflash_safe_execute_core_initfrom the "other" core (to the one Bluetooth is running on).- Automatically set Bluetooth MAC address to the correct MAC address (Wi-Fi MAC address + 1), as some devices do not have it set in OTP and were using the same default MAC from the Bluetooth chip causing collisions.
- Various bug-fixes and stability improvements (especially with concurrent Wi-Fi), including updating
cyw43_driverandbtstackto the newest versions.
Authors
Thanks to the following for their contributions:
2bndy5,
agento2,
Andrew Burge,
Andrew Scheller,
arjunak234,
David Thacher,
djazz,
Graham Sanderson,
hubiscode,
James Hughes,
Luke Wren,
Malte Thiesen,
Michael Busby,
Mr. Green's Workshop,
Paul Grayson,
Peter Harper
SDK 1.5.0
This release contains new libraries and functionality, along with numerous bug fixes and documentation improvements.
Highlights are listed below, or you can see the full list of individual commits here, and the full list of resolved issues here.
Note, these release notes are long and may appear truncated in the "Releases" tab; you can see the full version here.
New Board Support
The following boards have been added and may be specified via PICO_BOARD:
nullbits_bit_c_prowaveshare_rp2040_lcd_1.28waveshare_rp2040_one
Library Changes/Improvements
hardware_clocks
clock_gpio_init()now takes afloatfor the clock divider value, rather than anint.- Added
clock_gpio_init_int_frac()function to allow initialization of integer and fractional part of the clock divider value, without usingfloat. - Added
--ref-minoption tovcocalc.pyto override the minimum reference frequency allowed. vcocalc.pynow additionally considers reference frequency dividers greater than 1.
hardware_divider
- Improved the performance of
hw_divider_functions.
hardware_dma
- Added
dma_sniffer_set_output_invert_enabled()anddma_sniffer_set_output_reverse_enabled()functions to configure the DMA sniffer. - Added
dma_sniffer_set_data_accumulator()anddma_sniffer_get_data_accumulator()functions to access the DMA sniffer accumulator.
hardware_i2c
- Added
i2c_get_instance()function for consistency with otherhardware_libraries. - Added
i2c_read_byte_raw(),i2c_write_byte_raw()functions to directly read and write the I2C data register for an I2C instance.
hardware_timer
- Added
hardware_alarm_claim_unused()function to claim an unused hardware timer.
pico_cyw43_arch
- Added
cyw43_arch_wifi_connect_bssid_variants ofcyw43_arch_wifi_connect_functions to allow connection to a specific access point. - Blocking
cyw43_arch_wifi_connect_functions now continue trying to connect rather than failing immediately if the network is not found. cyw43_arch_wifi_connect_functions now return consistent return codes (PICO_OK, orPICO_ERROR_XXX).- The
pico_cyw43_archlibrary has been completely rewritten on top of the newpico_async_contextlibrary that generically abstracts the different types of asynchronous operation (poll,threadsafe_backgroundandfreertos) previously handled in a bespoke fashion bypico_cyw43_arch. Many edge case bugs have been fixed as a result of this. Note that this change should be entirely backwards compatible from the user point of view. cyw43_arch_init()andcyw43_arch_deinit()functions are now very thin layers which handleasync_contextlife-cycles, along with adding support for thecyw43_driver, lwIP, BTstack etc. to thatasync_context. Currently, these mechanisms remain the preferred documented way to initialize Pico W networking, however you are free to do similar initialization/de-initialization yourself.- Added
cyw43_arch_set_async_context()function to specify a customasync_contextprior to callingcyw43_arch_init*() - Added
cyw43_arch_async_context()function to get theasync_contextused by the CYW43 architecture support. - Added
cyw43_arch_init_default_async_context()function to return theasync_contextthatcyw43_arch_init*()would initialize if one has not been set by the user. - Added
cyw43_arch_wait_for_work_until()function to block until there is networking work to be done. This is most useful forpollstyle applications that have no other work to do and wish to sleep untilcyw43_arch_poll()needs to be called again.
pico_cyw43_driver
- The functionality has been clarified into 3 separate libraries:
cyw43_driver- the raw cyw43_driver code.cyw43_driver_picow- additional support for communication with the Wi-Fi chip over SPI on Pico W.pico_cyw43_driver- integration of the cyw43_driver with thepico-sdkviaasync_context
- Added
CYW43_WIFI_NVRAM_INCLUDE_FILEdefine to allow user to override the NVRAM file.
pico_divider
- Improved the performance of 64-bit divider functions.
pico_platform
- Add
panic_compact()function that discards the message to save space in non-debug (NEBUGdefined) builds.
pico_runtime
- Added proper implementation of certain missing
newlibsystem APIs:_gettimeofday(),_times(),_isatty(),_getpid(). - The above changes enable certain additional C/C++ library functionality such as
gettimeofday(),times()andstd::chrono. - Added
settimeofday()implementation such thatgettimeofday()can be meaningfully used. - Added default (return
-1) implementations of the remainingnewlibsystem APIs:_open(),_close(),_lseek(),_fstat(),_isatty(),_kill(), to prevent warnings on GCC 12. - Made all
newlibsystem API implementations weak so the user can override them.
pico_stdio
pico_stdioallows for outputting from within an IRQ handler that creates the potential for deadlocks (especially withpico_stdio_usb), and the intention is to not deadlock but instead discard output in any cases where a deadlock would otherwise occur. The code has been revamped to avoid more deadlock cases, and a new definePICO_STDIO_DEADLOCK_TIMEOUT_MShas been added to catch remaining cases that might be caused by user level locking.- Added
stdio_set_chars_available_callback()function to set a callback to be called when input is available. See also the newPICO_STDIO_USB_SUPPORT_CHARS_AVAILABLE_CALLBACKandPICO_STDIO_UART_SUPPORT_CHARS_AVAILABLE_CALLBACKdefines which both default to1and control the availability of this new feature for USB and UART stdio respectively (at the cost of a little more code). - Improved performance of
stdio_semihosting. - Give the user more control over the USB descriptors of
stdio_usbviaUSBD_VID,USBD_PID,USBD_PRODUCT,PICO_STDIO_USB_CONNECTION_WITHOUT_DTRandPICO_STDIO_USB_DEVICE_SELF_POWERED
pico_sync
- Added
critical_section_is_initialized()function to test if a critical section has been initialized. - Added
mutex_try_enter_block_until()function to wait only up to a certain time to acquire a mutex.
pico_time
- Added
from_us_since_boot()function to convert auint64_ttimestamp to anabsolute_time_t. - Added
absolute_time_min()function to return the earlier of twoabsolute_time_tvalues. - Added
alarm_pool_create_with_unused_hardware_alarm()function to create an alarm pool using a hardware alarm number claimed usinghardware_alarm_claim(). - Added
alarm_pool_core_num()function to determine what core an alarm pool runs on. - Added
alarm_pool_add_alarm_at_force_in_context()function to add an alarm, and have it always run in the IRQ context even if the target time is in the past, or during the call. This may be simpler in some cases than dealing with thefire_if_pastparameters to existing functions, and avoids some callbacks happening from non IRQ context.
pico_lwip
- Added
pico_lwip_mqttlibrary to expose the MQTT app functionality in lwIP. - Added
pico_lwip_mdnslibrary to expose the MDNS app functionality in lwIP. - Added
pico_lwip_freertoslibrary forNO_SYS=0with FreeRTOS as a complement topico_lwip_nosysforNO_SYS=1.
TinyUSB
- TinyUSB has upgraded from 0.12.0 to 0.15.0. See TinyUSB release notes here for details.
- Particularly host support should be massively improved.
- Defaulted new TinyUSB
dcd_rp2040driver'sTUD_OPT_RP2040_USB_DEVICE_UFRAME_FIXvariable to1as a workaround for errata RP2040-E15. This fix is required for correctness, but comes at the cost of some performance, so applications that won't ever be plugged into a Pi 4 or Pi 400 can optionally disable this by setting the value ofTUD_OPT_RP2040_USB_DEVICE_UFRAME_FIXto0either viatarget_compile_definitionsin theirCMakeLists.txtor in theirtusb_config.h.
New Libraries
pico_async_context
- Provides support for asynchronous events (timers/IRQ notifications) to be handled in a safe context without concurrent execution (as required by many asynchronous 3rd party libraries).
- Provides implementations matching those previously implemented in
pico_cyw43_arch:poll- Not thread-safe; the user must callasync_context_poll()periodically from their main loop, but can callasync_context_wait_for_work_until()to block until work is required.threadsafe_background- No polling is required; instead asynchronous work is performed in a low priority IRQ. Locking is provided such that IRQ/non-IRQ or multiple cores can interact safely.freertos- Asynchronous work is performed in a separate FreeRTOS task.
async_contextguarantees all callbacks happen on a single core.async_contextsupports multiple instances for providing independent context which can execute concurrently with respect to each other.
pico_i2c_slave
- A (slightly modified) pico_i2c_slave library from https://github.com/vmilea/pico_i2c_slave
- Adds a callback style event API for handling I2C slave requests.
pico_mbedtls
- Added
pico_mbedtlslibrary to provide MBed TLS support. You can depend on bothpico_lwip_mbedtlsandpico_mbedtlsto use MBed TLS and lwIP together. See the tls_client example inpico-examplesfor more details.
pico_rand
- Implements a new Random Number Generator API.
pico_randgenerates rando...
SDK version 1.4.0
This release adds wireless support for the Raspberry Pi Pico W, adds support for other new boards, and contains various
bug fixes, documentation improvements, and minor improvements/added functionality. You can see the full list of individual commits here.
New Board Support
The following boards have been added and may be specified via PICO_BOARD:
pico_wdatanoisetv_rp2040_dspsolderparty_rp2040_stamp_round_carrier
Wireless Support
-
Support for the Raspberry Pi Pico W is now included with the SDK (
PICO_BOARD=pico_w). The Pico W uses a driver
for the wireless chip calledcyw43_driverwhich is included as a submodule of the SDK. You need to initialize
this submodule for Pico W wireless support to be available. Note that the LED on the Pico W board is only
accessible via the wireless chip and can be accessed viacyw43_arch_gpio_put()and
cyw43_arch_gpio_get()(part of thepico_cyw43_archlibrary described below). As a result of the LED being on
the wireless chip, there is noPICO_DEFAULT_LED_PINsetting and the default LED based examples in pico-examples
do not work with the Pico W. -
IP support is provided by lwIP which is also included as a
submodule which you should initialize if you want to use it.The following libraries exposing lwIP functionality are provided by the SDK:
pico_lwip_core(included inpico_lwip)pico_lwip_core4(included inpico_lwip)pico_lwip_core6(included inpico_lwip)pico_lwip_netif(included inpico_lwip)pico_lwip_sixlowpan(included inpico_lwip)pico_lwip_ppp(included inpico_lwip)pico_lwip_api(this is a blocking API that may be used with FreeRTOS and is not included inpico_lwip)
As referenced above, the SDK provides a
pico_lwipwhich aggregates all of the commonly needed lwIP functionality.
You are of course free to use the substituent libraries explicitly instead.The following libraries are provided that contain the equivalent lwIP application support:
pico_lwip_snmppico_lwip_httppico_lwip_makefsdatapico_lwip_iperfpico_lwip_smtppico_lwip_sntppico_lwip_mdnspico_lwip_netbiospico_lwip_tftppico_lwip_mbedtls
-
Integration of the IP stack and the
cyw43_drivernetwork driver into the user's code is handled by
pico_cyw43_arch. Both the IP stack and the driver need to do work in response to network traffic, and
pico_cyw43_archprovides a variety of strategies for servicing that work. Four architecture variants
are currently provided as libraries:pico_cyw43_arch_lwip_poll- For using the RAW lwIP API (NO_SYS=1mode) with polling. With this architecture
the user code must periodically poll viacyw43_arch_poll()to perform background work. This architecture
matches the common use of lwIP on microcontrollers, and provides no multicore safetypico_cyw43_arch_lwip_threadsafe_background- For using the RAW lwIP API (NO_SYS=1mode) with multicore
safety, and automatic servicing of thecyw43_driverand
lwIP in the background. User polling is not required with this architecture, but care should be taken as lwIP
callbacks happen in an IRQ context.pico_cyw43_arch_lwip_sys_freertos- For using the full lwIP API including blocking sockets in OS mode
(NO_SYS=0), along with multicore/task safety, and automatic servicing of thecyw43_driverand the lwIP
stack in a separate task. This powerful architecture works with both SMP and non-SMP variants of the RP2040 port
of FreeRTOS-Kernel. Note you must setFREERTOS_KERNEL_PATHin your build to use this variant.pico_cyw43_arch_none- If you do not need the TCP/IP stack but wish to use the on-board LED or other wireless
chip connected GPIOs.
See the library documentation or the
pico/cyw43_arch.hheader for more details.
Notable Library Changes/Improvements
hardware_dma
- Added
dma_unclaim_mask()function for un-claiming multiple DMA channels at once. - Added
channel_config_set_high_priority()function to set the channel priority via a channel config object.
hardware_gpio
-
Improved the documentation for the pre-existing gpio IRQ functions which use the "one callback per core" callback
mechanism,
and added agpio_set_irq_callback()function to explicitly set the callback independently of enabling per pin GPIO
IRQs. -
Reduced the latency of calling the existing "one callback per core" GPIO IRQ callback.
-
Added new support for the user to add their own shared GPIO IRQ handler independent of the pre-existing
"one callback per core" callback mechanism, allowing for independent usage of GPIO IRQs without having to share one
handler.
See
the
documentation inhardware/irq.hfor full details of the functions added:gpio_add_raw_irq_handler()gpio_add_raw_irq_handler_masked()gpio_add_raw_irq_handler_with_order_priority()gpio_add_raw_irq_handler_with_order_priority_masked()gpio_remove_raw_irq_handler()gpio_remove_raw_irq_handler_masked()
-
Added a
gpio_get_irq_event_mask()utility function for use by the new "raw" IRQ handlers.
hardware_irq
- Added
user_irq_claim(),user_irq_unclaim(),user_irq_claim_unused()anduser_irq_is_claimed()
functions for claiming ownership of the user IRQs (the ones numbered 26-31 and not connected to any hardware).
Uses of the user IRQs have been updated to use these functions. Forstdio_usb, thePICO_STDIO_USB_LOW_PRIORITY_IRQdefine is still respected if specified, but otherwise an unclaimed one is
chosen. - Added an
irq_is_shared_handler()function to determine if a particular IRQ uses a shared handler.
pico_sync
- Added a
sem_try_acquire()function, for non blocking acquisition of a semaphore.
pico_stdio
stderris now supported and goes to the same destination asstdout.- Zero timeouts for
getchar_timeout_us()are now correctly honored (previously they were a 1us minimum).
stdio_usb
- stdio over USB can now be used even if you are linking to
tinyusb_deviceyourself. If you have a CDC device in your device descriptors, you can usepico_enable_stdio_usb(TARGET 1)in yourCMakeLists.txt - The use of a 1ms timer to handle background TinyUSB work has been replaced with use of a more interrupt driven
approach using a user IRQ for better performance. Note this new feature is disabled if shared IRQ handlers
are disabled viaPICO_DISABLE_SHARED_IRQ_HANDLERS=1
miscellaneous
get_core_num()has been moved topico/platform.hfromhardware/sync.h.- The C library function
realloc()is now multicore safe too. - The minimum PLL frequency has been increased from 400Mhz to 750Mhz to improve stability across operating
conditions. This should not affect the majority of users in any way, but may impact those trying to set
particularly low clock frequencies. If you do wish to return to the previous
minimum, you can setPICO_PLL_VCO_MIN_FREQ_MHZback to400. There is also a newPICO_PLL_VCO_MAX_FREQ_MHZ
which defaults to1600.
Build
- Compilation with GCC 12 is now supported.
SDK version 1.3.1
This release contains numerous bug fixes and documentation improvements which are not all listed here; you can see the full list of individual commits here.
New Board Support
The following boards have been added and may be specified via PICO_BOARD:
adafruit_kb2040adafruit_macropad_rp2040eetree_gamekit_rp2040garatronic_pybstick26_rp2040(renamed frompybstick26_rp2040)pimoroni_badger2040pimoroni_motor2040pimoroni_servo2040pimoroni_tiny2040_2mbseeed_xiao_rp2040solderparty_rp2040_stamp_carriersolderparty_rp2040_stampwiznet_w5100s_evb_pico
Notable Library Changes/Improvements
hardware_dma
- New documentation has been added to the
dma_channel_abort()function describing errata RP2040-E13, and how to work around it.
hardware_irq
- Fixed a bug related to removing and then re-adding shared IRQ handlers. It is now possible to add/remove handlers as documented.
- Added new documentation clarifying the fact the shared IRQ handler ordering "priorities" have values that increase with higher priority vs Cortex M0+ IRQ priorites which have values that decrease with priority!
hardware_pwm
- Added a
pwm_config_set_clkdiv_int_frac()method to complementpwm_config_set_clkdiv_int()andpwm_config_set_clkdiv().
hardware_pio
- Fixed the
pio_set_irqn_source_mask_enabled()method which previously affected the wrong IRQ.
hardware_rtc
- Added clarification to
rtc_set_datetime()documentation that the new value may not be visible to artc_get_datetime()very soon after, due to crossing of clock domains.
pico_platform
- Added a
busy_wait_at_least_cycles()method as a convenience method for a short tight-loop counter-based delay.
pico_stdio
- Fixed a bug related to removing stdio "drivers".
stdio_set_driver_eabled()can now be used freely to dynamically enable and disable drivers during runtime.
pico_time
- Added an
is_at_the_end_of_time()method to check if a given time matches the SDK's maximum time value.
Runtime
- A bug in
__ctzdi2()aka__builtin_ctz(uint64_t)was fixed.
Build
- Compilation with GCC 11 is now supported.
PIOASM_EXTRA_SOURCE_FILESis now actually respected.
pioasm
- Input files with Windows (CRLF) line endings are now accepted.
- A bug in the python output was fixed.
elf2uf2
- Extra padding was added to the UF2 output of misaligned or non-contiguous binaries to work around errata RP2040-E14.
Note the 1.3.0 release of the SDK incorrectly squashed the history of the changes. A new merge commit has been added to restore the full history, and the 1.3.0 tag has been updated
SDK version 1.3.0
This release contains numerous bug fixes and documentation improvements. Additionally, it contains the following notable changes/improvements:
Updated TinyUSB to 0.12.0
- The
lib/tinyusbsubmodule has been updated from 0.10.1 to 0.12.0. See https://github.com/hathach/tinyusb/releases/tag/0.11.0 and https://github.com/hathach/tinyusb/releases/tag/0.12.0 for release notes. - Improvements have been made for projects that include TinyUSB and also compile with enhanced warning levels and
-Werror. Warnings have been fixed in rp2040 specific TinyUSB code, and in TinyUSB headers, and a new cmake functionsuppress_tinyusb_warnings()has been added, that you may call from yourCMakeLists.txtto suppress warnings in other TinyUSB C files.
New Board Support
The following boards have been added and may be specified via PICO_BOARD:
adafruit_trinkey_qt2040melopero_shake_rp2040pimoroni_interstate75pimoroni_plasma2040pybstick26_rp2040waveshare_rp2040_lcd_0.96waveshare_rp2040_plus_4mbwaveshare_rp2040_plus_16mbwaveshare_rp2040_zero
Updated SVD, hardware_regs, hardware_structs
The RP2040 SVD has been updated, fixing some register access types and adding new documentation.
The hardware_regs headers have been updated accordingly.
The hardware_structs headers which were previously hand coded, are now generated from the SVD, and retain select documentation from the SVD, including register descriptions and register bit-field tables.
e.g. what was once
typedef struct {
io_rw_32 ctrl;
io_ro_32 fstat;
...becomes:
// Reference to datasheet: https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf#tab-registerlist_pio
//
// The _REG_ macro is intended to help make the register navigable in your IDE (for example, using the "Go to Definition" feature)
// _REG_(x) will link to the corresponding register in hardware/regs/pio.h.
//
// Bit-field descriptions are of the form:
// BITMASK [BITRANGE]: FIELDNAME (RESETVALUE): DESCRIPTION
typedef struct {
_REG_(PIO_CTRL_OFFSET) // PIO_CTRL
// PIO control register
// 0x00000f00 [11:8] : CLKDIV_RESTART (0): Restart a state machine's clock divider from an initial phase of 0
// 0x000000f0 [7:4] : SM_RESTART (0): Write 1 to instantly clear internal SM state which may be otherwise difficult...
// 0x0000000f [3:0] : SM_ENABLE (0): Enable/disable each of the four state machines by writing 1/0 to each of these four bits
io_rw_32 ctrl;
_REG_(PIO_FSTAT_OFFSET) // PIO_FSTAT
// FIFO status register
// 0x0f000000 [27:24] : TXEMPTY (0xf): State machine TX FIFO is empty
// 0x000f0000 [19:16] : TXFULL (0): State machine TX FIFO is full
// 0x00000f00 [11:8] : RXEMPTY (0xf): State machine RX FIFO is empty
// 0x0000000f [3:0] : RXFULL (0): State machine RX FIFO is full
io_ro_32 fstat;
...Behavioral Changes
There were some behavioral changes in this release:
pico_sync
SDK 1.2.0 previously added recursive mutex support using the existing (previously non-recursive) mutex_ functions. This caused a performance regression, and the only clean way to fix the problem was to return the mutex_ functions to their pre-SDK 1.2.0 behavior, and split the recursive mutex functionality out into separate recursive_mutex_ functions with a separate recursive_mutex_ type.
Code using the SDK 1.2.0 recursive mutex functionality will need to be changed to use the new type and functions, however as a convenience, the pre-processor define PICO_MUTEX_ENABLE_SDK120_COMPATIBILITY may be set to 1 to retain the SDK 1.2.0 behavior at the cost of an additional performance penalty. The ability to use this pre-processor define will be removed in a subsequent SDK version.
pico_platform
pico.hand its dependencies have been slightly refactored so it can be included by assembler code as well as C/C++ code. Thie ensures that assembler code and C/C++ code follow the same board configuration/override order and see the same configuration defines. This should not break any existing code, but is notable enough to mention.pico/platform.his now fully documented.
pico_standard_link
-Wl,max-page-size=4096 is now passed to the linker, which is beneficial to certain users and should have no discernible impact on the rest.
Other Notable Improvements
hardware_base
- Added
xip_noalloc_alias(addr),xip_nocache_alias(addr),xip_nocache_noalloc_alias(addr)macros for converting a flash address between XIP aliases (similar to thehw_xxx_alias(addr)macros).
hardware_dma
- Added
dma_timer_claim(),dma_timer_unclaim(),dma_claim_unused_timer()anddma_timer_is_claimed()to manage ownership of DMA timers. - Added
dma_timer_set_fraction()anddma_get_timer_dreq()to facilitate pacing DMA transfers using DMA timers.
hardware_i2c
- Added
i2c_get_dreq()function to facilitate configuring DMA transfers to/from an I2C instance.
hardware_irq
- Added
irq_get_priority(). - Fixed implementation when
PICO_DISABLE_SHARED_IRQ_HANDLERS=1is specified, and allowedirq_add_shared_handlerto be used in this case (as long as there is only one handler - i.e. it behaves exactly likeirq_set_exclusive_handler), - Sped up IRQ priority initialization which was slowing down per core initialization.
hardware_pio
pio_encode_functions inhardware/pico_instructions.hare now documented.
hardware_pwm
- Added
pwm_get_dreq()function to facilitate configuring DMA transfers to a PWM slice.
hardware_spi
- Added
spi_get_dreq()function to facilitate configuring DMA transfers to/from an SPI instance.
hardware_uart
- Added
uart_get_dreq()function to facilitate configuring DMA transfers to/from a UART instance.
hardware_watchdog
- Added
watchdog_enable_caused_reboot()to distinguish a watchdog reboot caused by a watchdog timeout after callingwatchdog_enable()from other watchdog reboots (e.g. that are performed when a UF2 is dragged onto a device in BOOTSEL mode).
pico_bootrom
- Added new constants and function signature typedefs to
pico/bootrom.hto facilitate calling bootrom functions directly.
pico_multicore
- Improved documentation in
pico/multicore.h; particularly,multicore_lockout_functions are newly documented.
pico_platform
PICO_RP2040is now defined to 1 inPICO_PLATFORM=rp2040(i.e. normal) builds.
pico_stdio
- Added
puts_raw()andputchar_raw()to skip CR/LF translation if enabled. - Added
stdio_usb_connected()to detect CDC connection when usingstdio_usb. - Added
PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MSdefine that can be set to wait for a CDC connection to be established during initialization ofstdio_usb. Note: value -1 means indefinite. This can be used to prevent initial program output being lost, at the cost of requiring an active CDC connection. - Fixed
semihosting_putcwhich was completely broken.
pico_usb_reset_interface
- This new library contains
pico/usb_reset_interface.hsplit out fromstdio_usbto facilitate inclusion in external projects.
CMake build
OUTPUT_NAMEtarget property is now respected when generating supplemental files (.BIN,.HEX,.MAP,.UF2)
pioasm
- Operator precedence of
*,/,-,+have been fixed - Incorrect MicroPython output has been fixed.
elf2uf2
- A bug causing an error with binaries produces by certain other languages has been fixed.
SDK version 1.2.0
This release contains numerous bug fixes and documentation improvements. Additionally it contains the following improvements/notable changes:
Updated TinyUSB to 0.10.1
The lib/tinyusb submodule has been updated from 0.8.0 and now tracks upstream https://github.com/hathach/tinyusb.git. It is worth making sure you do a
git submodule sync
git submodule update
to make sure you are correctly tracking upstream TinyUSB if you are not checking out a clean pico-sdk repository.
Note also that moving ffrom TinyUSB 0.8.0 to TinyUSB 0.10.1 may require some minor changes to your USB code.
New/improved board headers
- New board headers support for PICO_BOARDs
arduino_nano_rp240_connect,pimoroni_picolipo_4mbandpimoroni_picolipo_16mb - Missing/new
#definesfor default SPI and I2C pins have been added
Added CMSIS core headers
CMSIS core headers (e.g. core_cm0plus.h and RP2040.h) are made available via cmsis_core INTERFACE library. Additionally, CMSIS standard exception naming is available via PICO_CMSIS_RENAME_EXCEPTIONS=1
API improvements
pico_sync
- Added support for recursive mutexes via
recursive_mutex_init()andauto_init_recursive_mutex() - Added
mutex_enter_timeout_us() - Added
critical_section_deinit() - Added
sem_acquire_timeout_ms()andsem_acquire_block_until()
hardware_adc
- Added
adc_get_selected_input()
hardware_clocks
clock_get_hz()now returns actual achieved frequency rather than desired frequency
hardware_dma
- Added
dma_channel_is_claimed() - Added new methods for configuring/acknowledging DMA IRQs.
dma_irqn_set_channel_enabled(),dma_irqn_set_channel_mask_enabled(),dma_irqn_get_channel_status(),dma_irqn_acknowledge_channel()etc.
hardware_exception
New library for setting ARM exception handlers:
- Added
exception_set_exclusive_handler(),exception_restore_handler(),exception_get_vtable_handler()
hardware_flash
- Exposed previously private function
flash_do_cmd()for low level flash command execution
hardware_gpio
- Added
gpio_set_input_hysteresis_enabled(),gpio_is_input_hysteresis_enabled(),gpio_set_slew_rate(),gpio_get_slew_rate(),gpio_set_drive_strength(),gpio_get_drive_strength().gpio_get_out_level(),gpio_set_irqover()
hardware_i2c
- Corrected a number of incorrect hardware register definitions
- A number of edge case in the i2c code fixed
hardware_interp
- Added
interp_lane_is_claimed(),interp_unclaim_lane_mask()
hardware_irq
- Notably fixed the
PICO_LOWEST/HIGHEST_IRQ_PRIORITYvalues which were backwards!
hardware_pio
- Added new methods for configuring/acknowledging PIO interrupts (
pio_set_irqn_source_enabled(),
pio_set_irqn_source_mask_enabled(),pio_interrupt_get(),pio_interrupt_clear()etc.) - Added
pio_sm_is_claimed()
hardware_spi
- Added
spi_get_baudrate() - Changed
spi_init()to return the set/achieved baud rate rather than void - Changed
spi_is_writable()to return bool not size_t (it was always 1/0)
hardware_sync
- Notable documentation improvements for spin lock functions
- Added
spin_lock_is_claimed()
hardware_timer
- Added
busy_wait_ms()to matchbusy_wait_us() - Added
hardware_alarm_is_claimed()
pico_float/pico_double
- Correctly save/restore divider state if floating point is used from interrupts
pico_int64_ops
- Added
PICO_INT64_OPS_IN_RAMflag to move code into RAM to avoid veneers when calling code is in RAM
pico_runtime
- Added ability to override panic function by setting
PICO_PANIC_FUNCTION=footo the usefooas the implementation, or setting
PICO_PANIC_FUNCITON=to simply breakpoint, saving some code space
pico_unique_id
- Added
pico_get_unique_board_id_string().
General code improvements
- Cleanup up some additional classes of compiler warnings
- Adding some missing
constto method parameters
SVD
- USB DPRAM for device mode is now included
pioasm
- Added
#pragma onceto C/C++ output
RTOS interoperability
Improvements designed to make porting RTOSes either based on the SDK or supporting SDK code easier.
- Added
PICO_DIVIDER_DISABLE_INTERRUPTSflag to optionally configure all uses of the hardware divider to be guarded by disabling interrupts, rather than requiring on the RTOS to save/restore the divider state on context switch - Added new abstractions to
pico/lock_core.hto allow an RTOS to inject replacement code for SDK based
low level wait, notify and sleep/timeouts used by synchonization primitives inpico_syncand forsleep_methods. If an RTOS implements these few simple methods, then all SDK semaphore, mutex, queue, sleep methods can be safely used both within/to/from RTOS tasks, but also to communicate with non RTOS task aware code, whether it be existing libraries and IRQ handlers or code running perhaps (though not necessarily) on the other core
CMake build changes
Substantive changes have been made to the CMake build, so if you are using a hand crafted non-CMake build, you will need to update your compile/link flags. Additionally changed some possibly confusing status messages from CMake build generation to be debug only
Boot Stage 2
- New boot stage 2 for
AT25SF128A