Portenta H7 M7: upload succeeds, but board never comes back as USB device / Serial monitor stays dead — fixed by forcing -mfloat-abi=softfp

Hello all,

This is my first post to the community, but I wanted to post this in case it helps someone else because this one took a while to isolate. Some of this post has been generated with a LLM to save me time typing, but I’ve personally proofread everything and the solution is accurate.

I’m using an Arduino Portenta H7 (M7 core) and building with PlatformIO on a Raspberry Pi Compute Module 5 running Ubuntu 24.04.

Symptom

The firmware would:

  • build successfully

  • link successfully

  • upload successfully

  • verify successfully

but after reset, the Portenta would not come back as a USB device, and the Serial monitor path never appeared / never worked.

So from the outside it looked like:

  • upload completed fine

  • then the board disappeared

  • no USB CDC device

  • no serial output

  • no return to runtime

At first this looked like a bootloader handoff problem, crash after boot, bad flash offset, bad uploader, etc.


What I verified first

I narrowed it down pretty hard before finding the actual fix:

  • The board itself was fine.

  • The Portenta bootloader / flash layout were fine.

  • Uploading from the Pi with OpenOCD over SWD worked.

  • Uploading via DFU also worked.

  • A simple sketch built in the Arduino IDE ran correctly.

  • The Arduino IDE-built ELF also ran correctly when I uploaded that exact ELF from the Pi using OpenOCD or DFU.

That told me the issue was not:

  • the board

  • the bootloader

  • the Pi host

  • SWD/OpenOCD

  • DFU

  • USB wiring

  • or flash placement

It was specifically the PlatformIO-built firmware artifact.


Important detail

I eventually got the PlatformIO environment lined up so it matched the working Arduino core generation as closely as possible:

  • platform = ststm32@19.4.0

  • framework-arduino-mbed = 4.4.1

That matters because PlatformIO’s STM32 platform release notes show that ststm32@19.4.0 is the release that updated Arduino-mbed to 4.4.1, while 19.5.0 moved to 4.5.0. [github.com]

Even with that matched framework version, the PlatformIO-built image still uploaded successfully but did not run.


Actual root cause

The problem turned out to be a floating-point ABI mismatch in the PlatformIO build flags.

In the verbose PlatformIO build output, I found that the compile/link command line effectively included both:

-mfloat-abi=softfp

and later

-mfloat-abi=soft

So the build was effectively ending up with the wrong float ABI.

That matters because ArduinoCore-mbed packages much of the Mbed runtime as a precompiled libmbed.a, so if your sketch objects are built with the wrong ABI relative to the precompiled runtime, the firmware can still compile, link, and upload, but then fail very early at runtime.

That is exactly what I was seeing:

  • upload looked successful

  • but the Portenta never re-enumerated as USB

  • serial monitor never came back

  • board looked “dead” after upload


The fix

The fix was simply to remove the soft ABI flag and force softfp.

This was added to the platformio.ini that made the firmware start working normally:

build_unflags =
  -mfloat-abi=soft

build_flags =
  -Wall
  -g
  -mfloat-abi=softfp

After adding that, the exact same PlatformIO project started behaving correctly:

  • upload succeeds

  • board resets

  • Portenta comes back as USB device

  • Serial monitor works

  • firmware runs normally


Minimal working config

This is the relevant part of the working config on my side:


[env:portenta_h7_m7]
platform = ststm32@19.4.0
board = portenta_h7_m7
framework = arduino

build_unflags =
  -mfloat-abi=soft

build_flags =
  -Wall
  -g
  -mfloat-abi=softfp

I’m also using a custom OpenOCD upload command from the Pi side, but the uploader was not the problem — I had already proven that by successfully uploading and running the Arduino IDE-built ELF through the same OpenOCD path.


Why I’m posting this

This issue was confusing because it did not show up as:

  • a compile failure

  • a link failure

  • an upload failure

Instead, it materialized as:

PlatformIO reports successful upload, but the Portenta never comes back as a USB device and the serial monitor does not work.

So if anyone else sees that exact behavior on a Portenta H7 M7 build, I would strongly suggest checking the final compile/link flags for -mfloat-abi and making sure softfp is what actually wins.

If a regular Arduino firmware built with the latest ststm32 platform for a Portenta H7 does not work on the board, please file an issue against