SDK version 1.3.0
This release contains numerous bug fixes and documentation improvements. Additionally, it contains the following notable changes/improvements:
Updated TinyUSB to 0.12.0
- The
lib/tinyusb
submodule has been updated from 0.10.1 to 0.12.0. See https://github.com/hathach/tinyusb/releases/tag/0.11.0 and https://github.com/hathach/tinyusb/releases/tag/0.12.0 for release notes. - Improvements have been made for projects that include TinyUSB and also compile with enhanced warning levels and
-Werror
. Warnings have been fixed in rp2040 specific TinyUSB code, and in TinyUSB headers, and a new cmake functionsuppress_tinyusb_warnings()
has been added, that you may call from yourCMakeLists.txt
to suppress warnings in other TinyUSB C files.
New Board Support
The following boards have been added and may be specified via PICO_BOARD
:
adafruit_trinkey_qt2040
melopero_shake_rp2040
pimoroni_interstate75
pimoroni_plasma2040
pybstick26_rp2040
waveshare_rp2040_lcd_0.96
waveshare_rp2040_plus_4mb
waveshare_rp2040_plus_16mb
waveshare_rp2040_zero
Updated SVD, hardware_regs
, hardware_structs
The RP2040 SVD has been updated, fixing some register access types and adding new documentation.
The hardware_regs
headers have been updated accordingly.
The hardware_structs
headers which were previously hand coded, are now generated from the SVD, and retain select documentation from the SVD, including register descriptions and register bit-field tables.
e.g. what was once
typedef struct {
io_rw_32 ctrl;
io_ro_32 fstat;
...
becomes:
// Reference to datasheet: https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf#tab-registerlist_pio
//
// The _REG_ macro is intended to help make the register navigable in your IDE (for example, using the "Go to Definition" feature)
// _REG_(x) will link to the corresponding register in hardware/regs/pio.h.
//
// Bit-field descriptions are of the form:
// BITMASK [BITRANGE]: FIELDNAME (RESETVALUE): DESCRIPTION
typedef struct {
_REG_(PIO_CTRL_OFFSET) // PIO_CTRL
// PIO control register
// 0x00000f00 [11:8] : CLKDIV_RESTART (0): Restart a state machine's clock divider from an initial phase of 0
// 0x000000f0 [7:4] : SM_RESTART (0): Write 1 to instantly clear internal SM state which may be otherwise difficult...
// 0x0000000f [3:0] : SM_ENABLE (0): Enable/disable each of the four state machines by writing 1/0 to each of these four bits
io_rw_32 ctrl;
_REG_(PIO_FSTAT_OFFSET) // PIO_FSTAT
// FIFO status register
// 0x0f000000 [27:24] : TXEMPTY (0xf): State machine TX FIFO is empty
// 0x000f0000 [19:16] : TXFULL (0): State machine TX FIFO is full
// 0x00000f00 [11:8] : RXEMPTY (0xf): State machine RX FIFO is empty
// 0x0000000f [3:0] : RXFULL (0): State machine RX FIFO is full
io_ro_32 fstat;
...
Behavioral Changes
There were some behavioral changes in this release:
pico_sync
SDK 1.2.0 previously added recursive mutex support using the existing (previously non-recursive) mutex_
functions. This caused a performance regression, and the only clean way to fix the problem was to return the mutex_
functions to their pre-SDK 1.2.0 behavior, and split the recursive mutex functionality out into separate recursive_mutex_
functions with a separate recursive_mutex_
type.
Code using the SDK 1.2.0 recursive mutex functionality will need to be changed to use the new type and functions, however as a convenience, the pre-processor define PICO_MUTEX_ENABLE_SDK120_COMPATIBILITY
may be set to 1 to retain the SDK 1.2.0 behavior at the cost of an additional performance penalty. The ability to use this pre-processor define will be removed in a subsequent SDK version.
pico_platform
pico.h
and its dependencies have been slightly refactored so it can be included by assembler code as well as C/C++ code. Thie ensures that assembler code and C/C++ code follow the same board configuration/override order and see the same configuration defines. This should not break any existing code, but is notable enough to mention.pico/platform.h
is now fully documented.
pico_standard_link
-Wl,max-page-size=4096
is now passed to the linker, which is beneficial to certain users and should have no discernible impact on the rest.
Other Notable Improvements
hardware_base
- Added
xip_noalloc_alias(addr)
,xip_nocache_alias(addr)
,xip_nocache_noalloc_alias(addr)
macros for converting a flash address between XIP aliases (similar to thehw_xxx_alias(addr)
macros).
hardware_dma
- Added
dma_timer_claim()
,dma_timer_unclaim()
,dma_claim_unused_timer()
anddma_timer_is_claimed()
to manage ownership of DMA timers. - Added
dma_timer_set_fraction()
anddma_get_timer_dreq()
to facilitate pacing DMA transfers using DMA timers.
hardware_i2c
- Added
i2c_get_dreq()
function to facilitate configuring DMA transfers to/from an I2C instance.
hardware_irq
- Added
irq_get_priority()
. - Fixed implementation when
PICO_DISABLE_SHARED_IRQ_HANDLERS=1
is specified, and allowedirq_add_shared_handler
to be used in this case (as long as there is only one handler - i.e. it behaves exactly likeirq_set_exclusive_handler
), - Sped up IRQ priority initialization which was slowing down per core initialization.
hardware_pio
pio_encode_
functions inhardware/pico_instructions.h
are now documented.
hardware_pwm
- Added
pwm_get_dreq()
function to facilitate configuring DMA transfers to a PWM slice.
hardware_spi
- Added
spi_get_dreq()
function to facilitate configuring DMA transfers to/from an SPI instance.
hardware_uart
- Added
uart_get_dreq()
function to facilitate configuring DMA transfers to/from a UART instance.
hardware_watchdog
- Added
watchdog_enable_caused_reboot()
to distinguish a watchdog reboot caused by a watchdog timeout after callingwatchdog_enable()
from other watchdog reboots (e.g. that are performed when a UF2 is dragged onto a device in BOOTSEL mode).
pico_bootrom
- Added new constants and function signature typedefs to
pico/bootrom.h
to facilitate calling bootrom functions directly.
pico_multicore
- Improved documentation in
pico/multicore.h
; particularly,multicore_lockout_
functions are newly documented.
pico_platform
PICO_RP2040
is now defined to 1 inPICO_PLATFORM=rp2040
(i.e. normal) builds.
pico_stdio
- Added
puts_raw()
andputchar_raw()
to skip CR/LF translation if enabled. - Added
stdio_usb_connected()
to detect CDC connection when usingstdio_usb
. - Added
PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS
define that can be set to wait for a CDC connection to be established during initialization ofstdio_usb
. Note: value -1 means indefinite. This can be used to prevent initial program output being lost, at the cost of requiring an active CDC connection. - Fixed
semihosting_putc
which was completely broken.
pico_usb_reset_interface
- This new library contains
pico/usb_reset_interface.h
split out fromstdio_usb
to facilitate inclusion in external projects.
CMake build
OUTPUT_NAME
target property is now respected when generating supplemental files (.BIN
,.HEX
,.MAP
,.UF2
)
pioasm
- Operator precedence of
*
,/
,-
,+
have been fixed - Incorrect MicroPython output has been fixed.
elf2uf2
- A bug causing an error with binaries produces by certain other languages has been fixed.