ahtn / xusb-boot

USB raw HID bootloader for xmega microcontrollers
MIT License
7 stars 1 forks source link

Flashing on Windows #1

Open jackhumbert opened 6 years ago

jackhumbert commented 6 years ago

I'm trying to use my MSYS2 x64 setup to flash, and flash.py gives me this error:

AttributeError: function/symbol 'hid_enumerate' not found in library '<None>': No such process

When I try to walk through loading easyhid.py manually (using the one here with the compiled hidapi.dll), I get this:

OSError: cannot load library hidapi.dll: Exec format error.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'hidapi.dll'

I'm not super familiar with Python or FFI, but does there need to be a x64 version of the dll? My next step is compiling the dll locally.

What kind of setup are you using to flash on Windows right now?

ahtn commented 6 years ago

I'll have a look at this later when I'm on a Windows PC, but for now you can try the keyplus loader. Select "Firmware update" from the drop down box, and you should be able to flash through that (tested on 64-bit Win 10 and 32-bit Win 7).

jackhumbert commented 6 years ago

Ah, nice! Thanks, that worked :)

ahtn commented 6 years ago

The code is intended to run with the native version of python for Windows. So it will not work with MSYS2.

I'll work on cleaning up the shared code between my projects.

kahoch commented 5 years ago

@ahtn Hi, how to flash it to a new PCB? After soldered the atxmega32a4u, plug USB cable but nothing happen, the board cannot be detected.

emilytrau commented 5 years ago

Hi @kahoch

The atxmega does not come with a usb bootloader installed. You will need to flash one with an external programmer, such as the AVR ISP MKII. You can see the steps for flashing under Linux here.

kahoch commented 5 years ago

@angustrau Thank you so much! Just ordered a AVRISP MKII right now😊.

kahoch commented 5 years ago

@angustrau Hi, When I try to build bootloader on windows subsystem for linux (Ubuntu 18.04), got below errors, could you kindly advise? Thank you!

/ports/xmega/xusb-boot$ make BOARD=keyplus_mini
mkdir -p build/keyplus_mini-atxmega32a4u
Compiling C: src/xusb/usb_requests.c
/bin/sh: 2: [[: not found
Compiling C: src/xusb/xmega/usb_xmega.c
/bin/sh: 2: [[: not found
Compiling C: ./src/descriptors.c
/bin/sh: 2: [[: not found
Compiling C: ./src/boot_protocol.c
/bin/sh: 2: [[: not found
Compiling C: ./src/vendor_report.c
/bin/sh: 2: [[: not found
Compiling C: ./src/util.c
/bin/sh: 2: [[: not found
Compiling C: ./src/main.c
/bin/sh: 2: [[: not found
Assembling: ./src/sp_driver.S
Assembling: ./src/spm_interface.S
Assembling: ./src/main_pre_init.S
/bin/sh: 1: python: not found
Linking: build/keyplus_mini-atxmega32a4u/xusb-boot-keyplus_mini-atxmega32a4u.elf /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: missing argument(s) to option "--section-start"
collect2: error: ld returned 1 exit status
avr-makefile/avr.mk:258: recipe for target 'build/keyplus_mini-atxmega32a4u/xusb-boot-keyplus_mini-atxmega32a4u.elf' failed
make: *** [build/keyplus_mini-atxmega32a4u/xusb-boot-keyplus_mini-atxmega32a4u.elf] Error 1

emilytrau commented 5 years ago

@kahoch you can install the required dependencies with this script. I recommend using a virtual machine as WSL doesn't support USB passthrough.

kahoch commented 5 years ago

Thank you @angustrau ! All the dependencies had been installed, but still got some errors with Ubuntu in virtualbox. Then I built a arch linux enviourment and it works fine.

emilytrau commented 5 years ago

Glad to hear it!