Skip to content

Releases: raspberrypi/pico-sdk

SDK 1.5.1

14 Jun 02:39
Compare
Choose a tag to compare

This release is largely a bug fix release, however it also makes Bluetooth support official and adds some new libraries and functionality.

Highlights are listed below, or you can see the full list of individual commits here, and the full list of resolved issues here.

Board Support

The following board has been added and may be specified via PICO_BOARD:

  • pololu_3pi_2040_robot

The following board configurations have been modified:

  • adafruit_itsybitsy_rp2040 - corrected the 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, 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.

  • The Bluetooth API is provided by BTstack.
  • The following libraries are provided that expose core BTstack functionality:
    • pico_btstack_ble - Adds Bluetooth Low Energy (LE) support.
    • pico_btstack_classic - Adds Bluetooth Classic support.
    • pico_btstack_sbc_encoder - Adds Bluetooth Sub Band Coding (SBC) encoder support.
    • pico_btstack_sbc_decoder - Adds Bluetooth Sub Band Coding (SBC) decoder support.
    • pico_btstack_bnep_lwip - Adds Bluetooth Network Encapsulation Protocol (BNEP) support using LwIP.
    • pico_btstack_bnep_lwip_sys_freertos - Adds Bluetooth Network Encapsulation Protocol (BNEP) support using LwIP with FreeRTOS 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.
  • 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_multicoreyou 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.0

11 Feb 00:49
Compare
Choose a tag to compare

This release contains new libraries and functionality, along with numerous bug fixes and documentation improvements.

Highlights are listed below, or you can see the full list of individual commits here, and the full list of resolved issues here.

Note, these release notes are long and may appear truncated in the "Releases" tab; you can see the full version here.

New Board Support

The following boards have been added and may be specified via PICO_BOARD:

  • nullbits_bit_c_pro
  • waveshare_rp2040_lcd_1.28
  • waveshare_rp2040_one

Library Changes/Improvements

hardware_clocks

  • clock_gpio_init() now takes 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 vcocalc.py to override the minimum reference frequency allowed.
  • vcocalc.py now additionally considers reference frequency dividers greater than 1.

hardware_divider

  • Improved the performance of hw_divider_ functions.

hardware_dma

  • Added dma_sniffer_set_output_invert_enabled() 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, lwIP, BTstack 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 for details.
  • Particularly host support should be massively improved.
  • Defaulted new TinyUSB dcd_rp2040 driver's TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX variable to 1 as a workaround for errata RP2040-E15. This fix is required for correctness, but comes at the cost of some performance, so applications that won't ever be plugged into a Pi 4 or Pi 400 can optionally disable this by setting the value of TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIXto 0 either via target_compile_definitions in their CMakeLists.txt or in their tusb_config.h.

New Libraries

pico_async_context

  • Provides support for asynchronous events (timers/IRQ notifications) to be handled in a safe context without concurrent execution (as required by many asynchronous 3rd party libraries).
  • Provides implementations matching those previously implemented in pico_cyw43_arch:
    • poll - Not thread-safe; the user must 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

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 example in pico-examples for more details.

pico_rand

  • Implements a new Random Number Generator API.
  • pico_rand generates rando...
Read more

SDK version 1.4.0

30 Jun 06:59
Compare
Choose a tag to compare

This release adds wireless support for the Raspberry Pi Pico W, adds support for other new boards, and contains various
bug fixes, documentation improvements, and minor improvements/added functionality. You can see the full list of individual commits here.

New Board Support

The following boards have been added and may be specified via PICO_BOARD:

  • pico_w
  • datanoisetv_rp2040_dsp
  • solderparty_rp2040_stamp_round_carrier

