Skip to content

Commit

Permalink
Feat: Automatically reboot into user program after flashing
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemensElflein committed Oct 30, 2024
1 parent bcd7ddb commit 7c92de2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bootloader/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions bootloader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,15 @@ int main(void) {
#endif
}

// prevent bootloader from bootloading
chMtxLock(&reboot_mutex);
while (1) {
// make sure we're not currently updating the software
chMtxLock(&reboot_mutex);

jump_to_user_program();
jump_to_user_program();

// allow bootloader to work again, since jumping to user program didn't work
chMtxUnlock(&reboot_mutex);
chThdSleep(TIME_INFINITE);
// allow bootloader to work again, since jumping to user program didn't work
chMtxUnlock(&reboot_mutex);
// Wait a bit
chThdSleep(TIME_MS2I(100));
}
}

0 comments on commit 7c92de2

Please sign in to comment.