platformio / platform-ststm32

ST STM32: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/ststm32
Apache License 2.0
394 stars 308 forks source link

lora_e5_dev_board definition broken #738

Closed maxgerhardt closed 11 months ago

maxgerhardt commented 11 months ago

Using

[env:lora_e5_dev_board]
platform = ststm32@17.0.0
board = lora_e5_dev_board
framework = arduino

with empty sketch

#include <Arduino.h>

void setup() {}
void loop() {}

fails to compile

Linking .pio\build\lora_e5_dev_board\firmware.elf
c:/users/xxxxxxxxx/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: warning: .pio/build/lora_e5_dev_board/firmware.elf has a LOAD segment with RWX permissions
c:/users/xxxxxxxxx/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/lora_e5_dev_board/SrcWrapper/src/stm32/hw_config.c.o: in function `hw_config_init':
hw_config.c:(.text.hw_config_init+0x12): undefined reference to `SystemClock_Config'
c:/users/xxxxxxxxx/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/lora_e5_dev_board/libFrameworkArduino.a(HardwareSerial.cpp.o): in function `HardwareSerial::HardwareSerial(void*, HalfDuplexMode_t)':
HardwareSerial.cpp:(.text._ZN14HardwareSerialC2EPv16HalfDuplexMode_t+0x88): undefined reference to `digitalPin'
collect2.exe: error: ld returned 1 exit status

Because even though the board says it wants to use the "variant_generic.h"

https://github.com/platformio/platform-ststm32/blob/6eb42e394d96e4e884eebae7668a584ffe0b3503/boards/lora_e5_dev_board.json#L1-L5

it does not activate the right macro to enable the code to be compiled

https://github.com/stm32duino/Arduino_Core_STM32/blob/586319c6c2cee268747c8826d93e84b26d1549fd/variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I/variant_generic.cpp#L13-L17

This, it needs an additional

build_flags = -DARDUINO_GENERIC_WLE5JCIX

to work properly.

valeros commented 11 months ago

Thanks for pointing it out, fixed in the dev branch.