Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
bsod: Encode fault in boot magic
Browse files Browse the repository at this point in the history
  • Loading branch information
kbeckmann committed Jan 8, 2021
1 parent c34d0e2 commit 9359d8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions Core/Inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ void wdog_refresh(void);
#define BOOT_MAGIC_STANDBY 0xfedebeda
#define BOOT_MAGIC_RESET 0x1fa1afe1
#define BOOT_MAGIC_WATCHDOG 0xd066cafe
#define BOOT_MAGIC_BSOD 0xbad00000

/* USER CODE END Private defines */

Expand Down
3 changes: 3 additions & 0 deletions Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ __attribute__((optimize("-O0"))) void BSOD(BSOD_t fault, void *pc, void *lr)
wdog_refresh();
}

// Encode the fault type in the boot magic
boot_magic = BOOT_MAGIC_BSOD | (fault & 0xffff);

HAL_NVIC_SystemReset();

// Does not return
Expand Down

0 comments on commit 9359d8b

Please sign in to comment.