Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AT32 MCU DFU added #1707

Merged
merged 1 commit into from
Mar 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions js/port_handler.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
'use strict';

var usbDevices = {
STM32DFU: {'vendorId': 1155, 'productId': 57105}
filters: [
{'vendorId': 1155, 'productId': 57105},
{'vendorId': 11836, 'productId': 57105}
]
};

var PortHandler = new function () {
Expand Down Expand Up @@ -152,7 +155,7 @@ PortHandler.check = function () {
};

PortHandler.check_usb_devices = function (callback) {
chrome.usb.getDevices(usbDevices.STM32DFU, function (result) {
chrome.usb.getDevices(usbDevices, function (result) {
if (result.length) {
if (!$("div#port-picker #port [value='DFU']").length) {
$('div#port-picker #port').append($('<option/>', {value: "DFU", text: "DFU", data: {isDFU: true}}));
Expand All @@ -166,7 +169,7 @@ PortHandler.check_usb_devices = function (callback) {
self.dfu_available = false;
}

if(callback) callback(self.dfu_available);
if (callback) callback(self.dfu_available);
});
};

Expand Down
2 changes: 1 addition & 1 deletion js/protocols/stm32.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
PortHandler.check_usb_devices(function(dfu_available) {
if (dfu_available) {
clearInterval(interval);
STM32DFU.connect(usbDevices.STM32DFU, hex, options);
STM32DFU.connect(usbDevices, hex, options);
return;
}
// Check for the serial port
Expand Down
7 changes: 7 additions & 0 deletions js/protocols/stm32usbdfu.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ STM32DFU_protocol.prototype.getChipInfo = function (_interface, callback) {
// H750 SPRacing H7 EXST: "@External Flash /0x90000000/998*128Kg,1*128Kg,4*128Kg,21*128Ka"
// H750 SPRacing H7 EXST: "@External Flash /0x90000000/1001*128Kg,3*128Kg,20*128Ka" - Early BL firmware with incorrect string, treat as above.

// AT32F435: "@Internal Flash /0x08000000/512*002Kg,@Option byte /0x1FFFC000/01*512 g"

// H750 Partitions: Flash, Config, Firmware, 1x BB Management block + x BB Replacement blocks)
if (str == "@External Flash /0x90000000/1001*128Kg,3*128Kg,20*128Ka") {
str = "@External Flash /0x90000000/998*128Kg,1*128Kg,4*128Kg,21*128Ka";
Expand Down Expand Up @@ -617,6 +619,11 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
});
break;
case 1:
// workaroud for AT32
if (typeof self.chipInfo.option_bytes === "undefined" && typeof self.chipInfo.option_byte !== "undefined") {
self.chipInfo.option_bytes = self.chipInfo.option_byte;
}

if (typeof self.chipInfo.option_bytes === "undefined") {
console.log('Failed to detect option bytes');
self.cleanup();
Expand Down
3 changes: 2 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"notifications",
"alwaysOnTopWindows",
{"usbDevices": [
{"vendorId": 1155, "productId": 57105}
{"vendorId": 1155, "productId": 57105},
{"vendorId": 11836, "productId": 57105}
]}
],

Expand Down
2 changes: 1 addition & 1 deletion tabs/firmware_flasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ TABS.firmware_flasher.initialize = function (callback) {
GUI.log('<span style="color: red">Please select valid serial port</span>');
}
} else {
STM32DFU.connect(usbDevices.STM32DFU, parsed_hex, options);
STM32DFU.connect(usbDevices, parsed_hex, options);
}
} else {
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherFirmwareNotLoaded'));
Expand Down