Wireless Support

  • Support for the Raspberry Pi Pico W is now included with the SDK (PICO_BOARD=pico_w). The Pico W uses a driver
    for the wireless chip called cyw43_driver which is included as a submodule of the SDK. You need to initialize
    this submodule for Pico W wireless support to be available. Note that the LED on the Pico W board is only
    accessible via the wireless chip and can be accessed via cyw43_arch_gpio_put() and
    cyw43_arch_gpio_get() (part of the pico_cyw43_arch library described below). As a result of the LED being on
    the wireless chip, there is no PICO_DEFAULT_LED_PIN setting and the default LED based examples in pico-examples
    do not work with the Pico W.

  • IP support is provided by lwIP which is also included as a
    submodule which you should initialize if you want to use it.

    The following libraries exposing lwIP functionality are provided by the SDK:

    • pico_lwip_core (included in pico_lwip)
    • pico_lwip_core4 (included in pico_lwip)
    • pico_lwip_core6 (included in pico_lwip)
    • pico_lwip_netif (included in pico_lwip)
    • pico_lwip_sixlowpan (included in pico_lwip)
    • pico_lwip_ppp (included in pico_lwip)
    • pico_lwip_api (this is a blocking API that may be used with FreeRTOS and is not included in pico_lwip)

    As referenced above, the SDK provides a pico_lwip which aggregates all of the commonly needed lwIP functionality.
    You are of course free to use the substituent libraries explicitly instead.

    The following libraries are provided that contain the equivalent lwIP application support:

    • pico_lwip_snmp
    • pico_lwip_http
    • pico_lwip_makefsdata
    • pico_lwip_iperf
    • pico_lwip_smtp
    • pico_lwip_sntp
    • pico_lwip_mdns
    • pico_lwip_netbios
    • pico_lwip_tftp
    • pico_lwip_mbedtls
  • Integration of the IP stack and the cyw43_driver network driver into the user's code is handled by
    pico_cyw43_arch. Both the IP stack and the driver need to do work in response to network traffic, and
    pico_cyw43_arch provides a variety of strategies for servicing that work. Four architecture variants
    are currently provided as libraries:

    • pico_cyw43_arch_lwip_poll - For using the RAW lwIP API (NO_SYS=1 mode) with polling. With this architecture
      the user code must periodically poll via cyw43_arch_poll() to perform background work. This architecture
      matches the common use of lwIP on microcontrollers, and provides no multicore safety
    • pico_cyw43_arch_lwip_threadsafe_background - For using the RAW lwIP API (NO_SYS=1 mode) with multicore
      safety, and automatic servicing of the cyw43_driver and
      lwIP in the background. User polling is not required with this architecture, but care should be taken as lwIP
      callbacks happen in an IRQ context.
    • pico_cyw43_arch_lwip_sys_freertos - For using the full lwIP API including blocking sockets in OS mode
      (NO_SYS=0), along with multicore/task safety, and automatic servicing of the cyw43_driver and the lwIP
      stack in a separate task. This powerful architecture works with both SMP and non-SMP variants of the RP2040 port
      of FreeRTOS-Kernel. Note you must set FREERTOS_KERNEL_PATH in your build to use this variant.
    • pico_cyw43_arch_none - If you do not need the TCP/IP stack but wish to use the on-board LED or other wireless
      chip connected GPIOs.

    See the library documentation or the pico/cyw43_arch.h header for more details.

Notable Library Changes/Improvements

hardware_dma

  • Added dma_unclaim_mask() function for un-claiming multiple DMA channels at once.
  • Added channel_config_set_high_priority() function to set the channel priority via a channel config object.

hardware_gpio

  • Improved the documentation for the pre-existing gpio IRQ functions which use the "one callback per core" callback
    mechanism,
    and added a gpio_set_irq_callback() function to explicitly set the callback independently of enabling per pin GPIO
    IRQs.

  • Reduced the latency of calling the existing "one callback per core" GPIO IRQ callback.

  • Added new support for the user to add their own shared GPIO IRQ handler independent of the pre-existing
    "one callback per core" callback mechanism, allowing for independent usage of GPIO IRQs without having to share one
    handler.
    See
    the
    documentation in hardware/irq.h for full details of the functions added:

    • gpio_add_raw_irq_handler()
    • gpio_add_raw_irq_handler_masked()
    • gpio_add_raw_irq_handler_with_order_priority()
    • gpio_add_raw_irq_handler_with_order_priority_masked()
    • gpio_remove_raw_irq_handler()
    • gpio_remove_raw_irq_handler_masked()
  • Added a gpio_get_irq_event_mask() utility function for use by the new "raw" IRQ handlers.

