Showing results for 
Search instead for 
Did you mean: 

Core Hardware Register availability for User


Any Core Hardware Register available to user which is not used by HAL or the Processor itself which I can safely use without disturbing the rest of the MCU?

I am using an STM32L431. To keep the System State in check I am using a Volatile uint32_t variable and doing bit manipulations and using it as a 32 Bit Register.

I have to check or update this variable at MHz rate and I was wondering if I can use a "Free" Hardware register of the core to speed things up.

I have to keep track of multiple bits, even in Interrupts. I know a faster processor is the best answer but I am currently stuck with this processor for the prototype and I am almost have full utilization of the Core and desperately need any Bit of Performance available.

I initially thought of using only HAL but to get some more performance I made faster (unsafe) versions of functions and optimized everything I can as per my skills allow.

I think that if I use a Hardware Register, then, the processor does not have to fetch and load anything into its working registers. I am happy if I save 1 or 2 clock cycles.

Edit: I am using CubeIDE and HAL


Review ARM ABI

R9 often available, used to describe data section.

Could code in assembler and manage register usage directly. 

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

You might try the -ffixed-reg argument (for GCC) to prevent compiler from using a specific register.


If you feel a post has answered your question, please click "Accept as Solution".