Może mój edytor jakoś inaczej liczy linie, ale błąd jest chyba w tej linii: out SPL, r16 ; setup stack pointer
więc zacznij od sprawdzenia, czy definicje rejestrów w pliku *.h nie są przesunięte o 20h, i czy nie powinieneś użyć makra _SFR_IO_ADDR do konwersji pomiędzy adresami SFR, a adresami mapowanymi na RAM.
Więc jeśli __SFR_OFFSET jest równe 20h, to adres SPL wyjdzie poza zakres I/O. Przejrzyj dokładnie sfr_defs.h tam masz wszystko opisane.
If _SFR_ASM_COMPAT is not defined, C programs can use names like PORTA directly in C expressions (also on the left side of assignment perators) and GCC will do the right thing (use short I/O instructions if possible). The __SFR_OFFSET definition is not used in any way in this case. Define _SFR_ASM_COMPAT as 1 to make these names work as simple constants (addresses of the I/O registers). This is necessary when included in preprocessed assembler (*.S) source files, so it is done automatically if __ASSEMBLER__ is defined. By default, all addresses are defined as if they were memory addresses (used in lds/sts instructions). To use these addresses in in/out instructions, you must subtract 0x20 from them.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.