Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile for ATmega640/1280/2560 with SD CS pin on PORTH or higher #21

Open
per1234 opened this issue Aug 25, 2016 · 2 comments
Open

Comments

@per1234
Copy link
Contributor

per1234 commented Aug 25, 2016

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.

@anatom74
Copy link

anatom74 commented Apr 2, 2018

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

@per1234
Copy link
Contributor Author

per1234 commented Apr 2, 2018

Thanks @anatom74! I'm caught up in other projects right now but I am definitely planning to try to resolve some issues and make some improvements to avr_boot at some point in the future. Of course if someone gets around to doing it before me I surely don't mind!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants