You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks for this very small bootloader, and for inspiration around HID !
I have tested the last master branch with a STM32103RC (48K RAM/256K Flash), being a HD device. The bootloader was obviously compiled with the PAGE_SIZE=2048 option.
=> The last page is not flashed, and so, the firmware is corrupted.
It seems that The ISR handle HIDUSB_HandleData doesn't take care of pending bytes at the last round if bytes > 1024 and below 2048.
static void HIDUSB_HandleData(uint8_t *data)
{
(...)
case 0x00:
/* Reset Page Command */
UploadStarted = true;
CurrentPage = MIN_PAGE;
CurrentPageOffset = 0;
break;
case 0x01:
=> SOMETHING SHOULD BE DONE HERE TO WRITE PENDING BYTES BETWEEN >1024 AND < 2048....
/* Reboot MCU Command */
UploadFinished = true;
break;
default:
break;
}
} else if (CurrentPageOffset >=
(...)
On the other end, using the same buffer for page data and commands is a bit risky.
I have written a version with some optimization , allowing the auto detection of page size (i.e. density) by reading the flash size info from the device. I also use state transitions, rather than booleans to manage the bootloader state. I push here my version of HIDUSB_HandleData
I have also separated page data from USB data until we are sure that it is page data after a full 64 bytes packet received.
First, thanks for this very small bootloader, and for inspiration around HID !
I have tested the last master branch with a STM32103RC (48K RAM/256K Flash), being a HD device. The bootloader was obviously compiled with the PAGE_SIZE=2048 option.
=> The last page is not flashed, and so, the firmware is corrupted.
It seems that The ISR handle HIDUSB_HandleData doesn't take care of pending bytes at the last round if bytes > 1024 and below 2048.
On the other end, using the same buffer for page data and commands is a bit risky.
I have written a version with some optimization , allowing the auto detection of page size (i.e. density) by reading the flash size info from the device. I also use state transitions, rather than booleans to manage the bootloader state. I push here my version of HIDUSB_HandleData
I have also separated page data from USB data until we are sure that it is page data after a full 64 bytes packet received.
To save room, and stay below 2K, the USB string descriptors can be commented as they are not really used with generic HID devices.
Hope this helps.
The text was updated successfully, but these errors were encountered: