X7 bootloader improvement (#4139)

This commit is contained in:
3djc
2016-12-15 18:30:20 +01:00
committed by Andre Bernet
parent 1f46295c68
commit 822083300e
2 changed files with 22 additions and 11 deletions
+5
View File
@@ -25,6 +25,7 @@ option(FAS_PROTOTYPE "Support of old FAS prototypes (different resistors)" OFF)
option(TEMPLATES "Model templates menu" OFF)
option(WARNINGS_AS_ERRORS "Treat all compiler warnings as error" OFF)
option(TRACE_SIMPGMSPACE "Turn on traces in simpgmspace.cpp" ON)
set(DEFAULT_MODE "" CACHE STRING "Default sticks mode")
enable_language(ASM)
set(OPT s)
@@ -281,6 +282,10 @@ elseif(NOT SPLASH STREQUAL OFF)
add_definitions(-DSPLASH)
endif()
if(NOT DEFAULT_MODE STREQUAL "")
add_definitions(-DDEFAULT_MODE=${DEFAULT_MODE})
endif()
if(TRACE_SIMPGMSPACE)
add_definitions(-DTRACE_SIMPGMSPACE)
endif()
+17 -11
View File
@@ -44,12 +44,18 @@
#if LCD_W >= 212
#define STR_OR_PLUGIN_USB_CABLE INDENT "Or plug in a USB cable for mass storage"
#define STR_USB_CONNECTED "\026USB Connected"
#define STR_HOLD_ENTER_TO_START "\012Hold [ENT] to start writing"
#define STR_INVALID_FIRMWARE "\011Not a valid firmware file! "
#define STR_INVALID_EEPROM "\011Not a valid EEPROM file! "
#else
#define STR_OR_PLUGIN_USB_CABLE INDENT "Or plug in a USB cable"
#define STR_USB_CONNECTED "\012USB Connected "
#define STR_HOLD_ENTER_TO_START "\006Hold [ENT] to start"
#define STR_INVALID_FIRMWARE "\004Not a valid firmware! "
#define STR_INVALID_EEPROM "\004Not a valid EEPROM! "
#endif
#define STR_USB_CONNECTED CENTER "\011USB Connected"
const uint8_t bootloaderVersion[] __attribute__ ((section(".version"), used)) =
{
'B', 'O', 'O', 'T', '1', '0'
@@ -255,7 +261,7 @@ int menuFlashFile(uint32_t index, event_t event)
{
FRESULT fr;
lcdDrawTextAlignedLeft(4*FH, "\012Hold [ENT] to start writing");
lcdDrawTextAlignedLeft(4*FH, STR_HOLD_ENTER_TO_START);
if (Valid == 0) {
// Validate file here
@@ -277,9 +283,9 @@ int menuFlashFile(uint32_t index, event_t event)
if (Valid == 2) {
if (memoryType == MEM_FLASH)
lcdDrawTextAlignedLeft(4*FH, "\011Not a valid firmware file! ");
lcdDrawTextAlignedLeft(4*FH, STR_INVALID_FIRMWARE);
else
lcdDrawTextAlignedLeft(4*FH, "\011Not a valid EEPROM file! ");
lcdDrawTextAlignedLeft(4*FH, STR_INVALID_EEPROM);
if (event == EVT_KEY_BREAK(BOOT_KEY_EXIT) || event == EVT_KEY_BREAK(BOOT_KEY_MENU)) {
return 0;
}
@@ -550,7 +556,7 @@ int main()
else if (state == ST_FLASHING) {
// commit to flashing
lcdDrawTextAlignedLeft(4*FH, "\032Writing...");
lcdDrawTextAlignedLeft(4*FH, CENTER "\015Writing...");
if (!unlocked && (memoryType == MEM_FLASH)) {
unlocked = 1;
@@ -561,15 +567,15 @@ int main()
if (memoryType == MEM_FLASH) {
flashWriteBlock();
firmwareWritten += sizeof(Block_buffer);
progress = (200*firmwareWritten) / FirmwareSize;
progress = ((LCD_W-12)*firmwareWritten) / FirmwareSize;
}
else {
writeEepromBlock();
eepromWritten += sizeof(Block_buffer);
progress = (200*eepromWritten) / EEPROM_SIZE;
progress = ((LCD_W-12)*eepromWritten) / EEPROM_SIZE;
}
lcdDrawRect(3, 6*FH+4, 204, 7);
lcdDrawRect(3, 6*FH+4, (LCD_W-8), 7);
lcdDrawSolidHorizontalLine(5, 6*FH+6, progress, FORCE);
lcdDrawSolidHorizontalLine(5, 6*FH+7, progress, FORCE);
lcdDrawSolidHorizontalLine(5, 6*FH+8, progress, FORCE);
@@ -591,7 +597,7 @@ int main()
lockFlash();
unlocked = 0;
}
lcdDrawTextAlignedLeft(4*FH, "\024Writing Complete");
lcdDrawTextAlignedLeft(4*FH, CENTER "\007Writing Complete");
if (event == EVT_KEY_FIRST(BOOT_KEY_EXIT) || event == EVT_KEY_BREAK(BOOT_KEY_MENU)) {
state = ST_START;
vpos = 0;
@@ -631,7 +637,7 @@ int main()
lcdClear();
lcdRefresh();
lcdRefreshWait();
RCC->CSR |= RCC_CSR_RMVF; //clear the reset flags in RCC clock control & status register
RCC->CSR |= RCC_CSR_RMVF; // clear the reset flags in RCC clock control & status register
NVIC_SystemReset();
}
}