STM32WL support

Post here all questions related to STM32 core if you can't find a relevant section!
nedhorning
Posts: 2
Joined: Mon Jun 28, 2021 10:32 pm

Re: STM32WL support

Post by nedhorning »

I am trying to add a STM32WL variant for the MKR Windy module (STM32WLE5J8I6) using the information here: https://github.com/stm32duino/wiki/wiki ... nt-(board). I made decent progress but when I compile some simple code using Arduino I get an error “STM32YYxx chip series is not defined in the boards.txt”. I have the board defined in boards.txt but it looks like there isn’t a HAL driver (STM32WLxx_HAL_Driver?) for STM32WL. Is it possible for me to add an STM32WL variant to stm32duino or do I need to wait until that driver is available? This is my first attempt at adding a variant so it’s quite possible I made a mistake.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: STM32WL support

Post by fpiSTM »

Hi, cube drivers are not available yet.
I'm currently adding them. A PR is on going https://github.com/stm32duino/Arduino_C ... /pull/1429
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: STM32WL support

Post by fpiSTM »

PR is merged.
dolfandringa
Posts: 20
Joined: Wed Jun 03, 2020 3:47 am

Re: STM32WL support

Post by dolfandringa »

Awesome @fpiSTM . Thanks so much. Haven't really had time to do anything with the stm32duino and my stm32wl55 board until today. Right now I am looking at getting it included in Platformio . I know you're not the one making the Platformio packages/framework definition, but I am running into an issue which you might now better how to fix because its probably MCU specific.
I am starting to get close with these changes: https://github.com/platformio/platform- ... t?expand=1

But when I try to compile a very simple sketch using platformio, the compiler complains that there is no FPU present. Is this because of the dual M0/M4 MCU? In misc/svd/STM32WL5x_CM4.svd I do see

Code: Select all

<fpuPresent>true</fpuPresent>
while in system/Drivers/CMSIS/Device/ST/STM32WLxx/Include/stm32wl55xx.h I see

Code: Select all

#define __FPU_PRESENT             0U /*!< FPU not present
So is or is there no FPU present? I would guess there would be one in the cortex M4 ? But in your the stm32duino CMSIS drivers you define it as not being present.

In tools/platformio-build.py I also see

Code: Select all

if any(mcu in board_config.get("build.cpu")
       for mcu in ("cortex-m4", "cortex-m7")):
    env.Append(
        CCFLAGS=["-mfpu=fpv4-sp-d16", "-mfloat-abi=hard"],
        LINKFLAGS=["-mfpu=fpv4-sp-d16", "-mfloat-abi=hard"],
    )
and in my build.cpu is indeed set to cortex-m4. I guess this includes the fpu options to gcc. So what option would make sense here to exclude the fpu math?

Any ideas how resolve this issue?

The error I get is:

Code: Select all

