Uploading to Portenta H7 using DFU

Hi, platform.io newbie here, trying to upload to my new Portenta H7, using DFU upload protocol. Was wondering if anyone had any ideas as to what my issue could be:

/home/nathan/.platformio/packages/tool-dfuutil/bin/dfu-util: symbol lookup error: /home/nathan/.platformio/packages/tool-dfuutil/bin/dfu-util: undefined symbol: libusb_set_option
*** [upload] Error 127
libusb package issue? I’m not sure where to go with this, any help would be greatly appreciated :slight_smile:

That’s not good – looks like the dfu-util binary dynamically links to a libusb library that is missing a function / symbol.

What does

ldd /home/nathan/.platformio/packages/tool-dfuutil/bin/dfu-util


Hi, thanks for your reply, this is what I get:

linux-vdso.so.1 (0x00007ffd8b5b7000)
libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x00007f16098e7000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f16094f6000)
libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f16092d8000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f16090b9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1609aff000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f1608eb1000)

Which Linux distribution and version are you using?

HI, I’m on Ubuntu 18.04.6

That’s very outdated.

However, PlatformIO’s tool-dfuutil should locally come with a working libusb-1.0.so.0, to make it work independently of the installed libusb-dev package version of the distribution.

What’s the output of tree /home/nathan/.platformio/packages/tool-dfuutil/?

On a PlatformIO CLI, what’s the output of pio --version and pio platform list?

the tree output is this,
├── bin
│ ├── dfu-prefix
│ ├── dfu-suffix
│ ├── dfu-util
│ └── dfu-util-static
├── ChangeLog
├── dfuse-pack.py
├── package.json

platform io version:
PlatformIO Core, version 6.1.6

platform list:
└── ststm32 @ 15.5.1 (required: platformio/ststm32)

It indeed seems so that the used dfuutil version in this case does not have a lib/ folder that would have a compatible libusb library.

Try the following:

pio pkg install -g -t "tool-dfuutil@1.9.200310"
cp -r ~/.platformio/packages/tool-dfuutil@1.9.200310/lib ~/.platformio/packages/tool-dfuutil/.

Does uploading work now?

Hi, yep thats done it thanks. was it a version issue?

Yes, without lib/ folder in the tool-dfuutil folder, it would try to use you’re distribution’s libusb-dev package, which seems too old and is missing that libusb_set_option function. Try updating your distribution if you can to avoid future problems with this.

(I’m assuming sudo apt install libusb-dev told you “Newest version already installed”)

ahhh I see thanks for your help!!! Yes it did.

version (2:0.1.12-31)

Yeah that version is from 2017: https://ubuntu.pkgs.org/18.04/ubuntu-main-amd64/libusb-0.1-4_0.1.12-31_amd64.deb.html

On my Ubuntu 22.04 that’s 2:0.1.12-32build3 from 2022: https://ubuntu.pkgs.org/22.04/ubuntu-main-arm64/libusb-dev_0.1.12-32build3_arm64.deb.html