I am trying to compile a midi controller type program for the teensy using platformio. I was able to do this with the arduino IDE and get it uploaded without issues. I have never used platformio before so I thought I would try it. I am using the platformio plugin with clion.
#include <Encoder.h>
#include <Control_Surface.h>
// Instantiate a MIDI over USB interface.
USBMIDI_Interface midi;
// Instantiate a CCRotaryEncoder object
CCRotaryEncoder enc = {
{32, 33}, // pins
{14}, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
void setup() {
RelativeCCSender::setMode(relativeCCmode::TWOS_COMPLEMENT);
Control_Surface.begin(); // Initialize Control Surface
}
void loop() {
Control_Surface.loop(); // Update the Control Surface
}
The first error I get is In file included from .pio/libdeps/teensy2pp/MIDIUSB/src/MIDIUSB.cpp:17:0: .pio/libdeps/teensy2pp/MIDIUSB/src/MIDIUSB.h:74:2: error: #error "Unsupported architecture"
followed by a lot more errors from the same MIDIUSB.h file
This code compiles and was uploaded using the arduino IDE and the teensy loader.
I’ve looked at the compilation process and it seems PlatformIO includes some wrong libraries. MIDIUSB e.g. is recognized as some Arduino library written for AVR and SAM(D) processors and not the one in the core directory.
To correct that, add the line
lib_ignore = MIDIUSB, Audio
to the platformio.ini and retry.
EDIT: Also, the project should be cleaned to remove old build artifacts and libraries, e.g. using pio run -t clean or “Clean” in VSCode.
For that path is .pio\build\teensy2pp\libe68\SoftwareSerial\SoftwareSerial.cpp.o. Maybe again a different library is used (based on my 0xe68 and your 0xe99). Do you have maybe have a Arduino-AVR version of SoftwareSerial globally installed in ~/.platformio/lib? If yes, delete it.
Compilation goes through for me.
Checking size .pio\build\teensy2pp\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 10.2% (used 837 bytes from 8192 bytes)
Flash: [= ] 9.5% (used 12350 bytes from 130048 bytes)
====================== [SUCCESS] Took 5.55 seconds =============
adding the line platform_packages = toolchain-atmelavr@https://bintray.com/platformio/tool-packages/download_file?file_path=cc65b2c-toolchain-atmelavr-linux_x86_64-1.70300.191015.tar.gz to the platformio.ini to force usage of a 7.3.0 GCC instead of the 5.4.0, if the compiler is really at fault here (but somehow not on my system)