Merge remote-tracking branch 'origin/develop' into clang-corrections

This commit is contained in:
Hardy Griech 2025-10-15 13:04:22 +02:00
commit 9d82a9205a
35 changed files with 64 additions and 32 deletions

View file

@ -1,6 +1,6 @@
module(
name = "pico-sdk",
version = "2.2.0",
version = "2.2.1-develop",
)
bazel_dep(name = "platforms", version = "0.0.9")

View file

@ -7,10 +7,10 @@ if (NOT DEFINED PICO_SDK_VERSION_MAJOR)
set(PICO_SDK_VERSION_MINOR 2)
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, default=Current SDK revision, group=pico_base
# PICO_CMAKE_CONFIG: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, default=Current SDK revision, group=pico_base
set(PICO_SDK_VERSION_REVISION 0)
set(PICO_SDK_VERSION_REVISION 1)
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_PRE_RELEASE_ID, Optional SDK pre-release version identifier, default=Current SDK pre-release identifier, type=string, group=pico_base
# PICO_CMAKE_CONFIG: PICO_SDK_VERSION_PRE_RELEASE_ID, Optional SDK pre-release version identifier, default=Current SDK pre-release identifier, type=string, group=pico_base
#set(PICO_SDK_VERSION_PRE_RELEASE_ID develop)
set(PICO_SDK_VERSION_PRE_RELEASE_ID develop)
endif()
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_STRING, SDK version string, type=string, default=Current SDK version string, group=pico_base

0
src/boards/include/boards/waveshare_pico_cam_a.h Executable file → Normal file
View file

0
src/boards/include/boards/waveshare_rp2040_ble.h Executable file → Normal file
View file

0
src/boards/include/boards/waveshare_rp2040_eth.h Executable file → Normal file
View file

0
src/boards/include/boards/waveshare_rp2040_geek.h Executable file → Normal file
View file

0
src/boards/include/boards/waveshare_rp2040_matrix.h Executable file → Normal file
View file

0
src/boards/include/boards/waveshare_rp2040_pizero.h Executable file → Normal file
View file

View file

0
src/boards/include/boards/waveshare_rp2040_tiny.h Executable file → Normal file
View file

View file

0
src/boards/include/boards/waveshare_rp2350_eth.h Executable file → Normal file
View file

0
src/boards/include/boards/waveshare_rp2350_geek.h Executable file → Normal file
View file

0
src/boards/include/boards/waveshare_rp2350_lcd_0.96.h Executable file → Normal file
View file

0
src/boards/include/boards/waveshare_rp2350_lcd_1.28.h Executable file → Normal file
View file

0
src/boards/include/boards/waveshare_rp2350_one.h Executable file → Normal file
View file

0
src/boards/include/boards/waveshare_rp2350_plus_16mb.h Executable file → Normal file
View file

0
src/boards/include/boards/waveshare_rp2350_plus_4mb.h Executable file → Normal file
View file

0
src/boards/include/boards/waveshare_rp2350_tiny.h Executable file → Normal file
View file

View file

0
src/boards/include/boards/waveshare_rp2350_zero.h Executable file → Normal file
View file

View file

@ -109,8 +109,6 @@ extern "C" {
void __sev();
void __wev();
void __wfi();
void __wfe();

View file

@ -93,23 +93,44 @@ void PICO_WEAK_FUNCTION_IMPL_NAME(spin_unlock)(spin_lock_t *lock, uint32_t saved
spin_unlock_unsafe(lock);
}
PICO_WEAK_FUNCTION_DEF(__sev)
// These are defined on ARM hosts, but don't do what we want for the host
// since this is a simulated build.
#if PICO_C_COMPILER_IS_GNU || !__has_builtin(__sev)
#define __sev_c __sev
#else
#pragma redefine_extname __sev_c __sev
#endif
#if PICO_C_COMPILER_IS_GNU || !__has_builtin(__wfi)
#define __wfi_c __wfi
#else
#pragma redefine_extname __wfi_c __wfi
#endif
#if PICO_C_COMPILER_IS_GNU || !__has_builtin(__wfe)
#define __wfe_c __wfe
#else
#pragma redefine_extname __wfe_c __wfe
#endif
PICO_WEAK_FUNCTION_DEF(__sev_c)
volatile bool event_fired;
void PICO_WEAK_FUNCTION_IMPL_NAME(__sev)() {
void PICO_WEAK_FUNCTION_IMPL_NAME(__sev_c)() {
event_fired = true;
}
PICO_WEAK_FUNCTION_DEF(__wfi)
PICO_WEAK_FUNCTION_DEF(__wfi_c)
void PICO_WEAK_FUNCTION_IMPL_NAME(__wfi)() {
void PICO_WEAK_FUNCTION_IMPL_NAME(__wfi_c)() {
panic("Can't wait on irq for host core0 only implementation");
}
PICO_WEAK_FUNCTION_DEF(__wfe)
PICO_WEAK_FUNCTION_DEF(__wfe_c)
void PICO_WEAK_FUNCTION_IMPL_NAME(__wfe)() {
void PICO_WEAK_FUNCTION_IMPL_NAME(__wfe_c)() {
while (!event_fired) tight_loop_contents();
}
@ -146,4 +167,4 @@ int PICO_WEAK_FUNCTION_IMPL_NAME(spin_lock_claim_unused)(bool required) {
PICO_WEAK_FUNCTION_DEF(spin_lock_num)
uint PICO_WEAK_FUNCTION_IMPL_NAME(spin_lock_num)(spin_lock_t *lock) {
return 0;
}
}

View file

@ -1,5 +1,5 @@
This directory contains files specific to the RP2350 hardware. It is only used when building for RP2350 platforms, i.e.
`PICO_PLATFORM=rp2350-arm-s` or `PICO_PLATFORM=rp235-riscv`
`PICO_PLATFORM=rp2350-arm-s` or `PICO_PLATFORM=rp2350-riscv`
`hardware_regs` contains low level hardware register #defines autogenerated from the RP2350 chip definition itself.

View file

@ -556,6 +556,7 @@ static inline uint32_t dma_encode_transfer_count(uint transfer_count) {
*/
static inline uint32_t dma_encode_transfer_count_with_self_trigger(uint transfer_count) {
#if PICO_RP2040
(void)transfer_count;
panic_unsupported();
#else
return dma_encode_transfer_count(transfer_count) | (DMA_CH0_TRANS_COUNT_MODE_VALUE_TRIGGER_SELF << DMA_CH0_TRANS_COUNT_MODE_LSB);
@ -578,8 +579,8 @@ static inline uint32_t dma_encode_endless_transfer_count(void) {
#if PICO_RP2040
panic_unsupported();
#else
static_assert(DMA_CH0_TRANS_COUNT_MODE_VALUE_ENDLESS == 0xf);
static_assert(DMA_CH0_TRANS_COUNT_MODE_LSB == 28);
static_assert(DMA_CH0_TRANS_COUNT_MODE_VALUE_ENDLESS == 0xf, "");
static_assert(DMA_CH0_TRANS_COUNT_MODE_LSB == 28, "");
return 0xffffffffu;
#endif
}

View file

@ -196,9 +196,11 @@ void gpio_set_irq_enabled(uint gpio, uint32_t events, bool enabled) {
}
void gpio_set_irq_enabled_with_callback(uint gpio, uint32_t events, bool enabled, gpio_irq_callback_t callback) {
// first set callback, then enable the interrupt
gpio_set_irq_callback(callback);
// when enabling, first set callback, then enable the interrupt
// when disabling, first disable the interrupt, then clear callback
if (enabled) gpio_set_irq_callback(callback);
gpio_set_irq_enabled(gpio, events, enabled);
if (!enabled) gpio_set_irq_callback(callback);
if (enabled) irq_set_enabled(IO_IRQ_BANK0, true);
}

View file

@ -128,7 +128,7 @@ extern "C" {
__h3_bextmi_rd; \
})
#else
#define __hazard3_bextm(nbits, rs1, rs2) (((rs1) >> ((shamt) & 0x1f)) & (0xffu >> (7 - (((nbits) - 1) & 0x7))))
#define __hazard3_bextmi(nbits, rs1, rs2) (((rs1) >> ((shamt) & 0x1f)) & (0xffu >> (7 - (((nbits) - 1) & 0x7))))
#endif
#ifdef __hazard3_extension_xh3power

View file

@ -128,6 +128,15 @@ void irq_set_pending(uint num) {
#endif
}
#if !PICO_NO_RAM_VECTOR_TABLE
static void set_raw_irq_handler_and_unlock(uint num, irq_handler_t handler, uint32_t save) {
// update vtable (vtable_handler may be same or updated depending on cases, but we do it anyway for compactness)
get_vtable()[VTABLE_FIRST_IRQ + num] = handler;
__dmb();
spin_unlock(spin_lock_instance(PICO_SPINLOCK_ID_IRQ), save);
}
#endif
#if !PICO_DISABLE_SHARED_IRQ_HANDLERS && !PICO_NO_RAM_VECTOR_TABLE
// limited by 8 bit relative links (and reality)
static_assert(PICO_MAX_SHARED_IRQ_HANDLERS >= 1 && PICO_MAX_SHARED_IRQ_HANDLERS < 0x7f, "");
@ -202,13 +211,6 @@ bool irq_has_shared_handler(uint irq_num) {
return is_shared_irq_raw_handler(handler);
}
static void set_raw_irq_handler_and_unlock(uint num, irq_handler_t handler, uint32_t save) {
// update vtable (vtable_handler may be same or updated depending on cases, but we do it anyway for compactness)
get_vtable()[VTABLE_FIRST_IRQ + num] = handler;
__dmb();
spin_unlock(spin_lock_instance(PICO_SPINLOCK_ID_IRQ), save);
}
#else // PICO_DISABLE_SHARED_IRQ_HANDLERS && PICO_NO_RAM_VECTOR_TABLE
#define is_shared_irq_raw_handler(h) false
bool irq_has_shared_handler(uint irq_num) {

View file

@ -148,7 +148,7 @@ static inline uint pio_encode_sideset(uint sideset_bit_count, uint value) {
* \return the side set bits to be ORed with an instruction encoding
*/
static inline uint pio_encode_sideset_opt(uint sideset_bit_count, uint value) {
valid_params_if(PIO_INSTRUCTIONS, sideset_bit_count >= 0 && sideset_bit_count <= 4);
valid_params_if(PIO_INSTRUCTIONS, sideset_bit_count <= 4);
valid_params_if(PIO_INSTRUCTIONS, value <= ((1u << sideset_bit_count) - 1));
return 0x1000u | value << (12u - sideset_bit_count);
}

View file

@ -94,6 +94,9 @@ __force_inline static void __sev(void) {
pico_default_asm_volatile ("sev");
#endif
}
#else
// Forward declare so we don't have to #include <arm_acle.h>.
void __sev(void);
#endif
/*! \brief Insert a WFE instruction in to the code path.
@ -110,6 +113,9 @@ __force_inline static void __wfe(void) {
pico_default_asm_volatile ("wfe");
#endif
}
#else
// Forward declare so we don't have to #include <arm_acle.h>.
void __wfe(void);
#endif
/*! \brief Insert a WFI instruction in to the code path.
@ -121,6 +127,9 @@ __force_inline static void __wfe(void) {
__force_inline static void __wfi(void) {
pico_default_asm_volatile("wfi");
}
#else
// Forward declare so we don't have to #include <arm_acle.h>.
void __wfi(void);
#endif
/*! \brief Insert a DMB instruction in to the code path.

View file

@ -11,6 +11,6 @@
#include "pico/sha256.h"
typedef struct pico_sha256_state mbedtls_sha256_context;
#endif // PICO_RP2350
#endif // LIB_PICO_SHA256
#endif

View file

@ -370,7 +370,7 @@ static bool multicore_doorbell_claim_under_lock(uint doorbell_num, uint core_mas
(is_bit_claimed(doorbell_claimed[1], doorbell_num + 1u) << 1));
if (claimed_cores_for_doorbell & core_mask) {
if (required) {
panic( "Multicoore doorbell %d already claimed on core mask 0x%x; requested core mask 0x%x\n",
panic( "Multicore doorbell %d already claimed on core mask 0x%x; requested core mask 0x%x\n",
claimed_cores_for_doorbell, core_mask);
}
return false;

View file

@ -18,5 +18,3 @@ if (PICO_CYW43_SUPPORTED)
)
endif()
pico_generate_pio_header(pico_status_led ${CMAKE_CURRENT_LIST_DIR}/ws2812.pio)
get_target_property(OUT pico_status_led LINK_LIBRARIES)

View file

@ -109,7 +109,7 @@ bool status_led_init(void);
*
* \param context An \ref async_context used to communicate with the status LED (e.g. on Pico W or Pico 2 W)
* \return Returns true if the LED was initialized successfully, otherwise false on failure
* \sa status_led_init_with_context
* \sa status_led_init
*/
bool status_led_init_with_context(struct async_context *context);

View file

@ -80,7 +80,8 @@ bool colored_status_led_set_state(bool led_on) {
if (colored_status_led_supported()) {
#if COLORED_STATUS_LED_USING_WS2812_PIO
success = true;
if (led_on && !colored_status_led_on) {
if (led_on) {
// Turn the LED "on" even if it was already on, as the color might have changed
success = set_ws2812(colored_status_led_on_color);
} else if (!led_on && colored_status_led_on) {
success = set_ws2812(0);