2024-01-01 08:31 AM - edited 2024-01-01 10:58 AM
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
2024-01-01 09:15 AM
Review ARM ABI
R9 often available, used to describe data section.
Could code in assembler and manage register usage directly.
2024-01-01 10:01 AM
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