PlatformIO Community

Fastled clockless_trinket.h:326:24: error

Hi!
I use FastLED library for Arduino and have no problems with it. But I can’t use FastLED in Platformio due to this error popping up every time I compile the code:

In file included from C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/fastled_avr.h:6:0,
                 from C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms.h:39,
                 from C:\Users\Jarvis\.platformio\lib\FastLED_ID126\FastLED.h:52,
                 from C:\Users\Jarvis\.platformio\lib\FastLED_ID126\FastLED.cpp:2:
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h: In static member function 'static void ClocklessController<DATA_PIN, T1, T2, T3, RGB_ORDER, XTRA0, FLIP, WAIT_TIME>::showRGBInternal(PixelController<RGB_ORDER>&)':
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
Compiling .pio\build\nanoatmega328\libb1d\FastLED_ID126\bitswap.cpp.o
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:409:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 4: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:410:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 3: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:411:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 2: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:425:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 4: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:426:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 3: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:427:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 2: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:444:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 4: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:445:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 3: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:446:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 2: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
*** [.pio\build\nanoatmega328\libb1d\FastLED_ID126\FastLED.cpp.o] Error 1
In file included from C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/fastled_avr.h:6:0,
                 from C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms.h:39,
                 from C:\Users\Jarvis\.platformio\lib\FastLED_ID126\FastLED.h:52,
                 from C:\Users\Jarvis\.platformio\lib\FastLED_ID126\bitswap.cpp:2:
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h: In static member function 'static void ClocklessController<DATA_PIN, T1, T2, T3, RGB_ORDER, XTRA0, FLIP, WAIT_TIME>::showRGBInternal(PixelController<RGB_ORDER>&)':
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:409:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 4: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:410:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 3: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:411:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 2: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:425:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 4: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:426:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 3: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:427:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 2: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:444:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 4: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:445:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 3: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'
 #define FL_FALLTHROUGH __attribute__ ((fallthrough));
                        ^
C:\Users\Jarvis\.platformio\lib\FastLED_ID126\platforms/avr/clockless_trinket.h:446:55: note: in expansion of macro 'FL_FALLTHROUGH'
      case 2: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH
                                                       ^
*** [.pio\build\nanoatmega328\libb1d\FastLED_ID126\bitswap.cpp.o] Error 1

Can you show your platformio.ini and example code?

No problem!
I’ve just changed the board from arduino nano to arduino leonardo in ini file:

[env:leonardo]
platform = atmelavr
board = leonardo
framework = arduino
lib_deps =
  # Using a library name
  FastLED
  # ... or using library Id
  126
  # ... or depend on a specific version
  FastLED@3.3.3
  # Semantic Versioning Rules
  # http://docs.platformio.org/page/userguide/lib/cmd_install.html#description
  FastLED@^3.3.3
  FastLED@~3.3.3
  FastLED@>=3.3.3

Oh, also your issue with the code is already known in the main repository: https://github.com/FastLED/FastLED/pull/961

The issue lies withing using older AVR-GCC version. When using pio platform update in the PIO terminal, what does it output?

Ow! I edited replaced
#define FL_FALLTHROUGH attribute ((fallthrough));
with
#define FL_FALLTHROUGH
and all is working now.
But i’m curios if this may cause any further problems?

Okay that won’t help either because by standard it’s using GCC 5.4.0. The FestLED now needs fancy GCC 7 and or newer.

You should use this platformio.ini

[env:leonardo]
platform = atmelavr
board = leonardo
framework = arduino
lib_deps =
     FastLED
platform_packages =
  ; use GCC AVR 7.3.0+
  toolchain-atmelavr@>=1.70300.0

This will force the usage of the toolchain-atmelavr version greater than 1.70300, which contains the 7.3.0 compiler version, with which this code is compilable. See documentation.

I tested with with the Blink.ino example and it works.

>pio run
Processing leonardo (platform: atmelavr; board: leonardo; framework: arduino)
------------------------------------------------------------------------------------------------------------------------
PackageManager: Installing toolchain-atmelavr @ >=1.70300.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
toolchain-atmelavr @ 1.70300.191015 has been successfully installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/leonardo.html
PLATFORM: Atmel AVR 2.0.0 > Arduino Leonardo
HARDWARE: ATMEGA32U4 16MHz, 2.50KB RAM, 28KB Flash
PACKAGES:
 - framework-arduino-avr 5.0.0
 - toolchain-atmelavr 1.70300.191015 (7.3.0)
Converting main.ino
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Looking for FastLED library in registry
Found: https://platformio.org/lib/show/126/FastLED
LibraryManager: Installing id=126