hardware_irq

  • Added user_irq_claim(), user_irq_unclaim(), user_irq_claim_unused() and user_irq_is_claimed()
    functions for claiming ownership of the user IRQs (the ones numbered 26-31 and not connected to any hardware).
    Uses of the user IRQs have been updated to use these functions. For stdio_usb, the PICO_STDIO_USB_LOW_PRIORITY_IRQ define is still respected if specified, but otherwise an unclaimed one is
    chosen.
  • Added an irq_is_shared_handler() function to determine if a particular IRQ uses a shared handler.

pico_sync

  • Added a sem_try_acquire() function, for non blocking acquisition of a semaphore.

pico_stdio

  • stderr is now supported and goes to the same destination as stdout.
  • Zero timeouts for getchar_timeout_us() are now correctly honored (previously they were a 1us minimum).

stdio_usb

  • stdio over USB can now be used even if you are linking to tinyusb_device yourself. If you have a CDC device in your device descriptors, you can use pico_enable_stdio_usb(TARGET 1) in your CMakeLists.txt
  • The use of a 1ms timer to handle background TinyUSB work has been replaced with use of a more interrupt driven
    approach using a user IRQ for better performance. Note this new feature is disabled if shared IRQ handlers
    are disabled via PICO_DISABLE_SHARED_IRQ_HANDLERS=1

miscellaneous

  • get_core_num() has been moved to pico/platform.h from hardware/sync.h.
  • The C library function realloc() is now multicore safe too.
  • The minimum PLL frequency has been increased from 400Mhz to 750Mhz to improve stability across operating
    conditions. This should not affect the majority of users in any way, but may impact those trying to set
    particularly low clock frequencies. If you do wish to return to the previous
    minimum, you can set PICO_PLL_VCO_MIN_FREQ_MHZ back to 400. There is also a new PICO_PLL_VCO_MAX_FREQ_MHZ
    which defaults to 1600.

Build

  • Compilation with GCC 12 is now supported.

SDK version 1.3.1

18 May 20:50
Compare
Choose a tag to compare

This release contains numerous bug fixes and documentation improvements which are not all listed here; you can see the full list of individual commits here.

New Board Support

The following boards have been added and may be specified via PICO_BOARD:

  • adafruit_kb2040
  • adafruit_macropad_rp2040
  • eetree_gamekit_rp2040
  • garatronic_pybstick26_rp2040 (renamed from pybstick26_rp2040)
  • pimoroni_badger2040
  • pimoroni_motor2040
  • pimoroni_servo2040
  • pimoroni_tiny2040_2mb
  • seeed_xiao_rp2040
  • solderparty_rp2040_stamp_carrier
  • solderparty_rp2040_stamp
  • wiznet_w5100s_evb_pico

Notable Library Changes/Improvements

hardware_dma

  • New documentation has been added to the dma_channel_abort() function describing errata RP2040-E13, and how to work around it.

hardware_irq

  • Fixed a bug related to removing and then re-adding shared IRQ handlers. It is now possible to add/remove handlers as documented.
  • Added new documentation clarifying the fact the shared IRQ handler ordering "priorities" have values that increase with higher priority vs Cortex M0+ IRQ priorites which have values that decrease with priority!

hardware_pwm

  • Added a pwm_config_set_clkdiv_int_frac() method to complement pwm_config_set_clkdiv_int() and pwm_config_set_clkdiv().

hardware_pio

  • Fixed the pio_set_irqn_source_mask_enabled() method which previously affected the wrong IRQ.

hardware_rtc

  • Added clarification to rtc_set_datetime() documentation that the new value may not be visible to a rtc_get_datetime() very soon after, due to crossing of clock domains.

pico_platform

  • Added a busy_wait_at_least_cycles() method as a convenience method for a short tight-loop counter-based delay.

pico_stdio

  • Fixed a bug related to removing stdio "drivers". stdio_set_driver_eabled() can now be used freely to dynamically enable and disable drivers during runtime.

pico_time

  • Added an is_at_the_end_of_time() method to check if a given time matches the SDK's maximum time value.

