While your solution (inline asm) is almost certainly the best way of doing it, for the record the way to achieve the same thing in a .s file is:
Instead of the usual:
This is all controlled by the linker script, usually pico-sdk/src/rp2_common/pico_standard_link/memmap_default.ld
If you look in pico-sdk/src/rp2_common/pico_platform/include/pico/platform.h you will see that the definition of __not_in_flash uses a GCC attribute to set the section name (which defaults to .text.functionname) to .timecritical.functionname and then the linker script puts .timecritical.* into RAM.
Code:
.section .time_critical.my_function_name
Code:
.section .text.my_function_name
If you look in pico-sdk/src/rp2_common/pico_platform/include/pico/platform.h you will see that the definition of __not_in_flash uses a GCC attribute to set the section name (which defaults to .text.functionname) to .timecritical.functionname and then the linker script puts .timecritical.* into RAM.
Statistics: Posted by arg001 — Sat Mar 02, 2024 5:19 pm