Downloading  [#############-----------------------]   36%
Downloading  [##############----------------------]   40%
Downloading  [###############---------------------]   43%
Downloading  [################--------------------]   46%
Downloading  [##################------------------]   50%
Downloading  [###################-----------------]   53%
Downloading  [####################----------------]   56%
Downloading  [#####################---------------]   60%
Downloading  [######################--------------]   63%
Downloading  [########################------------]   66%
Downloading  [#########################-----------]   70%  00:00:00
Downloading  [##########################----------]   73%  00:00:00
Downloading  [###########################---------]   76%  00:00:00
Downloading  [############################--------]   80%  00:00:00
Downloading  [##############################------]   83%  00:00:00
Downloading  [###############################-----]   86%  00:00:00
Downloading  [################################----]   90%  00:00:00
Downloading  [#################################---]   93%  00:00:00
Downloading  [##################################--]   96%  00:00:00
Downloading  [####################################]  100%
FastLED @ 3.3.3 has been successfully installed!
Found 7 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <FastLED> 3.3.3
|   |-- <SPI> 1.0
|   |-- <SoftwareSerial> 1.0
Building in release mode
Compiling .pio\build\leonardo\src\main.ino.cpp.o
Compiling .pio\build\leonardo\libc14\SPI\SPI.cpp.o
Compiling .pio\build\leonardo\libf9a\SoftwareSerial\SoftwareSerial.cpp.o
Compiling .pio\build\leonardo\lib01c\FastLED_ID126\FastLED.cpp.o
Compiling .pio\build\leonardo\lib01c\FastLED_ID126\bitswap.cpp.o
Compiling .pio\build\leonardo\lib01c\FastLED_ID126\colorpalettes.cpp.o
Compiling .pio\build\leonardo\lib01c\FastLED_ID126\colorutils.cpp.o
Compiling .pio\build\leonardo\lib01c\FastLED_ID126\hsv2rgb.cpp.o
Compiling .pio\build\leonardo\lib01c\FastLED_ID126\lib8tion.cpp.o
Compiling .pio\build\leonardo\lib01c\FastLED_ID126\noise.cpp.o
Compiling .pio\build\leonardo\lib01c\FastLED_ID126\platforms.cpp.o
Compiling .pio\build\leonardo\lib01c\FastLED_ID126\power_mgt.cpp.o
Compiling .pio\build\leonardo\lib01c\FastLED_ID126\wiring.cpp.o
Archiving .pio\build\leonardo\libFrameworkArduinoVariant.a
Compiling .pio\build\leonardo\FrameworkArduino\CDC.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\HardwareSerial.cpp.o
In file included from C:/Users/Maxi/Downloads/led_test/src/main.ino:1:0:
.pio\libdeps\leonardo\FastLED_ID126/FastLED.h:14:21: note: #pragma message: FastLED version 3.003.003
 #    pragma message "FastLED version 3.003.003"
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Archiving .pio\build\leonardo\libc14\libSPI.a
Indexing .pio\build\leonardo\libFrameworkArduinoVariant.a
Archiving .pio\build\leonardo\libf9a\libSoftwareSerial.a
Compiling .pio\build\leonardo\FrameworkArduino\HardwareSerial0.cpp.o
Indexing .pio\build\leonardo\libc14\libSPI.a
Compiling .pio\build\leonardo\FrameworkArduino\HardwareSerial1.cpp.o
Indexing .pio\build\leonardo\libf9a\libSoftwareSerial.a
Compiling .pio\build\leonardo\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\PluggableUSB.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\Print.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\USBCore.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\WInterrupts.c.o
Compiling .pio\build\leonardo\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\WString.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\abi.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\hooks.c.o
Compiling .pio\build\leonardo\FrameworkArduino\main.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\new.cpp.o
Compiling .pio\build\leonardo\FrameworkArduino\wiring.c.o
Compiling .pio\build\leonardo\FrameworkArduino\wiring_analog.c.o
Compiling .pio\build\leonardo\FrameworkArduino\wiring_digital.c.o
Archiving .pio\build\leonardo\lib01c\libFastLED_ID126.a
Compiling .pio\build\leonardo\FrameworkArduino\wiring_pulse.S.o
Compiling .pio\build\leonardo\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\leonardo\FrameworkArduino\wiring_shift.c.o
Indexing .pio\build\leonardo\lib01c\libFastLED_ID126.a
Archiving .pio\build\leonardo\libFrameworkArduino.a
Indexing .pio\build\leonardo\libFrameworkArduino.a
Linking .pio\build\leonardo\firmware.elf
Checking size .pio\build\leonardo\firmware.elf
Building .pio\build\leonardo\firmware.hex
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   9.4% (used 240 bytes from 2560 bytes)
Flash: [==        ]  22.4% (used 6420 bytes from 28672 bytes)
============================= [SUCCESS] Took 9.05 seconds =============================

Also remember that writing

  # Using a library name
  FastLED
  # ... or using library Id
  126
  # ... or depend on a specific version
  FastLED@3.3.3
  # Semantic Versioning Rules
  # http://docs.platformio.org/page/userguide/lib/cmd_install.html#description
  FastLED@^3.3.3
  FastLED@~3.3.3
  FastLED@>=3.3.3

is wrong, you’re supposed to select the version / style you need, not all 6 at once.

1 Like

Together with the comment /* fall through */ as indicated in the pull request is the proper fix which hopefully get into FastLED soon so that the standard AVR GCC 5 can compile it.

If you don’t want to locally modify the code, see the post above for how to get the updated compiler which doesn’t need these steps.

Thank you! Trying to update GCC…