Processing stm32wl55 (platform: ststm32; board: nucleo_wl55jc; framework: arduino; extra_scripts: post:extra_script.py)
--------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_wl55jc.html
PLATFORM: ST STM32 (14.1.0) > ST Nucleo WL55JC
HARDWARE: STM32WL55JC 48MHz, 64KB RAM, 256KB Flash
DEBUG: Current (stlink) On-board (stlink) External (cmsis-dap, jlink)
PACKAGES:
 - framework-arduinoststm32 4.30000.210815 (3.0.0)
 - framework-cmsis 2.50700.210515 (5.7.0)
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
-----------------
GOING FOR M4 MATH
-----------------
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 11 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
arm-none-eabi-gcc -o .pio/build/stm32wl55/FrameworkArduinoVariant/PeripheralPins.c.o -c -std=gnu11 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Os -mcpu=cortex-m4 -mthumb -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 "-I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I" -DPLATFORMIO=50101 -DSTM32WL55JC1 -DSTM32WLxx -DARDUINO=10808 -DARDUINO_ARCH_STM32 -DARDUINO_NUCLEO_WL55JC -DBOARD_NAME=\"NUCLEO_WL55JC\" -DHAL_UART_MODULE_ENABLED -DUSE_FULL_LL_DRIVER -DVARIANT_H=\"variant_NUCLEO_WL55JC1.h\" -DSTM32WL55xx -DUSE_CM4_STARTUP_FILE -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/avr -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32 -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/LL -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/OpenAMP -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/hid -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/cdc -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32WLxx_HAL_Driver/Inc -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32WLxx_HAL_Driver/Src -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/STM32WLxx -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP/open-amp/lib/include -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP/libmetal/lib/include -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP/virtual_driver -I/home/dolfandringa/.platformio/packages/framework-cmsis/CMSIS/Core/Include -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32WLxx/Include -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32WLxx/Source/Templates/gcc -I/home/dolfandringa/.platformio/packages/framework-cmsis/CMSIS/DSP/Include -I/home/dolfandringa/.platformio/packages/framework-cmsis/CMSIS/DSP/PrivateInclude -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino /home/dolfandringa/.platformio/packages/framework-arduinoststm32/variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I/PeripheralPins.c
arm-none-eabi-gcc -o .pio/build/stm32wl55/SrcWrapper/src/HAL/stm32yyxx_hal.c.o -c -std=gnu11 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Os -mcpu=cortex-m4 -mthumb -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 "-I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I" -DPLATFORMIO=50101 -DSTM32WL55JC1 -DSTM32WLxx -DARDUINO=10808 -DARDUINO_ARCH_STM32 -DARDUINO_NUCLEO_WL55JC -DBOARD_NAME=\"NUCLEO_WL55JC\" -DHAL_UART_MODULE_ENABLED -DUSE_FULL_LL_DRIVER -DVARIANT_H=\"variant_NUCLEO_WL55JC1.h\" -DSTM32WL55xx -DUSE_CM4_STARTUP_FILE -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/avr -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32 -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/LL -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/OpenAMP -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/hid -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/cdc -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32WLxx_HAL_Driver/Inc -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32WLxx_HAL_Driver/Src -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/STM32WLxx -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP/open-amp/lib/include -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP/libmetal/lib/include -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP/virtual_driver -I/home/dolfandringa/.platformio/packages/framework-cmsis/CMSIS/Core/Include -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32WLxx/Include -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32WLxx/Source/Templates/gcc -I/home/dolfandringa/.platformio/packages/framework-cmsis/CMSIS/DSP/Include -I/home/dolfandringa/.platformio/packages/framework-cmsis/CMSIS/DSP/PrivateInclude -I/home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino /home/dolfandringa/.platformio/packages/framework-arduinoststm32/libraries/SrcWrapper/src/HAL/stm32yyxx_hal.c
In file included from /home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32WLxx/Include/stm32wl55xx.h:210,
                 from /home/dolfandringa/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32WLxx/Include/stm32wlxx.h:99,
                 from /home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/stm32_def.h:56,
                 from /home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/clock.h:19,
                 from /home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/wiring_time.h:23,
                 from /home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/wiring.h:38,
                 from /home/dolfandringa/.platformio/packages/framework-arduinoststm32/cores/arduino/Arduino.h:36,
                 from /home/dolfandringa/.platformio/packages/framework-arduinoststm32/variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I/PeripheralPins.c:21:
/home/dolfandringa/.platformio/packages/framework-cmsis/CMSIS/Core/Include/core_cm4.h:105:8: error: #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  105 |       #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
dolfandringa
Posts: 20
Joined: Wed Jun 03, 2020 3:47 am

Re: STM32WL support

Post by dolfandringa »

OK, with the following change https://github.com/stm32duino/Arduino_C ... o?expand=1
I did manage to turn off the fpu stuff on from tools/platformio/platformio-build.py. Should I submit that as PR?
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: STM32WL support

Post by fpiSTM »

@dolfandringa as stated in your issue on the STM32 core, FPU is optional for cortex M4:
https://www.st.com/content/st_com/en/ar ... ex-m4.html

The CMSIS is aligned with that. I have no advise for you for PIO as I do not use it nor support it, sorry.
dolfandringa
Posts: 20
Joined: Wed Jun 03, 2020 3:47 am

Re: STM32WL support

Post by dolfandringa »

@fpiSTM , if you care to look at the code, this is an issue in a file in Arduino_Core_STM32. https://github.com/stm32duino/Arduino_C ... o-build.py
is in your repository, so maintained by you I assume, and that sets a build flag for all cortex-m4 MCU's. Since the STM32WL55 does not contain an FPU (as per the CMSIS driver), but does contain a cortex-m4, I think the issue with the file you provide in tools/platformio/platformio-build.py. If you are willing to look at the code change, I am happy to help with a PR.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: STM32WL support

Post by fpiSTM »

@dolfandringa as mentioned I do not maintain this file.
It is maintained by PIO team, you can look the history of the file :)
nedhorning
Posts: 2
Joined: Mon Jun 28, 2021 10:32 pm

Re: STM32WL support

Post by nedhorning »

Has anyone been able to get LoRaWAN to work on the STM32WL or is anyone working on it? From what I can tell LoRaWAN support isn't planned for the STMDuino library for the WL.
Post Reply

Return to “General discussion”