Files
katapult/src/generic/armcm_reset.c
T
2022-10-31 07:23:14 -04:00

21 lines
602 B
C

// Generic reset command handler for ARM Cortex-M boards
//
// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
//
// This file may be distributed under the terms of the GNU GPLv3 license.
#include "autoconf.h" // CONFIG_FLASH_START
#include "board/internal.h" // NVIC_SystemReset
#include "board/irq.h" // irq_disable
#include "board/misc.h" // try_request_canboot
void
try_request_canboot(void)
{
uint32_t *bl_vectors = (uint32_t *)(CONFIG_BOOTLOADER_START);
uint64_t *req_sig = (uint64_t *)bl_vectors[0];
irq_disable();
*req_sig = REQUEST_CANBOOT;
NVIC_SystemReset();
}