/************************************************************************** * * Copyright (c) 2023 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file Update.c * * @author (last) Dana Rich * @date (last) 25-April-2023 * * @author (original) Dana Rich * @date (original) 7-March-2023 * ***************************************************************************/ #include "F021.h" #include "HDCommon.h" #include "system.h" #include "Update.h" #define BL_START_ADDRESS 0x00000000 uint32_t bootloaderStartAddress = (uint32_t)BL_START_ADDRESS; /*********************************************************************//** * @brief * The function transfers control to the bootloader code * @details Inputs: none * @details Outputs: Bootloader application started. * @return none *************************************************************************/ void startBootloader( void ) { bootloaderStartAddress = (uint32_t)BL_START_ADDRESS; ((void (*)(void))bootloaderStartAddress)(); } /*********************************************************************//** * @brief * Sets the software reset bits [15-14] of the System Exception Control * Register. Setting bit 15, or clearing bit 14 will cause a system * software reset. * * This will leave the device in a state where the bootloader will not be * left until the next power cycle or a command the start the main app * is received by the bootloader. * @details Inputs: none * @details Outputs: RM46x reboots * @return none *************************************************************************/ void rebootSystemNow( void ) { systemREG1->SYSECR = (0x10) << 14; }