Skip to content

Does not compile for STM32F103 blue-pill #805

Closed

Description

@Kashouryo

tested on the newest master branch, with STM32duino 1.5.

In file included from C:\Software\Arduino IDE\portable\sketchbook\libraries\FastLED/led_sysdefs.h:32:0,
from C:\Software\Arduino IDE\portable\sketchbook\libraries\FastLED/FastLED.h:41,

             from C:\Users\think\AppData\Local\Temp\arduino_modified_sketch_17966\Blink.ino:1:

C:\Software\Arduino IDE\portable\sketchbook\libraries\FastLED/platforms/avr/led_sysdefs_avr.h:12:20: fatal error: avr/io.h: No such file or directory
#include <avr/io.h>

                ^

compilation terminated.

Activity

  1. markopl96 commented on Jun 22, 2019

    @markopl96

    I'm using platformIO and I'm getting the same error, did someone found solution for that?

    It's looks for me like the library has some hardcoded #include from avr, coz when I compiled the same code from platformIO in ArduinoIDE where I have instaled avr and stm32 boards it compiled fine.

    @Kashouryo what IDE are you using? if arduino try to install avr and stm32 cores.

    Was sm able to run FastLED with STM32 in platformIO?

  2. Kashouryo commented on Jul 1, 2019

    @Kashouryo
    Author

    @markopl96
    I am using the original Arduino IDE 1.8.10

  3. H4RL3K4SP3R commented on Sep 3, 2019

    @H4RL3K4SP3R

    I ran into the same or a similar issue, with platformIO 4.0.3 and FastLED 3.3.2.
    When using board = bluepill_f103_c8 i get the same errors with unsuccesful imports of avr/io.h.
    If i use board = genericSTM32F103C8 i run into a different issue. The avr/io.h import seems to only happen when __STM32F1__ is not defined, then it will default to:
    #include "platforms/avr/led_sysdefs_avr.h" in /FastLED_ID126/led_sysdefs.h which later causes the avr/io.h import. Using board = genericSTM32F103C8 seems to correctly define __STM32F1__ but reveals further issues in /FastLED_ID126/platforms/arm/stm32/fastpin_arm_stm32.h, there it errors in Line 52:85 with "incomplete type '__gen_struct_GPIOB' used in nested name specifier"

  4. Fxlr8 commented on Oct 15, 2019

    @Fxlr8

    same for me,incomplete type '__gen_struct_GPIOA' used in nested name specifier error

    stm32f100CB, platformIO, fastled 3.3.2

  5. avinashsaraf commented on Oct 29, 2019

    @avinashsaraf

    Hi, I am getting same error can anyone please help me with the fix or is it still open?
    error: incomplete type '__gen_struct_GPIOB' used in nested name specifier

  6. markopl96 commented on Oct 29, 2019

    @markopl96

    @avinashsaraf what I did is kind of stupid 😄 but I was tired of looking for a solution so to walk around it I copied files from PIO into Arduino IDE and compile it there.

    btw, it's really strange for me that solution was still not found, PIO is really popular just like STM MCU and FastLED so You would think that this is gonna be a big/common issue.

  7. added
    platform: stm32
    area: core
    status: stale
    status: triage
    on Apr 16, 2026
  8. zackees commented on Jun 3, 2026

    @zackees
    Member

    Tracked in FastLED/fbuild#385 for STM32 / STM32duino fbuild platform/build support validation.

    That fbuild issue is scoped to board metadata, toolchain/backend support, and FastLED smoke-build evidence. Any remaining FastLED source/platform-code blocker should stay linked from both sides.

  9. zackees commented on Jun 3, 2026

    @zackees
    Member

    Triage update from fbuild side, tracked under FastLED/fbuild#385.

    The STM32F103 blue-pill build path through fbuild now works end-to-end. Verified locally with bluepill_f103c8 board on ststm32 / framework=arduino (arm-none-eabi-gcc 15.2.1):

    build succeeded in 18.6s (flash: 17712 bytes, ram: 2816 bytes)
    

    Your original error fatal error: avr/io.h: No such file or directory was the result of FastLED's old platforms.h falling through to the AVR fallback because STM32duino wasn't being detected. That preprocessor dispatch is FastLED-side - fbuild does not patch FastLED's headers, it only sets the toolchain define environment.

    fbuild gap status: none for STM32F1. Remaining work to actually compile FastLED is in FastLED's src/platforms/arm/stm32/ tree.

    See FastLED/fbuild#385 and PR FastLED/fbuild#396.

  10. zackees commented on Aug 1, 2026

    @zackees
    Member

    Status check with current master — the two symptoms in this thread have diverged.

    1. avr/io.h: No such file or directory — can no longer happen.

    This was the platform dispatch falling through to AVR when __STM32F1__ wasn't defined. Both halves are now guarded in src/led_sysdefs.h:

    • AVR is selected only on defined(__AVR__) || defined(__AVR_ATmega4809__) (line 61), so it is no longer a catch-all.

    • The terminal #else raises a clear diagnostic instead of picking a wrong platform:

      #error "This platform isn't recognized by FastLED... yet.  See comments in FastLED/led_sysdefs.h for options."
      

    An unrecognised board now says so, rather than failing three headers deep inside AVR.

    2. incomplete type '__gen_struct_GPIOB' — cannot be verified locally.

    bash compile bluepill --examples Blink does not reach the compiler at all:

    daemon error: daemon did not become healthy after 3 spawn attempts (10s each).
    

    Twice, consistently. To rule out a broken local environment I ran bash compile uno --examples Blink immediately after: succeeds in 2m09s. So this is STM32-specific, not general breakage — which matches FastLED/fbuild#385 being open for STM32 / STM32duino build support.

    I'm deliberately not proposing a fix for fastpin_arm_stm32.h on that basis. A pin-mux or register-struct change that compiles nowhere I can test is the kind of change that links cleanly and silently drives nothing; the honest state is "blocked on fbuild#385" rather than a patch nobody has built.

    So this issue is really two: symptom 1 is fixed, symptom 2 is gated on STM32 build support landing. Once fbuild#385 makes bash compile bluepill work, the __gen_struct_GPIOB half becomes checkable in minutes.

  11. zackees commented on Aug 1, 2026

    @zackees
    Member

    Closing — this thread contained two distinct failures, and both have been structurally fixed. Taking them separately, since they got conflated at the time.

    Failure 1 — avr/io.h: No such file or directory

    @H4RL3K4SP3R diagnosed this exactly right in 2019:

    The avr/io.h import seems to only happen when __STM32F1__ is not defined, then it will default to #include "platforms/avr/led_sysdefs_avr.h"

    That's precisely what happened: AVR was the unconditional #else fallback in led_sysdefs.h, so any board whose defines FastLED didn't recognise silently landed on AVR and then died on a missing AVR header — a confusing error that says nothing about the real problem.

    Fixed two ways.

    The AVR arm is now guarded rather than a catch-all (src/led_sysdefs.h:61):

    #elif defined(__AVR__) || defined(__AVR_ATmega4809__)
    #include "platforms/avr/led_sysdefs_avr.h"

    and the real #else is now an explicit unsupported-platform diagnostic pointing at PORTING.md, rather than a wrong #include. An unrecognised board now tells you it's unrecognised.

    The STM32 detection also got much broader (led_sysdefs.h:46) — STM32F10X_MD, __STM32F1__, STM32F1, STM32F1xx, STM32F2XX, STM32F4, STM32U5*, STM32G0* and more. @markopl96 and @Kashouryo, that's why the same code compiled in one IDE but not the other: different cores emit different defines, and only some were recognised. Far fewer fall through now.

    Failure 2 — incomplete type '__gen_struct_GPIOB' used in nested name specifier

    This was the deeper bug, hit by @H4RL3K4SP3R, @Fxlr8 and @avinashsaraf once they did get past the AVR fallback.

    The __gen_struct_GPIOx machinery no longer exists in src/platforms/arm/stm32/fastpin_arm_stm32.h — the file was rewritten around USE_NEW_STM32_PIN_DEFINITIONS, whose own comment explains the motivation:

    The legacy definitions use incorrect Arduino pin numbers instead of STM32 pin names

    It's selected automatically for Blue Pill, Maple Mini, generic F103C8/T, F4 variants and more. So both the crash and the mis-mapped pins behind it are gone.

    Current status

    The maintainer verified the bluepill_f103c8 path end-to-end via fbuild (ststm32 / framework=arduino, arm-none-eabi-gcc 15.2.1) at 17712 B flash / 2816 B RAM, and stm32f103c8, stm32f103cb and stm32f103tb are all in the CI board matrix.

    Honest caveat: I tried to reproduce that build locally to confirm, and couldn't — my toolchain install wedged on a lock unrelated to this code. So the fix claims above are from source inspection plus the maintainer's verified build, not from a build I ran myself.

    @markopl96 — your workaround of copying files into the Arduino IDE was a rational response to a genuinely misleading error, and you were right that it shouldn't have taken that. The error now names the actual problem.

    If a current FastLED still fails on an F103 board, please open a fresh issue with the exact board = value and core version — the two failure modes above are gone, so it would be something new.

  12. moved this from Triage to Done in FastLED Trackeron Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreplatform: stm32status: stalestatus: triage

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions