Assembly in RAM

I believe that in C I can preface my function to locate it in SRAM so it runs faster like this:

int __not_in_flash(my_function)(int a) { }

What do I need to add in my assembly file so it will also be in SRAM?

Which file can I look at in the build directory to confirm both worked?

Thanks for your help.

Geoff

.section .time_critical,“ax”,%progbits

The directive .section .time_critical, "ax", %progbits defines a section named .time_critical in the object file. The "ax" specifies the section’s attributes: ‘a’ indicates the section is allocatable (it will be allocated in memory at runtime), and ‘x’ indicates it is executable (it contains code that can be executed). The %progbits is the section type, which signifies that the section contains program data that is part of the executable image, typically used for code or initialized data. This combination is commonly used to mark critical code sections that require both memory allocation and execution privileges.

1 Like

Thanks @picouser. For both the answer, and an explanation of each component.