2013-07-31 08:48:23 -07:00
|
|
|
/************************************************************************************//**
|
|
|
|
* \file Demo\ARMCM3_EFM32_Olimex_EM32G880F128STK_IAR\Boot\hooks.c
|
|
|
|
* \brief Bootloader callback source file.
|
|
|
|
* \ingroup Boot_ARMCM3_EFM32_Olimex_EM32G880F128STK_IAR
|
|
|
|
* \internal
|
|
|
|
*----------------------------------------------------------------------------------------
|
|
|
|
* C O P Y R I G H T
|
|
|
|
*----------------------------------------------------------------------------------------
|
|
|
|
* Copyright (c) 2012 by Feaser http://www.feaser.com All rights reserved
|
|
|
|
*
|
|
|
|
*----------------------------------------------------------------------------------------
|
|
|
|
* L I C E N S E
|
|
|
|
*----------------------------------------------------------------------------------------
|
|
|
|
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as published by the Free
|
|
|
|
* Software Foundation, either version 3 of the License, or (at your option) any later
|
|
|
|
* version.
|
|
|
|
*
|
|
|
|
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with OpenBLT.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* A special exception to the GPL is included to allow you to distribute a combined work
|
|
|
|
* that includes OpenBLT without being obliged to provide the source code for any
|
|
|
|
* proprietary components. The exception text is included at the bottom of the license
|
|
|
|
* file <license.html>.
|
|
|
|
*
|
|
|
|
* \endinternal
|
2012-03-03 15:05:56 -08:00
|
|
|
****************************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************************
|
|
|
|
* Include files
|
|
|
|
****************************************************************************************/
|
|
|
|
#include "boot.h" /* bootloader generic header */
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************************
|
|
|
|
* B A C K D O O R E N T R Y H O O K F U N C T I O N S
|
|
|
|
****************************************************************************************/
|
|
|
|
|
|
|
|
#if (BOOT_BACKDOOR_HOOKS_ENABLE > 0)
|
2013-07-31 08:48:23 -07:00
|
|
|
/************************************************************************************//**
|
|
|
|
** \brief Initializes the backdoor entry option.
|
|
|
|
** \return none.
|
2012-03-03 15:05:56 -08:00
|
|
|
**
|
|
|
|
****************************************************************************************/
|
|
|
|
void BackDoorInitHook(void)
|
|
|
|
{
|
|
|
|
} /*** end of BackDoorInitHook ***/
|
|
|
|
|
|
|
|
|
2013-07-31 08:48:23 -07:00
|
|
|
/************************************************************************************//**
|
|
|
|
** \brief Checks if a backdoor entry is requested.
|
|
|
|
** \return BLT_TRUE if the backdoor entry is requested, BLT_FALSE otherwise.
|
2012-03-03 15:05:56 -08:00
|
|
|
**
|
|
|
|
****************************************************************************************/
|
|
|
|
blt_bool BackDoorEntryHook(void)
|
|
|
|
{
|
|
|
|
/* default implementation always activates the bootloader after a reset */
|
|
|
|
return BLT_TRUE;
|
|
|
|
} /*** end of BackDoorEntryHook ***/
|
|
|
|
#endif /* BOOT_BACKDOOR_HOOKS_ENABLE > 0 */
|
|
|
|
|
|
|
|
|
2013-05-22 06:37:47 -07:00
|
|
|
/****************************************************************************************
|
|
|
|
* C P U D R I V E R H O O K F U N C T I O N S
|
|
|
|
****************************************************************************************/
|
|
|
|
|
|
|
|
#if (BOOT_CPU_USER_PROGRAM_START_HOOK > 0)
|
2013-07-31 08:48:23 -07:00
|
|
|
/************************************************************************************//**
|
|
|
|
** \brief Callback that gets called when the bootloader is about to exit and
|
|
|
|
** hand over control to the user program. This is the last moment that
|
|
|
|
** some final checking can be performed and if necessary prevent the
|
|
|
|
** bootloader from activiting the user program.
|
|
|
|
** \return BLT_TRUE if it is okay to start the user program, BLT_FALSE to keep
|
|
|
|
** keep the bootloader active.
|
2013-05-22 06:37:47 -07:00
|
|
|
**
|
|
|
|
****************************************************************************************/
|
|
|
|
blt_bool CpuUserProgramStartHook(void)
|
|
|
|
{
|
|
|
|
/* okay to start the user program */
|
|
|
|
return BLT_TRUE;
|
|
|
|
} /*** end of CpuUserProgramStartHook ***/
|
|
|
|
#endif /* BOOT_CPU_USER_PROGRAM_START_HOOK > 0 */
|
|
|
|
|
|
|
|
|
2012-03-03 15:05:56 -08:00
|
|
|
/****************************************************************************************
|
|
|
|
* N O N - V O L A T I L E M E M O R Y D R I V E R H O O K F U N C T I O N S
|
|
|
|
****************************************************************************************/
|
|
|
|
|
|
|
|
#if (BOOT_NVM_HOOKS_ENABLE > 0)
|
2013-07-31 08:48:23 -07:00
|
|
|
/************************************************************************************//**
|
|
|
|
** \brief Callback that gets called at the start of the internal NVM driver
|
|
|
|
** initialization routine.
|
|
|
|
** \return none.
|
2012-03-03 15:05:56 -08:00
|
|
|
**
|
|
|
|
****************************************************************************************/
|
|
|
|
void NvmInitHook(void)
|
|
|
|
{
|
|
|
|
} /*** end of NvmInitHook ***/
|
|
|
|
|
|
|
|
|
2013-07-31 08:48:23 -07:00
|
|
|
/************************************************************************************//**
|
|
|
|
** \brief Callback that gets called at the start of the NVM driver write
|
|
|
|
** routine. It allows additional memory to be operated on. If the address
|
|
|
|
** is not within the range of the additional memory, then
|
|
|
|
** BLT_NVM_NOT_IN_RANGE must be returned to indicate that the data hasn't
|
|
|
|
** been written yet.
|
|
|
|
** \param addr Start address.
|
|
|
|
** \param len Length in bytes.
|
|
|
|
** \param data Pointer to the data buffer.
|
|
|
|
** \return BLT_NVM_OKAY if successful, BLT_NVM_NOT_IN_RANGE if the address is
|
|
|
|
** not within the supported memory range, or BLT_NVM_ERROR is the write
|
|
|
|
** operation failed.
|
2012-03-03 15:05:56 -08:00
|
|
|
**
|
|
|
|
****************************************************************************************/
|
|
|
|
blt_int8u NvmWriteHook(blt_addr addr, blt_int32u len, blt_int8u *data)
|
|
|
|
{
|
|
|
|
return BLT_NVM_NOT_IN_RANGE;
|
|
|
|
} /*** end of NvmWriteHook ***/
|
|
|
|
|
|
|
|
|
2013-07-31 08:48:23 -07:00
|
|
|
/************************************************************************************//**
|
|
|
|
** \brief Callback that gets called at the start of the NVM driver erase
|
|
|
|
** routine. It allows additional memory to be operated on. If the address
|
|
|
|
** is not within the range of the additional memory, then
|
|
|
|
** BLT_NVM_NOT_IN_RANGE must be returned to indicate that the memory
|
|
|
|
** hasn't been erased yet.
|
|
|
|
** \param addr Start address.
|
|
|
|
** \param len Length in bytes.
|
|
|
|
** \return BLT_NVM_OKAY if successful, BLT_NVM_NOT_IN_RANGE if the address is
|
|
|
|
** not within the supported memory range, or BLT_NVM_ERROR is the erase
|
|
|
|
** operation failed.
|
2012-03-03 15:05:56 -08:00
|
|
|
**
|
|
|
|
****************************************************************************************/
|
|
|
|
blt_int8u NvmEraseHook(blt_addr addr, blt_int32u len)
|
|
|
|
{
|
|
|
|
return BLT_NVM_NOT_IN_RANGE;
|
|
|
|
} /*** end of NvmEraseHook ***/
|
|
|
|
|
|
|
|
|
2013-07-31 08:48:23 -07:00
|
|
|
/************************************************************************************//**
|
|
|
|
** \brief Callback that gets called at the end of the NVM programming session.
|
|
|
|
** \return BLT_TRUE is successful, BLT_FALSE otherwise.
|
2012-03-03 15:05:56 -08:00
|
|
|
**
|
|
|
|
****************************************************************************************/
|
|
|
|
blt_bool NvmDoneHook(void)
|
|
|
|
{
|
|
|
|
return BLT_TRUE;
|
|
|
|
} /*** end of NvmDoneHook ***/
|
|
|
|
#endif /* BOOT_NVM_HOOKS_ENABLE > 0 */
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************************
|
|
|
|
* W A T C H D O G D R I V E R H O O K F U N C T I O N S
|
|
|
|
****************************************************************************************/
|
|
|
|
|
|
|
|
#if (BOOT_COP_HOOKS_ENABLE > 0)
|
2013-07-31 08:48:23 -07:00
|
|
|
/************************************************************************************//**
|
|
|
|
** \brief Callback that gets called at the end of the internal COP driver
|
|
|
|
** initialization routine. It can be used to configure and enable the
|
|
|
|
** watchdog.
|
|
|
|
** \return none.
|
2012-03-03 15:05:56 -08:00
|
|
|
**
|
|
|
|
****************************************************************************************/
|
|
|
|
void CopInitHook(void)
|
|
|
|
{
|
|
|
|
} /*** end of CopInitHook ***/
|
|
|
|
|
|
|
|
|
2013-07-31 08:48:23 -07:00
|
|
|
/************************************************************************************//**
|
|
|
|
** \brief Callback that gets called at the end of the internal COP driver
|
|
|
|
** service routine. This gets called upon initialization and during
|
|
|
|
** potential long lasting loops and routine. It can be used to service
|
|
|
|
** the watchdog to prevent a watchdog reset.
|
|
|
|
** \return none.
|
2012-03-03 15:05:56 -08:00
|
|
|
**
|
|
|
|
****************************************************************************************/
|
|
|
|
void CopServiceHook(void)
|
|
|
|
{
|
|
|
|
} /*** end of CopServiceHook ***/
|
|
|
|
#endif /* BOOT_COP_HOOKS_ENABLE > 0 */
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************** end of hooks.c ************************************/
|