Compilation error on Teensy 4.1

Hi,

I am receiving a compilation error on a Teensy 4.1 with a very simple code. It has worked well previously, so I am suspecting some updates but can find out what has happened. I am using PlatformIO on Visual Studio on Windows 10.

The code is as follows.

#include <Arduino.h>

void setup() {
  analogWriteFrequency(2, 9000000);
  analogWrite(2, 128);
}

void loop() {
}

The compilation message is:

> Executing task in folder Teensy4pt1Evaluation: C:\Users\grbo\.platformio\penv\Scripts\platformio.exe run --target upload <

Processing teensy41 (platform: teensy; board: teensy41; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.14.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
 - framework-arduinoteensy 1.155.0 (1.55)
 - tool-teensy 1.155.0 (1.55)
 - toolchain-gccarmnoneeabi 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 93 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\teensy41\src\main.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\AudioStream.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\Blink.cc.o
Compiling .pio\build\teensy41\FrameworkArduino\CrashReport.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\DMAChannel.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\EventResponder.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\HardwareSerial1.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\HardwareSerial4.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\HardwareSerial5.cpp.o
*** [.pio\build\teensy41\src\main.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\AudioStream.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\Blink.cc.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\HardwareSerial.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\CrashReport.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\DMAChannel.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\EventResponder.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\HardwareSerial1.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\HardwareSerial3.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\HardwareSerial2.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\HardwareSerial4.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\HardwareSerial5.cpp.o] Error 1
============================================================================= [FAILED] Took 1.58 seconds =============================================================================
The terminal process "C:\Users\grbo\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1.

Can anybody give me an idea of what is going on and help me to solve this issue?

Gregory

Please remove the folders

  • C:\Users\<user>\.platformio\.cache
  • C:\Users\<user>\.platformio\packages\toolchain-gccarmnoneeabi*
  • C:\Users\<user>\.platformio\packages\framework-arduinoteensy

and rebuild the project.

I just did and obtained more or less the same results:

Executing task in folder Teensy4pt1Evaluation: C:\Users\grbo\.platformio\penv\Scripts\platformio.exe run <

Processing teensy41 (platform: teensy; board: teensy41; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Tool Manager: Installing platformio/toolchain-gccarmnoneeabi @ ~1.50401.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: toolchain-gccarmnoneeabi @ 1.50401.190816 has been installed!
Tool Manager: Installing platformio/framework-arduinoteensy @ ~1.155.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: framework-arduinoteensy @ 1.155.0 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.14.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
 - framework-arduinoteensy 1.155.0 (1.55)
 - tool-teensy 1.155.0 (1.55)
 - toolchain-gccarmnoneeabi 1.50401.190816 (5.4.1) 
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 93 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\teensy41\src\main.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\AudioStream.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\Blink.cc.o
Compiling .pio\build\teensy41\FrameworkArduino\CrashReport.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\DMAChannel.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\EventResponder.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\HardwareSerial1.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\HardwareSerial4.cpp.o
Compiling .pio\build\teensy41\FrameworkArduino\HardwareSerial5.cpp.o
*** [.pio\build\teensy41\src\main.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\AudioStream.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\Blink.cc.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\CrashReport.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\DMAChannel.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\EventResponder.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\HardwareSerial.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\HardwareSerial1.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\HardwareSerial2.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\HardwareSerial3.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\HardwareSerial4.cpp.o] Error 1
*** [.pio\build\teensy41\FrameworkArduino\HardwareSerial5.cpp.o] Error 1
============================================================================= [FAILED] Took 106.47 seconds =============================================================================
The terminal process "C:\Users\grbo\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Do you have an antivirus that could block execution somehow? This does noot look healthy.

When you open a CLI and execute

C:\Users\%USERNAME%\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-g++ --version

what does it say?

Hi,
I am using a work laptop so there is an antivirus and managed by my employer I guess. It have the possibility to add exclusion though. I have never had any problems previously with execution blocking with VSC, but new updates that I am unaware of might cause problems now…

Under is what I obtain after the command you suggest:
arm-none-eabi-g++.exe (GNU Tools for ARM Embedded Processors) 5.4.1 20160919 (release) [ARM/embedded-5-branch revision 240496]
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

This is correct – so the compiler can be executed from a shell, but not by PlatformIO? Weird. The only instances where I’ve seen this is as said, with very aggressive antivirus systems.

Can you again open a CLI and run

pio run -j1 -v

for a verbose, single-threaded compilation and post the log?

Here it is:

PS C:\Users\grbo\Documents\Teensy4pt1Evaluation> pio run -j1 -v
Processing teensy41 (platform: teensy; board: teensy41; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.14.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
 - framework-arduinoteensy 1.155.0 (1.55)
 - tool-teensy 1.155.0 (1.55)
 - toolchain-gccarmnoneeabi 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 93 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
arm-none-eabi-g++ -o .pio\build\teensy41\src\main.cpp.o -c -fno-exceptions -felide-constructors -fno-rtti -std=gnu++14 -Wno-error=narrowing -fpermissive -fno-threadsafe-statics -Wall -ffunction-sections -fdata-sections -mthumb -mcpu=cortex-m7 -nostdlib -fsingle-precision-constant -mfloat-abi=hard -mfpu=fpv5-d16 -O2 -DPLATFORMIO=50204 -D__IMXRT1062__ -DARDUINO_TEENSY41 -DUSB_SERIAL -DARDUINO=10805 -DTEENSYDUINO=155 -DCORE_TEENSY -DF_CPU=600000000 -DLAYOUT_US_ENGLISH -Iinclude -Isrc -IC:\Users\grbo\.platformio\packages\framework-arduinoteensy\cores\teensy4 src\main.cpp
*** [.pio\build\teensy41\src\main.cpp.o] Error 1
================================================== [FAILED] Took 1.07 seconds ==================================================