We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
On ARM, interrupts have a separate banked stack pointer. You don't have to worry about sharing the stack with them and are therefore free to use r13 for anything you want so long as you preserve it before returning.
my_fct: push {r0 - r12, lr} movw r12, #:lower16:.save_zone movt r12, #:upper16:.save_zone ldr r11, [r12], #4 str sp, [r12, r11, lsl #2] add r11, #1 str r11, [r12, #-4]! ... movw r12, #:lower16:.save_zone movt r12, #:upper16:.save_zone ldr r11, [r12], #4 sub r11, r11, #1 ldr sp, [r12, r11, lsl #2] str r11, [r12, #-4]! pop {r0 - r12, pc}.data.save_zone: .word 0 .word 0, 0, 0, 0, 0, 0, 0