Compile errors using WS2812B_STM32_Libmaple (include errors detected)

Aloha Folks,

I am trying to use the WS2812B_STM32_Libmaple which seems to work fine within the Arduino IDE but I am getting compile errors within PlatformIO and VSCode.

My terminal output is as follows:

Processing genericSTM32F103C8 (platform: ststm32; board: genericSTM32F103C8; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103C8.html
PLATFORM: ST STM32 (15.4.1) > STM32F103C8 (20k RAM. 64k Flash)
HARDWARE: STM32F103C8T6 72MHz, 20KB RAM, 64KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES:
 - framework-arduinoststm32 @ 4.20200.221104 (2.2.0)
 - framework-cmsis @ 2.50700.210515 (5.7.0)
 - tool-dfuutil @ 1.11.0
 - toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 14 compatible libraries
Scanning dependencies...
Dependency Graph
|-- RunningAverage @ 0.4.3
|-- IRremote @ 4.0.0      
|-- SmartLeds @ 1.2.1     
Building in release mode
Compiling .pio\build\genericSTM32F103C8\src\main.cpp.o
Compiling .pio\build\genericSTM32F103C8\libb3f\SmartLeds\Color.cpp.o
Compiling .pio\build\genericSTM32F103C8\libb3f\SmartLeds\SmartLeds.cpp.o
In file included from .pio\libdeps\genericSTM32F103C8\SmartLeds\src\Color.cpp:1:
.pio\libdeps\genericSTM32F103C8\SmartLeds\src\Color.h:4:10: fatal error: esp_attr.h: No such file or directory

******************************************************************
* Looking for esp_attr.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:esp_attr.h"
* Web  > https://registry.platformio.org/search?q=header:esp_attr.h
*
******************************************************************

    4 | #include "esp_attr.h"
      |          ^~~~~~~~~~~~
compilation terminated.
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\libmetal\generic\generic_device.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\libmetal\generic\generic_init.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\libmetal\generic\generic_io.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\libmetal\generic\generic_shmem.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\libmetal\generic\time.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\libmetal\init.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\libmetal\io.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\libmetal\log.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\libmetal\shmem.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\mbox_ipcc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\open-amp\remoteproc\remoteproc_virtio.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\open-amp\rpmsg\rpmsg.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\OpenAMP\open-amp\rpmsg\rpmsg_virtio.c.o
*** [.pio\build\genericSTM32F103C8\libb3f\SmartLeds\Color.cpp.o] Error 1
In file included from .pio\libdeps\genericSTM32F103C8\SmartLeds\src\SmartLeds.cpp:1:
.pio\libdeps\genericSTM32F103C8\SmartLeds\src\SmartLeds.h:37:18: fatal error: esp32-hal.h: No such file or directory

*******************************************************************
* Looking for esp32-hal.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:esp32-hal.h"
* Web  > https://registry.platformio.org/search?q=header:esp32-hal.h
*
*******************************************************************

   37 |         #include "esp32-hal.h"
      |                  ^~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\genericSTM32F103C8\libb3f\SmartLeds\SmartLeds.cpp.o] Error 1
src\main.cpp:4:10: fatal error: WS2812B.h: No such file or directory

*****************************************************************
* Looking for WS2812B.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:WS2812B.h"
* Web  > https://registry.platformio.org/search?q=header:WS2812B.h
*
*****************************************************************

    4 | #include <WS2812B.h>
      |          ^~~~~~~~~~~
compilation terminated.
*** [.pio\build\genericSTM32F103C8\src\main.cpp.o] Error 1

Any insight is appreciated.

But you’re using the Arduino_Core_STM32 core and not Maple core.

See documentation for switching to the Maple core.

*smacks forehead* - This will hopefully be the last time you remind me of this, how embarrassing…
…and , thank you.

@maxgerhardt It now appears that switching the core breaks the IIRRemote library. Again, this lib works fine in the Arduino IDE…

Processing bluepill_f103c8_128k (platform: ststm32; board: bluepill_f103c8_128k; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/bluepill_f103c8_128k.html
PLATFORM: ST STM32 (15.4.1) > BluePill F103C8 (128k)
HARDWARE: STM32F103C8T6 72MHz, 20KB RAM, 128KB Flash
DEBUG: Current (stlink) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES:
 - framework-arduinoststm32-maple @ 3.10000.201129 (1.0.0)
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 31 compatible libraries
Scanning dependencies...
Dependency Graph
|-- IRremote @ 4.0.0
Building in release mode
Compiling .pio\build\bluepill_f103c8_128k\src\main.cpp.o
In file included from .pio\libdeps\bluepill_f103c8_128k\IRremote\src/IRremote.hpp:323:0,
                 from .pio\libdeps\bluepill_f103c8_128k\IRremote\src/IRremote.h:10,
                 from src\main.cpp:2:
.pio\libdeps\bluepill_f103c8_128k\IRremote\src/ir_Pronto.hpp: In member function 'void IRsend::sendPronto(const __FlashStringHelper*, int_fast8_t)':
.pio\libdeps\bluepill_f103c8_128k\IRremote\src/ir_Pronto.hpp:185:5: error: 'strncpy_P' was not declared in this scope
     strncpy_P(work, reinterpret_cast<const char*>(str), len);
     ^~~~~~~~~
.pio\libdeps\bluepill_f103c8_128k\IRremote\src/ir_Pronto.hpp:185:5: note: suggested alternative: 'strcpy_P'
     strncpy_P(work, reinterpret_cast<const char*>(str), len);
     ^~~~~~~~~
     strcpy_P
*** [.pio\build\bluepill_f103c8_128k\src\main.cpp.o] Error 1

I am still unable to get the IRRemote lib to compile so I looked for another IR lib and found IRMP which appears to work well.

But at which exact version is it installed in the Arduino IDE? Older versions may work fine, you’re using 4.0.0 here, released 4 months ago.

I did actually think of that and noticed that the Arduino IDE was using 3.9.0, so I tried using that version of the lib locally but I encountered the same behavior.

Very weird, because the Maple core definitely has the necessary macros to redirect the “_P” (“PROGMEM” on AVR) functions to the regular ones

let me double check if that file is also in the version PlatformIO uses… And even then, there might a difference in some activation macros that make it go unused in PIO.

Very interesting, the Maple core PlatformIO uses does not have the strncpy_P macro, but the Git version does.

Seems like the used Maple core is outdated by at least one year when that commit was added.

One can work-around it in the platformio.ini:

[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = arduino
board_build.core = maple
lib_deps = z3t0/IRremote@^4.0.0
build_flags = -Dstrncpy_P=strncpy

Good to know! Thank you.

This is now tracked in Update Maple core package · Issue #592 · platformio/platform-ststm32 · GitHub.