MCUdude / MegaCoreX

An Arduino hardware package for ATmega4809, ATmega4808, ATmega3209, ATmega3208, ATmega1609, ATmega1608, ATmega809 and ATmega808
GNU Lesser General Public License v2.1
245 stars 49 forks source link

#include <SD.h> doesn't compile #114

Closed bigginsking closed 3 years ago

bigginsking commented 3 years ago

Hi, Trying to interface with an SD card and the SD library prevents the code from compiling. Here is the verbose output from Arduino 1.8.7:

``` In file included from C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2Card.h:26:0, from C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFat.h:29, from C:\Program Files (x86)\Arduino\libraries\SD\src/SD.h:20, from C:\Users\Bill\Documents\Arduino\Test4809\Test4809.ino:2: C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:424:5: error: 'DDRD' was not declared in this scope {&DDRD, &PIND, &PORTD, 0}, // D0 0 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:424:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 0}, // D0 0 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:424:12: error: 'PIND' was not declared in this scope {&DDRD, &PIND, &PORTD, 0}, // D0 0 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:424:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 0}, // D0 0 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:425:5: error: 'DDRD' was not declared in this scope {&DDRD, &PIND, &PORTD, 1}, // D1 1 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:425:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 1}, // D1 1 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:425:12: error: 'PIND' was not declared in this scope {&DDRD, &PIND, &PORTD, 1}, // D1 1 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:425:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 1}, // D1 1 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:426:5: error: 'DDRD' was not declared in this scope {&DDRD, &PIND, &PORTD, 2}, // D2 2 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:426:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 2}, // D2 2 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:426:12: error: 'PIND' was not declared in this scope {&DDRD, &PIND, &PORTD, 2}, // D2 2 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:426:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 2}, // D2 2 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:427:5: error: 'DDRD' was not declared in this scope {&DDRD, &PIND, &PORTD, 3}, // D3 3 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:427:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 3}, // D3 3 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:427:12: error: 'PIND' was not declared in this scope {&DDRD, &PIND, &PORTD, 3}, // D3 3 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:427:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 3}, // D3 3 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:428:5: error: 'DDRD' was not declared in this scope {&DDRD, &PIND, &PORTD, 4}, // D4 4 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:428:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 4}, // D4 4 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:428:12: error: 'PIND' was not declared in this scope {&DDRD, &PIND, &PORTD, 4}, // D4 4 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:428:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 4}, // D4 4 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:429:5: error: 'DDRD' was not declared in this scope {&DDRD, &PIND, &PORTD, 5}, // D5 5 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:429:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 5}, // D5 5 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:429:12: error: 'PIND' was not declared in this scope {&DDRD, &PIND, &PORTD, 5}, // D5 5 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:429:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 5}, // D5 5 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:430:5: error: 'DDRD' was not declared in this scope {&DDRD, &PIND, &PORTD, 6}, // D6 6 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:430:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 6}, // D6 6 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:430:12: error: 'PIND' was not declared in this scope {&DDRD, &PIND, &PORTD, 6}, // D6 6 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:430:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 6}, // D6 6 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:431:5: error: 'DDRD' was not declared in this scope {&DDRD, &PIND, &PORTD, 7}, // D7 7 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:431:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 7}, // D7 7 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:431:12: error: 'PIND' was not declared in this scope {&DDRD, &PIND, &PORTD, 7}, // D7 7 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:431:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 7}, // D7 7 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:432:5: error: 'DDRB' was not declared in this scope {&DDRB, &PINB, &PORTB, 0}, // B0 8 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:432:5: note: suggested alternative: 'DD0' {&DDRB, &PINB, &PORTB, 0}, // B0 8 ^~~~ DD0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:432:12: error: 'PINB' was not declared in this scope {&DDRB, &PINB, &PORTB, 0}, // B0 8 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:432:12: note: suggested alternative: 'PIN0' {&DDRB, &PINB, &PORTB, 0}, // B0 8 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:433:5: error: 'DDRB' was not declared in this scope {&DDRB, &PINB, &PORTB, 1}, // B1 9 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:433:5: note: suggested alternative: 'DD0' {&DDRB, &PINB, &PORTB, 1}, // B1 9 ^~~~ DD0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:433:12: error: 'PINB' was not declared in this scope {&DDRB, &PINB, &PORTB, 1}, // B1 9 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:433:12: note: suggested alternative: 'PIN0' {&DDRB, &PINB, &PORTB, 1}, // B1 9 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:434:5: error: 'DDRB' was not declared in this scope {&DDRB, &PINB, &PORTB, 2}, // B2 10 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:434:5: note: suggested alternative: 'DD0' {&DDRB, &PINB, &PORTB, 2}, // B2 10 ^~~~ DD0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:434:12: error: 'PINB' was not declared in this scope {&DDRB, &PINB, &PORTB, 2}, // B2 10 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:434:12: note: suggested alternative: 'PIN0' {&DDRB, &PINB, &PORTB, 2}, // B2 10 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:435:5: error: 'DDRB' was not declared in this scope {&DDRB, &PINB, &PORTB, 3}, // B3 11 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:435:5: note: suggested alternative: 'DD0' {&DDRB, &PINB, &PORTB, 3}, // B3 11 ^~~~ DD0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:435:12: error: 'PINB' was not declared in this scope {&DDRB, &PINB, &PORTB, 3}, // B3 11 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:435:12: note: suggested alternative: 'PIN0' {&DDRB, &PINB, &PORTB, 3}, // B3 11 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:436:5: error: 'DDRB' was not declared in this scope {&DDRB, &PINB, &PORTB, 4}, // B4 12 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:436:5: note: suggested alternative: 'DD0' {&DDRB, &PINB, &PORTB, 4}, // B4 12 ^~~~ DD0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:436:12: error: 'PINB' was not declared in this scope {&DDRB, &PINB, &PORTB, 4}, // B4 12 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:436:12: note: suggested alternative: 'PIN0' {&DDRB, &PINB, &PORTB, 4}, // B4 12 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:437:5: error: 'DDRB' was not declared in this scope {&DDRB, &PINB, &PORTB, 5}, // B5 13 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:437:5: note: suggested alternative: 'DD0' {&DDRB, &PINB, &PORTB, 5}, // B5 13 ^~~~ DD0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:437:12: error: 'PINB' was not declared in this scope {&DDRB, &PINB, &PORTB, 5}, // B5 13 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:437:12: note: suggested alternative: 'PIN0' {&DDRB, &PINB, &PORTB, 5}, // B5 13 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:438:5: error: 'DDRC' was not declared in this scope {&DDRC, &PINC, &PORTC, 0}, // C0 14 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:438:5: note: suggested alternative: 'DD0' {&DDRC, &PINC, &PORTC, 0}, // C0 14 ^~~~ DD0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:438:12: error: 'PINC' was not declared in this scope {&DDRC, &PINC, &PORTC, 0}, // C0 14 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:438:12: note: suggested alternative: 'PIN0' {&DDRC, &PINC, &PORTC, 0}, // C0 14 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:439:5: error: 'DDRC' was not declared in this scope {&DDRC, &PINC, &PORTC, 1}, // C1 15 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:439:5: note: suggested alternative: 'DD0' {&DDRC, &PINC, &PORTC, 1}, // C1 15 ^~~~ DD0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:439:12: error: 'PINC' was not declared in this scope {&DDRC, &PINC, &PORTC, 1}, // C1 15 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:439:12: note: suggested alternative: 'PIN0' {&DDRC, &PINC, &PORTC, 1}, // C1 15 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:440:5: error: 'DDRC' was not declared in this scope {&DDRC, &PINC, &PORTC, 2}, // C2 16 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:440:5: note: suggested alternative: 'DD0' {&DDRC, &PINC, &PORTC, 2}, // C2 16 ^~~~ DD0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:440:12: error: 'PINC' was not declared in this scope {&DDRC, &PINC, &PORTC, 2}, // C2 16 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:440:12: note: suggested alternative: 'PIN0' {&DDRC, &PINC, &PORTC, 2}, // C2 16 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:441:5: error: 'DDRC' was not declared in this scope {&DDRC, &PINC, &PORTC, 3}, // C3 17 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:441:5: note: suggested alternative: 'DD0' {&DDRC, &PINC, &PORTC, 3}, // C3 17 ^~~~ DD0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:441:12: error: 'PINC' was not declared in this scope {&DDRC, &PINC, &PORTC, 3}, // C3 17 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:441:12: note: suggested alternative: 'PIN0' {&DDRC, &PINC, &PORTC, 3}, // C3 17 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:442:5: error: 'DDRC' was not declared in this scope {&DDRC, &PINC, &PORTC, 4}, // C4 18 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:442:5: note: suggested alternative: 'DD0' {&DDRC, &PINC, &PORTC, 4}, // C4 18 ^~~~ DD0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:442:12: error: 'PINC' was not declared in this scope {&DDRC, &PINC, &PORTC, 4}, // C4 18 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:442:12: note: suggested alternative: 'PIN0' {&DDRC, &PINC, &PORTC, 4}, // C4 18 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:443:5: error: 'DDRC' was not declared in this scope {&DDRC, &PINC, &PORTC, 5} // C5 19 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:443:5: note: suggested alternative: 'DD0' {&DDRC, &PINC, &PORTC, 5} // C5 19 ^~~~ DD0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:443:12: error: 'PINC' was not declared in this scope {&DDRC, &PINC, &PORTC, 5} // C5 19 ^~~~ C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:443:12: note: suggested alternative: 'PIN0' {&DDRC, &PINC, &PORTC, 5} // C5 19 ^~~~ PIN0 exit status 1 Error compiling for board ATmega4809. ```
MCUdude commented 3 years ago

Hi! You're using an old IDE version where the bundled SD library doesn't support the ATmega4809. Try updating to the latest IDE.

bigginsking commented 3 years ago

Ah, yes, that fixes it, amateur here... thanks!