SpenceKonde / DxCore

Arduino core for AVR DA, DB, DD, EA and future DU-series parts - Microchip's latest and greatest AVRs. Library maintainers: Porting help and adviccee is available.
Other
188 stars 50 forks source link

Error Compiling for board AVR DB Series (Optiboot) #352

Closed cchimick closed 2 years ago

cchimick commented 2 years ago

Designed my project around the arduino mega. Switched to the AVR128DB64 due to supply issues. I believe I successfully uploaded the bootloader. When compiling the sketch in the Arduino IDE, I'm getting the error message:

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\chris\Documents\GitHub\PipeMonitor\Temp_Logger\Temp_Logger.ino:4: C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:438: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:438:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 0}, // D0 0 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:438: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:438:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 0}, // D0 0 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:439: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:439:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 1}, // D1 1 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:439: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:439:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 1}, // D1 1 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:440: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:440:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 2}, // D2 2 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:440: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:440:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 2}, // D2 2 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:441: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:441:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 3}, // D3 3 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:441: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:441:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 3}, // D3 3 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:442: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:442:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 4}, // D4 4 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:442: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:442:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 4}, // D4 4 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:443: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:443:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 5}, // D5 5 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:443: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:443:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 5}, // D5 5 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:444: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:444:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 6}, // D6 6 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:444: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:444:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 6}, // D6 6 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:445: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:445:5: note: suggested alternative: 'VDD' {&DDRD, &PIND, &PORTD, 7}, // D7 7 ^~~~ VDD C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:445: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:445:12: note: suggested alternative: 'PIN0' {&DDRD, &PIND, &PORTD, 7}, // D7 7 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:446: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:446:5: note: suggested alternative: 'DD4' {&DDRB, &PINB, &PORTB, 0}, // B0 8 ^~~~ DD4 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:446: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:446:12: note: suggested alternative: 'PIN0' {&DDRB, &PINB, &PORTB, 0}, // B0 8 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:447: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:447:5: note: suggested alternative: 'DD4' {&DDRB, &PINB, &PORTB, 1}, // B1 9 ^~~~ DD4 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:447: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:447:12: note: suggested alternative: 'PIN0' {&DDRB, &PINB, &PORTB, 1}, // B1 9 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:448: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:448:5: note: suggested alternative: 'DD4' {&DDRB, &PINB, &PORTB, 2}, // B2 10 ^~~~ DD4 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:448: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:448:12: note: suggested alternative: 'PIN0' {&DDRB, &PINB, &PORTB, 2}, // B2 10 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:449: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:449:5: note: suggested alternative: 'DD4' {&DDRB, &PINB, &PORTB, 3}, // B3 11 ^~~~ DD4 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:449: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:449:12: note: suggested alternative: 'PIN0' {&DDRB, &PINB, &PORTB, 3}, // B3 11 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:450: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:450:5: note: suggested alternative: 'DD4' {&DDRB, &PINB, &PORTB, 4}, // B4 12 ^~~~ DD4 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:450: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:450:12: note: suggested alternative: 'PIN0' {&DDRB, &PINB, &PORTB, 4}, // B4 12 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:451: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:451:5: note: suggested alternative: 'DD4' {&DDRB, &PINB, &PORTB, 5}, // B5 13 ^~~~ DD4 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:451: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:451:12: note: suggested alternative: 'PIN0' {&DDRB, &PINB, &PORTB, 5}, // B5 13 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:452: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:452:5: note: suggested alternative: 'DD4' {&DDRC, &PINC, &PORTC, 0}, // C0 14 ^~~~ DD4 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:452: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:452:12: note: suggested alternative: 'PIN0' {&DDRC, &PINC, &PORTC, 0}, // C0 14 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:453: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:453:5: note: suggested alternative: 'DD4' {&DDRC, &PINC, &PORTC, 1}, // C1 15 ^~~~ DD4 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:453: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:453:12: note: suggested alternative: 'PIN0' {&DDRC, &PINC, &PORTC, 1}, // C1 15 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:454: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:454:5: note: suggested alternative: 'DD4' {&DDRC, &PINC, &PORTC, 2}, // C2 16 ^~~~ DD4 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:454: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:454:12: note: suggested alternative: 'PIN0' {&DDRC, &PINC, &PORTC, 2}, // C2 16 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:455: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:455:5: note: suggested alternative: 'DD4' {&DDRC, &PINC, &PORTC, 3}, // C3 17 ^~~~ DD4 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:455: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:455:12: note: suggested alternative: 'PIN0' {&DDRC, &PINC, &PORTC, 3}, // C3 17 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:456: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:456:5: note: suggested alternative: 'DD4' {&DDRC, &PINC, &PORTC, 4}, // C4 18 ^~~~ DD4 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:456: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:456:12: note: suggested alternative: 'PIN0' {&DDRC, &PINC, &PORTC, 4}, // C4 18 ^~~~ PIN0 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:457: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:457:5: note: suggested alternative: 'DD4' {&DDRC, &PINC, &PORTC, 5} // C5 19 ^~~~ DD4 C:\Program Files (x86)\Arduino\libraries\SD\src/utility/Sd2PinMap.h:457: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:457:12: note: suggested alternative: 'PIN0' {&DDRC, &PINC, &PORTC, 5} // C5 19 ^~~~ PIN0 exit status 1 Error compiling for board AVR DB-series (Optiboot).

