cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to use the Core General Purpose Registers R0...R12 as regular varibles?

arnold_w
Senior

I'm working with the STM32F446 microcontroller and sometimes I want to assign a peripheral register values from different variables in as few clock cycles as possible. I read in PM0214 https://www.st.com/resource/en/programming_manual/dm00046982-stm32-cortex-m4-mcus-and-mpus-programming-manual-stmicroelectronics.pdf page 18 that the core has some General Purpose Registers R0 ... R12. Am I allowed to use those for my own purposes and if so, what's the syntax to use them?

1 REPLY 1

In assembler you can manage them anyway you want.

The compiler follows the ABI specification, and allocates them to local and optimized variables. The register directive is generally ignored at this point.

Perhaps get a book on ARM Assembler / Architecture

Look at the code generated by the compiler.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..