I reserved some registers that are used in an Asm file with:
register unsigned char reform_cntr asm("r4"); register unsigned char rownum asm("r5"); register unsigned char row asm("r6");
which should be safe according to the manual.
As the project grew I moved the above into a separate file along with other C functions that related to the ASM file.
Things were working well but slowly deteriorated with absolutely crazy results at time...which I put down to me forgetting a comma, a semicolon or other, which of course wasn't.
As it turned out winAvr was taking so many liberties with R6 that I had to get a pregnancy test for it.... :?
Moving the registers reservation back into main fixes the problem for now. I can still see R6 being used by vprintf and maybe other places by I hope it is being pushed and popped as required.
The question is: Do I need to add the registers reservation lines to all C files in the project or just leave it in main? It is possible that other functions in other files start to mess around with reserved registers I suppose without it or I may get double definitions or other issues.
Tried to add those line to the header file of the module that uses the registers but winAvr complained.