Arm Mbed OS support forum

Cannot flash to Portenta H7 with new target option from latest mbed-os release


Has anyone been able to have the mbed CLI detect and flash the Portenta_H7_M7 as a target?

I’m running Ubuntu 20.04.2 LTS on a VM and I can compile the *blinky-baremetal * project with no problem. The only thing is I fail to flash when using the command:
mbed compile -m PORTENTA_H7_M7 -t GCC_ARM --flash --sterm

Simply put, the CLI cannot detect the board.

I have tried …

  • Plugging the USB in and out
  • Using lsusb
  • Using ls -a /dev/ttyACM*

I know I can …

  • Build with mbed CLI
  • Select the Portenta as a target
    • Using latest mbed-os release: 6.8.0

What I have installed/running…

  • cmake: v3.16.3
  • mbed-os: v6.8.0
  • arm-none-gcc: 10.2.1 (I know, I know, it gives me a warning about; but that’s not the problem; I have used 9.x.x version before too)

Output of mbed config -G -L

[mbed] Global config:

[mbed] Local config (/home/ponirs/mbed_dev/blinky-baremetal):

I’ve also seen that the mbed Studio also picks up the option to choose the Portenta H7 as a target. I can build with it as well. However, it is the same issue as the CLI; which makes perfect sense to me. The CLI and the Studio do the same operation in different ways.

Here is my mbed compile -f --sterm output:

$ mbed compile -f --sterm
[mbed] Working path "/home/ponirs/mbed_dev/blinky-baremetal" (program)
[mbed] WARNING: Missing Python modules were not auto-installed.
       The Mbed OS tools in this program require the following Python modules: future, cryptography
       You can install all missing modules by running "pip install -r requirements.txt" in "/home/ponirs/mbed-os"
       On Posix systems (Linux, etc) you might have to switch to superuser account or use "sudo"
WARNING: MBED_GCC_ARM_PATH set as environment variable but doesn't exist
[Warning] @,: Compiler version mismatch: Have 10.2.1; expected version >= 9.0.0 and < 10.0.0
Building project blinky-baremetal (PORTENTA_H7_M7, GCC_ARM)
Scan: blinky-baremetal
Using ROM region application in this build.
  Region application: size 0x100000, offset 0x8000000
Using RAM region application_ram in this build.
  Region application_ram: size 0x80000, offset 0x24000000
Link: blinky-baremetal
Elf2Bin: blinky-baremetal
Merging Regions
  Filling region application with ./BUILD/PORTENTA_H7_M7/GCC_ARM/blinky-baremetal_application.bin
Space used after regions merged: 0x76e0
Merging Regions
  Filling region application with ./BUILD/PORTENTA_H7_M7/GCC_ARM/blinky-baremetal_application.bin
Space used after regions merged: 0x76e0
| Module           |     .text |   .data |     .bss |
| [fill]           |    56(+0) |   3(+0) |   18(+0) |
| [lib]/c_nano.a   |  2584(+0) | 100(+0) |   14(+0) |
| [lib]/gcc.a      |   772(+0) |   0(+0) |    0(+0) |
| [lib]/misc       |   188(+0) |   0(+0) |   28(+0) |
| [lib]/nosys.a    |    16(+0) |   0(+0) |    0(+0) |
| main.o           |   108(+0) |   0(+0) |   28(+0) |
| mbed-os/drivers  |    80(+0) |   0(+0) |    0(+0) |
| mbed-os/hal      |  1466(+0) |   8(+0) |  114(+0) |
| mbed-os/platform |  4934(+0) |   4(+0) |  306(+0) |
| mbed-os/targets  | 16828(+0) |  13(+0) | 1484(+0) |
| Subtotals        | 27032(+0) | 128(+0) | 1992(+0) |
Total Static RAM memory (data + bss): 2120(+0) bytes
Total Flash memory (text + data): 27160(+0) bytes

Update Image: ./BUILD/PORTENTA_H7_M7/GCC_ARM/blinky-baremetal_update.bin
Image: ./BUILD/PORTENTA_H7_M7/GCC_ARM/blinky-baremetal.bin
[mbed] ERROR: The target board you compiled for is not connected to your system.
       Please reconnect it and retry the last command.

My board is definitely detected by my VM because I can flash to it using the Arduino IDE and Arduino Pro IDE. They use dfu-utils but I’m not super familiar with how the mbed-tools flash through USB. Unless, I need an external debugger/programmer for the Portenta. But, I doubt it since I see SWD/JTAG pins in the schematic. However, I haven’t closely looked at what they are connected to. So, I should probably do that as well… :thinking:

Here is what is connected to my VM though USB:

ls -a /dev/ttyACM* output:

lsusb output:
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 004: ID 0e0f:0002 VMware, Inc. Virtual USB Hub Bus 003 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub Bus 003 Device 005: ID 2341:025b Arduino SA Envie M7 Bus 003 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 002: ID 0e0f:0002 VMware, Inc. Virtual USB Hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Please let me know if there is any additional info I missed. I’m still learning about mbed tools and have a little experience with STM MCUs (Team HAL drivers! :partying_face:) but this RTOS stuff is a brand new world for me.

I’ve been stuck on this for days and I’m finally reaching out to the community since the Arduino IDEs are not a good option for debugging ANYTHING. :frowning_face:
I hope someone can point me out in the right direction.


I think it is same like with Arduino Nano 33BLE, please see

Also this info looks useful.
Portenta H7 SWD interface. Where is the SWDIO and SWCLK Debug pins or pads? (

BR, Jan