mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-12-10 07:14:36 +01:00
More robust clobbering of ARM builtins on host (#2657)
Since ARM hosts have builtins listed in hardware/sync.h, these builtins should be clobbered. Newer versions of LLVM/Clang emit an error when clobbering these builtins, so this switches the overrides to use the same patterns as pico_atomic to clobber the builtins.
This commit is contained in:
parent
17b914418d
commit
87c9c013fe
2 changed files with 28 additions and 9 deletions
|
|
@ -109,8 +109,6 @@ extern "C" {
|
||||||
|
|
||||||
void __sev();
|
void __sev();
|
||||||
|
|
||||||
void __wev();
|
|
||||||
|
|
||||||
void __wfi();
|
void __wfi();
|
||||||
|
|
||||||
void __wfe();
|
void __wfe();
|
||||||
|
|
|
||||||
|
|
@ -93,23 +93,44 @@ void PICO_WEAK_FUNCTION_IMPL_NAME(spin_unlock)(spin_lock_t *lock, uint32_t saved
|
||||||
spin_unlock_unsafe(lock);
|
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;
|
volatile bool event_fired;
|
||||||
|
|
||||||
void PICO_WEAK_FUNCTION_IMPL_NAME(__sev)() {
|
void PICO_WEAK_FUNCTION_IMPL_NAME(__sev_c)() {
|
||||||
event_fired = true;
|
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");
|
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();
|
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)
|
PICO_WEAK_FUNCTION_DEF(spin_lock_num)
|
||||||
uint PICO_WEAK_FUNCTION_IMPL_NAME(spin_lock_num)(spin_lock_t *lock) {
|
uint PICO_WEAK_FUNCTION_IMPL_NAME(spin_lock_num)(spin_lock_t *lock) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue