Closed joric closed 4 years ago
Upd Managed to build it with BOOT_SECTION_SIZE_KB = 4
and BOARD = NONE
using msys2 installed with qmk script (avr-gcc version is 5.4.0 now, was 4.9.2 edit no need for msys2, just upgrade your WSL to ubuntu 18.04). Flashed with USBASP as so:
avrdude -c usbasp -p atmega32u4 -U flash:w:BootloaderMassStorage.hex
Just got USB drive popped on a Pro Micro (OMG!). Now I test user firmware.
Regarding IO13 and C7 I just noticed it's only for BOARD = BOARD_LEONARDO
, BOARD = NONE
uses different path (something with reset and fuses, not sure how it works yet).
Upd apparently hex need to be converted to bin as described here.
avr-objcopy -O binary -R .eeprom -R .fuse -R .lock -R .signature input.hex output.bin
Video: https://youtu.be/S4cgjP2mC5c Bootloader I used: BootloaderMassStorage.hex.zip
Upd. Hex won't convert, tried that:
avr-objcopy -I ihex input.hex -O binary FLASH.BIN
Tried to drag it (22Kb file) onto the USB Drive but it says There's not enough space on LUFA BOOT. You need an additional 16.0 KB to copy these files. Space free: 6.00 KB, Total Size: 40.0 KB.
Upd. Figures out Windows is too stupid to overwrite files in place, you have to delete them first. Deleted old FLASH.BIN, wrote the new one, rebooted and it worked! To pop up USB Drive again, hold RESET on power on. Everything seems to be in order. Closing for now.
Reopened, question of the day: why it doesn't want to overwrite old FLASH.BIN without manual deleting? Is it possible to make it work without deleting old FLASH.BIN first? STM32F103T8U6 bootloader (64K flash, 20K RAM) allows to overwrite just fine.
The bootloader only presents just enough FAT sectors to fit the application in - this is because the sectors are backed by the literal internal FLASH memory. Other MSC bootloaders generally buffer the data into RAM so that they can handle renames, long file names and other FAT features, but the AVR8 devices lack the memory to do so. Deleting the file frees up the sectors of the filesystem such that a new image can be written.
First of all, I can't even build it now, atmega32u4/32/4 configuration never bulds even with BOARD=NONE. Maybe in 2013 it worked somehow. I'm using standard gcc toolchain on WSL (debian).
My conf is:
It only builds for
BOOT_SECTION_SIZE_KB = 6
, 4 or 5 doesn't work.Also I can't use prebuilt Leonardo images from here http://fourwalledcubicle.com/blog/2013/03/magic/comment-page-1/ because IO13 (PC7) is not even broken out on Pro Micro. Could you please remap it to double reset or something as does Adafruit? There are very few pins broken out (just 18 gpios) and using a dedicated pin to invoke usb drive is pretty wasteful. Thanks for the great bootloader, but making it work on Pro Micros would be even greater, considering mass adoption of those boards.