cancel
Showing results for 
Search instead for 
Did you mean: 

Core Hardware Register availability for User

pranjalk197
Associate

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

2 REPLIES 2

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..
TDK
Guru

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

https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html

 

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