Hello,
I am using four registers as global variables (R10, R11, R12, R13), in this case, as counters in interrupt. Every 10 us I need to check if there is 0 or 1 on pin. If there is 1, I increment the register value, using inline assembler. After 20 ms I send the value in the registers by I2C and clear them. Whole code is written in C, only few inline asm to work with the registers. Everything is working.
My only concern is about compiler using the R10 to R13 registers. I need to know, how to lock these registers, that they are not used by the compiler... I checked the dissassembly and only use of these registers is the part, where I use them. But what if the code is compiled with newer or older compiler....? Is there any chance to say to the compiler to not use my registers? Any idea how the -ffixed-reg works? (example ) Will this help my cause?
Thank you.