feat: H7 support (#5738)
Co-authored-by: Richard Li <richard.li@ces.hk> Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
This commit is contained in:
co-authored by
Richard Li
philmoz
raphaelcoeffic
parent
5a15ffb017
commit
3d25c2a0f8
@@ -34,6 +34,10 @@
|
||||
#include "lib_file.h"
|
||||
#endif
|
||||
|
||||
#ifndef BOOTLOADER_ADDRESS
|
||||
#define BOOTLOADER_ADDRESS FIRMWARE_ADDRESS
|
||||
#endif
|
||||
|
||||
bool isBootloader(const char * filename)
|
||||
{
|
||||
FIL file;
|
||||
@@ -66,12 +70,6 @@ void BootloaderFirmwareUpdate::flashFirmware(const char * filename, ProgressHand
|
||||
|
||||
f_open(&file, filename, FA_READ);
|
||||
|
||||
static uint8_t unlocked = 0;
|
||||
if (!unlocked) {
|
||||
unlocked = 1;
|
||||
unlockFlash();
|
||||
}
|
||||
|
||||
UINT flash_size = file.obj.objsize;
|
||||
if (flash_size > BOOTLOADER_SIZE) {
|
||||
flash_size = BOOTLOADER_SIZE;
|
||||
@@ -97,7 +95,7 @@ void BootloaderFirmwareUpdate::flashFirmware(const char * filename, ProgressHand
|
||||
}
|
||||
for (UINT j = 0; j < count; j += FLASH_PAGESIZE) {
|
||||
WDG_ENABLE(3000);
|
||||
flashWrite(CONVERT_UINT_PTR(FIRMWARE_ADDRESS + i + j), CONVERT_UINT_PTR(buffer + j));
|
||||
flashWrite(CONVERT_UINT_PTR(BOOTLOADER_ADDRESS + i + j), CONVERT_UINT_PTR(buffer + j));
|
||||
WDG_ENABLE(WDG_DURATION);
|
||||
}
|
||||
progressHandler("Bootloader", STR_WRITING, i, flash_size);
|
||||
@@ -117,12 +115,6 @@ void BootloaderFirmwareUpdate::flashFirmware(const char * filename, ProgressHand
|
||||
watchdogSuspend(0);
|
||||
WDG_RESET();
|
||||
|
||||
if (unlocked) {
|
||||
lockFlash();
|
||||
unlocked = 0;
|
||||
}
|
||||
|
||||
f_close(&file);
|
||||
|
||||
pulsesStart();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user