This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Stacking and interrupts

Hullo guys , I had to write my own assembly subroutines to be called from C files . From the ARM Cortex-M documentation , it's clear that when an interrupt occur , only R0->R3 , R12 are pushed into stack . So for safe operation , those 're the only registers allowed to be used when interrupts 're enabled ?

Parents
  • You think it's bad that the Cortex-M saves a number of registers? Most processors hardly save any state at all...

    You do not want a processor that saves all state to memory, since saving state consumes memory bandwidth and affects latency. So the only solution is to have complete register banks to switch between. But not easy to do either in case you want nested interrupts - then each interrupt nesting needs one more register bank.

    In the end, the compiler will have to save extra registers in case of a C function. And the developer - you - will have to save extra state in case of an assembly-written routine.

Reply
  • You think it's bad that the Cortex-M saves a number of registers? Most processors hardly save any state at all...

    You do not want a processor that saves all state to memory, since saving state consumes memory bandwidth and affects latency. So the only solution is to have complete register banks to switch between. But not easy to do either in case you want nested interrupts - then each interrupt nesting needs one more register bank.

    In the end, the compiler will have to save extra registers in case of a C function. And the developer - you - will have to save extra state in case of an assembly-written routine.

Children