Runtime

  • A bug in __ctzdi2() aka __builtin_ctz(uint64_t) was fixed.

Build

  • Compilation with GCC 11 is now supported.
  • PIOASM_EXTRA_SOURCE_FILES is now actually respected.

pioasm

  • Input files with Windows (CRLF) line endings are now accepted.
  • A bug in the python output was fixed.

elf2uf2

  • Extra padding was added to the UF2 output of misaligned or non-contiguous binaries to work around errata RP2040-E14.

Note the 1.3.0 release of the SDK incorrectly squashed the history of the changes. A new merge commit has been added to restore the full history, and the 1.3.0 tag has been updated

SDK version 1.3.0

01 Nov 19:28
Compare
Choose a tag to compare

This release contains numerous bug fixes and documentation improvements. Additionally, it contains the following notable changes/improvements:

Updated TinyUSB to 0.12.0

  • The lib/tinyusb submodule has been updated from 0.10.1 to 0.12.0. See https://github.com/hathach/tinyusb/releases/tag/0.11.0 and https://github.com/hathach/tinyusb/releases/tag/0.12.0 for release notes.
  • Improvements have been made for projects that include TinyUSB and also compile with enhanced warning levels and -Werror. Warnings have been fixed in rp2040 specific TinyUSB code, and in TinyUSB headers, and a new cmake function suppress_tinyusb_warnings() has been added, that you may call from your CMakeLists.txt to suppress warnings in other TinyUSB C files.

New Board Support

The following boards have been added and may be specified via PICO_BOARD:

  • adafruit_trinkey_qt2040
  • melopero_shake_rp2040
  • pimoroni_interstate75
  • pimoroni_plasma2040
  • pybstick26_rp2040
  • waveshare_rp2040_lcd_0.96
  • waveshare_rp2040_plus_4mb
  • waveshare_rp2040_plus_16mb
  • waveshare_rp2040_zero

Updated SVD, hardware_regs, hardware_structs

The RP2040 SVD has been updated, fixing some register access types and adding new documentation.

The hardware_regs headers have been updated accordingly.

The hardware_structs headers which were previously hand coded, are now generated from the SVD, and retain select documentation from the SVD, including register descriptions and register bit-field tables.

e.g. what was once

