I would like to bind a global variable to an unused I/O register (e.g. PORTB) using avr-gcc, to reduce code size. I learned this trick in AVR's application note AVR035 (page 14).
In the application note, they use the IAR compiler and bind the variable to an I/O register like this:
__no_init volatile uint8_t counter@0x35;
With avr-gcc, I can bind a variable to a standard register (r3 in this case) using this line:
register uint8_t counter asm("r3");
This does not work for I/O registers though. Is there a way to do this for I/O registers?