1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 11:29:53 +03:00

STM F3 support

Partial F3 support. Should be enough to flash correctly.
Currently only full chip erase is supported.

IT IS NOT TESTED AT ALL as I don't have hardware
This commit is contained in:
Bart 2015-05-19 03:04:40 +02:00
parent d10023ec4b
commit ef682cdca9

View file

@ -304,6 +304,8 @@ STM32_protocol.prototype.verify_chip_signature = function (signature) {
break;
case 0x422: // not tested
console.log('Chip recognized as F3 STM32F30xxx, STM32F31xxx');
this.available_flash_size = 0x40000;
this.page_size = 2048;
break;
}
@ -342,6 +344,8 @@ STM32_protocol.prototype.verify_flash = function (first_array, second_array) {
STM32_protocol.prototype.upload_procedure = function (step) {
var self = this;
var extendedErase=false;
switch (step) {
case 1:
// initialize serial interface on the MCU side, auto baud rate settings
@ -389,6 +393,9 @@ STM32_protocol.prototype.upload_procedure = function (step) {
self.retrieve(data[1] + 1 + 1, function (data) { // data[1] = number of bytes that will follow [ 1 except current and ACKs]
console.log('STM32 - Bootloader version: ' + (parseInt(data[0].toString(16)) / 10).toFixed(1)); // convert dec to hex, hex to dec and add floating point
extendedErase=data[7]==0x44;
// proceed to next step
self.upload_procedure(3);
});
@ -418,6 +425,26 @@ STM32_protocol.prototype.upload_procedure = function (step) {
// erase memory
$('span.progressLabel').text('Erasing ...');
if(extendedErase)
{
console.log('Executing global chip extended erase');
self.send([0x44, 0xBB], 1, function (reply) {
if (self.verify_response(self.status.ACK, reply)) {
self.send( [0xFF, 0xFF, 0x00], 1, function (reply){
if (self.verify_response(self.status.ACK, reply)){
console.log('Executing global chip extended erase - done');
self.upload_procedure(5);
}
});
}
});
}else{
if (self.options.erase_chip) {
console.log('Executing global chip erase');
@ -462,6 +489,7 @@ STM32_protocol.prototype.upload_procedure = function (step) {
}
});
}
}
break;
case 5:
// upload