ITADN
raspberrypi/pico-sdk

版本发布 6

2.2.0
? · 2025-07-29

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](https://github.com/raspberrypi/pico-sdk/pulls?q=is%3Apr+milestone%3A2.2.0+is%3Amerged), and the full list of resolved issues [here](https://github.com/raspberrypi/pico-sdk/issues?q=is%3Aissue+milestone%3A2.2.0+is%3Aclosed). ### Board Support The following board configurations have been added and may be specified via `PICO_BOARD`: * `adafruit_feather_rp2040_adalogger` * `adafruit_fruit_jam` * `eelectronicparts_picomini_2mb` * `eelectronicparts_picomini_4mb` * `eelectronicparts_picomini_8mb` * `eelectronicparts_picomini_16mb` * `olimex_rp2350_xl` * `olimex_rp2350_xxl` * `sparkfun_iotredboard_rp2350` * `sparkfun_xrp_controller` * `uugear_wittypi5_hat_plus` * `waveshare_rp2350_usb_a` * `weact_studio_rp2350b_core` * `wiznet_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](https://rpltd.co/pico-c-sdk) for more details. There are two choices of embedded bootloader: 1. A slower, hardened one with side-channel resistance 2. 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](https://rpltd.co/pico-c-sdk) ### 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()` and `status_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 via `PICO_DEFAULT_LED_PIN` or 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 functions `status_let_set_state()` and `status_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 via `PICO_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=host` too, though does nothing ### Notable Library Changes/Improvements #### hardware_dma * Added `channel_config_set_read_address_update_type()` and `channel_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_increment` and `channel_config_set_write_increment` using 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_t` over `dma_channel_config` for consistency with other libraries * Updated the documentation for `dma_channel_set_transfer_count()`, `dma_channel_configure()`, `dma_channel_transfer_from_buffer_now` and `dma_channel_transfer_tobuffer_now` to 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()` and `dma_encode_endless_transfer_count()` as convenience methods to safely encode the `encoded_transfer_count` argument to these functions #### hardware_gpio * `gpio_acknowledge_irq` has 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 when `PICO_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_program` and `flash_do_cmd` now 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 for `no_flash` binaries 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()` and `powman_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()` and `powman_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 to `value == RCP_MASK_TRUE` which isn't #### hardware_watchdog * Added `watchdog_get_time_remaining_us()` to complement `watchdog_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_background` from both cores * Fixed a race condition in `async_context_execute_sync()` when using `pico_async_context_threadsafe_background` that might cause an assertion * Fixed a race condition in `async_context_deinit()` when using `pico_async_context_freertos` that might cause an assertion * Added support for FreeRTOS' `configSUPPORT_STATIC_ALLOCATION=1` when using `pico_async_context_freertos` #### pico_binary_info * Fixed compilation when used by C++ code #### pico_bootrom * Add `rom_pick_ab_partition_during_update` function to provide a wrapper around `rom_pick_ab_partition`, which is safe to call before calling `rom_explicit_buy` during a Flash Update boot or TBYB boot. During development, `rom_pick_ab_partition_during_update` was named `rom_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_ENABLED` for finer logging control * Fixed `btstack_cyw43_deinit()` to properly clean up the underlying `async_context` via a new `btstack_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 #### pico_clib_interface * Added a default weak implementation of `_get_entropy()` in `pico_newlib_interface` that returns -1 to avoid a linker warning. You can provide your own strong implementation if you wish to hook it up to `pico_rand` #### pico_crt0 * Added preprocessor defines that can be used for advanced control of the early application startup code: * Added `PICO_CRT0_NEAR_CALLS` which, when set to 1, allows the saving of a handful of bytes if the calls made from `pico_crt0` to the application (`main`, `runtime_init` etc.) are in a range <16M (e.g. from RAM->RAM or flash->flash) * Added `PICO_CRT0_NO_RESET_SECTION` to allow wholesale replacement of the `.reset` section containing the earliest startup code, while keeping the vector table * Added preprocessor defines that can be used for advanced control of the contents of the embedded `IMAGE_DEF` * Added `PICO_CRT0_INCLUDE_PICOBIN_VECTOR_TABLE_ITEM` if the user wants to override the default inclusion rules for the `VECTOR_TABLE` item * Added `PICO_CRT0_INCLUDE_PICOBIN_ENTRY_POINT_ITEM` if the user wants to override the default inclusion rules for the `ENTRY_POINT` item * Changed spacer sections (`.stack` and `.heap`) to be allocatable by default. Added `PICO_CRT0_ALLOCATE_SPACERS` to control this #### pico_cyw43_arch * Enumerated possible error codes for `pico_cyw43_arch` methods in the documentation #### pico_cyw43_driver * Added new preprocessor define `PICO_CYW43_LOGGING_ENABLED`, which can be set to 0 to disable all `cyw43-driver` logging even in debug builds * Upgraded lib/cyw43-driver to [1.1.0](https://github.com/georgerobotics/cyw43-driver/releases/tag/v1.1.0) * Note: this change has broken builds on GCC 6 and GCC 7 - please use a newer compiler version if you wish to use WiFi or Bluetooth #### pico_lwip * Upgraded lwIP to [2.2.1](https://savannah.nongnu.org/news/?id=10724) #### pico_mbedtls * Changed `makefsdata.py` slightly to allow it to recognize files that have been manually gzipped (e.g. "mysite.css.gz") and then send the proper Content-Encoding information in the response headers. * Upgraded Mbed TLS to [3.6.1](https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-3.6.1) #### pico_multicore * Fixed `multicore_lockout_` functions to be able to recover from a timeout situation (manifested as a problem with `flash_safe_execute()`) #### pico_runtime_init * Renamed `PICO_RUNTIME_SKIP_POST_CLOCK_RESETS` define to `PICO_RUNTIME_SKIP_INIT_POST_CLOCK_RESETS` which is consistent with all other similar `PICO_RUNTIME_` defines. This is a backwards incompatible change if you happened to be using it #### pico_stdio_usb * Added the following preprocessor defines to improve the flexibility of using `pico_stdio_usb` alongside direct usage of TinyUSB device mode by the application: * `PICO_STDIO_USB_ENABLE_IRQ_BACKGROUND_TASK` - whether `pico_stdio_usb` provides a background task to call `tud_task()` * `PICO_STDIO_USB_ENABLE_TINYUSB_INIT` - whether `pico_stdio_usb` calls `tusb_init()` during initialization * `PICO_STDIO_USB_USE_DEFAULT_DESCRIPTORS` - whether `pico_stdio_usb` is responsible for providing the CDC descriptors * Added `stdio_usb_call_chars_available_callback()` to allow an application with direct usage of TinyUSB device mode, to call the `stdio_chars_available_callback` in response to CDC events #### pico_time * Fixed `alarm_pool_destroy()` to "unclaim" the correct hardware alarm #### pico_unique_id * Moved runtime caching of the unique id earlier in the C library initialization process, so that it is available to C++ constructors. * Added `PICO_UNIQUE_BOARD_ID_INIT_PRIORITY` to allow the user to control this further ### Board Configuration * Added `CYW43_WL_GPIO_SMPS_PIN` to complement the pre-existing `CYW43_WL_GPIO_LED_PIN` and `CYW43_WL_GPIO_VBUS_PIN` * Reworked the mechanism used to make the board configuration headers have side effects on CMake variables, since the use of comments caused confusion: * Now prefer "pico_cmake_set(var, value)" over "// pico_cmake_set var = value" * Now prefer "pico_cmake_set_default(var, value)" over "// pico_cmake_set_default var = value" ### Host Build * Added `pico_rand` library * Enabled `hardware_irq` stub library, which was present before but not available ### Miscellaneous * Added "spare" IRQs to the SVD ### Documentation * Many miscellaneous improvements * A new section for documentation on SDK CMake functions has been added to the [C/C++ SDK book](https://rpltd.co/pico-c-sdk) * Many missing CMake variables and preprocessor defines have been added; these variables have been added to the [C/C++ SDK book](https://rpltd.co/pico-c-sdk) * Add new section on Signing & Encrypting on RP2350 to the [C/C++ SDK book](https://rpltd.co/pico-c-sdk) * Extended and fixed the list of web links in the API documentation ### Pioasm * Fixed C code generation for the `.mov_status irq set <n>` directive * Added `--version` option to print version information * Updated code generation to include the Pioasm version number as a comment in the generated files ### Build * GCC 15 is now supported * Clang 20.1 is now supported * Some changes were made to build more cleanly with C99 #### CMake Build * Improved handling of BIN/UF2/DIS/HEX output files when using Ninja. Ninja provides added functionality over Make which allows these files to be properly "cleaned" and regenerated if deleted. * The second argument of `pico_package_uf2_output` is now optional, and defaults to `0x10000000` (the start of flash) * Added `pico_ensure_load_map`, which ensures that `picotool seal` is invoked to add a `LOAD_MAP`, even when not signing or hashing * Added `pico_check_linker_script()`, which is called to warn of possible incompatibilities with custom linker scripts * Fixed default build type specification via `PICO_DEFAULT_BINARY_TYPE` * Fixed location of `.map` for certain Ninja builds * Added support for creating self-decrypting binaries * Added a warning when signing a binary with the provided "example" encryption keys #### Bazel Build * Updated Bazel to 8.1.0 * Allowed the user to disable adding of the default compiler flags `opt`, `debug` and `fastbuild` compilation modes, so the user can add their own. This is controlled by `//bazel/config:PICO_COMPILATION_NO_OPT_ARGS`, `//bazel/config:PICO_COMPILATION_NO_DEBUG_ARGS`, `//bazel/config:PICO_COMPILATION_NO_FASTBUILD_ARGS` * Added `//bazel/config:PICO_TINYUSB_CONFIG` to allow the user to specify the location of their own `tusb_config.h` ### New Examples There are new examples in the [pico_examples](https://github.com/raspberrypi/pico-examples) repository. Example|Description ---|--- [hello_encrypted](https://github.com/raspberrypi/pico-examples/blob/master/encrypted/hello_encrypted) | Create a self-decrypting binary, using the hardened decryption stage. This should be secure against side channel attacks. [hello_encrypted_mbedtls](https://github.com/raspberrypi/pico-examples/blob/master/encrypted/hello_encrypted) | Create a self-decrypting binary, using the MbedTLS decryption stage. This is not secure against side channel attacks, so is fast but provides limited protection. [uart_boot](https://github.com/raspberrypi/pico-examples/blob/master/bootloaders/uart) | A bootloader which boots a separate RP2350 using the UART boot interface. See section 5.8 in the datasheet for more details, including the wiring requirements [partition_info](https://github.com/raspberrypi/pico-examples/blob/master/flash/partition_info) | Extract and enumerate partition information (address ranges, permissions, IDs, and names) from the partition table [hello_freertos_static_allocation](https://github.com/raspberrypi/pico-examples/blob/master/freertos/hello_freertos) | Demonstrates how to run FreeRTOS on two cores with static RAM allocation. [picow_ota_update](https://github.com/raspberrypi/pico-examples/blob/master/pico_w/wifi/ota_update) | A minimal OTA update server (RP235x Only). See the separate [README](https://github.com/raspberrypi/pico-examples/blob/master/pico_w/wifi/ota_update/README.md) for more details. [status_blink](https://github.com/raspberrypi/pico-examples/blob/master/status_led/status_blink) | Blink the onboard LED using the status_led API. [color_blink](https://github.com/raspberrypi/pico-examples/blob/master/status_led/color_blink) | Blink the onboard colored (WS2812) LED using the colored_status_led API if supported by the board ### Modified Examples Example|Description ---|--- [hello_freertos_one_core](https://github.com/raspberrypi/pico-examples/blob/master/freertos/hello_freertos) | Demonstrates how to run FreeRTOS and tasks on one core (previously called `hello_freertos1`) [hello_freertos_two_cores](https://github.com/raspberrypi/pico-examples/blob/master/freertos/hello_freertos) | Demonstrates how to run FreeRTOS and tasks on two cores (previously called `hello_freertos2`). ### Authors Alex Brudner, Alexey Vazhnov, Andrew Brock, Andrew Scheller, Armando Montanez, BogDan Vatra, Brad Nolan, Caleb Jamison, Christopher Chamberlain, Damien George, Dan Halbert, David Dyck, Dryw Wade, eightycc, el-bert0, fadhil riyanto, Goran Miskovic, Graham Sanderson. Jack Whitham, Jeunese Payne, Joel Murphy, Luke Wren, Marek Küthe, Mark Hermeling Markus Gyger, Michael Brase, Patrick Plenefisch, Peter Harper, Philip Howard, rbryson74, Scott Shawcroft, Sergio R. Caprile, SFE-Brudnerd, sonodima, Timo Kokkonen, Tommy G, William Vinnicombe, UUGear

2.1.1预发布
? · 2025-02-19

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](https://github.com/raspberrypi/pico-sdk/pulls?q=is%3Apr+milestone%3A2.1.1+is%3Amerged), and the full list of resolved issues [here](https://github.com/raspberrypi/pico-sdk/issues?q=is%3Aissue+milestone%3A2.1.1+is%3Aclosed). ### Board Support The following board has been added and may be specified via `PICO_BOARD`: - `sparkfun_iotnode_lorawan_rp2350` - `waveshare_pico_cam_a` - `waveshare_rp2040_ble` - `waveshare_rp2040_eth` - `waveshare_rp2040_geek` - `waveshare_rp2040_matrix` - `waveshare_rp2040_pizero` - `waveshare_rp2040_power_management_hat_b` - `waveshare_rp2040_tiny` - `waveshare_rp2040_touch_lcd_1.28` - `waveshare_rp2350_eth` - `waveshare_rp2350_geek` - `waveshare_rp2350_lcd_0.96` - `waveshare_rp2350_lcd_1.28` - `waveshare_rp2350_one` - `waveshare_rp2350_plus_4mb` - `waveshare_rp2350_plus_16mb` - `waveshare_rp2350_tiny` - `waveshare_rp2350_touch_lcd_1.28` - `waveshare_rp2350_zero` The following board configurations have been modified: - `adafruit_feather_rp2350` - Increased the XOSC startup delay - `seeed_xiao_rp2350` - Increased the default SPI clock divider - `waveshare_rp2040_lcd_0.96` - Renamed `WAVESHARE_RP2040_LCD_*` constants to `WAVESHARE_LCD_*` - `waveshare_rp2040_lcd_1.28` - Renamed `WAVESHARE_RP2040_LCD_*` constants to `WAVESHARE_LCD_*` Note: the default `PICO_XOSC_STARTUP_DELAY_MULTIPLIER` if not specified by a board 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 `config_configure()` supporting the full range of clock dividers * Added `PICO_USE_FASTEST_SUPPORTED_CLOCK` and 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()` and `disable_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 gpio` with 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 after will return the right value #### pico_bootrom * Added `rom_data_lookup_inline()` to complement `rom_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 `cye43_driver` to revision `c1075d4b` * 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.h` across both RP2040 and RP2350 variants of `pico_double_pico` #### pico_float * Major cleanup, with much improved documentation * RP2350 `pico_float_pico_dcp` variant 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.h` across RP2040 and all RP2350 variants of `pico_float_pico` #### pico_flash * Fixed a build error when using FreeRTOS with `configSUPPORT_DYNAMIC_ALLOCATION=0` #### pico_lwip * Fixed build with `PPP_SUPPORT=1` when using `pico_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, allowing `multicore_lockout_victim_init()` to perform correctly after the reset #### pico_runtime_init * Added `SYS_CLK_VREG_VOLTAGE_AUTO_ADJUST` to indicate the voltage regular should be set to `SYS_CLK_VREG_VOLTAGE_MIN` during 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 via `pico_sha256_finish()` #### pico_stdio_usb * Allow user to override `CFG_TUD_CDC_RX_BUFSIZE`, `CFG_TUD_CDC_TX_BUFSIZE` and `CFG_TUD_CDC_EP_BUFSIZE` defines 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](https://github.com/hathach/tinyusb/releases/tag/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 `main` branch 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](https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/portable/ThirdParty/GCC/RP2040/FreeRTOS_Kernel_import.cmake) which works for both RP2040 and RP2350 ### Pioasm * Fixed encoding of `WAIT GPIO` with 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_ABORT` register 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()` * `.DIS` files 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.cmake` as it is copied into external projects ### Bazel Build * Updated LLVM/Clang toolchain to fix stack overflow issue with `fma()` relation math functions ### New Examples There are in the [pico_examples](https://github.com/raspberrypi/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](https://github.com/raspberrypi/pico-examples/tree/master/binary_info/blink_any) | Uses `bi_ptr` variables to create a configurable blink binary - see the separate [readme](https://github.com/raspberrypi/pico-examples/tree/master/binary_info/README.md) for mote details [binary_info/hello_anything](https://github.com/raspberrypi/pico-examples/tree/master/binary_info/hello_anything) | Uses `bi_ptr` variables to create a configurable hello_world binary - see the separate [readme](https://github.com/raspberrypi/pico-examples/tree/master/binary_info/README.md) for more details [i2c/slave_mem_i2c_burst](https://github.com/raspberrypi/pico-examples/tree/master/i2c/slave_mem_i2c) | 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](https://github.com/raspberrypi/pico-examples/tree/master/pico_w/wifi/blink) | 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](https://github.com/raspberrypi/pico-examples/tree/master/pico_w/wifi/blink) | 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](https://github.com/raspberrypi/pico-examples/tree/master/pico_w/wifi/http_client) | Demonstrates how to make http and https requests [pico_w/wifi/picow_http_client_verify](https://github.com/raspberrypi/pico-examples/tree/master/pico_w/wifi/http_client) | Demonstrates how to make a https request with server authentication [pico_w/wifi/freertos/picow_freertos_http_client_sys](https://github.com/raspberrypi/pico-examples/tree/master/pico_w/wifi/freertos/http_client) | Demonstrates how to make a https request in NO_SYS=0 (i.e. full FreeRTOS integration) [universal/blink](https://github.com/raspberrypi/pico-examples/tree/master/universal/CMakeLists.txt#L126) | Same as the [blink](blink) example, but universal. [universal/nuke_universal](https://github.com/raspberrypi/pico-examples/tree/master/universal/CMakeLists.txt#L132) | Same as the [flash/nuke](https://github.com/raspberrypi/pico-examples/tree/master/flash/nuke) example, but universal. On RP2350 runs as a packaged SRAM binary, so is written to flash and copied to SRAM by the bootloader #### Added in 2.1.1 timeframe Example|Description ---|--- [pico_w/wifi/mqtt/picow_mqtt_client](https://github.com/raspberrypi/pico-examples/tree/master/pico_w/wifi/mqtt) | Demonstrates how to implement a MQTT client application [uart_pio_dma](pio/uart_pio_dma) | Send and receive data from a UART implemented using the PIO and DMA [usb/device/dev_multi_cdc](https://github.com/raspberrypi/pico-examples/tree/master/usb/device/dev_multi_cdc) | A USB CDC device example with two serial ports, one of which is used for standard SDK stdio. The example exposes two serial ports over USB to the host. The first port is used for stdio, and the second port is used for a simple echo loopback. You can connect to the second port and send some characters, and they will be echoed back on the first port while you will receive a `"OK\r\n"` message on the second port indicating that the data was received. ### Authors Thanks to the following for their contributions: Steven Conaway, David Dyck, d-c-d, Liam Fraser, gazzyt, Hardy Griech, Wu Haotian, Dan Halbert, Peter Harper, Petr Hosek, Richard Hulme, HugoTro, Jean Jonethal, Osman Karaketir, Lesords, Gregory Neverov, nilswiersma, Matthias Ringwald, Graham Sanderson, Andrew Scheller, Matias Silva, Arkin Solomon, William Vinnicombe, Dryw Wade, waveshare, Luke Wren, Enrico Zaghini

2.1.0
? · 2024-11-25

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](https://github.com/raspberrypi/pico-sdk/pulls?q=is%3Apr+milestone%3A2.1.0+is%3Amerged), and the full list of resolved issues [here](https://github.com/raspberrypi/pico-sdk/issues?q=is%3Aissue+milestone%3A2.1.0+is%3Aclosed). ### Board Support The following board has been added and may be specified via `PICO_BOARD`: - `adafruit_feather_rp2350` - `datanoisetv_rp2350_dsp` - `hellbeder_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 SPCE - `pimoroni_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 to `hardware_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 set `PICO_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` to `PICO_CLOCK_ADJUST_PERI_CLOCK_WITH_SYS_CLOCK`. The former is still supported. * `vco_calc.py` now outputs `SYS_CLK_HZ` in the CMake output, which is required for `clock_get_hz(clk_sys)` to return the correct value * Renamed `clock_gpio_init_int_frac()` to `clock_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()` and `flash_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` and `i2c_read_burst_blocking` to send/receive multiple bytes without intervening stops. * Fixed rare hang during `i2c_read_blocking` #### hardware_interp * Renamed `interp_add_accumulater()` to `interp_add_accumulator()`. The old incorrect spelling is still supported. #### hardware_pio * Added `pio_sm_set_pins64()`, `pio_sm_set_pins_with_mask64()` and `pio_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()` to `sm_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 other `clkdiv` methods. * Renamed `pio_calculate_clkdiv_from_float()` to `pio_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 other `clkdiv` methods. * Added `PICO_PIO_CLKDIV_ROUND_NEAREST` for controlling rounding of floating-point clock dividers #### hardware_pwm * Renamed `pwm_config_set_clkdiv_int_frac()` to `pwm_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 other `clkdiv` 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 called `timer_hardware_alarm_get_irq_num()`. #### pico_aon_timer * Added `aon_timer_start_calendar()`, `aon_timer_set_time_calendar()`, `aon_timer_get_time_calendar()` and `aon_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 affects `rom_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 revision `cf924bb` * Renamed `cyw43_set_pio_clkdiv_int_frac()` to `cyw43_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 other `clkdiv` methods * Renamed `CYW43_PIO_CLOCK_DIV_FRAC8` to `CYW43_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()` and `realloc()` with `picolibc` #### 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 with `stdio_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()` and `tm_to_datetime()` for converting C library date/times to/from RP2040 RTC date/times * Added `pico_localtime_r()` and `pico_mktime()` for use by `pico_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](https://github.com/hathach/tinyusb/releases/tag/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, ...` and `mov ..., rx_fifo` instructions ### Build * Madebuild dependent on any signature files or embedded-partition-table JSON * Added back `.hex` file output (lost in 2.0.0) * Made `PICO_FLASH_SIZE_BYTES` and `PICO_CYW43_SUPPORTED` if specified in CMake, correctly affect the compiled code. * Various corrections to library dependencies * Added `PANIC` and `AUTO_INIT_MUTEX` options to `pico_minimize_runtime()` * Made `boot_stage2` build reproducible (same binary if no source changes) #### Bazel Build * Add support for building on Raspberry Pi OS * More CMake build configuration options supported * Preview support for Wi-Fi builds ### Authors Thanks to the following for their contributions: anhnhancao, Andrew Featherstone, Andrew Burge, Andrew Scheller, Armando Montanez, Caleb Jamison, Chris Boross, Dave Roth, David Goffredo, Dhiru Kholia, Dranoel, Dryw Wade, Earle F. Philhower, Giampiero Baggiani, Graham Sanderson, Gregory Neverov, Hugh Nixon, iCMDdev, inc, Ikko Eltociear Ashimine, Jack Wilsdon, jaguilar, Koji KITAYAMA, Liam Fraser, Luke Wren, Machdyne UG, Matt Bennett, Mete Balcı, newbrain, Nhan Cao, Nikhil Dabas, Peter Harper, Petr Hosek, Philip Howard, Scott Shawcroft, seesturm, Stanislav Rubint, Stefan Kerkmann, Sylwester, Taylor Cramer, theshteves, Thomas Watson, Tobias Simetsreiter, William Vinnicombe, yh-sb

SDK 2.0.02.0.0
? · 2024-08-08

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](https://https://rptl.io/rp2350-datasheet) * There is a lot of new functionality in the SDK, it is also worth reading the [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-c-sdk) book. This also includes documentation for RP2040 and RP2350 APIs, along with much more complete documentation of SDK `#defines` and `CMake` 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) or `rp2350-risc-v` (RISC-V) as well as the previous `rp2040` (default) and `host`. * Setting `PICO_BOARD=some_board` will now set `PICO_PLATFORM` if one is specified in `some_board.h` since most boards either use exclusively RP2040 or RP2350. * `PICO_PLATFORM` also supports `rp2350` but this gets replaced with the value `PICO_DEFAULT_RP2350_PLATFORM` which you can set in your environment or `CMakeLists.txt`. Many of the boards for RP2350 - including `pico2`- select `rp2350` as the `PICO_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](https://https://rptl.io/rp2350-datasheet) "Bootrom Concepts" section, and also the [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-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 in `pico_runtime_init`. * 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 in `pico_boot_lock` around affects bootrom functions, and thus will take and release locks if `PICO_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 call `runtime_init_foo()` before `main` (or per core initialisation). * If `PICO_RUNTIME_NO_INIT_FOO` is not set, it adds the (weak) implementation of `runtime_init_foo()`. * 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 to `uint64_t` regardless of the type of build. You can set `PICO_OPAQUE_ABSOLUTE_TIME_T=1` to make it a struct in all build types. #### pico_binary_info * Now supports > 32 GPIO pins when `PICO_BINARY_INFO_USE_PINS_64=1` - this is defaulted for you based on the number of GPIOs on the board. #### hardware_adc * `PARAM_ASSERTIONS_ENABLED_ADC` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_ADC` - the old define is still supported as a fallback. * `ADC_TEMPERATURE_CHANNEL_NUM` added since this value varies between RP2040 and RP2350. #### hardware_clocks * `set_sys_clock_` functions are now in `hardware/clocks.h`. * Clock configuration. * `PLL_COMMON_REFDIV` is deprecated in favour of `PLL_SYS_REFDIV` and `PLL_USB_REFDIV`. * `PLL_SYS_VCO_FREQ_HZ` is new and preferred over `PLL_SYS_VCO_FREQ_KHZ`. * `PLL_USB_VCO_FREQ_HZ` is new and preferred over `PLL_USB_VCO_FREQ_KHZ`. * `XOSC_HZ`, `SYS_CLK_HZ`, `USB_CLK_HZ` now added, and take preference over the still supported `XOSC_KHZ`, `SYS_CLK_KHZ`, and `USB_CLK_KHZ`. * `set_sys_clock_hz()` and `check_sys_clock_hz()` added. * `clock_configure_undivided()` and `clock_configure_int_divider()` for no divisor or a whole integer divider as the code doesn't require 64-bit arithmetic and thus saves space. * The `enum clock_index` no longer exists and has been replaced with `clock_num_t`. However, all clock functions now take `clock_handle_t` to allow for future enhancement. This is currently just an alias for `clock_num_t` * [vcocalc.py](src/rp2_common/hardware_clocks/scripts/vcocalc.py) can now be used to generate the `CMake` configuration for a particular clock setting. * The default system clock on RP2350 is 150Mhz. #### hardware_divider * Since the RP2350 processors have efficient divider instructions, RP2350 has no SIO HW Divider. Software versions of the `hardware_divider` functions are provided for RP2350. * `HAS_SIO_DIVIDER` define is now provided for you. #### hardware_dma * `PARAM_ASSERTIONS_ENABLED_DMA` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_DMA` - the old define is still supported as a fallback. * Added `dma_get_irq_num()`function and `DMA_IRQ_NUM()` macro to return the process IRQ Number for the _n_ th DMA IRQ. * `NUM_DMA_IRQS` define is provided for you. * it is 2 on RP2040 and 4 on RP2350. #### hardware_exception * `PARAM_ASSERTIONS_ENABLED_EXCEPTION` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_EXCEPTION` - the old define is still supported as a fallback. * Added RISC-V support. * exception numbers are processor exception `cause` numbers. * `exeception_[get|set]_priority()` are added for Arm. #### hardware_flash * `PARAM_ASSERTIONS_ENABLED_FLASH` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_FLASH` - the old define is still supported as a fallback. * `flash_flush_cache()` is added. #### hardware_gpio * `PARAM_ASSERTIONS_ENABLED_GPIO` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_GPIO` - the old define is still supported as a fallback. * The `enum gpio_function` no longer exists and has been replaced with `gpio_function_t`. * `gpio_xxx_masked()` functions now have a `gpio_xxx_masked64()` variant that takes a 64-bit mask of GPIO indexes. * `gpio_xxx_mask()` functions now have a `gpio_xxx_mask64()` variant that takes a 64-bit mask of GPIO indexes. * `gpio_get_all64()` added to read the state of >32 pins. * `gpio_put_all64()` added to write the state of >32 pins. * On Arm RP2350 GPIO Co-Processor instructions are used by default. This is controlled via `PICO_USE_GPIO_COPROCESSOR`. * `HAS_GPIO_COPROCESSOR` define indicates hardware support. #### hardware_i2c * `PARAM_ASSERTIONS_ENABLED_I2C` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_I2C` - the old define is still supported as a fallback. * `PICO_DEFAULT_I2C_INSTANCE()` macro added which is equivalent to the pre-existing `i2c_default` * Added `I2C_NUM()`, `I2C_INSTANCE()`, `I2C_DREQ_NUM()` macros to abstract differences between platforms. * Fixed per-character timeouts. #### hardware_interp * `PARAM_ASSERTIONS_ENABLED_INTERP` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_INTERP` - the old define is still supported as a fallback. #### hardware_irq * `PARAM_ASSERTIONS_ENABLED_IRQ` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_IRQ` - the old define is still supported as a fallback. * `irq_xxx_mask_xxx()` functions now have a `gpio_xxx_mask_n_xxx()` variant that affects the _n_ th set of 32 IRQs * Expose `runtime_init_per_core_irq_priorities()` function * Added `irq_set_riscv_vector_handler()` function to replace code entries in the machine vector table. #### hardware_pio * `PARAM_ASSERTIONS_ENABLED_PIO` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_PIO` - the old define is still supported as a fallback. * `PICO_PIO_VERSION` is used to determine whether new RP2350 functionality (`PICO_PIO_VERSION=1`) is supported. This is defaulted based on the platform. * `PICO_PIO_USE_GPIO_BASE` is used to determine whether support is enabled for GPIOs above 32. TThe default value is set based on the chip package. * Added `pio_sm_set_jmp_pin()`. * Added `pio_claim_free_sm_and_add_program()`, `pio_claim_free_sm_and_add_program_for_gpio_range()` and `pio_remove_program_and_unclaim_sm() to simplify finding and claiming a free PIO instance and state machine and installing programs. * Added `pio_get_irq_num()`function to return the process IRQ Number for the _n_ th PIO IRQ for a PIO instance. * Added `PIO_NUM()`, `PIO_INSTANCE()`, `PIO_IRQ_NUM()`, `PIO_DREQ_NUM()` and `PIO_FUNCSEL_NUM()` macros to abstract differences between platforms. * Added `sm_config_set_out_pin_base()` and `sm_config_set_out_pin_count()`. * Added `sm_config_set_in_pin_base()` and `sm_config_set_in_pin_count()`. Note the latter is only meaningful on `PICO_PIO_VERSION=1` which supports a limit. * Added `sm_config_set_set_pin_base()` and `sm_config_set_set_pin_count()`. * Added `sm_config_set_sideset_pin_base()` and `sm_config_set_sideset_pin_count()`. * For `PICO_PICO_VERSION=1` i.e. RP2350: * Added `pio_set_gpio_base()` and `pio_get_gpio_base()` to assign the PIO instance to pins 0-31 or 16-47. * Added `pio_set_sm_multi_mask_enabled()`. * Added `pio_clkdiv_restart_sm_multi_mask()`. * Added `pio_enable_sm_multi_mask_in_sync()`. * `NUM_PIO_IRQS` define is now provided for you (2 on both RP2040 and RP2350). #### hardware_pll * `PICO_PLL_VCO_MIN_FREQ_HZ` is new and now preferred to `PICO_PLL_VCO_MIN_FREQ_KHZ` or `PICO_PLL_VCO_MIN_FREQ_MHZ`. * `PICO_PLL_VCO_MAX_FREQ_HZ` is new and now preferred to `PICO_PLL_VCO_MAX_FREQ_KHZ` or `PICO_PLL_VCO_MAX_FREQ_MHZ`. * `PLL_RESET_NUM()` macro added to abstract differences between platforms. #### hardware_pwm * `PARAM_ASSERTIONS_ENABLED_PWM` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_PWM` - the old define is still supported as a fallback. * `PICO_DEFAULT_PWM_INSTANCE()` macro added which is equivalent to the pre-existing `pwm_default`. * Added `PWM_SLICE_NUM()` and `PWM_DREQ_NUM()` macros to abstract differences between platforms. * Added `PWM_DEFAULT_IRQ_NUM()` since RP2350 supports 2 PWM IRQs to indicate which IRQ the pre-existing RP2040 functions use. * Added `pwm_set_irq0_enabled()`, `pwm_set_irq1_enabled()` and `pwm_irqn_set_slice_enabled()` to differentiate between the IRQs. * Added `pwm_set_irq0_mask_enabled()`, `pwm_set_irq1_mask_enabled()` and `pwm_irqn_set_mask_enabled()` to differentiate between the IRQs. * Added `pwm_get_irq0_status_mask()`, `pwm_get_irq1_status_mask()` and `pwm_irqn_get_status_mask()` to differentiate between the IRQs. * Added `pwm_pwm_force_irq0()`, `pwm_force_irq1()` and `pwm_irqn_force()` to differentiate between the IRQs. #### hardware_resets * `PARAM_ASSERTIONS_ENABLED_RESETS` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_RESETS` - the old define is still supported as a fallback. * `reset_block()` is renamed to `reset_block_mask()` but the old name is still supported. * `unreset_block()` is renamed to `unreset_block_mask()` but the old name is still supported. * `unreset_block_wait()` is renamed to `unreset_block_mask_wait_blocking()` but the old name is still supported. * `reset_block_num()`, `unreset_block_num()`, `unreset_block_num_wait_blocking()` and `reset_unreset_block_num_wait_blocking()` added to reset or unreset a single block by `reset_num_t` index. #### hardware_rtc * Note this library is only available on RP2040, since the RP2350 lacks the RTC hardware. * There is a similar always-on timer in `hardware_powman`. * A common API for both RP2040 and RP2350 is provided in `pico_aon_timer`. * `HAS_RP2040_RTC` define is now provided for you. #### hardware_spi * `PARAM_ASSERTIONS_ENABLED_SPI` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_SPI` - the old define is still supported as a fallback. * `PICO_DEFAULT_SPI_INSTANCE()` macro added which is equivalent to the pre-existing `spi_default`. * Added `SPI_NUM()`, `SPI_INSTANCE()`, `SPI_DREQ_NUM()` macros to abstract differences between platforms. * Fixed per-character timeouts. #### hardware_sync * `restore_interrupts_from_disabled()` is added as a variant for `restore_interrupts()` which **must** be paired with a matching `save_and_disable_interrupts()`. This is the common usage and produces smaller/faster code on RISC-V. * Spinlock functionality has been delegated to a separate hardware_sync_spinlock library, which is included for you. * hardware_sync_spin_lock. * Whilst RP2350 has the same SIO spin locks as RP2040, due to Errata RP2350-E2, these are not used by default. * Instead, a software implementation using atomic instructions is used. * You can set `PICO_USE_SW_SPIN_LOCKS=0` to disable this if you know you aren't affected by RP2350-E2 and want to use the h/w spin locks instead. * Added `spin_try_lock_unsafe()` function. #### hardware_timer * `PARAM_ASSERTIONS_ENABLED_TIMER` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_TIMER` - the old define is still supported as a fallback. * RP2350 supports two timer instances. * `PICO_DEFAULT_TIMER_INSTANCE()` macro added based on `PICO_DEFAULT_TIMER` (0 on RP2040, 0/1 on RP2350). * Added `TIMER_NUM()`, `TIMER_INSTANCE()`, `TIMER_ALARM_NUM_FROM_IRQ()` and `TIMER_ALARM_NUM_FROM_IRQ()` macros to abstract differences between platforms * Added `hardware_alarm_get_irq_num()` to get the processor IRQ number for a particular alarm on a timer. * New versions of all functions added with a `timer_` prefix and a timer instance passed as the first argument. The pre-existing functions call these with the default timer instance. * `NUM_TIMERS` has been renamed to `NUM_ALARMS` as that's what it was (4). * `NUM_GENERIC_TIMERS` has been added which is 1 on RP2040 and 2 on RP2350. #### hardware_uart * `PARAM_ASSERTIONS_ENABLED_UART` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_UART` - the old define is still supported as a fallback. * `PICO_DEFAULT_UART_INSTANCE()` macro added which is equivalent to the pre-existing `uart_default`. * Added `UART_NUM()`, `UART_INSTANCE()`, `UART_DREQ_NUM()`, `UART_IRQ_NUM()`, `UART_CLOCK_NUM()`, `UART_RESET_NUM()` macros to abstract differences between platforms. * `uart_set_irq_enables()` is renamed to `uart_set_irqs_enabled()` but the old name is still supported. * `uart_get_dreq()` is renamed to `uart_get_dreq_num()` but the old name is still supported. * `uart_get_reset_num()` is added. * Incorrect baud setting for certain frequencies was fixed. #### hardware_vreg * `vreg_disable_voltage_limit()` added to allow full range of DVDD voltage selection on RP2350 #### hardware_watchdog * `PARAM_ASSERTIONS_ENABLED_WATCHDOG` is renamed to `PARAM_ASSERTIONS_ENABLED_HARDWARE_WATCHDOG` - the old define is still supported as a fallback. * Added `watchdog_disable()`. * `watchdog_get_count()` is renamed to `watchdog_get_time_remaining_ms()` but the old name is still supported. #### hardware_xosc * `XOSC_HZ` is new and now preferred to `XOSC_KHZ`. #### hardware_regs * `enum irq_num_[rp2040|rp2350]` (typedef-ed as `irq_num_t`) added with the constants from `inctrl.h`. Note these remain as #defines when included from assembly. * `enum dreq_num_[rp2040|rp2350]` (typedef-ed as `dreq_num_t`) added with the constants from `dreq.h`. Note these remain as #defines when included from assembly. #### hardware_structs * `enum bus_ctrl_perf_counter_[rp2040|rp2350]` (typedef-ed as `bus_ctrl_perf_counter_t`) added. * **Note** enum bus_ctrl_per_counter no longer exists. * `enum clock_num_[rp2040|rp2350]` (typedef-ed as `clock_num_t`) added. * **Note** enum clock_index no longer exists. * `enum clock_dest_num_[rp2040|rp2350]` (typedef-ed as `clock_dest_num_t`) added. * `enum gpio_function_[rp2040|rp2350]` (typedef-ed as `gpio_function_t`) added. * **Note** enum gpio_function no longer exists. * `enum gpio_function1_[rp2040|rp2350]` (typedef-ed as `gpio_function1_t`) added (for QSPI bank). * `enum reset_num_[rp2040|rp2350]` (typedef-ed as `reset_num_t`) added. * `enum tick_gen_num_rp2350` (typedef-ed as `reset_num_t`) added. * Various naming consistencies have been fixed. * `iobank0.h` -> `io_bank00.h`, `iobank0_hw` -> `io_bank0_hw` - shims are provided for the old versions. * `ioqspi.h` -> `io_qspi0.h`, `ioqspi_hw` -> `io_qspi_hw` - shims are provided for the old versions. * `padsbank0.h` -> `pads_bank0.h`, `padsbank0_hw` -> `pads_bank0_hw` - shims are provided for the old versions. * `padsqspi.h` -> `pads_qspi.h`, `padsqspi_hw` -> `pads_qspi_hw` - shims are provided for the old versions. * `bus_ctrl.h` -> `busctrl.h`, `bus_ctrl_hw` -> `busctrl_hw` (don't ask! but `hardware_struct` headers now match `hardware_regs` names at least!). #### boot_stage2 * There are now separate implementations for RP2040 and RP2350. * A `boot_stage2` is not needed on RP2350, but one can be included via the define `PICO_EMBED_XIP_SETUP=1`. #### cmsis * CMSIS headers are updated to CMSIS 6.1 * Device headers `RP2040.h` and `RP2350.h` are generated, and now include basic hardware structures as per the latest `SVDConv` defaults. #### pico_bootrom * New RP2350 bootrom APIs added. * `rom_xxx()` inline function wrappers added for all `xxx()` ROM functions. * Additional `rom_get_boot_random()` and `rom_add_flash_runtime_partition()` for RP2350 which use underlying bootrom functionality but aren't just wrapper functions. ### pico_bt_stack * BTStack updated to 1.6.1 from 1.5.6 * Lots of additions, fixes and changes, for the full list see the [change log](https://github.com/bluekitchen/btstack/blob/master/CHANGELOG.md) #### pico_cyw43_arch * `PARAM_ASSERTIONS_ENABLED_CYW43_ARCH` is renamed to `PARAM_ASSERTIONS_ENABLED_PICO_CYW43_ARCH` - the old define is still supported as a fallback. * lib/cyw43-driver has been updated to the latest version * Mostly bug fixes. * Adds WPA3 support for Pico W. To use this, use CYW43_AUTH_WPA3_SAE_AES_PSK or CYW43_AUTH_WPA3_WPA2_AES_PSK instead of CYW43_AUTH_WPA2_AES_PSK when connecting to wifi with cyw43_arch_wifi_connect_timeout_ms or cyw43_arch_enable_ap_mode. #### pico_cyw43_driver * `cyw43_driver` updated to commit `faf36381`. * Added support for changing the clock speed of the SPI connection to the Wi-Fi chip. See `CYW43_PIO_CLOCK_DIV_INT`, `CYW43_PIO_CLOCK_DIV_FRAC` and `CYW43_PIO_CLOCK_DIV_DYNAMIC`. #### pico_divider * Functions that returned a quotient and divider in a `uint64_t` or `int64_t` now return a `divmod_result_t` - the signed-ness of the value before was meaningless anyway, and the compiler will still return it as a 64-bit value. * Extra functions in `pico/divider.h` now implemented for `pico_set_divider_implemtation(compiler)` as well as for RP2350 which has no RP2040 hardware divider. #### pico_double * `pico_set_double_implementation(pico)` (the default) now uses the Double Co-Processor (DCP) for double-precision floating-point arithmetic on Arm RP2350, and highly optimised Arm VFP implementations of the double-precision scientific functions, for much improved performance over the C library versions. * Extra functions exposed from `pico` implementation * `int2double()` * `uint2double()` * `int642double()` * `uint642double()` * `double2uint()` * `double2uint64()` * Extra functions exposed from `pico` implementation for Arm RP2350 only * `ddiv_fast()` * `sqrt_fast()` * `mla()` #### pico_float * `pico_set_float_implementation(pico)` (the default) now uses the compiler for single-precision floating point arithmetic on Arm RP2350 since the processor has VFP instructions, but includes custom optimised scientific functions also using the VFP. * `pico_set_diouble_implementation(pico_dcp)` uses the Double Co-Processor (DCP) for single-precision floating point arithmetic on Arm RP2350, and highly optimised Arm M33 implementations of the single-precision scientific functions, for much improved performance over the C library versions. This library is intended for those situations where you cannot (or don't want to) use the VFP instructions. * Extra functions exposed from `pico` implementation. * `int2float()` * `uint2float()` * `int642float()` * `uint642float()` * `float2uint()` * `float2uint64()` * `float2uint_z()` * `float2uint64_z()` * Extra functions exposed from `pico` implementation for Arm R2350 only. * `float2fix64_z()` * `fdiv_fast()` * `fsqrt_fast()` #### pico_lwip * Update lib/lwip to 2.2.0 * There have been some bugs fixed, and some new features were added (most notably full Address Conflict Detection support). #### pico_mbedtls * Update to lib/mbedtls to 2.28.8 from 2.28.1 * This release of Mbed TLS provides bug fixes and minor enhancements. This release includes fixes for security issues. * Added support for hardware SHA256 calculation on RP2350 * To use this in mbedtls you need to define MBEDTLS_SHA256_ALT in your mbedtls_config.h. Use LIB_PICO_SHA256 to check if hardware SHA256 is supported and fallback to defining MBEDTLS_SHA256_C for the software SHA256 calculation. #### pico_multicore * Added `SIO_FIFO_IRQ_NUM()` to get the IRQ number for the FIFO IRQ on a particular core, since RP2040 and RP2350 are different. * **note** that RP2350 uses the same IRQ number on both cores, so if you have IRQ handlers for both cores, you should share the same function and check the core number in the IRQ handler. This strategy of course works on RP2040 too. * Added `multicore_fifo_push_blocking_inline()` and `multicore_fifo_pop_blocking_inline()`. * Added `multicore_doorbell_` functions for the new intercore Doorbells on RP2350. * `NUM_DOORBELLS` is provided which is 8 on RP2350, 0 on RP2040. #### pico_rand * Added the hardware TRNG as an additional entropy source on RP2350. * `HAS_RP2350_TRNG` indicates hardware support. * Many, but not all, of the pre-existing entropy sources are disabled on RP2350 in favour of using the TRNG. #### pico_runtime * A shadow of its former self, it now just: * aggregates other default libraries required for getting to `main()` and having the C runtime work. * provides low level `runtime_run_initializers()` and `runtime_run_per_core_initializers()` which run initializers from the `__preinit_array`. * The `runtime_init()` entrypoint has moved to `pico_clib_interface`. #### pico_standard_link * Much previously included functionality has been split out into `pico_crt0`, `pico_cxx_options` and `pico_standard_binary_info`. * What remains is entirely focused on setting up the linker configuration. * **Finally** fixed a bug where changes to the linker script did not cause a relink. #### pico_stdio * Some internal reorganisation to separate functionality between here and `pico_clib_interface`. * Added `PICO_STDIO_SHORT_CIRCUIT_CLIB_FUNCS` to control whether `printf`, `vprintf`, `puts`, `putchar` and `getchar` go thru the C library (thus usually pulling in all the FILE handling APIs resulting in huge bloat - but more sensible behaviour when mixing say `printf` with `fprintf(stdout` etc.) This defaults to 0, i.e. "do short-circuit the c lib" which was the behaviour in the previous SDK version. * Add support for Segger RTT stdio. * Implemented `stdio_flush()` for UART and USB CDC. * Added `stdio_deinit_all()` and individual `stdio_deinit_xxx` functions. #### pico_stdio_usb * Now supports MS OS2 descriptors by default. See `PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_MS_OS_20_DESCRIPTOR`. * `PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE` and `PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE` are now both supported even if the user is using `tinyusb_device` directly themselves. * Bug that could cause deadlock with FreeRTOS SMP and printing from IRQs fixed. #### pico_stdlib * `pico/stdlib.h` no longer declares `set_sys_clock_` functions. You must include `hardware/clocks.h` explicitly. #### pico_time * `remaining_alarm_time_ms()`, `remaining_alarm_time_us()`, `alarm_pool_remaining_alarm_time_ms()` and `alarm_pool_remaining_alarm_time_us()` were added. * Implementation of alarm pools completely rewritten for much lower overhead, jitter and higher throughput in the majority of cases. The pairing heap has been replaced with a linked list which is faster and uses less memory in most normal use cases too. * **NOTE** `fire_if_past` now always fires asynchronously in the same way as a normal timeout (rather than being called synchronously during the call). Thus `alarm_pool_add_alarm_at_force_in_context` is now no different to `alarm_pool_add_alarm_at`. * New `pico_timer_adapter` abstraction added so `pico_time` could be backed by other types of timer hardware in the future, and so `pico_time` no longer depends directly on a `hardware_timer` abstraction which simplifies `PICO_PLATFORM=host`. * Support for two hardware timer blocks on RP2350. * `alarm_pool_timer_t` abstraction added to represent the time "counter" backing the alarm pool. * `alarm_pool_t` now has an associated `alarm_pool_timer_t` instance. * `alarm_pool_create_on_timer()` is added to create an alarm pool on a specific alarm pool timer. * `alarm_pool_get_default_timer()` is added which is used when not explicitly passing an alarm pool timer. `PICO_DEFAULT_TIMER` selects which timer instance is the default (0 on `RP2040`, 0/1 on `RP2350`). * `PARAM_ASSERTIONS_ENABLED_TIME` is renamed to `PARAM_ASSERTIONS_ENABLED_PICO_TIME` - the old define is still supported as a fallback. * `check_timeout_fn` now takes two parameters. This was likely unused outside the `pico_time` implementation anyway. * Expose `runtime_init_default_alarm_pool()` function. #### pico_util * `time_to_datetime()`, `datetime_to_time()` and `datetime_to_str()` functions relating to `hardware_rtc` are now guarded by `PICO_INCLUDE_RTC_DATETIME` which defaults to 0 on RP2350, since RP2350 does not include the RP2040 RTC hardware. * `timespec_to_ms()`, `timespec_to_us()`, `ms_to_timespec()`, and `ms_to_timespec()` added to convert between C-library high-resolution time offset and millisecond or microsecond precision offsets. * `queue_try_remove()`, `queue_try_remove()`, `queue_remove_blocking()` and `queue_peek_blocking()` now support passing NULL as the element out pointer if the caller doesn't care. #### tinyusb * TinyUSB moved from release 0.15.0 to commit `42326428` (0.17.0 WIP) * Note that `bsp/board.h` has been renamed by TinyUSB to `bsp/board_api.h` the SDK adds a re-director header for you for now. * Support added for RP2350. Requires a custom memcpy implementation in the rp2040 tinusb driver, as unaligned 32 bit access to device memory causes a hard fault on the Cortex M33. * See the [TinyUSB changelog]https://github.com/hathach/tinyusb/blob/master/docs/info/changelog.rst) for full details. #### pioasm * `pioasm` now supports the full RP2350 PIO (`PICO_PIO_VERSION=1`) instruction set * Additionally, it supports many new directives. See the [RP2350 Datasheet](https://rptl.io/rp2040-datasheet) for full details. * **Note** that currently not all output formats support `PICO_PIO_VERSION=1` as they are community provided. ### FreeRTOS integration * You should use this repo for the current FreeRTOS-Kernel supporting RP2040 and RP2350: https://github.com/raspberrypi/FreeRTOS-Kernel * Dropped legacy support for `configNUM_CORES` for the correct `configNUMBER_OF_CORES`, which is 2 for SMP support and 1 for non-SMP support. * RP2350_ARM_NTZ (non-trust-zone), and RP2350_RISC-V are available as well as an updated RP2040 version; the former two basically give you the same "single privilege/security domain" experience as on RP2040. * SMP and non-SMP support (along with running FreeRTOS on either core) are available for all. * A nasty, but rare pre-existing RP2040 deadlock (especially with TinyUSB printf from IRQs) has been fixed on all three versions; If you were setting configSUPPORT_PICO_SYNC_INTEROP=0 as a workaround, you should no longer do so. Generally, if you are using printf (or anything else using SDK locking primitives) then you do really want configSUPPORT_PICO_SYNC_INTEROP=1 for the best concurrency * FreeRTOS on RISC-V does not currently support IRQ preemption (which is a Hazard3 only feature anyway). ### Backwards Incompatibilities There are a handful of minor backwards incompatibilities, that hopefully should affect very few people. * `boot_picbin` library is now called `boot_picobin_headers`. * `boot picoboot` library is now called `boot_picoboot_headers`. * `boot_uf2` library is now called `boot_uf2_headers`. * `pico_base` library is now called `pico_base_headers`. * `pico/error.h` - `PICO_ERROR_GENERIC` is now `-1` because there were pre-existing APIs that returned -1 for any error. `PICO_ERROR_TIMEOUT` is now `-2` (they are swapped from their previous values). * `pico_stdlib` * `pico/stdlib.h` no longer declares `set_sys_clock_` functions. You must include `hardware/clocks.h` explicitly. * `pico_time` * `check_timeout_fn` now takes two parameters. This was likely unused outside the `pico_time` implementation anyway. * `fire_if_past` now always fires asynchronously in the same way as a normal timeout (rather than being called synchronously during the call). Thus `alarm_pool_add_alarm_at_force_in_context` is now no different to `alarm_pool_add_alarm_at`. * `hardware_clocks` * The `enum clock_index` no longer exists and has been replaced with `clock_num_t`. However, all clock functions now take `clock_handle_t` to allow for future enhancement. This is currently just an alias for `clock_num_t`. * `hardware_structs` * `enum bus_ctrl_perf_counter_[rp2040|rp2350]` (typedef-ed as `bus_ctrl_perf_counter_t`) added. * **Note** enum bus_ctrl_per_counter no longer exists. * `enum clock_num_[rp2040|rp2350]` (typedef-ed as `clock_num_t`) added. * **Note** enum clock_index no longer exists. * `enum clock_dest_num_[rp2040|rp2350]` (typedef-ed as `clock_dest_num_t`) added. * `enum gpio_function_[rp2040|rp2350]` (typedef-ed as `gpio_function_t`) added. * **Note** enum gpio_function no longer exists. * `hardware_timer` * `NUM_TIMERS` has been renamed to `NUM_ALARMS` as that's what it was (4). ### Build * There are major CMake build changes. If you are maintaining your own non-CMake build, you will have to make extensive changes by looking at the differences yourself. * All SDK headers are now "system" includes. * You can now specify `rp2350-arm-s` (Arm Secure) and `rp2350-risc-v` (RISC-V) as well as the previous `rp2040` (default) and `host`. * Setting `PICO_BOARD=some_board` will now set `PICO_PLATFORM` if one is specified in `some_board.h` since most boards either use exclusively RP2040 or RP2350. * `PICO_PLATFORM` also supports `rp2350` but this gets replaced with the value `PICO_DEFAULT_RP2350_PLATFORM` which you can set in your environment or `CMakeLists.txt`. Many of the boards for RP2350 - including `pico2`- select `rp2350` as the `PICO_BOARD` to honour your preference. * `PICO_PLATFORM`, `PICO_BOARD` and other variables will be taken from your environment if not otherwise defined now retain their value after the first CMake invocation. i.e. a pre-existing CMake build configuration directory will not change based on your environment if you re-run `cmake`. * `PICO_BOARD=pico_w` is no longer an odd child out requiring a CMake board file; support for CYW43 Wi-Fi can now be specified in the board header. * `ELF2UF2` is now replaced by use of `picotool` which will be built as part of your build if not installed on the system. See the [picotool GitHub repository](https://github.com/raspberrypi/picotool) for more details on building and installing it locally. * `PICO_GCC_TRIPLE` can now be a ';' separated list as well as a single value. * 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. * Compiler support is widening - we always recommend a recent version.) * All recent GCCs are supported on Arm. (GCC 14 has not yet been tested for full support though). * Very recent GCCs are required on RISC-V due to the bleeding-edge nature of some of the processor instructions. * Recent LLVM Embedded Toolchain for ArmRM versions are supported on Arm. * Pigweed LLVM is supported for Arm. * For further details see the [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-c-sdk) book. * Bazel may be used to build the SDK on Arm. See the [README](bazel/README.md). Note that the Bazel build is community-provided and maintained. ### Building Documentation * The `docs` build target to build the HTML code documentation now builds a set of documentation peculiar to your particular `PICO_PLATFORM` setting. * `PICO_PLATFORM=combined_docs` can be used (just for building docs) to build the combined documentation for both RP2040 and RP2350. ### Fixed Issues You can see a list of individual commits [here](https://github.com/raspberrypi/pico-sdk/pulls?q=is%3Apr+milestone%3A2.0.0+is%3Amerged), and a list of resolved issues [here](https://github.com/raspberrypi/pico-sdk/issues?q=is%3Aissue+milestone%3A2.0.0+is%3Aclosed). Note these only include public changes made since version 1.5.1. The majority of new code and collateral fixes for the previously unannounced RP2350 were developed and committed in private and delivered as a single "squashed" commit. ### New Examples There are in the [pico_examples](https://github.com/raspberrypi/pico-examples) repository. Example|Description ---|--- [enc_bootloader](https://github.com/raspberrypi/pico-examples/tree/master/bootloaders/encrypted) | A bootloader which decrypts binaries from flash into SRAM. [hello_dcp](https://github.com/raspberrypi/pico-examples/tree/master/dcp/hello_dcp) | Use the double-precision coprocessor directly in assembler. [dvi_out_hstx_encoder](https://github.com/raspberrypi/pico-examples/tree/master/dvi_out_hstx_encoder) `RP2350`| Use the HSTX to output a DVI signal with 3:3:2 RGB [runtime_flash_permissions](https://github.com/raspberrypi/pico-examples/tree/master/flash/runtime_flash_permissions) | Demonstrates adding partitions at runtime to change the flash permissions [hello_freertos](https://github.com/raspberrypi/pico-examples/tree/master/freertos/hello_freertos) | Examples that demonstrate how run FreeRTOS and tasks on 1 or 2 cores. [multicore_doorbell](https://github.com/raspberrypi/pico-examples/tree/master/multicore/multicore_doorbell) | Claims two doorbells for signaling between the cores. Counts how many doorbell IRQs occur on the second core and uses doorbells to coordinate exit. [hello_otp](https://github.com/raspberrypi/pico-examples/tree/master/otp/hello_otp) | Demonstrate reading and writing from the OTP on RP2350, along with some of the features of OTP (error correction and page locking). [picow_httpd](https://github.com/raspberrypi/pico-examples/tree/master/pico_w/wifi/httpd) | Runs a LWIP HTTP server test app [picow_freertos_ntp_client_socket](https://github.com/raspberrypi/pico-examples/tree/master/pico_w/wifi/freertos/ntp_client_socket) | Connects to an NTP server using the LwIP Socket API with FreeRTOS in NO_SYS=0 (i.e. full FreeRTOS integration) mode. [pico_freertos_httpd_nosys](https://github.com/raspberrypi/pico-examples/tree/master/pico_w/wifi/freertos/httpd) | Runs a LWIP HTTP server test app under FreeRTOS in NO_SYS=1 mode. [pico_freertos_httpd_sys](https://github.com/raspberrypi/pico-examples/tree/master/pico_w/wifi/freertos/httpd) | Runs a LWIP HTTP server test app under FreeRTOS in NO_SYS=0 (i.e. full FreeRTOS integration) mode. [squarewave_div_sync](https://github.com/raspberrypi/pico-examples/tree/master/pio/squarewave) | Generates a square wave on three GPIOs and synchronises the divider on all the state machines [quadrature_encoder_substep](https://github.com/raspberrypi/pico-examples/tree/master/pio/quadrature_encoder_substep) | High resolution speed measurement using a standard quadrature encoder [hello_sha256](https://github.com/raspberrypi/pico-examples/tree/master/sha/sha256) | Demonstrates how to use the pico_sha256 library to calculate a checksum using the hardware in rp2350 [mbedtls_sha256](https://github.com/raspberrypi/pico-examples/tree/master/sha/mbedtls_sha256) | Demonstrates using the SHA-256 hardware acceleration in mbedtls [boot_info](https://github.com/raspberrypi/pico-examples/tree/master/system/boot_info) | Demonstrate how to read and interpret sys info boot info. [rand](https://github.com/raspberrypi/pico-examples/tree/master/system/rand) | Demonstrate how to use the pico random number functions. [hello_universal](https://github.com/raspberrypi/pico-examples/tree/master/universal/hello_universal) | The obligatory Hello World program for Pico (USB and serial output). On RP2350 it will reboot to the other architecture after every 10 prints. [nuke_universal](https://github.com/raspberrypi/pico-examples/tree/master/universal/CMakeLists.txt#L107) | Same as the [nuke](https://github.com/raspberrypi/pico-examples/tree/master/flash/nuke) binary, but universal. On RP2350 runs as a packaged SRAM binary, so is written to flash and copied to SRAM by the bootloader

SDK 1.5.11.5.1
? · 2023-06-14

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](https://github.com/raspberrypi/pico-sdk/pulls?q=is%3Apr+milestone%3A1.5.1+is%3Amerged), and the full list of resolved issues [here](https://github.com/raspberrypi/pico-sdk/issues?q=is%3Aissue+milestone%3A1.5.1+is%3Aclosed). ### 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 mismatched `PICO_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 to `async_when_pending_worker_t` to match `async_at_time_worker_t`. #### pico_cyw43_arch * Added `cyw43_arch_disable_sta_mode()` function to complement `cyw43_arch_enable_sta_mode()`. * Added `cyw43_arch_disable_ap_mode()` function to complement `cyw43_arch_enable_ap_mode()`. #### pico_stdio_usb * The 20-character limit for descriptor strings `USBD_PRODUCT` and `USBD_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` and `set_sys_clock_khz` methods now reference a pre-processor define `PICO_CLOCK_AJDUST_PERI_CLOCK_WITH_SYS_CLOCK`. If set to `1`, 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 preexisting `XOSC_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 if `XOSC_KHZ` is an exact multiple of 1000 Khz. Note that either `XOSC_MHZ` or `XOSC_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` and `PLL_SYS_POSTDIV2` are used to configure the system clock PLL during runtime initialization. These are defaulted for you if `SYS_CLK_KHZ=125000`, `XOSC_KHZ=12000` and `PLL_COMMON_REFDIV=1`. You can modify these values in your `CMakeLists.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` and `PLL_USB_POSTDIV2` are used to configure the USB clock PLL during runtime initialization. These are defaulted for you if `USB_CLK_KHZ=48000`, `XOSC_KHZ=12000` and `PLL_COMMON_REFDIV=1`. You can modify these values in your `CMakeLists.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-existing `PICO_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-existing `PICO_PLL_VCO_MAX_FREQ_MHZ`, though specifying either is supported. ### 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 using `pico_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( ... )` and `pico_default_asm_volatile( ... )` are provided that are equivalent to `__asm` and `__asm volatile` blocks, but with a `.syntax unified` at the beginning. * 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` and `PICO_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](https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm), noting however that currently only version 14.0.0 works, as later versions use `picolib` rather than `newlib`. * 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](https://github.com/raspberrypi/pico-examples#pico-w-bluetooth). * The Bluetooth API is provided by [BTstack](https://github.com/bluekitchen/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 for `NO_SYS=0`. * The following integration libraries are also provided: * `pico_btstack_run_loop_async_context` - provides a common `async_context` backed implementation of a BTstack *"run loop"* that can be used for all BTstack use with the `pico-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` function `pico_btstack_make_gatt_header` can be used to run the BTstack `compile_gatt` tool to make a GATT header file from a BTstack `GATT` file. * `pico_cyw43_driver` and `cyw43_driver` now support HCI communication for Bluetooth. * `cyw43_driver_picow` now supports Pico W specific HCI communication for Bluetooth over SPI. * `cyw43_arch_init()` and `cyw43_arch_deinit()` automatically handle Bluetooth support if `CYW43_ENABLE_BLUETOOTH` is `1` (as it will be automatically if you depend on `pico_btstack_cyw43`). Key changes since 1.5.0: * Added Raspberry Pi specific [BTstack license](https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_btstack/LICENSE.RP). * The storage offset in flash for `pico_btstack_flash_bank` can be specified at runtime by defining `pico_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 new `pico_flash` library to make sure the other core is not accessing flash during flash updates. If you are using `pico_multicore`you must have called `flash_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` and `btstack` 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.01.5.0
? · 2023-02-11

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](https://github.com/raspberrypi/pico-sdk/pulls?q=is%3Apr+milestone%3A1.5.0+is%3Amerged), and the full list of resolved issues [here](https://github.com/raspberrypi/pico-sdk/issues?q=is%3Aissue+milestone%3A1.5.0+is%3Aclosed). Note, these release notes are long and may appear truncated in the "Releases" tab; you can see the full version [here](https://github.com/raspberrypi/pico-sdk/releases/tag/1.5.0) ### 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 a `float` for the clock divider value, rather than an `int`. * Added `clock_gpio_init_int_frac()` function to allow initialization of integer and fractional part of the clock divider value, without using `float`. * Added `--ref-min` option to `vocalc.py` to override the minimum reference frequency allowed. * `vocalc.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()` and `dma_sniffer_set_output_reverse_enabled()` functions to configure the DMA sniffer. * Added `dma_sniffer_set_data_accumulator()` and `dma_sniffer_get_data_accumulator()` functions to access the DMA sniffer accumulator. #### hardware_i2c * Added `i2c_get_instance()` function for consistency with other `hardware_` 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 of `cyw43_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`, or `PICO_ERROR_XXX`). * The `pico_cyw43_arch` library has been completely rewritten on top of the new `pico_async_context` library that generically abstracts the different types of asynchronous operation (`poll`, `threadsafe_background` and `freertos`) previously handled in a bespoke fashion by `pico_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()` and `cyw43_arch_deinit()` functions are now very thin layers which handle `async_context` life-cycles, along with adding support for the `cyw43_driver`, `pico_lwip` etc. to that `async_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 custom `async_context` prior to calling `cyw43_arch_init*()` * Added `cyw43_arch_async_context()` function to get the `async_context` used by the CYW43 architecture support. * Added `cyw43_arch_init_default_async_context()` function to return the `async_context` that `cyw43_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 for `poll` style applications that have no other work to do and wish to sleep until `cyw43_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 the `pico-sdk` via `async_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()` and `std::chrono`. * Added `settimeofday()` implementation such that `gettimeofday()` can be meaningfully used. * Added default (return `-1`) implementations of the remaining `newlib` 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 with `pico_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 define `PICO_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 new `PICO_STDIO_USB_SUPPORT_CHARS_AVAILABLE_CALLBACK` and `PICO_STDIO_UART_SUPPORT_CHARS_AVAILABLE_CALLBACK` defines which both default to `1` 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` via `USBD_VID`, `USBD_PID`, `USBD_PRODUCT`, `PICO_STDIO_USB_CONNECTION_WITHOUT_DTR` and `PICO_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 a `uint64_t` timestamp to an `absolute_time_t`. * Added `absolute_time_min()` function to return the earlier of two `absolute_time_t` values. * Added `alarm_pool_create_with_unused_hardware_alarm()` function to create an alarm pool using a hardware alarm number claimed using `hardware_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 the `fire_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 for `NO_SYS=0` with FreeRTOS as a complement to `pico_lwip_nosys` for `NO_SYS=1`. #### TinyUSB * TinyUSB has upgraded from 0.12.0 to 0.15.0. See TinyUSB release notes [here](https://github.com/hathach/tinyusb/releases) for details. * Particularly *host* support should be massively improved. * Defaulted new `PICO_RP2040_USB_DEVICE_UFRAME_FIX` variable to `1` as a workaround for errata RP2040-E15.This sets the default value for TinyUSB's `dcd_rp2040` driver's `TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX` flag. 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 to `0`. ### 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 call `async_context_poll()` periodically from their main loop, but can call `async_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 both `pico_lwip_mbedtls` and `pico_mbedtls` to use MBed TLS and lwIP together. See the [tls_client](https://github.com/raspberrypi/pico-examples/tree/master/pico_w/wifi/tls_client.c) example in `pico-examples` for more details #### pico_rand * Implements a new Random Number Generator API * `pico_rand` Generates random numbers at runtime utilizing a number of possible entropy, 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()` and `get_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.h` with a struct for the Arm Cortex M0+ NVIC available via the `nvic_hw` pointer. * Added new `PICO_CXX_DISABLE_ALLOCATION_OVERRIDES` which can be set to `1` if you do not want `pico_standard_link` to include non-exceptional overrides of `std::new`, `std::new[]`, `std::delete` and `std::delete[]` when exceptions are disabled. * `elf2uf2` now correctly uses `LMA` instead of `VMA` of 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 `CMake` mechanism). * The build will pick up pre-installed `elf2uf2` and `pioasm` if found via an installed `pico-sdk-tools` `CMake` package. If it can do so, then no native compiler is required for the build! * It is now possible to switch the board type `PICO_BOARD` in an existing `CMake` build directory. * `ARCHIVE_OUTPUT_DIRECTORY` is now respected in build for `UF2` output files. * Spaces are now supported in the path to the `pico-sdk` * All libraries `xxx` in the `pico-sdk` now support a `xxx_headers` variant that just pulls in the libraries' headers. These `xxx_headers` libraries correctly mirror the dependencies of the `xxx` libraries, so you can use `xxx_headers` instead of `xxx` as your dependency if you do not want to pull in any implementation files (perhaps if you are making a `STATIC` library). Actually the "all" is not quite true, non code libraries such as `pico_standard_link` and `pico_cxx_options` are 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](https://github.com/raspberrypi/pico-examples/tree/master/pico_w/bt). Key changes: * The Bluetooth is provided by [BTstack](https://github.com/bluekitchen/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 for `NO_SYS=0`. * The following integration libraries are also provided: * `pico_btstack_run_loop_async_context` - provides a common `async_context` backed implementation of a BTstack *"run loop"* that can be used for all BTstack use with the `pico-sdk`. * `pico_btsack_flash_bank` - provides a sample implementation for storing required Bluetooth state in flash. *`pico_btstack_cyw43` - integrates BTstack with the CYW43 driver. * Added `CMake` function `pico_btstack_make_gatt_header` that can be used to run the BTstack `compile_gatt` tool to make a GATT header file from a BTstack `GATT` file. * Updated `pico_cyw43_driver` and `cyw43_driver` to support HCI communication for Bluetooth. * Updated `cyw43_driver_picow` to support Pico W specific HCI communication for Bluetooth over SPI. * Updated `cyw43_arch_init()` and `cyw43_arch_deinit()` to additionally handle Bluetooth support if `CYW43_ENABLE_BLUETOOTH` is `1` (as it will be automatically if you depend on `pico_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