Fix state if local target does not match board

10.8-maintenance
Mark Haslinghuis 2022-03-04 21:22:18 +01:00
parent a8d982a47c
commit b4f35d5fad
2 changed files with 11 additions and 3 deletions

View File

@ -688,7 +688,7 @@
"message": "Detected device with total flash size $1 KiB"
},
"dfu_hex_address_errors": {
"message": "<span class=\"message-negative\">Error</span>: Firmware image contains addresses not found on target device"
"message": "Firmware image contains addresses not found on target device"
},
"dfu_error_image_size": {
"message": "<span class=\"message-negative\">Error</span>: Supplied image is larger then flash available on the chip! Image: $1 KiB, limit = $2 KiB"

View File

@ -615,6 +615,13 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
self.chipInfo = chipInfo;
self.flash_layout = chipInfo.internal_flash;
if (TABS.firmware_flasher.parsed_hex.bytes_total > chipInfo.internal_flash.total_size) {
const firmwareSize = TABS.firmware_flasher.parsed_hex.bytes_total;
const boardSize = chipInfo.internal_flash.total_size;
const bareBoard = TABS.firmware_flasher.bareBoard;
console.log(`Firmware size ${firmwareSize} exceeds board memory size ${boardSize} (${bareBoard})`);
}
} else if (typeof chipInfo.external_flash !== "undefined") {
// external flash
nextAction = 2; // no option bytes
@ -642,7 +649,8 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
if (unusableBlocks.length > 0) {
GUI.log(i18n.getMessage('dfu_hex_address_errors'));
self.cleanup();
TABS.firmware_flasher.flashingMessage(i18n.getMessage('dfu_hex_address_errors'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
self.leave();
} else {
self.getFunctionalDescriptor(0, function (descriptor, resultCode) {
self.transferSize = resultCode ? 2048 : descriptor.wTransferSize;