From b04a09110f39a626b0654f6d1b18ca47674a5af8 Mon Sep 17 00:00:00 2001 From: Graham Sanderson Date: Tue, 26 Oct 2021 16:07:21 -0500 Subject: [PATCH] revert additional assertion check which breaks used of hw_alias macro outside of functions (#635) * revert additional assertion check which breaks used of hw_alias macros outside of functions --- .../hardware_base/include/hardware/address_mapped.h | 12 +++++++----- src/rp2_common/pico_runtime/runtime.c | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/rp2_common/hardware_base/include/hardware/address_mapped.h b/src/rp2_common/hardware_base/include/hardware/address_mapped.h index 156939f..a3b9584 100644 --- a/src/rp2_common/hardware_base/include/hardware/address_mapped.h +++ b/src/rp2_common/hardware_base/include/hardware/address_mapped.h @@ -81,11 +81,13 @@ typedef ioptr const const_ioptr; #define _REG_(x) // Helper method used by hw_alias macros to optionally check input validity -static __force_inline uint32_t hw_alias_check_addr(volatile void *addr) { - uint32_t rc = (uintptr_t)addr; - invalid_params_if(ADDRESS_ALIAS, rc < 0x40000000); // catch likely non HW pointer types - return rc; -} +#define hw_alias_check_addr(addr) ((uintptr_t)(addr)) +// can't use the following impl as it breaks existing static declarations using hw_alias, so would be a backwards incompatibility +//static __force_inline uint32_t hw_alias_check_addr(volatile void *addr) { +// uint32_t rc = (uintptr_t)addr; +// invalid_params_if(ADDRESS_ALIAS, rc < 0x40000000); // catch likely non HW pointer types +// return rc; +//} // Helper method used by xip_alias macros to optionally check input validity static __force_inline uint32_t xip_alias_check_addr(const void *addr) { diff --git a/src/rp2_common/pico_runtime/runtime.c b/src/rp2_common/pico_runtime/runtime.c index 8b91d62..575e23e 100644 --- a/src/rp2_common/pico_runtime/runtime.c +++ b/src/rp2_common/pico_runtime/runtime.c @@ -244,7 +244,7 @@ extern void __attribute__((noreturn)) __printflike(1, 0) PICO_PANIC_FUNCTION(__u // Use a forwarding method here as it is a little simpler than renaming the symbol as it is used from assembler void __attribute__((naked, noreturn)) __printflike(1, 0) panic(__unused const char *fmt, ...) { // if you get an undefined reference here, you didn't define your PICO_PANIC_FUNCTION! - asm ( + __asm ( "push {lr}\n" #if !PICO_PANIC_FUNCTION_EMPTY "bl " __XSTRING(PICO_PANIC_FUNCTION) "\n"