This is my first time to integrate C and ASM code in WINAVR and I have a problem. I use an Atxmega256.
my C code is really large (I have some large data array in PROGMEM). And my .S assembly code contain a IJMP (Indirect jump.) the IJMP use Z as reference pointer to jump to a specific location in flash memory. But the IJMP instruction can jump only in memory from the first 64k. (It's normal, it use the Z pointer ZH and ZL to make the jump).
My problem is that since my C code is larger than 64K, the C compiler compile the C code first and the ASM code second. This cause the Asm code to be executed past the first 64K, so the IJMP fail. I searched on internet and this forum how to compile the ASM code first to avoid this issue, but never found an answer. Maybe someone here have a solution to add a parameter to the compiler to compile the ASM code first? or a way to do it in the code?