Flash unlock validation on STM32

This commit is contained in:
robert committed 2026-08-11 11:48:19 +03:00
1 parent 9ccfc02a86
commit fa4a2563e5
4 files changed
+34 -36

No files matched your search

+1 -3
View File
@@ -45,11 +45,9 @@ MG_IRAM static int is_dualbank(void) {
}
MG_IRAM static void flash_unlock(void) {
static bool unlocked = false;
if (unlocked == false) {
if (MG_REG(MG_FLASH_BASE + MG_FLASH_CR) & MG_BIT(31)) {
MG_REG(MG_FLASH_BASE + MG_FLASH_KEYR) = 0x45670123;
MG_REG(MG_FLASH_BASE + MG_FLASH_KEYR) = 0xcdef89ab;
unlocked = true;
}
}