← index #16527Issue #4933
Off-topic · high · value 0.425
QUERY · ISSUE

RFC: Use board name for firmware files

openby chrismas9opened 2025-01-05updated 2025-03-03
enhancementports

Description

Whenever I build firmware for a board I need to rename firmware.elf, etc to the board name before distributing it to users. Would it be useful to replace "firmware" with the board name in Makefile to automate this? I have tested it and the result looks like this:

LINK build-PYBV10/PYBV10.elf
   text    data     bss     dec     hex filename
 364920      52   26908  391880   5fac8 build-PYBV10/PYBV10.elf
GEN build-PYBV10/PYBV10-0.bin
GEN build-PYBV10/PYBV10-1.bin
GEN build-PYBV10/PYBV10.hex
GEN build-PYBV10/PYBV10.dfu

If interested I can submit a PR for the stm32 port, and probably other arm ports, but I don't have the build environment to do non-arm ports.

Code Size

No response

Implementation

I intend to implement this feature and would submit a Pull Request if desirable

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

NoBackendError when libusb is installed via MacPorts

closedby cdwilsonopened 2019-07-19updated 2019-08-07

I've got libusb installed via MacPorts and I'm getting a NoBackendError when using pydfu.py (dfu-util works fine):

$ make BOARD=STM32F4DISC deploy
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
GEN build-STM32F4DISC/genhdr/mpversion.h
CC ../../lib/utils/pyexec.c
CC moduos.c
LINK build-STM32F4DISC/firmware.elf
   text    data     bss     dec     hex filename
 321380      32   27632  349044   55374 build-STM32F4DISC/firmware.elf
GEN build-STM32F4DISC/firmware.dfu
Writing build-STM32F4DISC/firmware.dfu to the board
Traceback (most recent call last):
  File "../../tools/pydfu.py", line 591, in <module>
    main()
  File "../../tools/pydfu.py", line 570, in main
    init()
  File "../../tools/pydfu.py", line 99, in init
    devices = get_dfu_devices(idVendor=__VID, idProduct=__PID)
  File "../../tools/pydfu.py", line 424, in get_dfu_devices
    custom_match=FilterDFU(), **kwargs))
  File "/Users/chris/.anyenv/envs/pyenv/versions/default/lib/python3.6/site-packages/usb/core.py", line 1263, in find
    raise NoBackendError('No backend available')
usb.core.NoBackendError: No backend available
make: *** [deploy] Error 1

I think this is because pyusb uses ctypes.util.find_library to find the backend libs, which doesn't search /opt/local/lib. However, it will search DYLD_FALLBACK_LIBRARY_PATH, so adding the following hack to pydfu.py fixes the problem:

if sys.platform == "darwin":
    import os
    os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/opt/local/lib"

It seems like there should be a better way to fix this, since this seems like more of an issue with pyusb, rather than micropython. However, I'm not quite sure how to tell pyusb (or find_library()) to look in /opt/local/bin.

Anybody else come up with a better way to resolve this?

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied