Releases: raspberrypi/pico-sdk
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_rp2350
datanoisetv_rp2350_dsp
hellbender_0001
machdyne_werkzeug
pico2_w
pimoroni_pico_plus2_w_rp2350
sparkfun_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=0
to 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_NEAREST
for controlling rounding of floating-point clock dividers
hardware_clocks
- Corrected spelling of
PICO_CLOCK_AJDUST_PERI_CLOCK_WITH_SYS_CLOCK
toPICO_CLOCK_ADJUST_PERI_CLOCK_WITH_SYS_CLOCK
. The former is still supported. vco_calc.py
now outputsSYS_CLK_HZ
in 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_NEAREST
for 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_execute
on FreeRTOS SMP
hardware_i2c
- Added
i2c_write_burst_blocking
andi2c_read_burst_blocking
to 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 otherclkdiv
methods. - 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 otherclkdiv
methods. - Added
PICO_PIO_CLKDIV_ROUND_NEAREST
for 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 otherclkdiv
methods. - Added
PICO_PWM_CLKDIV_ROUND_NEAREST
for 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
__HeapLimit
is now correctly set by the default linker scripts again- Fixed linker option
-Wl,--print-memory-usage
showing 100% RAM used
pico_clib_interface
- Made Some small improvements to
picolibc
integration
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_driver
to 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 otherclkdiv
methods - Renamed
CYW43_PIO_CLOCK_DIV_FRAC8
toCYW43_PIO_CLOCK_DIV_FRAC
. The old name is still supported - RISC-V is now supported
- Added
PICO_BTSTACK_CYW43_MAX_HCI_PROCESS_LOOP_COUNT
configuration 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_stage2
binary 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_LOW
setting 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_util
time 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_fifo
instructions
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
#defines
andCMake
build 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_board
will now setPICO_PLATFORM
if one is specified insome_board.h
since most boards either use exclusively RP2040 or RP2350. PICO_PLATFORM
also supportsrp2350
but this gets replaced with the valuePICO_DEFAULT_RP2350_PLATFORM
which you can set in your environment orCMakeLists.txt
. Many of the boards for RP2350 - includingpico2
- selectrp2350
as thePICO_BOARD
to 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_badge
gen4_rp2350_24
gen4_rp2350_24ct
gen4_rp2350_24t
gen4_rp2350_28
gen4_rp2350_28ct
gen4_rp2350_28t
gen4_rp2350_32
gen4_rp2350_32ct
gen4_rp2350_32t
gen4_rp2350_35
gen4_rp2350_35ct
gen4_rp2350_35t
hellbender_2350A_devboard
ilabs_challenger_rp2350_bconnect
ilabs_challenger_rp2350_wifi_ble
melopero_perpetuo_rp2350_lora
phyx_rick_tny_rp2350
pico2
pimoroni_pga2350
pimoroni_pico_plus2_rp2350
pimoroni_plasma2350
pimoroni_tiny2350
seeed_xiao_rp2350
solderparty_rp2350_stamp
solderparty_rp2350_stamp_xl
sparkfun_promicro_rp2350
switchscience_picossci2_conta_base
switchscience_picossci2_dev_board
switchscience_picossci2_micro
switchscience_picossci2_rp2350_breakout
switchscience_picossci2_tiny
tinycircuits_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_COPROCESSOR
define 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_TIMER
define indicates hardware support.
hardware_rcp (RP2350 Arm)
- Contains inline functions and assembler macros for the RCP (Redundancy Co-Processor) instructions.
HAS_REDUNDANCY_COPROCESSOR
define 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_WATCHDOG
is 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.EXTEXCLALL
must 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_runtime
by 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_ENABLED
which 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_bootrom
call the functions inpico_boot_lock
around affects bootrom functions, and thus will take and release locks ifPICO_BOOTROM_LOCKING_ENABLED=1
. NUM_BOOT_LOCKS
define 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_runtime
by default.
pico_crt0
- New library split out of
pico_standard_link
to 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_SIZE
chunk, to better match the standard behaviour.PICO_HEAP_SIZE
is the minimum heap size required, and space is required for it at link time.sbrk
in the previous SDK ignored it anyway and used the end of RAM so there is no functional change there.
- Included by
pico_runtime
by default
pico_cxx_options
- New library split out of
pico_standard_link
to configure C++ options. - Included by
pico_standard_link
by default.
pico_platform_compiler
- New library split out of
pico_platform
with the functions/macros related to the compiler. - Included by
pico_platform
by default.
pico_platform_panic
- New library split out of
pico_platform
with the panic function implementation. - Included by
pico_platform
by default.
pico_platform_sections
- New library split out of
pico_platform
with the section macros such as__not_in_flash_func
. - Included by
pico_platform
by 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_array
initialisers, the new runtime_init library: - Separates each initialiser out individually, for say initialiser "foo".
- Defines
PICO_RUNTIME_INIT_FOO
which 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_FOO
is not set, it adds the initialiser entry to callruntime_init_foo()
beforemain
(or per core initialisation). - If
PICO_RUNTIME_NO_INIT_FOO
is 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_runtime
by 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_link
that adds the "common" binary info items to the binary. - Included by
pico_standard_link
by 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_t
now always defaults touint64_t
regardless 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_I2C
bus 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_baudrate
functions 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_data
member toasync_when_pending_worker_t
to 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_PRODUCT
andUSBD_MANUFACTURER
can now be extended by defining
USBD_DESC_STR_MAX
. PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS
is 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_pll
andset_sys_clock_khz
methods 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_KHZ
is used in preference to the preexistingXOSC_MHZ
to 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_MHZ
will be automatically defined for backwards compatibility ifXOSC_KHZ
is an exact multiple of 1000 Khz. Note that eitherXOSC_MHZ
orXOSC_KHZ
may be specified by the user, but not both. - The new define
PLL_COMMON_REFDIV
can be specified to override the default reference divider of 1. - The new defines
PLL_SYS_VCO_FREQ_KHZ
,PLL_SYS_POSTDIV1
andPLL_SYS_POSTDIV2
are used to configure the system clock PLL during runtime initialization. These are defaulted for you ifSYS_CLK_KHZ=125000
,XOSC_KHZ=12000
andPLL_COMMON_REFDIV=1
. You can modify these values in yourCMakeLists.txt
if 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_POSTDIV1
andPLL_USB_POSTDIV2
are used to configure the USB clock PLL during runtime initialization. These are defaulted for you ifUSB_CLK_KHZ=48000
,XOSC_KHZ=12000
andPLL_COMMON_REFDIV=1
. You can modify these values in yourCMakeLists.txt
if you want to configure a different USB clock if you are using a non-standard crystal. - The new define
PICO_PLL_VCO_MIN_FREQ_KHZ
is 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_KHZ
is 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_multicore
to 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
unified
syntax.- New C macros
pico_default_asm( ... )
andpico_default_asm_volatile( ... )
are provided that are equivalent to__asm
and__asm volatile
blocks, but with a.syntax unified
at the beginning.
- New C macros
- A new assembler macro
pico_default_asm_setup
is 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_BOARD
andPICO_BOARD_HEADER_DIRS
now correctly use the latest environment variable value if present. -
A CMake performance regression due to repeated calls to
find_package
has 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 usepicolib
rather 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_context
backed 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
CMake
functionpico_btstack_make_gatt_header
can be used to run the BTstackcompile_gatt
tool to make a GATT header file from a BTstackGATT
file. pico_cyw43_driver
andcyw43_driver
now support HCI communication for Bluetooth.cyw43_driver_picow
now supports Pico W specific HCI communication for Bluetooth over SPI.cyw43_arch_init()
andcyw43_arch_deinit()
automatically handle Bluetooth support ifCYW43_ENABLE_BLUETOOTH
is1
(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_bank
can be specified at runtime by definingpico_flash_bank_get_storage_offset_func
to your own function to return the offset within flash. pico_btstack_flash_bank
is now safe for multicore / FreeRTOS SMP use, as it uses the newpico_flash
library to make sure the other core is not accessing flash during flash updates. If you are usingpico_multicore
you must have calledflash_safe_execute_core_init
from 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_driver
andbtstack
to 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_pro
waveshare_rp2040_lcd_1.28
waveshare_rp2040_one
Library Changes/Improvements
hardware_clocks
clock_gpio_init()
now takes afloat
for 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-min
option tovcocalc.py
to override the minimum reference frequency allowed. vcocalc.py
now 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_arch
library has been completely rewritten on top of the newpico_async_context
library that generically abstracts the different types of asynchronous operation (poll
,threadsafe_background
andfreertos
) 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_context
life-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_context
prior to callingcyw43_arch_init*()
- Added
cyw43_arch_async_context()
function to get theasync_context
used by the CYW43 architecture support. - Added
cyw43_arch_init_default_async_context()
function to return theasync_context
thatcyw43_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 forpoll
style 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-sdk
viaasync_context
- Added
CYW43_WIFI_NVRAM_INCLUDE_FILE
define 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 (NEBUG
defined) builds.
pico_runtime
- Added proper implementation of certain missing
newlib
system 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 remainingnewlib
system APIs:_open()
,_close()
,_lseek()
,_fstat()
,_isatty()
,_kill()
, to prevent warnings on GCC 12. - Made all
newlib
system API implementations weak so the user can override them.
pico_stdio
pico_stdio
allows 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_MS
has 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_CALLBACK
andPICO_STDIO_UART_SUPPORT_CHARS_AVAILABLE_CALLBACK
defines which both default to1
and 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_usb
viaUSBD_VID
,USBD_PID
,USBD_PRODUCT
,PICO_STDIO_USB_CONNECTION_WITHOUT_DTR
andPICO_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_t
timestamp to anabsolute_time_t
. - Added
absolute_time_min()
function to return the earlier of twoabsolute_time_t
values. - 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_past
parameters to existing functions, and avoids some callbacks happening from non IRQ context.
pico_lwip
- Added
pico_lwip_mqtt
library to expose the MQTT app functionality in lwIP. - Added
pico_lwip_mdns
library to expose the MDNS app functionality in lwIP. - Added
pico_lwip_freertos
library forNO_SYS=0
with FreeRTOS as a complement topico_lwip_nosys
forNO_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_rp2040
driver'sTUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX
variable to1
as 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_FIX
to0
either viatarget_compile_definitions
in theirCMakeLists.txt
or 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_context
guarantees all callbacks happen on a single core.async_context
supports 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_mbedtls
library to provide MBed TLS support. You can depend on bothpico_lwip_mbedtls
andpico_mbedtls
to use MBed TLS and lwIP together. See the tls_client example inpico-examples
for more details.
pico_rand
- Implements a new Random Number Generator API.
pico_rand
generates 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_w
datanoisetv_rp2040_dsp
solderparty_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_driver
which 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_arch
library described below). As a result of the LED being on
the wireless chip, there is noPICO_DEFAULT_LED_PIN
setting 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_lwip
which 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_snmp
pico_lwip_http
pico_lwip_makefsdata
pico_lwip_iperf
pico_lwip_smtp
pico_lwip_sntp
pico_lwip_mdns
pico_lwip_netbios
pico_lwip_tftp
pico_lwip_mbedtls
-
Integration of the IP stack and the
cyw43_driver
network 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_arch
provides 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=1
mode) 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=1
mode) with multicore
safety, and automatic servicing of thecyw43_driver
and
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_driver
and 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_PATH
in 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.h
header 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.h
for 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_IRQ
define 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
stderr
is 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_device
yourself. 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.h
fromhardware/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_MHZ
back 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_kb2040
adafruit_macropad_rp2040
eetree_gamekit_rp2040
garatronic_pybstick26_rp2040
(renamed frompybstick26_rp2040
)pimoroni_badger2040
pimoroni_motor2040
pimoroni_servo2040
pimoroni_tiny2040_2mb
seeed_xiao_rp2040
solderparty_rp2040_stamp_carrier
solderparty_rp2040_stamp
wiznet_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_FILES
is 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/tinyusb
submodule 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.txt
to 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_qt2040
melopero_shake_rp2040
pimoroni_interstate75
pimoroni_plasma2040
pybstick26_rp2040
waveshare_rp2040_lcd_0.96
waveshare_rp2040_plus_4mb
waveshare_rp2040_plus_16mb
waveshare_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.h
and 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.h
is 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=1
is specified, and allowedirq_add_shared_handler
to 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.h
are 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.h
to facilitate calling bootrom functions directly.
pico_multicore
- Improved documentation in
pico/multicore.h
; particularly,multicore_lockout_
functions are newly documented.
pico_platform
PICO_RP2040
is 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_MS
define 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_putc
which was completely broken.
pico_usb_reset_interface
- This new library contains
pico/usb_reset_interface.h
split out fromstdio_usb
to facilitate inclusion in external projects.
CMake build
OUTPUT_NAME
target 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_4mb
andpimoroni_picolipo_16mb
- Missing/new
#defines
for 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_PRIORITY
values 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_RAM
flag 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=foo
to the usefoo
as 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
const
to method parameters
SVD
- USB DPRAM for device mode is now included
pioasm
- Added
#pragma once
to 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_INTERRUPTS
flag 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.h
to allow an RTOS to inject replacement code for SDK based
low level wait, notify and sleep/timeouts used by synchonization primitives inpico_sync
and 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
1.1.2 bug fix release
Fixes issues with boot stage 2 selection
1.1.1 bug fix release
This fixes a number of bugs, and additionally adds support for a board configuration header to choose the boot_stage2