Add "Reset to OpenBLT" button (#4364)

Similar to "Reset to DFU", but uses different seed
This commit is contained in:
Andrey G 2022-07-22 08:21:11 +03:00 committed by GitHub
parent d87be38401
commit 59eee6641c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 3 deletions

View File

@ -213,6 +213,7 @@ endif
ifeq ($(USE_OPENBLT),yes)
# Reserve start of flash for OpenBLT
USE_OPT += -Wl,--defsym=BOOTLOADER=1
DDEFS += -DEFI_USE_OPENBLT=TRUE
endif
$(info PROJECT_BOARD: $(PROJECT_BOARD))

View File

@ -529,6 +529,14 @@ void executeTSCommand(uint16_t subsystem, uint16_t index) {
rebootNow();
#endif /* EFI_PROD_CODE */
break;
#if EFI_USE_OPENBLT
case 0xbc:
/* Jump to OpenBLT if present */
jump_to_openblt();
break;
#endif
default:
firmwareError(OBD_PCM_Processor_Fault, "Unexpected bench subsystem %d %d", subsystem, index);
}

View File

@ -9,6 +9,9 @@
// Base MCU
void baseMCUInit(void);
void jump_to_bootloader();
#if EFI_USE_OPENBLT
void jump_to_openblt();
#endif
bool allowFlashWhileRunning();
bool ramReadProbe(volatile const char *read_address);

View File

@ -326,7 +326,7 @@ stm32_hardware_pwm* getNextPwmDevice() {
}
#endif
void jump_to_bootloader() {
static void reset_and_jump(uint32_t breadcrumb) {
#ifdef STM32H7XX
// H7 needs a forcible reset of the USB peripheral(s) in order for the bootloader to work properly.
// If you don't do this, the bootloader will execute, but USB doesn't work (nobody knows why)
@ -334,11 +334,19 @@ void jump_to_bootloader() {
RCC->AHB1ENR &= ~(RCC_AHB1ENR_USB1OTGHSEN | RCC_AHB1ENR_USB2OTGFSEN);
#endif
// leave DFU breadcrumb which assembly startup code would check, see [rusefi][DFU] section in assembly code
*((unsigned long *)0x2001FFF0) = 0xDEADBEEF; // End of RAM
*((unsigned long *)0x2001FFF0) = breadcrumb; // End of RAM
// and now reboot
NVIC_SystemReset();
}
void jump_to_bootloader() {
// leave DFU breadcrumb which assembly startup code would check, see [rusefi][DFU] section in assembly code
reset_and_jump(0xDEADBEEF);
}
void jump_to_openblt() {
reset_and_jump(0xCAFEBABE);
}
#endif /* EFI_PROD_CODE */
#if EFI_AUX_SERIAL

View File

@ -1778,6 +1778,8 @@ cmd_stop_engine = "@@TS_IO_TEST_COMMAND_char@@\x00\x79\x00\x00"
cmd_reset_controller = "@@TS_IO_TEST_COMMAND_char@@\x00\xbb\x00\x00"
; jump to DFU mode
cmd_dfu = "@@TS_IO_TEST_COMMAND_char@@\x00\xba\x00\x00"
; jump to OpenBLT bootloader
cmd_openblt = "@@TS_IO_TEST_COMMAND_char@@\x00\xbc\x00\x00"
; See 'executeTSCommand' in firmware source code
@ -3696,6 +3698,7 @@ dialog = tcuControls, "Transmission Settings"
commandButton = "Write Config", cmd_write_config
commandButton = "Reset ECU", cmd_reset_controller
commandButton = "Reset to DFU", cmd_dfu
commandButton = "Reset to OpenBLT", cmd_openblt
commandButton = "F7 nDBANK fix", cmd_nDBANK@@if_ts_show_f7_presets
commandButton = "No flash Burn mode", cmd_burn_without_flash