pcfreak1201 commented 2 years ago

Well, the cores cover/translate the internal I/O to the Arduino-Std-Functions. But you use a SD-Lib, which directly uses the internal registers of the - in this case - classic AVRs. That doesn't work. How the new generation works do you find here: https://github.com/SpenceKonde/DxCore/blob/master/megaavr/extras/Ref_Digital.md So, you can change the lib by your own, or serarch for newer libs. Here are some more information: https://github.com/SpenceKonde/megaTinyCore/blob/571da180506039903a7a3a2852cd78ec3b09a7c5/megaavr/extras/LibraryCompatibility.md

pcfreak1201 commented 2 years ago

Forgot my previous answer. I didn't recognize it is an Arduino lib. Simply copy the SD-folder from Spence's megaTinyCore in the DxCore libraries folder and it should work: https://github.com/SpenceKonde/megaTinyCore/tree/master/megaavr/libraries/SD

SpenceKonde commented 2 years ago

I don't think that will work, but copying it to sketchbook/libraries in place of the other version will.

SD library doesn't have the fix (which is very straightforward) in the version you have installed - I thought I put in a PR to fix this - the fix is trivial. They specifically test for the 4809 (because they make official boards based on it), when they should test if __AVR_ARCH__==102 || ___AVR_ARCH__==103 || __AVR_ARCH == 104

Ugh, do I have to also add duplicated copies of the libraries as SD_megaTinyCore and SD_DxCore like I already do on servo,so that people can use my servo supplied with the core (which, again works) instead of the version that gets installed through the library manager (which does not work).

I do don't I....

annoying

pcfreak1201 commented 2 years ago

Well, I tried yor way first, by adding #elif defined(__AVR_DA__) || defined(__AVR_DB__) || defined(__AVR_DD__) but doesn't work (may be too much if elif else ...?) on my system - because I saw the changes / PR from @MCUdude but his updates from commit 9bb121c aren't still in the actual version?! So I tried your way from the MegaTinyCore and copied the folder and that worked. So as first aid for the OP, looks OK for me.

cchimick commented 2 years ago

Sorry for the trouble guys. Everything worked with the mega but since ive switched to the AVR128db64, I'm way beyond my depth. So I downloaded the MegaTinyCore. I take the SD folder and copy it into my arduino libraries folder?

pcfreak1201 commented 2 years ago

That's normal when you change the controller ;-) Not in your Arduino/library-folder but in .arduino15/packages/DxCore/hardware/megaavr/1.4.10/libraries

SpenceKonde commented 2 years ago

Closing this as SD library is now in the master branch (granted the master branch is totally hosed in numerous ways)

In order to use it, though, I think you wont be able to have an SD library installed in libraries. I can't do the trick I did with Servo, because a million other libraries include SD.h, including the other ones you likely want to use