Sparkfun Micromod F405 fails to run when compiled via PlatformIO

Hello!

I have a project which I am trying to migrate from ArduinoIDE to PlatformIO. When I create a “Hello World” .bin using PlatformIO I am not able to see it run on my device. I am able to run code built by ArduinoIDE.

Here is my “hello world” code:

#include <Wire.h>

void setup() {
  Wire.begin();
  Serial.begin(115200);
  while (!Serial); 

  Serial.println("ready");
}

void loop() {
  Serial.println("hello, world");
  delay(5000);
}

The relevant part of my platformio.ini is:

[env:stable]
platform = ststm32
board = sparkfun_micromod_f405
framework = arduino
upload_protocol = dfu
monitor_port = COM4
monitor_speed = 115200 

To configure ArduinoIDE I:

PlatformIO documentation for sparkfun_micromod_f405 is:

{
  "build": {
    "arduino": {
      "variant_h": "variant_MICROMOD_F405.h"
    },
    "core": "stm32",
    "cpu": "cortex-m4",
    "extra_flags": "-DSTM32F4 -DSTM32F405xx",
    "f_cpu": "168000000L",
    "framework_extra_flags": {
      "arduino": "-DCUSTOM_PERIPHERAL_PINS -DARDUINO_MICROMOD_F405"
    },
    "mcu": "stm32f405rgt6",
    "product_line": "STM32F405xx",
    "variant": "STM32F4xx/F405RGT_F415RGT",
    "zephyr": {
      "variant": "sparkfun_micromod_stm32f405"
    }
  },
  "debug": {
    "jlink_device": "STM32F405RG",
    "openocd_target": "stm32f4x",
    "svd_path": "STM32F40x.svd"
  },
  "frameworks": [
    "arduino",
    "cmsis",
    "stm32cube",
    "libopencm3",
    "zephyr"
  ],
  "name": "SparkFun MicroMod STM32F405",
  "upload": {
    "maximum_ram_size": 131072,
    "maximum_size": 1048576,
    "protocol": "stlink",
    "protocols": [
      "dfu",
      "serial",
      "jlink",
      "stlink",
      "blackmagic"
    ]
  },
  "url": "https://www.sparkfun.com/products/17713",
  "vendor": "SparkFun"
}

I note that url points to products/17713 which is an older version of the product and that products/21326 is the current version. It’s unclear to me if this means that other pieces of this definition are stale and interfering with my needs.

I also note that framework_extra_flags is being given -DARDUINO_MICROMOD_F405 but potentially needs to be given -DARDUINO_MICROMOD_F405_DFU. I don’t know what this would do, but in the build logs provided below I see the _DFU variant being used in the ArduinoIDE build logs.

Potentially a red herring, but when I look at the .bin’s created by PlatformIO and ArduinoIDE I see a significant size discrepancy. ArduinoIDE generates a .bin that’s ~43kb and PlatformIO generates one which is ~21kb.

I also note that ArduinoIDE is using arm-none-eabi 9.3.1-1.3 where PlatformIO is using 12.3.1

If it’s helpful, here is the output I get when I compile with verbosity using each platform:

ArduinoIDE:


FQBN: SparkFun:stm32:GenF4:pnum=MICROMOD_F405,usb=CDCgen,rtlib=nanofp
Using board 'GenF4' from platform in folder: C:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0
Using core 'arduino' from platform in folder: C:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0

"C:\\Users\\MeoDesktop\\AppData\\Local\\Arduino15\\packages\\SparkFun\\tools\\STM32Tools\\2.0.0/win/busybox.exe" sh "C:\\Users\\MeoDesktop\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\stm32\\2.1.0\\system/extras/prebuild.sh" "C:\\Users\\MeoDesktop\\AppData\\Local\\Temp\\arduino\\sketches\\373E4CA0A0B524B5D7949FE51C570930" "C:\\Users\\MeoDesktop\\Desktop\\sketch_may28a"
Detecting libraries used...
C:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\tools\xpack-arm-none-eabi-gcc\9.3.1-1.3/bin/arm-none-eabi-g++ -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_FULL_LL_DRIVER -mthumb @C:\Users\MeoDesktop\AppData\Local\Temp\arduino\sketches\373E4CA0A0B524B5D7949FE51C570930/sketch/build_opt.h -c -Os -w -std=gnu++14 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -IC:\Users\MeoDesktop\Desktop\sketch_may28a -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\cores\arduino/avr -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\cores\arduino/stm32 -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\cores\arduino/stm32/LL -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\cores\arduino/stm32/usb -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\cores\arduino/stm32/OpenAMP -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\cores\arduino/stm32/usb/hid -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\cores\arduino/stm32/usb/cdc -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\system/Drivers/STM32F4xx_HAL_Driver/Inc -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\system/Drivers/STM32F4xx_HAL_Driver/Src -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\system/STM32F4xx -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\system/Middlewares/ST/STM32_USB_Device_Library/Core/Src -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\system/Middlewares/OpenAMP -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\system/Middlewares/OpenAMP/open-amp/lib/include -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\system/Middlewares/OpenAMP/libmetal/lib/include -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\system/Middlewares/OpenAMP/virtual_driver -w -x c++ -E -CC -DSTM32F4xx -DARDUINO=10607 -DARDUINO_MICROMOD_F405_DFU -DARDUINO_ARCH_STM32 -DBOARD_NAME="MICROMOD_F405_DFU" -DVARIANT_H="variant_MICROMOD_F405_DFU.h" -DSTM32F405xx -DUSBCON -DUSBD_VID=0 -DUSBD_PID=0 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC -DHAL_UART_MODULE_ENABLED -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\tools\CMSIS\5.7.0/CMSIS/Core/Include/ -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\system/Drivers/CMSIS/Device/ST/STM32F4xx/Include/ -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\system/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/ -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\tools\CMSIS\5.7.0/CMSIS/DSP/Include -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\tools\CMSIS\5.7.0/CMSIS/DSP/PrivateInclude -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\cores\arduino -IC:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\variants\STM32F4xx\F405RGT_F415RGT C:\Users\MeoDesktop\AppData\Local\Temp\arduino\sketches\373E4CA0A0B524B5D7949FE51C570930\sketch\sketch_may28a.ino.cpp -o nul
<truncated for brevity>
Using cached library dependencies for file:
<...lots of cached deps here>
Generating function prototypes...
<truncated for brevity> 
C:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\system/Middlewares/OpenAMP/virtual_driver -w -x c++ -E -CC -DSTM32F4xx -DARDUINO=10607 -DARDUINO_MICROMOD_F405_DFU -DARDUINO_ARCH_STM32 -DBOARD_NAME="MICROMOD_F405_DFU" -DVARIANT_H="variant_MICROMOD_F405_DFU.h" -DSTM32F405xx -DUSBCON -DUSBD_VID=0 -DUSBD_PID=0 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC -DHAL_UART_MODULE_ENABLED -
<truncated for brevity> 
Compiling libraries...
Compiling library "Wire"
<...lots of previously compiled files here>
Using precompiled core: C:\Users\MeoDesktop\AppData\Local\Temp\arduino\cores\7a87c0ca3040e9a96beb232255eb2a08\core.a
Linking everything together...
"C:\\Users\\MeoDesktop\\AppData\\Local\\Arduino15\\packages\\SparkFun\\tools\\xpack-arm-none-eabi-gcc\\9.3.1-1.3/bin/arm-none-eabi-gcc" -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Os --specs=nano.specs -u _printf_float -Wl,--defsym=LD_FLASH_OFFSET=0 -Wl,--defsym=LD_MAX_SIZE=1048576 -Wl,--defsym=LD_MAX_DATA_SIZE=131072 -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common "-Wl,--default-script=C:\\Users\\MeoDesktop\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\stm32\\2.1.0\\variants\\STM32F4xx\\F405RGT_F415RGT/ldscript.ld" "-Wl,--script=C:\\Users\\MeoDesktop\\AppData\\Local\\Arduino15\\packages\\SparkFun\\hardware\\stm32\\2.1.0\\system/ldscript.ld" "-Wl,-Map,C:\\Users\\MeoDesktop\\AppData\\Local\\Temp\\arduino\\sketches\\373E4CA0A0B524B5D7949FE51C570930/sketch_may28a.ino.map" <...lots of build artifacts here>

Using library Wire at version 1.0 in folder: C:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\libraries\Wire 
Using library Source Wrapper at version 1.0.1 in folder: C:\Users\MeoDesktop\AppData\Local\Arduino15\packages\SparkFun\hardware\stm32\2.1.0\libraries\SrcWrapper 
"C:\\Users\\MeoDesktop\\AppData\\Local\\Arduino15\\packages\\SparkFun\\tools\\xpack-arm-none-eabi-gcc\\9.3.1-1.3/bin/arm-none-eabi-size" -A "C:\\Users\\MeoDesktop\\AppData\\Local\\Temp\\arduino\\sketches\\373E4CA0A0B524B5D7949FE51C570930/sketch_may28a.ino.elf"
Sketch uses 42776 bytes (4%) of program storage space. Maximum is 1048576 bytes.
Global variables use 4536 bytes (3%) of dynamic memory, leaving 126536 bytes for local variables. Maximum is 131072 bytes.

PlatformIO:

 *  Executing task: C:\Users\MeoDesktop\.platformio\penv\Scripts\platformio.exe run 

Processing stable (platform: ststm32; board: sparkfun_micromod_f405; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/sparkfun_micromod_f405.html
PLATFORM: ST STM32 (17.4.0) > SparkFun MicroMod STM32F405
HARDWARE: STM32F405RGT6 168MHz, 128KB RAM, 1MB Flash
DEBUG: Current (blackmagic) External (blackmagic, jlink, stlink)
PACKAGES:
 - framework-arduinoststm32 @ 4.20701.0 (2.7.1)
 - framework-cmsis @ 2.50900.0 (5.9.0)
 - tool-dfuutil @ 1.11.0
 - toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.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
|-- Wire @ 1.0.0
Building in release mode
Compiling .pio\build\stable\FrameworkArduinoVariant\PeripheralPins.c.o
Compiling .pio\build\stable\FrameworkArduinoVariant\PeripheralPins_FEATHER_F405.c.o
Compiling .pio\build\stable\FrameworkArduinoVariant\PeripheralPins_MICROMOD_F405.c.o
Compiling .pio\build\stable\FrameworkArduinoVariant\generic_clock.c.o
Compiling .pio\build\stable\FrameworkArduinoVariant\variant_FEATHER_F405.cpp.o
Compiling .pio\build\stable\FrameworkArduinoVariant\variant_MICROMOD_F405.cpp.o
Compiling .pio\build\stable\FrameworkArduinoVariant\variant_generic.cpp.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_adc.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_adc_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_can.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_cec.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_comp.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_comp_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_cordic.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_cortex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_crc.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_crc_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_cryp.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_cryp_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_dac.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_dac_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_dcache.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_dcmi.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_dcmi_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_dfsdm.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_dfsdm_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_dma.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_dma2d.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_dma_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_dsi.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_dts.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_eth.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_eth_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_exti.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_fdcan.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_firewall.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_flash.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_flash_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_flash_ramfunc.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_fmac.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_fmpi2c.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_fmpi2c_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_fmpsmbus.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_fmpsmbus_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_gfxmmu.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_gfxtim.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_gpio.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_gpio_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_gpu2d.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_gtzc.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_hash.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_hash_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_hcd.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_hrtim.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_hsem.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_i2c.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_i2c_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_i2s.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_i2s_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_i3c.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_icache.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_ipcc.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_irda.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_iwdg.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_jpeg.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_lcd.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_lptim.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_ltdc.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_ltdc_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_mdf.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_mdios.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_mdma.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_mmc.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_mmc_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_nand.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_nor.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_opamp.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_opamp_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_ospi.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_otfdec.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_pccard.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_pcd.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_pcd_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_pka.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_pssi.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_pwr.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_pwr_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_qspi.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_ramcfg.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_ramecc.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_rcc.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_rcc_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_rng.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_rng_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_rtc.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_rtc_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_sai.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_sai_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_sd.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_sd_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_sdadc.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_sdram.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_smartcard.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_smartcard_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_smbus.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_smbus_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_spdifrx.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_spi.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_spi_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_sram.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_subghz.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_swpmi.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_tim.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_tim_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_tsc.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_uart.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_uart_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_usart.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_usart_ex.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_wwdg.c.o
Compiling .pio\build\stable\SrcWrapper\src\HAL\stm32yyxx_hal_xspi.c.o
Compiling .pio\build\stable\SrcWrapper\src\HardwareTimer.cpp.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_adc.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_bdma.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_comp.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_cordic.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_crc.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_crs.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_dac.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_delayblock.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_dlyb.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_dma.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_dma2d.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_exti.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_fmac.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_fmc.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_fmpi2c.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_fsmc.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_gpio.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_hrtim.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_i2c.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_i3c.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_icache.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_lpgpio.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_lptim.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_lpuart.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_mdma.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_opamp.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_pka.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_pwr.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_rcc.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_rng.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_rtc.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_sdmmc.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_spi.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_swpmi.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_tim.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_ucpd.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_usart.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_usb.c.o
Compiling .pio\build\stable\SrcWrapper\src\LL\stm32yyxx_ll_utils.c.o
Compiling .pio\build\stable\SrcWrapper\src\new.cpp.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\PortNames.c.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\analog.cpp.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\bootloader.c.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\clock.c.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\core_callback.c.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\dwt.c.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\hw_config.c.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\interrupt.cpp.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\otp.c.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\pinmap.c.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\stm32_def.c.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\system_stm32yyxx.c.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\timer.c.o
Compiling .pio\build\stable\SrcWrapper\src\stm32\uart.c.o
Compiling .pio\build\stable\SrcWrapper\src\syscalls.c.o
Compiling .pio\build\stable\src\main.cpp.o
Compiling .pio\build\stable\libffe\Wire\Wire.cpp.o
Compiling .pio\build\stable\libffe\Wire\utility\twi.c.o
Compiling .pio\build\stable\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\stable\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\stable\FrameworkArduino\Print.cpp.o
Compiling .pio\build\stable\FrameworkArduino\RingBuffer.cpp.o
Compiling .pio\build\stable\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\stable\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\stable\FrameworkArduino\USBSerial.cpp.o
Compiling .pio\build\stable\FrameworkArduino\VirtIOSerial.cpp.o
Compiling .pio\build\stable\FrameworkArduino\WInterrupts.cpp.o
Compiling .pio\build\stable\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\stable\FrameworkArduino\WSerial.cpp.o
Compiling .pio\build\stable\FrameworkArduino\WString.cpp.o
Compiling .pio\build\stable\FrameworkArduino\abi.cpp.o
Compiling .pio\build\stable\FrameworkArduino\avr\dtostrf.c.o
Compiling .pio\build\stable\FrameworkArduino\board.c.o
Compiling .pio\build\stable\FrameworkArduino\core_debug.c.o
Compiling .pio\build\stable\FrameworkArduino\hooks.c.o
Compiling .pio\build\stable\FrameworkArduino\itoa.c.o
Compiling .pio\build\stable\FrameworkArduino\main.cpp.o
Compiling .pio\build\stable\FrameworkArduino\pins_arduino.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\libmetal\device.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\libmetal\generic\condition.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\libmetal\generic\cortexm\sys.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\libmetal\generic\generic_device.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\libmetal\generic\generic_init.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\libmetal\generic\generic_io.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\libmetal\generic\generic_shmem.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\libmetal\generic\time.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\libmetal\init.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\libmetal\io.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\libmetal\log.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\libmetal\shmem.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\mbox_ipcc.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\open-amp\remoteproc\remoteproc_virtio.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\open-amp\rpmsg\rpmsg.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\open-amp\rpmsg\rpmsg_virtio.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\openamp.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\rsc_table.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\virt_uart.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\virtio\virtio.c.o
Archiving .pio\build\stable\libffe\libWire.a
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\virtio\virtqueue.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\virtio_buffer.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\OpenAMP\virtio_log.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\startup_stm32yyxx.S.o
Compiling .pio\build\stable\FrameworkArduino\stm32\usb\cdc\cdc_queue.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\usb\cdc\usbd_cdc.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\usb\cdc\usbd_cdc_if.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\usb\hid\usbd_hid_composite.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\usb\hid\usbd_hid_composite_if.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\usb\usb_device_core.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\usb\usb_device_ctlreq.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\usb\usb_device_ioreq.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\usb\usbd_conf.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\usb\usbd_desc.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\usb\usbd_ep_conf.c.o
Compiling .pio\build\stable\FrameworkArduino\stm32\usb\usbd_if.c.o
Compiling .pio\build\stable\FrameworkArduino\wiring_analog.c.o
Compiling .pio\build\stable\FrameworkArduino\wiring_digital.c.o
Compiling .pio\build\stable\FrameworkArduino\wiring_pulse.cpp.o
Compiling .pio\build\stable\FrameworkArduino\wiring_shift.c.o
Compiling .pio\build\stable\FrameworkArduino\wiring_time.c.o
Archiving .pio\build\stable\libFrameworkArduino.a
Linking .pio\build\stable\firmware.elf
c:/users/meodesktop/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: warning: .pio/build/stable/firmware.elf has a LOAD segment with RWX permissions
Checking size .pio\build\stable\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   1.1% (used 1456 bytes from 131072 bytes)
Flash: [          ]   1.9% (used 20372 bytes from 1048576 bytes)
Building .pio\build\stable\firmware.bin
Adding dfu suffix to firmware.bin
dfu-suffix (dfu-util) 0.11

Copyright 2011-2012 Stefan Schmidt, 2013-2020 Tormod Volden
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Suffix successfully added to file

After I upload the code built by PlatformIO, my serial monitor does not connect to the device and I don’t see it using a COM port when I look for it in device manager.

I don’t really know what to look for here. I might be completely off in the weeds. There might be some clear as day incompatibility. Maybe I just need to tweak one argument somewhere? Or maybe there’s complete lack of support for this newer version?

Is anyone able to offer any guidance to me on why my PlatformIO build might not be working? I am confident it’s the build process and not the upload process. If I take the ArduinoIDE build artifacts and overwrite my PlatformIO build artifacts with them then I am able to successfully upload and run the code.

Thanks

I found the solution. I believe the code was working fine but that serial communication wasn’t configured properly which was leading me to believe there were larger issues.

Difficulty with getting USB serial [USB CDC] working - #30 by umar.techboy This post was helpful.

I introduced these build flags and was able to run my hello world program successfully without issue:

build_flags = -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC -D USBCON -D USBD_USE_CDC -D USB_MANUFACTURER="Unknown" -D USB_PRODUCT="STM32F4" -D USBD_PID=0x0029 -D USBD_VID=0x1B4F

I’m not sure how many of them are especially relevant. I derived PID and VID by declaring USBD_VID inside of ArduinoIDE and then right-clicking on it to take me to its definition. I found it in variant_MICROMOD_F405_DFU.h but these values will be different for other product lines.

I started to realize something was wrong when I right-clicked on Serial inside of ArduinoIDE and was taken to a different code location than when I right-clicked it from within PlatformIO. This led me to realizing that I needed the USBCON build flags.