-1

I am trying to program my STM32 via PlatformIO. I am using the built in blink example so I 'know; that my code is not what is causing the issue. I am using macOS - M1 Max - Monterey(12.13.1).

Here is the board I am using: https://ubld.it/products/stm32-midi-dev

The program builds just fine, but when trying to upload, I get the following error:

dyld[54244]: Library not loaded: /opt/local/lib/libusb-1.0.0.dylib
Referenced from: /Users/***/.platformio/packages/tool-stm32duino/dfu-util/dfu-util
  Reason: tried: '/opt/local/lib/libusb-1.0.0.dylib' (no such file), '/usr/local/lib/libusb-1.0.0.dylib' (no such file), '/usr/lib/libusb-1.0.0.dylib' (no such file)
/Users/***/.platformio/packages/tool-stm32duino/maple_upload: line 53: 54244 Abort trap: 6           ${DFU_UTIL} -d ${usbID} -a ${altID} -D ${binfile} -R ${dfuse_addr} -R
*** [upload] Error 134

My platformio.ini file is as follows:

[env:genericSTM32F103CB]
platform = ststm32
board = genericSTM32F103CB
framework = arduino
board_build.core = maple
upload_protocol = dfu

I have tried the following:

  1. brew install libusb - but it was already installed
  2. brew uninstall libusb - then - brew install libusb
  3. Library not loaded: /opt/local/lib/libssl.1.0.0.dylib (LoadError) - This seemed to be more SSL related, but tried anyways

I have read the error message and understand that it appears that a file does not exist, but unsure of what next steps would be as I tried reinstalling libusb above.

Here is my full upload output if helpful:

CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103CB.html
PLATFORM: ST STM32 (15.3.0) > STM32F103CB (20k RAM. 128k Flash)
HARDWARE: STM32F103CBT6 72MHz, 20KB RAM, 128KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-arduinoststm32-maple @ 3.10000.201129 (1.0.0) 
 - tool-dfuutil @ 1.9.211020 
 - tool-openocd @ 2.1100.211028 (11.0) 
 - tool-stm32duino @ 1.0.1 
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://docs.platformio.org/en/latest/librarymanager/ldf.html
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 30 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio/build/genericSTM32F103CB/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  21.1% (used 4312 bytes from 20480 bytes)
Flash: [=         ]  14.3% (used 18712 bytes from 131072 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, dfu, jlink, serial, stlink
CURRENT: upload_protocol = dfu
Looking for upload port...
Auto-detected: /dev/cu.usbmodem1101
Uploading .pio/build/genericSTM32F103CB/firmware.bin
Failed to open serial device.
dyld[54773]: Library not loaded: /opt/local/lib/libusb-1.0.0.dylib
  Referenced from: /Users/***/.platformio/packages/tool-stm32duino/dfu-util/dfu-util
  Reason: tried: '/opt/local/lib/libusb-1.0.0.dylib' (no such file), '/usr/local/lib/libusb-1.0.0.dylib' (no such file), '/usr/lib/libusb-1.0.0.dylib' (no such file)
/Users/***/.platformio/packages/tool-stm32duino/maple_upload: line 53: 54773 Abort trap: 6           ${DFU_UTIL} -d ${usbID} -a ${altID} -D ${binfile} -R ${dfuse_addr} -R
*** [upload] Error 134

Thanks in advance for the help. Pretty new to embedded.

=== EDIT === As I continue to research, I think it is related to homebrew not installing in the normal spot for libusb. Homebrew Mac M1 can't find installs

bmckay
  • 19
  • 1
  • 4

1 Answers1

1

Ok. Thanks to Ivan at PlatformIO, he was able to give me the below resolution. It now works great.

There are no new versions of STM32Duino /dfu-binaries for macOS ARM:

Could I ask you to try the next things?

  1. Edit ~/.platformio/packages/tool-stm32duino/maple_upload
  2. Comment line 43 and add a new one below
DFU_UTIL=~/.platformio/packages/tool-dfuutil/bin/dfu-util
bmckay
  • 19
  • 1
  • 4