简体   繁体   中英

Can't program daisy device from VSCode - openocd can't find libusb

I am trying to debug my daisy program but I can't get VSCode to program the device, even though it works from the command line.

When I do task program from the command palette I get

openocd -s /usr/local/share/openocd/scripts -f interface/stlink.cfg -f target/stm32h7x.cfg
-c "program./build/PickupMachine.elf verify reset exit" dyld[62640]: Library not loaded: /usr/local/opt/libusb-compat/lib/libusb-0.1.4.dylib Referenced from: <2AF14ADF-FE69-3018-B458-47925DB060E7> /Library/DaisyToolchain/0.1.3-ARM/openocd/bin/openocd Reason: tried: '/usr/local/opt/libusb-compat/lib/libusb-0.1.4.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/libusb-compat/lib/libusb-0.1.4.dylib' (no such file), '/usr/local/opt/libusb-compat/lib/libusb-0.1.4.dylib' (no such file), '/usr/local/lib/libusb-0.1.4.dylib' (no such file), '/usr/lib/libusb-0.1.4.dylib' (no such file, not in dyld cache) make: *** [program] Abort trap: 6

I tried brew reinstall libusb

The same command works from the command line:

➜ PickupMachine git:(main) ✗ openocd -s /usr/local/share/openocd/scripts -f interface/stlink.cfg -f target/stm32h7x.cfg
-c "program./build/PickupMachine.elf verify reset exit" Open On-Chip Debugger 0.11.0 Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info: auto-selecting first available session transport "hla_swd". To override use 'transport select '. Info: The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD Info: clock speed 1800 kHz Info: STLINK V3J7M2 (API v3) VID:PID 0483:374E Info: Target voltage: 3.297018 Info: stm32h7x.cpu0: hardware has 8 breakpoints, 4 watchpoints Info: starting gdb server for stm32h7x.cpu0 on 3333 Info: Listening on port 3333 for gdb connections target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x080005e0 msp: 0x20020000 Info: Unable to match requested speed 4000 kHz, using 3300 kHz Info: Unable to match requested speed 4000 kHz, using 3300 kHz ** Programming Started ** Info: Device: STM32H74x/75x Info: flash size probed value 128 Info: STM32H7 flash has a single bank Info: Bank (0) size is 128 kb, base address is 0x08000000 Info: Padding image section 1 at 0x08011c50 with 16 bytes (bank write end alignment) Warn: Adding extra erase range, 0x08011c60.. 0x0801ffff ** Programming Finished ** ** Verify Started ** ** Verified OK ** ** Resetting Target ** shutdown command invoked

The issue had to do with VSCode still using the old brew locations. If I install VSCode via brew (ironically) it looks for openocd, arm-none-eabi-gcc in the old /usr/bin folder. If I download VSCode using the Apple Silicon link at the visual studio site then it correctly uses the /opt/homebrew folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM