mirror of
https://jihulab.com/mr-one/openpilot.git
synced 2026-10-26 20:43:49 +08:00
remove stale bootloader magic jump; 0xd1 jumps directly
This commit is contained in:
@@ -33,15 +33,10 @@ void early_initialization(void) {
|
||||
// Init register and interrupt tables
|
||||
init_registers();
|
||||
|
||||
// after it's been in the bootloader, things are initted differently, so we reset
|
||||
if ((enter_bootloader_mode != BOOT_NORMAL) &&
|
||||
(enter_bootloader_mode != ENTER_BOOTLOADER_MAGIC) &&
|
||||
(enter_bootloader_mode != ENTER_SOFTLOADER_MAGIC)) {
|
||||
enter_bootloader_mode = BOOT_NORMAL;
|
||||
// NOTE: no NVIC_SystemReset here - a stale RAM value during a plain
|
||||
// hardware-reset boot was observed to hang before USB init on this board.
|
||||
// Just clear the stale value and continue.
|
||||
}
|
||||
// Always clear any bootloader magic left in RAM. A stale value from a
|
||||
// previous bootloader/DFU session would otherwise send us back into the ROM
|
||||
// bootloader on a plain hardware reset (which then does not enumerate USB).
|
||||
enter_bootloader_mode = BOOT_NORMAL;
|
||||
|
||||
// if wrong chip, reboot
|
||||
volatile unsigned int id = DBGMCU->IDCODE;
|
||||
@@ -57,10 +52,6 @@ void early_initialization(void) {
|
||||
|
||||
detect_board_type();
|
||||
|
||||
if (enter_bootloader_mode == ENTER_BOOTLOADER_MAGIC) {
|
||||
led_init();
|
||||
current_board->init_bootloader();
|
||||
led_set(LED_GREEN, 1);
|
||||
jump_to_bootloader();
|
||||
}
|
||||
// Bootloader entry is done directly by the 0xd1 comms handler via
|
||||
// jump_to_bootloader(), not through a magic RAM value (which can be stale).
|
||||
}
|
||||
|
||||
@@ -71,8 +71,7 @@ int comms_control_handler(ControlPacket_t *req, uint8_t *resp) {
|
||||
switch (req->param1) {
|
||||
case 0:
|
||||
print("-> entering bootloader\n");
|
||||
enter_bootloader_mode = ENTER_BOOTLOADER_MAGIC;
|
||||
NVIC_SystemReset();
|
||||
jump_to_bootloader();
|
||||
break;
|
||||
case 1:
|
||||
print("-> entering softloader\n");
|
||||
|
||||
@@ -180,8 +180,7 @@ int comms_control_handler(ControlPacket_t *req, uint8_t *resp) {
|
||||
// only allow bootloader entry on debug builds
|
||||
#ifdef ALLOW_DEBUG
|
||||
print("-> entering bootloader\n");
|
||||
enter_bootloader_mode = ENTER_BOOTLOADER_MAGIC;
|
||||
NVIC_SystemReset();
|
||||
jump_to_bootloader();
|
||||
#endif
|
||||
break;
|
||||
case 1:
|
||||
|
||||
Reference in New Issue
Block a user