How to compile for stm32 on a arm64 host with platform io

i have an error when i try to compile my code for the stm32 with the framework modified by @maxgerhardt and originaly from grumpyoldpizza on an rock 5b arm sbc (with a rk3588 cpu 16gb ram and a nvme ssd):

Hmpf. The Arduino core wants to use a 7.2.1 GCC but the registry doesn’t have that version for linux_aarch64 (PlatformIO Registry). The next highest and available one is 9.3.1. Let me adjust the version requirements so you can give that a try…

ok thankyou i use it because i want to use my high power sbc more often (and not just the 500W brick under my desk that wants to be an roomheater)

Done in Make compiler version less restrictive for AArch64 · maxgerhardt/platform-ststm32@42aea56 · GitHub. Can you retry?

You might have to delete the old version with rm -rf ~/.platformio/platforms/ststm32*.

it worked after removing the old stuff

@maxgerhardt it works but i noticed with your framework the mbed upload doesnt work it throws this error: The application file format is unknown and cannot be parsed and/or processed

That’s weird. Can you post the whole log of pio run -t upload -v on the CLI?

sorry for being late but here is the output:

hannes@rock-5b ~/D/P/P/STM32 Robot [1]> pio run -t upload -v
Processing nucleo_wb55rg (platform: GitHub - maxgerhardt/platform-ststm32: ST STM32: development platform for PlatformIO; board: grumpyoldpizza_nucleo_wb55rg; framework: arduino; build_flags: -DPIO_FRAMEWORK_ARDUINO_STORAGE_TYPE_NONE; upload_protocol: mbed; lib_deps: adafruit/Adafruit SSD1306@^2.5.7, adafruit/Adafruit NeoPixel@^1.10.7, robtillaart/PCF8574@^0.3.7; monitor_port: /dev/ttyACM0; monitor_speed: 115200; upload_port: /media/hannes/NOD_WB55RG)

CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/grumpyoldpizza_nucleo_wb55rg.html
PLATFORM: ST STM32 (15.4.1+sha.42aea56) (git+https://github.com/maxgerhardt/platform-ststm32.git#stm32wb) > NUCLEO-WB55RG
HARDWARE: STM32WB55RG 64MHz, 192KB RAM, 512KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, cmsis-dap, jlink)
PACKAGES:

  • framework-arduinoststm32wb @ 0.1.5-dev+sha.cb01ed3 (git+https://github.com/maxgerhardt/ArduinoCore-stm32wb.git)
  • tool-dfuutil @ 1.11.0
  • tool-openocd @ 2.1100.211028 (11.0)
  • tool-stm32duino @ 1.0.1
  • toolchain-gccarmnoneeabi @ 1.90301.200702 (9.3.1)
    LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 20 compatible libraries
    Scanning dependencies…
    Dependency Graph
    |-- Adafruit SSD1306 @ 2.5.7 (License: Unknown, Path: /home/hannes/Dokumente/PlatformIO/Projects/STM32 Robot/.pio/libdeps/nucleo_wb55rg/Adafruit SSD1306)
    | |-- Adafruit GFX Library @ 1.11.3 (License: Unknown, Path: /home/hannes/Dokumente/PlatformIO/Projects/STM32 Robot/.pio/libdeps/nucleo_wb55rg/Adafruit GFX Library)
    | | |-- Adafruit BusIO @ 1.14.1 (License: Unknown, Path: /home/hannes/Dokumente/PlatformIO/Projects/STM32 Robot/.pio/libdeps/nucleo_wb55rg/Adafruit BusIO)
    | | | |-- Wire @ 1.1 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/Wire)
    | | | |-- SPI @ 1.0 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/SPI)
    | | |-- Wire @ 1.1 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/Wire)
    | | |-- SPI @ 1.0 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/SPI)
    | |-- Adafruit BusIO @ 1.14.1 (License: Unknown, Path: /home/hannes/Dokumente/PlatformIO/Projects/STM32 Robot/.pio/libdeps/nucleo_wb55rg/Adafruit BusIO)
    | | |-- Wire @ 1.1 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/Wire)
    | | |-- SPI @ 1.0 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/SPI)
    | |-- Wire @ 1.1 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/Wire)
    | |-- SPI @ 1.0 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/SPI)
    |-- Adafruit NeoPixel @ 1.10.7 (License: Unknown, Path: /home/hannes/Dokumente/PlatformIO/Projects/STM32 Robot/.pio/libdeps/nucleo_wb55rg/Adafruit NeoPixel)
    |-- PCF8574 @ 0.3.7 (License: MIT, Path: /home/hannes/Dokumente/PlatformIO/Projects/STM32 Robot/.pio/libdeps/nucleo_wb55rg/PCF8574)
    | |-- Wire @ 1.1 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/Wire)
    |-- Adafruit GFX Library @ 1.11.3 (License: Unknown, Path: /home/hannes/Dokumente/PlatformIO/Projects/STM32 Robot/.pio/libdeps/nucleo_wb55rg/Adafruit GFX Library)
    | |-- Adafruit BusIO @ 1.14.1 (License: Unknown, Path: /home/hannes/Dokumente/PlatformIO/Projects/STM32 Robot/.pio/libdeps/nucleo_wb55rg/Adafruit BusIO)
    | | |-- Wire @ 1.1 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/Wire)
    | | |-- SPI @ 1.0 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/SPI)
    | |-- Wire @ 1.1 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/Wire)
    | |-- SPI @ 1.0 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/SPI)
    |-- BLE @ 1.0.0 (License: Unknown, Path: /home/hannes/.platformio/packages/framework-arduinoststm32wb/libraries/BLE)
    |-- SparkFun TB6612FNG Motor Driver Library @ 1.0.0 (License: Unknown, Path: /home/hannes/Dokumente/PlatformIO/Projects/STM32 Robot/.pio/libdeps/nucleo_wb55rg/SparkFun_TB6612FNG_Arduino_Library)
    |-- adc_read (License: Unknown, Path: /home/hannes/Dokumente/PlatformIO/Projects/STM32 Robot/.pio/libdeps/nucleo_wb55rg/adc_read)
    Building in release mode
    arm-none-eabi-g++ -o .pio/build/nucleo_wb55rg/firmware.elf -T STM32WB55xx_FLASH.ld -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mcpu=cortex-m4 -march=armv7e-m -mthumb -mabi=aapcs -Os --specs=nosys.specs --specs=nano.specs -Wl,–gc-sections -Wl,–check-sections -Wl,–unresolved-symbols=report-all -Wl,–warn-common -Wl,–warn-section-align -Wl,–defsym=RTC_EPOCH=1672526063 -Wl,–defsym=RTC_ZONE=3600 -Wl,–defsym=RTC_DST=0 -Wl,–defsym=__RTC_LEAP_SECONDS=18 .pio/build/nucleo_wb55rg/FrameworkArduinoVariant/variant.cpp.o .pio/build/nucleo_wb55rg/src/main.cpp.o -L/home/hannes/.platformio/platforms/ststm32/ldscripts -L.pio/build/nucleo_wb55rg -L/home/hannes/.platformio/packages/framework-arduinoststm32wb/system/STM32WBxx/Lib -L/home/hannes/.platformio/packages/framework-arduinoststm32wb/system/CMSIS/DSP/Lib -L/home/hannes/.platformio/packages/framework-arduinoststm32wb/system/STM32WBxx/LinkScripts -Wl,–start-group .pio/build/nucleo_wb55rg/libd6b/libWire.a .pio/build/nucleo_wb55rg/lib425/libSPI.a “.pio/build/nucleo_wb55rg/libe24/libAdafruit BusIO.a” “.pio/build/nucleo_wb55rg/libf7f/libAdafruit GFX Library.a” “.pio/build/nucleo_wb55rg/lib8e4/libAdafruit SSD1306.a” “.pio/build/nucleo_wb55rg/lib9c2/libAdafruit NeoPixel.a” .pio/build/nucleo_wb55rg/lib090/libPCF8574.a .pio/build/nucleo_wb55rg/lib063/libBLE.a .pio/build/nucleo_wb55rg/lib164/libSparkFun_TB6612FNG_Arduino_Library.a .pio/build/nucleo_wb55rg/lib86e/libadc_read.a .pio/build/nucleo_wb55rg/libFrameworkArduino.a -larm_cortexM4lf_math -lm -lstm32wb55xx -Wl,–end-group
    MethodWrapper([“checkprogsize”], [“.pio/build/nucleo_wb55rg/firmware.elf”])
    Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
    RAM: [ ] 1.9% (used 3664 bytes from 196608 bytes)
    Flash: [= ] 12.1% (used 63320 bytes from 524288 bytes)
    .pio/build/nucleo_wb55rg/firmware.elf :
    section size addr
    .text 57544 134217728
    .rodata 5488 134275272
    .fatal_info 16 536870912
    .data 280 536870928
    .bss 3280 536871208
    .noinit 104 536874488
    .dma 8 536874592
    .heap 2072 536874600
    .stack_dummy 4096 536876672
    .ipcc 2872 537067520
    .rtt_control 56 537071616
    .data2 0 537071672
    .bss2 0 537071672
    .noinit2 8 537071672
    .ccvectors 320 268468224
    .cctext 0 268468544
    .rtt_data 10240 537104384
    .ARM.extab 0 134281040
    .ARM.exidx 8 134281040
    .info 40 134281048
    .stabstr 441 0
    .comment 140 0
    .debug_aranges 6696 0
    .debug_info 243182 0
    .debug_abbrev 26824 0
    .debug_line 131896 0
    .debug_frame 22764 0
    .debug_str 44048 0
    .debug_loc 148056 0
    .debug_ranges 13024 0
    .ARM.attributes 48 0
    Total 723551
    arm-none-eabi-objcopy -O binary .pio/build/nucleo_wb55rg/firmware.elf .pio/build/nucleo_wb55rg/firmware.bin
    ([“upload”], [“.pio/build/nucleo_wb55rg/firmware.bin”])
    AVAILABLE: blackmagic, cmsis-dap, jlink, mbed, stlink
    CURRENT: upload_protocol = mbed
    MethodWrapper([“upload”], [“.pio/build/nucleo_wb55rg/firmware.bin”])
    Using manually specified: /media/hannes/NOD_WB55RG
    MethodWrapper([“upload”], [“.pio/build/nucleo_wb55rg/firmware.bin”])
    Firmware has been successfully uploaded.
    (Some boards may require manual hard reset)
    ========================================================= [SUCCESS] Took 2.57 seconds =========================================================
    hannes@rock-5b ~/D/P/P/STM32 Robot>

That looks like it has copied the firmware successfully to the specified path. The error message pops up separately?

Can you make sure the ST-Link firmware is up-to-date by using STSW-LINK007 - ST-LINK, ST-LINK/V2, ST-LINK/V2-1, STLINK-V3 boards firmware upgrade - STMicroelectronics?

i did that but still no change and on the virtual disk is a file called fail.txt afterwards and here are the contents of the fail.txt:

The application file format is unknown and cannot be parsed and/or processed

That’s… intersting, PlatformIO seems to be using the .bin file which should be what it wants.

Can you manually drag+drop the ELF file in .pio/build/nucleo_wb55rg/firmware.elf to the virutal drive?

Or does it maybe expect a .hex or a .zip or some other format, hm.

with the elf file it does nothing not even reboot like with the bin

A result in https://vpuniverse.com/forums/topic/5591-pin2dmd-black-screen-after-attempted-firmware-update/ seems to indicate that it may also be a broken .bin file that leads to this error message… but you said that if you program the file via STM32CubeProgrammer it works without problems right?

yes and also the stlink option in pio in the platformio,ini file

The .elf to .bin file conversion used in the arduino core, which is then used for the dfu-util as input file, is done exactly as in PlatformIO. The OpenOCD upload uses the .elf file.

Last few options to explore would be:

  1. Does the mbed upload also fail with a .bin file that comes out of the Arduino IDE? Either the GrumpyOldPizza core or the GitHub - stm32duino/Arduino_Core_STM32: STM32 core support for Arduino core.
  2. If not, does it work with .bin files generated through STM32CubeMX?

could you please send me both because i dont have arduino ide installed anymore and i absolutley dont know how cube mx works

Well the easiest one is the offiical STM32Core, since that’s directly supported. Does this blinky example work? Deleted

For an STM32CubeMX generated firmware, test out Deleted.

both examples work via the drag’n’drop method