Can't compile for ATmega640/1280/2560 with SD CS pin on PORTH or higher
per1234 opened this issue · comments
command:
make MCU_TARGET=atmega1280 BOOT_ADR=0x1F000 F_CPU=8000000 SD_CS_PORT=PORTH SD_CS_DDR=DDRH SD_CS_BIT=5 USE_LED=0 USE_UART=0 ADDED_CFLAGS="-Wextra -Wno-strict-aliasing" TARGET=$(MCU_TARGET)_cs8_$(F_CPU)L
avr-gcc 6.0.1 error message:
asmfunc.S: Assembler messages:
asmfunc.S:86: Error: operand out of range: 225
asmfunc.S:124: Error: operand out of range: 226
asmfunc.S:138: Error: operand out of range: 226
avr-gcc 4.9.2-atmel3.5.3-arduino2 message:
asmfunc.S: Assembler messages:
asmfunc.S:86: Error: number must be positive and less than 32
asmfunc.S:124: Error: number must be positive and less than 32
asmfunc.S:138: Error: number must be positive and less than 32
This was trying to build for SD CS Arduino pin 8 but I get similar errors for any bit on any port above G.
I haven't had much luck searching for information on this. The best I've found is http://www.nongnu.org/avr-libc/user-manual/group__avr__sfr__notes.html but I've tried every combination of the fixes listed and still couldn't compile but I'm just basically working on it randomly since I don't really understand what the problem is.
From datasheet it might be a problem related to:
For I/O registers
located in extended I/O map, "IN", "OUT", "SBIS", "SBIC", "CBI", and "SBI" instructions must be replaced with
instructions that allow access to extended I/O. Typically "LDS" and "STS" combined with "SBRS", "SBRC", "SBR",
and "CBR".
For example, yiou can put following code inside init_spi (in asmfunc.S):
lds r16,DDRH ; sbr r16,0x80 ; EN: output sts DDRH, r16 ;
and
lds r16,PORTH ; cbr r16,0x80 ; EN: output sts PORTH, r16 ;
note that this example is for pin enable on H.7