Skip to content

Commit

Permalink
fix: flashing from BL
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelcoeffic committed Jan 7, 2025
1 parent ebf916b commit 57cb68f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 326 deletions.
14 changes: 2 additions & 12 deletions radio/src/targets/common/arm/stm32/bootloader/bin_fw_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,25 +274,15 @@ void firmwareInitWrite(uint32_t index)

bool firmwareWriteBlock(uint32_t* progress)
{
// commit to flashing
if (!unlocked) {
unlocked = 1;
unlockFlash();
}

flashWriteBlock();
firmwareWritten += sizeof(Block_buffer);
*progress = (100 * firmwareWritten) / firmwareSize;

readFirmwareFile();
if (BlockCount == 0) {
lockFlash();
return true;
}
else if (firmwareWritten >= FLASHSIZE - BOOTLOADER_SIZE) {
lockFlash();
if (BlockCount == 0 || firmwareWritten >= FLASHSIZE - BOOTLOADER_SIZE) {
return true;
}

return false;
}

1 change: 0 additions & 1 deletion radio/src/targets/common/arm/stm32/bootloader/boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ enum BootloaderState {
ST_OPEN_DIR,
ST_FILE_LIST,
ST_FLASH_CHECK,
ST_ERASING,
ST_FLASHING,
ST_FLASH_DONE,
ST_RESTORE_MENU,
Expand Down
9 changes: 2 additions & 7 deletions radio/src/targets/common/arm/stm32/bootloader/boot_menu.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "boot.h"
#include "firmware_files.h"

#include "hal/usb_driver.h"
#include "hal/rotary_encoder.h"

#include "lcd.h"

Expand Down Expand Up @@ -211,13 +213,6 @@ void bootloaderMenu()
} else if (result == 1) {
// confirmed
firmwareInitWrite(vpos);
state = ST_ERASING;
}
} else if (state == ST_ERASING) {
uint32_t progress = 0;
bool done = firmwareEraseBlock(&progress);
bootloaderDrawScreen(state, progress);
if (done) {
state = ST_FLASHING;
}
} else if (state == ST_FLASHING) {
Expand Down
290 changes: 0 additions & 290 deletions radio/src/targets/common/arm/stm32/bootloader/uf2_fw_files.cpp

This file was deleted.

Loading

0 comments on commit 57cb68f

Please sign in to comment.