I want to bind a global variable to an unused I / O register (e.g. PORTB) using avr-gcc to reduce code size. I found out about this in the note to the AVR application AVR035 (p. 14).
In a note to the application, they use the IAR compiler and bind the variable to the I / O register as follows:
__no_init volatile uint8_t counter@0x35;
With avr-gcc, I can bind a variable to the standard register (r3 in this case) using this line:
register uint8_t counter asm("r3");
However, this does not work for I / O registers. Is there a way to do this for I / O registers?
source
share