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 random numbers at runtime utilizing a number of possible entropy sources, and uses those sources to modify the state of a 128-bit 'Pseudo Random Number Generator' implemented in software.- Adds
get_rand_32(),get_rand_64()andget_rand_128()functions to return largely unpredictable random numbers (which should be different on each board/run for example).
Miscellaneous
- Added a new header
hardware/structs/nvic.hwith a struct for the Arm Cortex M0+ NVIC available via thenvic_hwpointer. - Added new
PICO_CXX_DISABLE_ALLOCATION_OVERRIDESwhich can be set to1if you do not wantpico_standard_linkto include non-exceptional overrides ofstd::new,std::new[],std::deleteandstd::delete[]when exceptions are disabled. elf2uf2now correctly usesLMAinstead ofVMAof the entry point to determine binary type (flash/RAM). This is required to support some exotic binaries correctly.
Build
- The build will now check for a functional compiler via the standard
CMakemechanism. - The build will pick up pre-installed
elf2uf2andpioasmif found via an installedpico-sdk-toolsCMakepackage. If it can do so, then no native compiler is required for the build! - It is now possible to switch the board type
PICO_BOARDin an existingCMakebuild directory. ARCHIVE_OUTPUT_DIRECTORYis now respected in build forUF2output files.- Spaces are now supported in the path to the
pico-sdk - All libraries
xxxin thepico-sdknow support axxx_headersvariant that just pulls in the libraries' headers. Thesexxx_headerslibraries correctly mirror the dependencies of thexxxlibraries, so you can usexxx_headersinstead ofxxxas your dependency if you do not want to pull in any implementation files (perhaps if you are making aSTATIClibrary). Actually the "all" is not quite true, non code libraries such aspico_standard_linkandpico_cxx_optionsare an exception.
Bluetooth Support for Pico W (BETA)
The support is currently available as a beta. More details will be forthcoming with the actual release.
In the meantime, there are examples in pico-examples.
Key changes:
- The Bluetooth API is provided by BTstack.
- The following new 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.
- Added
CMakefunctionpico_btstack_make_gatt_headerthat can be used to run the BTstackcompile_gatttool to make a GATT header file from a BTstackGATTfile. - Updated
pico_cyw43_driverandcyw43_driverto support HCI communication for Bluetooth. - Updated
cyw43_driver_picowto support Pico W specific HCI communication for Bluetooth over SPI. - Updated
cyw43_arch_init()andcyw43_arch_deinit()to additionally handle Bluetooth support ifCYW43_ENABLE_BLUETOOTHis1(as it will be automatically if you depend onpico_btstack_cyw43).
Authors
Thanks to the following for their contributions:
alastairpatrick,
Andrew Burge,
Andrew Scheller,
Attila Wagner,
bruelltuete,
Damien George,
Daniel Treffenstädt,
David Greaves,
DipSwitch,
Earle F. Philhower, III,
Engineer_Will,
envirocoder,
Flaviu Tamas,
Graham Sanderson,
James Peach,
Jan Niehusmann,
Jay Greco,
Jeremy Grosser,
Jonathan Bell,
Jonathan Reichelt Gjertsen,
KafCoppelia,
Koji KITAYAMA,
Liam Frasier,
Lord-Lucan,
Matthias Ringwald,
Mr. Green's Workshop,
Nicolas Pouillon,
Nikhil Dabas,
Patrick Plenefisch,
Pedro Tôrres,
Peter Harper,
Peter Pettersson,
Radoslav Gerganov,
ryanjsims,
Stargirl Flowers,
Thomas Roberts,
Timo Kokkonen