I have a project in which I want to handle one specific time and process critical interrupt entirely in assembler, but which on the whole is so complex I prefer C for the rest of the programming.
For clarity (lots of asm code!) and full control of the resulting asm code I put this routine in a .S file rather than inline-assembler in the C code.
I have one problem which I cannot find a usable answer to on this forum or through google, I have spent many an hour searching and probably it's my search terms, but I have found only posts about external RAM and other such foolish issues ;-).
I want to store a set of 16 variables, each 16 bit in RAM from the C code, which will be used by the assembler routine if necessary. I cannot however figure out how to make AVR GCC compile my program so that my array as defined in the main C file ends up in one specific part of the (internal!) RAM, so that I can be sure where to retrieve it in assembler. I process them as single bytes in assembler, so it's no problem to use constants in an LDS command (no runtime variation of which byte is processed where)
Is there an AVR GCC wizard out there with the answer? I'm pretty sure making all 32 registers volatile and storing my variables there is the worst possible solution! For many reasons... :-P