question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compilation error for board `mightycore644` when including SPI.h in v1.13.0

See original GitHub issue

Broken build when updating to v1.13.0, with mightycore644 board.

I attach a minimal test sample to reproduce the issue: arduino-blink.zip. As you can see from the platformio.ini file, the basic program builds fine when using the previous version (platform = atmelavr@1.12.5).

Also note that, when commenting #include <SPI.h>, the compilation error disappears.

Here is the full compilation log for a clean build.

user@machine ~/arduino-blink> pio run
Processing mightycore644_atmelavr1.12.5 (framework: arduino; board: mightycore644; platform: atmelavr@1.12.5)
--------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/mightycore644.html
PLATFORM: Atmel AVR > MightyCore ATmega644
HARDWARE: ATMEGA644P 16MHz 4KB RAM (63KB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 9 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SPI (MightyCore)> 1.0
Compiling .pioenvs/mightycore644_atmelavr1.12.5/src/Blink.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/lib8e1/SPI/SPI.cpp.o
Archiving .pioenvs/mightycore644_atmelavr1.12.5/libFrameworkArduinoVariant.a
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/CDC.cpp.o
Indexing .pioenvs/mightycore644_atmelavr1.12.5/libFrameworkArduinoVariant.a
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/HID.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/HardwareSerial.cpp.o
Archiving .pioenvs/mightycore644_atmelavr1.12.5/lib8e1/libSPI.a
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/HardwareSerial0.cpp.o
Indexing .pioenvs/mightycore644_atmelavr1.12.5/lib8e1/libSPI.a
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/HardwareSerial1.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/HardwareSerial2.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/HardwareSerial3.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/IPAddress.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/PluggableUSB.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/Print.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/Stream.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/Tone.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/USBCore.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/WInterrupts.c.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/WMath.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/WString.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/_wiring_pulse.S.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/abi.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/avr-libc/malloc.c.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/avr-libc/realloc.c.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/hooks.c.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/main.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/new.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/wiring.c.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/wiring_analog.c.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/wiring_digital.c.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/wiring_extras.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/wiring_pulse.c.o
Compiling .pioenvs/mightycore644_atmelavr1.12.5/FrameworkArduino/wiring_shift.c.o
Archiving .pioenvs/mightycore644_atmelavr1.12.5/libFrameworkArduino.a
Indexing .pioenvs/mightycore644_atmelavr1.12.5/libFrameworkArduino.a
Linking .pioenvs/mightycore644_atmelavr1.12.5/firmware.elf
Checking size .pioenvs/mightycore644_atmelavr1.12.5/firmware.elf
Building .pioenvs/mightycore644_atmelavr1.12.5/firmware.hex
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [          ]   0.2% (used 9 bytes from 4096 bytes)
PROGRAM: [          ]   1.5% (used 986 bytes from 64512 bytes)
================================== [SUCCESS] Took 1.93 seconds ==================================

Processing mightycore644_atmelavr1.13.0 (framework: arduino; board: mightycore644; platform: atmelavr@1.13.0)
--------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/mightycore644.html
PLATFORM: Atmel AVR > MightyCore ATmega644
HARDWARE: ATMEGA644P 16MHz 4KB RAM (63KB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 12 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SPI> 1.0
|   |-- <SPI1> 1.0
Compiling .pioenvs/mightycore644_atmelavr1.13.0/src/Blink.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.13.0/lib13b/SPI1/SPI1.cpp.o
Compiling .pioenvs/mightycore644_atmelavr1.13.0/lib33f/SPI/SPI.cpp.o
Archiving .pioenvs/mightycore644_atmelavr1.13.0/libFrameworkArduinoVariant.a
Indexing .pioenvs/mightycore644_atmelavr1.13.0/libFrameworkArduinoVariant.a
In file included from /home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp:14:0:
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h: In static member function 'static void SPI1Class::beginTransaction(SPI1Settings)':
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:203:5: error: 'SPCR1' was not declared in this scope
SPCR1 = settings.spcr1;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:204:5: error: 'SPSR1' was not declared in this scope
SPSR1 = settings.spsr1;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h: In static member function 'static uint8_t SPI1Class::transfer(uint8_t)':
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:209:5: error: 'SPDR1' was not declared in this scope
SPDR1 = data;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:217:14: error: 'SPSR1' was not declared in this scope
while (!(SPSR1 & _BV(SPIF))) ; // wait
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h: In static member function 'static uint16_t SPI1Class::transfer16(uint16_t)':
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:223:11: error: 'SPCR1' was not declared in this scope
if (!(SPCR1 & _BV(DORD))) {
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:224:7: error: 'SPDR1' was not declared in this scope
SPDR1 = in.msb;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:226:16: error: 'SPSR1' was not declared in this scope
while (!(SPSR1 & _BV(SPIF))) ;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:230:16: error: 'SPSR1' was not declared in this scope
while (!(SPSR1 & _BV(SPIF))) ;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:233:7: error: 'SPDR1' was not declared in this scope
SPDR1 = in.lsb;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:235:16: error: 'SPSR1' was not declared in this scope
while (!(SPSR1 & _BV(SPIF))) ;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:239:16: error: 'SPSR1' was not declared in this scope
while (!(SPSR1 & _BV(SPIF))) ;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h: In static member function 'static void SPI1Class::transfer(void*, size_t)':
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:247:5: error: 'SPDR1' was not declared in this scope
SPDR1 = *p;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:250:16: error: 'SPSR1' was not declared in this scope
while (!(SPSR1 & _BV(SPIF))) ;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:255:14: error: 'SPSR1' was not declared in this scope
while (!(SPSR1 & _BV(SPIF))) ;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h: In static member function 'static void SPI1Class::setBitOrder(uint8_t)':
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:292:31: error: 'SPCR1' was not declared in this scope
if (bitOrder == LSBFIRST) SPCR1 |= _BV(DORD);
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:293:10: error: 'SPCR1' was not declared in this scope
else SPCR1 &= ~(_BV(DORD));
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h: In static member function 'static void SPI1Class::setDataMode(uint8_t)':
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:298:5: error: 'SPCR1' was not declared in this scope
SPCR1 = (SPCR1 & ~SPI_MODE_MASK) | dataMode;
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h: In static member function 'static void SPI1Class::setClockDivider(uint8_t)':
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:303:5: error: 'SPCR1' was not declared in this scope
SPCR1 = (SPCR1 & ~SPI_CLOCK_MASK) | (clockDiv & SPI_CLOCK_MASK);
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:304:5: error: 'SPSR1' was not declared in this scope
SPSR1 = (SPSR1 & ~SPI_2XCLOCK_MASK) | ((clockDiv >> 2) & SPI_2XCLOCK_MASK);
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h: In static member function 'static void SPI1Class::attachInterrupt()':
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:309:42: error: 'SPCR1' was not declared in this scope
inline static void attachInterrupt() { SPCR1 |= _BV(SPIE); }
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h: In static member function 'static void SPI1Class::detachInterrupt()':
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:310:42: error: 'SPCR1' was not declared in this scope
inline static void detachInterrupt() { SPCR1 &= ~_BV(SPIE); }
^
In file included from /home/frazar/.platformio/packages/framework-arduinoavr/cores/MightyCore/Arduino.h:28:0,
from /home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.h:17,
from /home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp:14:
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp: In static member function 'static void SPI1Class::begin()':
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp:32:37: error: 'SS1' was not declared in this scope
uint8_t port = digitalPinToPort(SS1);
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp:32:20: note: in expansion of macro 'digitalPinToPort'
uint8_t port = digitalPinToPort(SS1);
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp:33:39: error: 'SS1' was not declared in this scope
uint8_t bit = digitalPinToBitMask(SS1);
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp:33:19: note: in expansion of macro 'digitalPinToBitMask'
uint8_t bit = digitalPinToBitMask(SS1);
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp:39:20: error: 'SS1' was not declared in this scope
digitalWrite(SS1, HIGH);
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp:45:13: error: 'SS1' was not declared in this scope
pinMode(SS1, OUTPUT);
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp:50:5: error: 'SPCR1' was not declared in this scope
SPCR1 |= _BV(MSTR);
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp:59:13: error: 'SCK1' was not declared in this scope
pinMode(SCK1, OUTPUT);
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp:60:13: error: 'MOSI1' was not declared in this scope
pinMode(MOSI1, OUTPUT);
^
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp: In static member function 'static void SPI1Class::end()':
/home/frazar/.platformio/packages/framework-arduinoavr/libraries/__cores__/MightyCore/SPI1/src/SPI1.cpp:74:5: error: 'SPCR1' was not declared in this scope
SPCR1 &= ~_BV(SPE);
^
Compiling .pioenvs/mightycore644_atmelavr1.13.0/FrameworkArduino/CDC.cpp.o
*** [.pioenvs/mightycore644_atmelavr1.13.0/lib13b/SPI1/SPI1.cpp.o] Error 1
=================================== [ERROR] Took 1.01 seconds ===================================

=========================================== [SUMMARY] ===========================================
Environment mightycore644_atmelavr1.12.5	[SUCCESS]
Environment mightycore644_atmelavr1.13.0	[ERROR]
=================================== [ERROR] Took 2.95 seconds ===================================

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
MCUdudecommented, May 6, 2019

I know all about it. I did fix this some days ago, but it’s not available through PlatformIO yet. It can be solved by either replacing the libraries with the upstream version.

I suggest @ivankravets updates the MightyCore core files based on the upstream version and not the latest release. I’ll issue a new MightyCore release very soon, but at the moment I’m waiting for a collaborator to figure out some cycle accurate code in order to achieve accurate delayMicroseconds() for odd “UART frequencies” such as 1.8432 MHz, 7.3728 MHz and 14.7456 MHz. This will make MightyCore even more versatile for PlatformIO users.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing SPI Library - Programming Questions - Arduino Forum
Several questions - Trying to compile and error on finding SPI.h. ... This means it comes pre-installed with each Arduino boards platform.
Read more >
exit status 1 error compiling for board arduino, FIX. - YouTube
This is a basic tutorial for arduino beginners, who often face this type of problem while uploading the code.
Read more >
How to fix compilation error for ESP32 in Arduino IDE?
FIXED! The problem was that there were no /hardware/espressif/esp32 folders existing anywhere, even though the board support was installed.
Read more >
Riscv Dev Board with LCD - To Be Classified - Seeed Forum
I have been trying to compile the examples in the LCD master library mentioned on the product page and there is no SPI.h...
Read more >
Adafruit BusIO/Adafruit_SPIDevice.h:1:17: fatal error: SPI.h
Hello, I am trying to run a simple motor test with my Arduino board. I have installed the Adafruit BusIO library but I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found