typedef struct {
    io_rw_32 ctrl;
    io_ro_32 fstat;
    ...

becomes:

// Reference to datasheet: https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf#tab-registerlist_pio
//
// The _REG_ macro is intended to help make the register navigable in your IDE (for example, using the "Go to Definition" feature)
// _REG_(x) will link to the corresponding register in hardware/regs/pio.h.
//
// Bit-field descriptions are of the form:
// BITMASK [BITRANGE]: FIELDNAME (RESETVALUE): DESCRIPTION

typedef struct {
    _REG_(PIO_CTRL_OFFSET) // PIO_CTRL
    // PIO control register
    // 0x00000f00 [11:8]  : CLKDIV_RESTART (0): Restart a state machine's clock divider from an initial phase of 0
    // 0x000000f0 [7:4]   : SM_RESTART (0): Write 1 to instantly clear internal SM state which may be otherwise difficult...
    // 0x0000000f [3:0]   : SM_ENABLE (0): Enable/disable each of the four state machines by writing 1/0 to each of these four bits
    io_rw_32 ctrl;

    _REG_(PIO_FSTAT_OFFSET) // PIO_FSTAT
    // FIFO status register
    // 0x0f000000 [27:24] : TXEMPTY (0xf): State machine TX FIFO is empty
    // 0x000f0000 [19:16] : TXFULL (0): State machine TX FIFO is full
    // 0x00000f00 [11:8]  : RXEMPTY (0xf): State machine RX FIFO is empty
    // 0x0000000f [3:0]   : RXFULL (0): State machine RX FIFO is full
    io_ro_32 fstat;
    ...

Behavioral Changes

There were some behavioral changes in this release:

pico_sync

SDK 1.2.0 previously added recursive mutex support using the existing (previously non-recursive) mutex_ functions. This caused a performance regression, and the only clean way to fix the problem was to return the mutex_ functions to their pre-SDK 1.2.0 behavior, and split the recursive mutex functionality out into separate recursive_mutex_ functions with a separate recursive_mutex_ type.

Code using the SDK 1.2.0 recursive mutex functionality will need to be changed to use the new type and functions, however as a convenience, the pre-processor define PICO_MUTEX_ENABLE_SDK120_COMPATIBILITY may be set to 1 to retain the SDK 1.2.0 behavior at the cost of an additional performance penalty. The ability to use this pre-processor define will be removed in a subsequent SDK version.

pico_platform

  • pico.h and its dependencies have been slightly refactored so it can be included by assembler code as well as C/C++ code. Thie ensures that assembler code and C/C++ code follow the same board configuration/override order and see the same configuration defines. This should not break any existing code, but is notable enough to mention.
  • pico/platform.h is now fully documented.

pico_standard_link

-Wl,max-page-size=4096 is now passed to the linker, which is beneficial to certain users and should have no discernible impact on the rest.

Other Notable Improvements

hardware_base

  • Added xip_noalloc_alias(addr), xip_nocache_alias(addr), xip_nocache_noalloc_alias(addr) macros for converting a flash address between XIP aliases (similar to the hw_xxx_alias(addr) macros).

hardware_dma

  • Added dma_timer_claim(), dma_timer_unclaim(), dma_claim_unused_timer() and dma_timer_is_claimed() to manage ownership of DMA timers.
  • Added dma_timer_set_fraction() and dma_get_timer_dreq() to facilitate pacing DMA transfers using DMA timers.

hardware_i2c

  • Added i2c_get_dreq() function to facilitate configuring DMA transfers to/from an I2C instance.

hardware_irq

  • Added irq_get_priority().
  • Fixed implementation when PICO_DISABLE_SHARED_IRQ_HANDLERS=1 is specified, and allowed irq_add_shared_handler to be used in this case (as long as there is only one handler - i.e. it behaves exactly like irq_set_exclusive_handler),
  • Sped up IRQ priority initialization which was slowing down per core initialization.

hardware_pio

  • pio_encode_ functions in hardware/pico_instructions.h are now documented.

hardware_pwm

  • Added pwm_get_dreq() function to facilitate configuring DMA transfers to a PWM slice.

hardware_spi

  • Added spi_get_dreq() function to facilitate configuring DMA transfers to/from an SPI instance.

hardware_uart

  • Added uart_get_dreq() function to facilitate configuring DMA transfers to/from a UART instance.

hardware_watchdog

  • Added watchdog_enable_caused_reboot() to distinguish a watchdog reboot caused by a watchdog timeout after calling watchdog_enable() from other watchdog reboots (e.g. that are performed when a UF2 is dragged onto a device in BOOTSEL mode).

pico_bootrom

  • Added new constants and function signature typedefs to pico/bootrom.h to facilitate calling bootrom functions directly.

pico_multicore

  • Improved documentation in pico/multicore.h; particularly, multicore_lockout_ functions are newly documented.

pico_platform

  • PICO_RP2040 is now defined to 1 in PICO_PLATFORM=rp2040 (i.e. normal) builds.

pico_stdio

  • Added puts_raw() and putchar_raw() to skip CR/LF translation if enabled.
  • Added stdio_usb_connected() to detect CDC connection when using stdio_usb.
  • Added PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS define that can be set to wait for a CDC connection to be established during initialization of stdio_usb. Note: value -1 means indefinite. This can be used to prevent initial program output being lost, at the cost of requiring an active CDC connection.
  • Fixed semihosting_putc which was completely broken.

pico_usb_reset_interface

  • This new library contains pico/usb_reset_interface.h split out from stdio_usb to facilitate inclusion in external projects.

CMake build

  • OUTPUT_NAME target property is now respected when generating supplemental files (.BIN, .HEX, .MAP, .UF2)

pioasm

  • Operator precedence of *, /, -, + have been fixed
  • Incorrect MicroPython output has been fixed.

elf2uf2

  • A bug causing an error with binaries produces by certain other languages has been fixed.

SDK version 1.2.0

03 Jun 15:54
bfcbefa
Compare
Choose a tag to compare

This release contains numerous bug fixes and documentation improvements. Additionally it contains the following improvements/notable changes:

Updated TinyUSB to 0.10.1

The lib/tinyusb submodule has been updated from 0.8.0 and now tracks upstream https://github.com/hathach/tinyusb.git. It is worth making sure you do a

git submodule sync
git submodule update

to make sure you are correctly tracking upstream TinyUSB if you are not checking out a clean pico-sdk repository.

Note also that moving ffrom TinyUSB 0.8.0 to TinyUSB 0.10.1 may require some minor changes to your USB code.

New/improved board headers

  • New board headers support for PICO_BOARDs arduino_nano_rp240_connect, pimoroni_picolipo_4mb and pimoroni_picolipo_16mb
  • Missing/new #defines for default SPI and I2C pins have been added

Added CMSIS core headers

CMSIS core headers (e.g. core_cm0plus.h and RP2040.h) are made available via cmsis_core INTERFACE library. Additionally, CMSIS standard exception naming is available via PICO_CMSIS_RENAME_EXCEPTIONS=1

API improvements

pico_sync

  • Added support for recursive mutexes via recursive_mutex_init() and auto_init_recursive_mutex()
  • Added mutex_enter_timeout_us()
  • Added critical_section_deinit()
  • Added sem_acquire_timeout_ms() and sem_acquire_block_until()

hardware_adc

  • Added adc_get_selected_input()

hardware_clocks

  • clock_get_hz() now returns actual achieved frequency rather than desired frequency

hardware_dma

  • Added dma_channel_is_claimed()
  • Added new methods for configuring/acknowledging DMA IRQs. dma_irqn_set_channel_enabled(), dma_irqn_set_channel_mask_enabled(), dma_irqn_get_channel_status(), dma_irqn_acknowledge_channel() etc.

hardware_exception

New library for setting ARM exception handlers:

  • Added exception_set_exclusive_handler(), exception_restore_handler(), exception_get_vtable_handler()

hardware_flash

  • Exposed previously private function flash_do_cmd() for low level flash command execution

hardware_gpio

  • Added gpio_set_input_hysteresis_enabled(), gpio_is_input_hysteresis_enabled(), gpio_set_slew_rate(), gpio_get_slew_rate(), gpio_set_drive_strength(), gpio_get_drive_strength(). gpio_get_out_level(), gpio_set_irqover()

hardware_i2c

  • Corrected a number of incorrect hardware register definitions
  • A number of edge case in the i2c code fixed

hardware_interp

  • Added interp_lane_is_claimed(), interp_unclaim_lane_mask()

hardware_irq

  • Notably fixed the PICO_LOWEST/HIGHEST_IRQ_PRIORITY values which were backwards!

hardware_pio

  • Added new methods for configuring/acknowledging PIO interrupts (pio_set_irqn_source_enabled(),
    pio_set_irqn_source_mask_enabled(), pio_interrupt_get(), pio_interrupt_clear() etc.)
  • Added pio_sm_is_claimed()

hardware_spi

  • Added spi_get_baudrate()
  • Changed spi_init() to return the set/achieved baud rate rather than void
  • Changed spi_is_writable() to return bool not size_t (it was always 1/0)

hardware_sync

  • Notable documentation improvements for spin lock functions
  • Added spin_lock_is_claimed()

hardware_timer

  • Added busy_wait_ms() to match busy_wait_us()
  • Added hardware_alarm_is_claimed()

pico_float/pico_double

  • Correctly save/restore divider state if floating point is used from interrupts

pico_int64_ops

  • Added PICO_INT64_OPS_IN_RAM flag to move code into RAM to avoid veneers when calling code is in RAM

pico_runtime

  • Added ability to override panic function by setting PICO_PANIC_FUNCTION=foo to the use foo as the implementation, or setting
    PICO_PANIC_FUNCITON= to simply breakpoint, saving some code space

pico_unique_id

  • Added pico_get_unique_board_id_string().

General code improvements

  • Cleanup up some additional classes of compiler warnings
  • Adding some missing const to method parameters

SVD

  • USB DPRAM for device mode is now included

pioasm

  • Added #pragma once to C/C++ output

RTOS interoperability

Improvements designed to make porting RTOSes either based on the SDK or supporting SDK code easier.

  • Added PICO_DIVIDER_DISABLE_INTERRUPTS flag to optionally configure all uses of the hardware divider to be guarded by disabling interrupts, rather than requiring on the RTOS to save/restore the divider state on context switch
  • Added new abstractions to pico/lock_core.h to allow an RTOS to inject replacement code for SDK based
    low level wait, notify and sleep/timeouts used by synchonization primitives in pico_sync and for sleep_ methods. If an RTOS implements these few simple methods, then all SDK semaphore, mutex, queue, sleep methods can be safely used both within/to/from RTOS tasks, but also to communicate with non RTOS task aware code, whether it be existing libraries and IRQ handlers or code running perhaps (though not necessarily) on the other core

CMake build changes

Substantive changes have been made to the CMake build, so if you are using a hand crafted non-CMake build, you will need to update your compile/link flags. Additionally changed some possibly confusing status messages from CMake build generation to be debug only

Boot Stage 2

  • New boot stage 2 for AT25SF128A

1.1.2 bug fix release

07 Apr 13:21
Compare
Choose a tag to compare

Fixes issues with boot stage 2 selection

1.1.1 bug fix release

01 Apr 22:34
1769968
Compare
Choose a tag to compare

This fixes a number of bugs, and additionally adds support for a board configuration header to choose the boot_stage2

SDK version 1.1.0

05 Mar 15:16
fc10a97
Compare
Choose a tag to compare

New Feature Highlights

  • Added board headers for Adafruit, Pimoroni & SparkFun boards

    • new values for PICO_BOARD are adafruit_feather_rp2040, adafruit_itsybitsy_rp2040, adafruit_qtpy_rp2040,
      pimoroni_keybow2040, pimoroni_picosystem, pimoroni_tiny2040, sparkfun_micromod,
      sparkfun_promicro, sparkfun_thingplus, in addition to the existing pico and vgaboard.
    • Added additional definitions for a default SPI, I2C pins as well as the existing ones for UART
    • Allow default pins to be undefined (not all boards have UART for example), and SDK will compile but warn as needed in the absence of default.
    • Added additional definition for a default WS2812 compatible pin (currently unused).
  • New reset options

    • Added pico_bootsel_via_double_reset library to allow reset to BOOTSEL mode via double press of a RESET button
    • When using pico_stdio_usb i.e. stdio connected via USB CDC to host, setting baud rate to 1200 (by default)
      can optionally be used to reset into BOOTSEL mode.
    • When using pico-stdio_usb i.e. stdio connected via USB CDC to host, an additional interface may be added
      to give picotool control over resetting the device.
  • Build improvement for non SDK or existing library builds

    • Removed additional compiler warnings (note register headers now use _u(x) macro for unsigned values though).
    • Made build more clang friendly.

This release also contains many bug fixes, documentation updates and minor improvements.

Note: there are some nominally backwards incompatible changes not worthy of a major version bump:
- PICO_DEFAULT_UART_ defines now default to undefined if there is no default rather than -1 previously
- The broken multicore_sleep_core1() API has been removed; multicore_reset_core1
is already available to put core 1 into a deep sleep.

SDK version 1.0.1

01 Feb 21:07
Compare
Choose a tag to compare
  • add pico_get_unique_id method to return a unique identifier for a Pico board using the identifier of the external flash
  • exposed all 4 pacing timers on the DMA peripheral (previously only 2 were exposed)
  • fixed ninja build (i.e. cmake -G ninja .. ; ninja)
  • minor other improvements and bug fixes

Additionally, a low level change was made to the way flash binaries start executing after boot_stage2. This was at the request of folks implementing other language runtimes. It is not generally of concern to end users, however it did require a change to the linker scripts so if you have cloned those to make modifications then you need to port across the relevant changes. If you are porting a different language runtime using the SDK boot_stage2 implementations then you should be aware that you should now have a vector table (rather than executable code) - at 0x10000100