armcm_reset: Flush dcache before rebooting into canboot

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-12-16 12:30:22 -05:00
parent b0d9cbfb4b
commit 02b45c91fb
1 changed files with 10 additions and 8 deletions

View File

@ -23,14 +23,16 @@ canboot_reset(uint64_t req_signature)
uint32_t *bl_vectors = (uint32_t *)CONFIG_FLASH_BOOT_ADDRESS;
uint64_t *boot_sig = (uint64_t *)(bl_vectors[1] - 9);
uint64_t *req_sig = (uint64_t *)bl_vectors[0];
if (boot_sig == (void *)ALIGN((size_t)boot_sig, 8) &&
*boot_sig == CANBOOT_SIGNATURE &&
req_sig == (void *)ALIGN((size_t)req_sig, 8))
{
if (boot_sig != (void*)ALIGN((size_t)boot_sig, 8)
|| *boot_sig != CANBOOT_SIGNATURE
|| req_sig != (void*)ALIGN((size_t)req_sig, 8))
return;
irq_disable();
*req_sig = req_signature;
#if __CORTEX_M >= 7
SCB_CleanDCache_by_Addr((void*)req_sig, sizeof(*req_sig));
#endif
NVIC_SystemReset();
}
}
void