TrinketKeybaord library (ATiny85) compiles in Arduino-IDE but not in PIO


#1

Hi,
I try to switch from Arduino IDE to Visual Studio Code using PlatformIO extension.
All my Arduino projects compile except one !

The one that does not compile is a small project with the Trinket from Adafruit (= ATiny85 under the hood).

The error I get has to do with the particular library I intend to use called “TrinketKeyboard”.
(The library shall not be confused with the TrinketKeyboar for Trinket-PRO devices !!).

Again, on the Arduino-IDE everything works fine. I installed the library on the Arduino IDE by importing a .zip-file.

The .zip-file import option obviously does not exist on the PlatformIO. There, I simply copy/paste the very same library into the lib-folder of my workspace. (like I did for all the other perfectly fine running PIO projects…).

However, the TrinketKeyboard Library does not work on PlatformIO and I am working on it since 4 hours. Now I give up unless somebody has a brillant idea :slight_smile:

The error message says:

Scanning dependencies…
Dependency Graph
|--
Compiling .pioenvs/trinket5/src/Trinket_2Button.ino.cpp.o
Compiling .pioenvs/trinket5/lib269/TrinketKeyboard/usbdrv/usbdrvasm.asm.o
avr-as: unrecognized option `-x’
*** [.pioenvs/trinket5/lib269/TrinketKeyboard/usbdrv/usbdrvasm.asm.o] Error 1


#2

Can you post your full platformio.ini and lnk to the library? I’m only finding https://platformio.org/lib/show/759/Pro%20Trinket%20USB%20Keyboard%20Library which isn’t what you have according to you. What example code are you running?


#3

Alright I guess you mean https://github.com/adafruit/Adafruit-Trinket-USB/tree/master/TrinketKeyboard.

I just compiled this without problems by doing:

  • download the full zip file of the repository
  • extract the TrinketKeyboard folder into the libs folder of the PIO project
  • open lib/TrinketKeyboard/usbdrv/usbdrvasm.asm and remove the last line end
  • copy the lib/TrinketKeyboard/TrinketKeyboardExample/TrinketKeyboardExample.ino to src/main.cpp (important).
  • build
Processing trinket5 (platform: atmelavr; board: trinket5; framework: arduino)


CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/trinket5.html
PLATFORM: Atmel AVR > Adafruit Trinket 5V/16MHz
HARDWARE: ATTINY85 16MHz 512B RAM (8KB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Framework incompatible library C:\Users\Maxi\Documents\stackoverflow_testing\.piolibdeps\SX1272Lib_ID2756
Framework incompatible library C:\Users\Maxi\Documents\stackoverflow_testing\.piolibdeps\SoftwareSerial_ID2728
More details about "Library Compatibility Mode": https://docs.platformio.org/page/librarymanager/ldf.html#ldf-compat-mode
Collected 43 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <TrinketKeyboard> (C:\Users\Maxi\Documents\stackoverflow_testing\lib\TrinketKeyboard)
avr-gcc -x assembler-with-cpp -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -Ilib\TrinketKeyboard -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 -c -o .pioenvs\trinket5\lib971\TrinketKeyboard\usbdrv\usbdrvasm.asm.o lib\TrinketKeyboard\usbdrv\usbdrvasm.asm
avr-gcc-ar rc .pioenvs\trinket5\libFrameworkArduinoVariant.a
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\CDC.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\CDC.cpp
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\HardwareSerial.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\HardwareSerial.cpp
avr-gcc-ar rc .pioenvs\trinket5\lib971\libTrinketKeyboard.a .pioenvs\trinket5\lib971\TrinketKeyboard\TrinketKeyboard.cpp.o .pioenvs\trinket5\lib971\TrinketKeyboard\TrinketKeyboardC.c.o .pioenvs\trinket5\lib971\TrinketKeyboard\usbdrv\oddebug.c.o .pioenvs\trinket5\lib971\TrinketKeyboard\usbdrv\usbdrv.c.o .pioenvs\trinket5\lib971\TrinketKeyboard\usbdrv\usbdrvasm.S.o .pioenvs\trinket5\lib971\TrinketKeyboard\usbdrv\usbdrvasm.asm.o .pioenvs\trinket5\lib971\TrinketKeyboard\usbdrv_includer.c.o .pioenvs\trinket5\lib971\TrinketKeyboard\usbdrvasm_includer.S.o
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\HardwareSerial0.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\HardwareSerial0.cpp
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\HardwareSerial1.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\HardwareSerial1.cpp
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\HardwareSerial2.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\HardwareSerial2.cpp
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\HardwareSerial3.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\HardwareSerial3.cpp
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\IPAddress.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\IPAddress.cpp
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\PluggableUSB.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\PluggableUSB.cpp
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\Print.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\Print.cpp
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\Stream.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\Stream.cpp
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\Tone.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\Tone.cpp
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\USBCore.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\USBCore.cpp
In file included from C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\Tone.cpp:37:0:
C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\Tone.cpp: In function 'void TIMER2_COMPA_vect()':
C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\Tone.cpp:538:5: warning: 'TIMER2_COMPA_vect' appears to be a misspelled signal handler, missing __vector prefix [-Wmisspelled-isr]
ISR(TIMER2_COMPA_vect)
^
avr-gcc -o .pioenvs\trinket5\FrameworkArduino\WInterrupts.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\WInterrupts.c
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\WMath.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\WMath.cpp
C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\WInterrupts.c: In function 'attachInterrupt':
C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\WInterrupts.c:166:8: warning: #warning attachInterrupt may need some more work for this cpu (case 1) [-Wcpp]
#warning attachInterrupt may need some more work for this cpu (case 1)
^
C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\WInterrupts.c: In function 'detachInterrupt':
C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\WInterrupts.c:255:8: warning: #warning detachInterrupt may need some more work for this cpu (case 1) [-Wcpp]
#warning detachInterrupt may need some more work for this cpu (case 1)
^
In file included from C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\WInterrupts.c:29:0:
C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\WInterrupts.c: In function 'INT1_vect':
C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\WInterrupts.c:310:15: warning: 'INT1_vect' appears to be a misspelled signal handler, missing __vector prefix [-Wmisspelled-isr]
IMPLEMENT_ISR(INT1_vect, EXTERNAL_INT_1)
^
C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\WInterrupts.c:310:1: note: in expansion of macro 'IMPLEMENT_ISR'
IMPLEMENT_ISR(INT1_vect, EXTERNAL_INT_1)
^
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\WString.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\WString.cpp
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\abi.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\abi.cpp
avr-gcc -o .pioenvs\trinket5\FrameworkArduino\hooks.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\hooks.c
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\main.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\main.cpp
avr-g++ -o .pioenvs\trinket5\FrameworkArduino\new.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\new.cpp
avr-gcc -o .pioenvs\trinket5\FrameworkArduino\wiring.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\wiring.c
avr-gcc -o .pioenvs\trinket5\FrameworkArduino\wiring_analog.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\wiring_analog.c
avr-gcc -o .pioenvs\trinket5\FrameworkArduino\wiring_digital.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\wiring_digital.c
avr-gcc -x assembler-with-cpp -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 -c -o .pioenvs\trinket5\FrameworkArduino\wiring_pulse.S.o C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\wiring_pulse.S
avr-gcc -o .pioenvs\trinket5\FrameworkArduino\wiring_pulse.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\wiring_pulse.c
avr-gcc-ranlib .pioenvs\trinket5\libFrameworkArduinoVariant.a
avr-gcc -o .pioenvs\trinket5\FrameworkArduino\wiring_shift.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 C:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino\wiring_shift.c
avr-gcc-ranlib .pioenvs\trinket5\lib971\libTrinketKeyboard.a
avr-gcc-ar rc .pioenvs\trinket5\libFrameworkArduino.a .pioenvs\trinket5\FrameworkArduino\CDC.cpp.o .pioenvs\trinket5\FrameworkArduino\HardwareSerial.cpp.o .pioenvs\trinket5\FrameworkArduino\HardwareSerial0.cpp.o .pioenvs\trinket5\FrameworkArduino\HardwareSerial1.cpp.o .pioenvs\trinket5\FrameworkArduino\HardwareSerial2.cpp.o .pioenvs\trinket5\FrameworkArduino\HardwareSerial3.cpp.o .pioenvs\trinket5\FrameworkArduino\IPAddress.cpp.o .pioenvs\trinket5\FrameworkArduino\PluggableUSB.cpp.o .pioenvs\trinket5\FrameworkArduino\Print.cpp.o .pioenvs\trinket5\FrameworkArduino\Stream.cpp.o .pioenvs\trinket5\FrameworkArduino\Tone.cpp.o .pioenvs\trinket5\FrameworkArduino\USBCore.cpp.o .pioenvs\trinket5\FrameworkArduino\WInterrupts.c.o .pioenvs\trinket5\FrameworkArduino\WMath.cpp.o .pioenvs\trinket5\FrameworkArduino\WString.cpp.o .pioenvs\trinket5\FrameworkArduino\abi.cpp.o .pioenvs\trinket5\FrameworkArduino\hooks.c.o .pioenvs\trinket5\FrameworkArduino\main.cpp.o .pioenvs\trinket5\FrameworkArduino\new.cpp.o .pioenvs\trinket5\FrameworkArduino\wiring.c.o .pioenvs\trinket5\FrameworkArduino\wiring_analog.c.o .pioenvs\trinket5\FrameworkArduino\wiring_digital.c.o .pioenvs\trinket5\FrameworkArduino\wiring_pulse.S.o .pioenvs\trinket5\FrameworkArduino\wiring_pulse.c.o .pioenvs\trinket5\FrameworkArduino\wiring_shift.c.o
avr-gcc-ranlib .pioenvs\trinket5\libFrameworkArduino.a
avr-g++ -o .pioenvs\trinket5\firmware.elf -Os -mmcu=attiny85 -Wl,--gc-sections -flto -fuse-linker-plugin .pioenvs\trinket5\src\main.cpp.o -L.pioenvs\trinket5 -Wl,--start-group .pioenvs\trinket5\lib971\libTrinketKeyboard.a .pioenvs\trinket5\libFrameworkArduinoVariant.a .pioenvs\trinket5\libFrameworkArduino.a -lm -Wl,--end-group
MethodWrapper(["checkprogsize"], [".pioenvs\trinket5\firmware.elf"])
avr-objcopy -O ihex -R .eeprom .pioenvs\trinket5\firmware.elf .pioenvs\trinket5\firmware.hex
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [==        ]  20.9% (used 107 bytes from 512 bytes)
PROGRAM: [====      ]  40.0% (used 3274 bytes from 8192 bytes)
.pioenvs\trinket5\firmware.elf  :
section                    size      addr
.text                      3246         0
.data                        28   8388704
.bss                         79   8388732
.comment                     17         0
.note.gnu.avr.deviceinfo     60         0
.debug_aranges              160         0
.debug_info                1996         0
.debug_abbrev              1100         0
.debug_line                 678         0
.debug_str                  361         0
Total                      7725
 [SUCCESS] Took 15.51 seconds 

#4

Yes, you guessed the correct library !

One question to your suggested step #4 (i.e. copy the lib/TrinketKeybaord.... to screenshot/main.cpp (Important)

How did you exactly mean that ? (I don’t know how to copy a file to a file ? Did you mean to replace the one file or did you mean to add the file at the same location ? Can you please clarify ?

Then, to be complete on the library we are talking about:
I did two changes to the library (the one that you correctly found as well) - (as these were necessary also inside the Arduino IDE for successful compilation)

Here are the two changes from the original library :
(…however, I don’t think they are relevant for my original question tough, …but simply for completeness reasons I state them here below…) :

Make sure that line 17 and 18 show the following:

#undef __SFR_OFFSET
#define __SFR_OFFSET 0 /* used by avr-libc's register definitions */

Make sure that line 73 shows the follwowing:
#if 0x41 &lt; 0x40 /* This is an I/O address, use in and out */

If the two changes are not made, the TrinketKeyboard library will not compile (not for Arduino IDE and not for PlatformIO under VSCode).


#5

Just copy th example ino file to your src folder and rename it to the cpp extension. See file structure:

I did not have to make these changes for it being able to compile… What PlatformIO version are you using? (pio --version)


#6

Since I am completely new to PlatformIO - silly question where do I type: pio --version ???

Under PIO Home it says: Home 2.0.0 Core 3.6.2

The two changes I stated were indeed also necessary for the Arduino IDE. I am not sure if it has to do with the fact that I am on an older MAC book (late 2013) or if it has something to do with the USB driver.

I will now try what you explained… Thank you very much.


#7

I did move the example to the src folder and renamed it to main.cpp

But I get the very same error like the entire afternoon today:

My platform.io file looks as follows:

[env:trinket5]
platform = atmelavr
lib_extra_dirs = ~/Documents/Arduino/libraries/Arduino_applications/Learning/libraries
board = trinket5
framework = arduino


#8

Yes that’s your PIO version, and it’s the most recent one (good).

Strange because it doesn’t even tyr to compile the .S file… Can you rerun with verbosity on? Open a shell inside your IDE and type pio run -v.


#9

Here is the rerun with “verbosity” …


#10

Okay now we have the difference.

My PIO is trying to do

avr-gcc -x assembler-with-cpp -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=attiny85 -DPLATFORMIO=30602 -DARDUINO_AVR_TRINKET5 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -Ilib\TrinketKeyboard -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\Maxi\.platformio\packages\framework-arduinoavr\variants\trinket_tiny8 -c -o .pioenvs\trinket5\lib971\TrinketKeyboard\usbdrv\usbdrvasm.asm.o lib\TrinketKeyboard\usbdrv\usbdrvasm.asm

i.e., avr-gcc with the -x assembler-with-cpp flag.

But yours is trying to use avr-as with the exact same set of GCC flags, which won’t work. I have no idea why.

Can you please just delete the usbdrvasm.asm file? It should still try to compile the .S file normally.

Since I am on Windows, this might be an macOS specific problem…


#11

NOW IT WORKS :slight_smile:

56

Oh dear - how on earth would I have guessed ! Thank you very very much !

Do you know why one can delete the usbdrvasm.asm without any consequences ??


#12

Great. Still a macOS bug in PIO I think. @ivankravets?

Well the header file states that this file just exists because it compiles for the IAR toolchain. Since we’re using GCC and all the file is doing is a

#include "usbdrvasm.S"
//end 

I see no reason to not delete it.


#13

Hm - educated guess… :slight_smile:
Again, thank you very much !


#14

Indeed, this is a bug and I’ve just fixed it in https://github.com/platformio/platformio-core/commit/b87435948237998b2b39f60dda1faf2875a0fede

Arduino builder ignores *.asm and *.ASM files. We did the same for Arduino-based libraries.

Please set platformio-ide.useDevelopmentPIOCore to true in https://docs.platformio.org/en/latest/ide/vscode.html#settings. Restart VSCode. Open PlatformIO IDE Terminal and type pio upgrade --dev.

Does it ignore ASM files now?


#15

@ivankravets: Thank you for your effort. However we are not there yet :confused:

After setting to true as you requested inside PIO’s settings…
04
…and restarting VSCode, I typed as you suggested, inside a Terminal… pio upgrade --dev
It states:

PlatformIO has been successfully upgraded to 3.6.4b1

Then I closed and re-opened VSCode.

However, I still get the very same error as before!!

I can only eliminate the error with the workaround that @maxgerhardt suggested (i.e. deleting the file usbdrvasm.asm inside the library-subfolder)…


#16

Could you provide a simple project (archive) to reproduce this issue? You can share it on Dropbox or other services.