Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7427

Bare metal, Assembly language • Calling flash functions from RAM on RP2040

$
0
0
What's the right way to call flash functions from RAM? Here's a minimal example of what I am trying to do:

Code:

#include "pico/asm_helper.S"pico_default_asm_setup.section .time_critical.sleep_for_100_usregular_func sleep_for_100_us    push {lr}    // Sleep for 100us.    movs r0, #100 // Lower 32 bits.    movs r1, #0 // Upper 32 bits.    bl sleep_us    pop {pc}
This results in a compile error, as the required veneer isn't being generated (a __sleep_us_veneer generated for __not_in_flash C functions calling sleep_us):

Code:

.time_critical.sleep_for_100_us+0x6): relocation truncated to fit: R_ARM_THM_CALL against symbol `sleep_us' defined in .text.sleep_us section in CMakeFiles/project.dir/__/__/vendor/pico-sdk/src/common/pico_time/time.c.obj
Is there a way to get the linker to generate the required veneer for assembly calls? If not, what's the right way to go about doing this?

Statistics: Posted by jackwilsdon — Fri Oct 04, 2024 3:41 pm — Replies 1 — Views 42



Viewing all articles
Browse latest Browse all 7427

Trending Articles