diff --git a/locales/en/messages.json b/locales/en/messages.json index 9ed3e6f1..3fdd3f65 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -688,9 +688,9 @@ "message": "Detected device with total flash size $1 KiB" }, "dfu_hex_address_errors": { - "message": "Error: Firmware image contains addresses not found on target device" + "message": "Firmware image contains addresses not found on target device" }, - "dfu_error_image_size": { + "dfu_error_image_size": { "message": "Error: Supplied image is larger then flash available on the chip! Image: $1 KiB, limit = $2 KiB" }, diff --git a/src/js/protocols/stm32usbdfu.js b/src/js/protocols/stm32usbdfu.js index 3448503d..f5defaab 100644 --- a/src/js/protocols/stm32usbdfu.js +++ b/src/js/protocols/stm32usbdfu.js @@ -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;