From 5bdefa6487768ceed0e1a35596e8d006e4063ad1 Mon Sep 17 00:00:00 2001 From: Frank Voorburg Date: Thu, 1 Aug 2013 07:44:55 +0000 Subject: [PATCH] - added bootloader version macros to boot.h. - added new hook functions to the NVM module to allow an application specific override for user program verification/checksum handling. git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@54 5dc33758-31d5-4daf-9ae8-b24bf3d40d73 --- .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../ARMCM3_LM3S_EK_LM3S6965_GCC/Boot/config.h | 6 +++- .../ARMCM3_LM3S_EK_LM3S6965_GCC/Boot/hooks.c | 28 +++++++++++++++++ .../ARMCM3_LM3S_EK_LM3S6965_IAR/Boot/config.h | 6 +++- .../ARMCM3_LM3S_EK_LM3S6965_IAR/Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../ARMCM3_LM3S_EK_LM3S8962_GCC/Boot/config.h | 6 +++- .../ARMCM3_LM3S_EK_LM3S8962_GCC/Boot/hooks.c | 28 +++++++++++++++++ .../ARMCM3_LM3S_EK_LM3S8962_IAR/Boot/config.h | 6 +++- .../ARMCM3_LM3S_EK_LM3S8962_IAR/Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 28 +++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 31 +++++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 31 +++++++++++++++++++ .../Boot/config.h | 6 +++- .../Boot/hooks.c | 31 +++++++++++++++++++ Target/Source/ARM7_LPC2000/nvm.c | 25 +++++++++++++-- Target/Source/ARMCM3_EFM32/nvm.c | 25 +++++++++++++-- Target/Source/ARMCM3_LM3S/nvm.c | 25 +++++++++++++-- Target/Source/ARMCM3_STM32/nvm.c | 25 +++++++++++++-- Target/Source/ARMCM4_STM32/nvm.c | 25 +++++++++++++-- Target/Source/boot.h | 11 +++++++ Target/Source/plausibility.h | 8 +++++ 47 files changed, 803 insertions(+), 30 deletions(-) diff --git a/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_Crossworks/Boot/config.h b/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_Crossworks/Boot/config.h index f0269b6d..8e85e137 100644 --- a/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_Crossworks/Boot/config.h +++ b/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_Crossworks/Boot/config.h @@ -130,12 +130,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (256) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_Crossworks/Boot/hooks.c b/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_Crossworks/Boot/hooks.c index 02e618c9..b3a072a5 100644 --- a/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_Crossworks/Boot/hooks.c +++ b/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_Crossworks/Boot/hooks.c @@ -168,6 +168,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_GCC/Boot/config.h b/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_GCC/Boot/config.h index c8ec1cff..30d3d23b 100644 --- a/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_GCC/Boot/config.h +++ b/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_GCC/Boot/config.h @@ -130,12 +130,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (256) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_GCC/Boot/hooks.c b/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_GCC/Boot/hooks.c index 70570cfc..b19c1d11 100644 --- a/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_GCC/Boot/hooks.c +++ b/Target/Demo/ARM7_LPC2000_Olimex_LPC_L2294_GCC/Boot/hooks.c @@ -168,6 +168,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_Crossworks/Boot/config.h b/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_Crossworks/Boot/config.h index 4448f5eb..93cc043b 100644 --- a/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_Crossworks/Boot/config.h +++ b/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_Crossworks/Boot/config.h @@ -103,12 +103,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (128) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_Crossworks/Boot/hooks.c b/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_Crossworks/Boot/hooks.c index 74bbe33c..8e48c033 100644 --- a/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_Crossworks/Boot/hooks.c +++ b/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_Crossworks/Boot/hooks.c @@ -154,6 +154,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_GCC/Boot/config.h b/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_GCC/Boot/config.h index b90984b4..15503ffb 100644 --- a/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_GCC/Boot/config.h +++ b/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_GCC/Boot/config.h @@ -103,12 +103,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (128) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_GCC/Boot/hooks.c b/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_GCC/Boot/hooks.c index 0eeba354..399852ff 100644 --- a/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_GCC/Boot/hooks.c +++ b/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_GCC/Boot/hooks.c @@ -154,6 +154,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_IAR/Boot/config.h b/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_IAR/Boot/config.h index b011fc15..2bc07c13 100644 --- a/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_IAR/Boot/config.h +++ b/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_IAR/Boot/config.h @@ -105,12 +105,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (128) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_IAR/Boot/hooks.c b/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_IAR/Boot/hooks.c index 4f39def5..e3cf78c3 100644 --- a/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_IAR/Boot/hooks.c +++ b/Target/Demo/ARMCM3_EFM32_Olimex_EM32G880F128STK_IAR/Boot/hooks.c @@ -154,6 +154,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/config.h b/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/config.h index 72ad507e..edb0cbb7 100644 --- a/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/config.h +++ b/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/config.h @@ -139,12 +139,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (256) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/hooks.c b/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/hooks.c index 3355fef1..fa1218b7 100644 --- a/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/hooks.c +++ b/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/hooks.c @@ -159,6 +159,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_GCC/Boot/config.h b/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_GCC/Boot/config.h index df79d4ff..9cb14c50 100644 --- a/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_GCC/Boot/config.h +++ b/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_GCC/Boot/config.h @@ -139,12 +139,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (256) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_GCC/Boot/hooks.c b/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_GCC/Boot/hooks.c index 9c07d156..30aa8bac 100644 --- a/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_GCC/Boot/hooks.c +++ b/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_GCC/Boot/hooks.c @@ -159,6 +159,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_IAR/Boot/config.h b/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_IAR/Boot/config.h index 6edfd9fe..ea3788c1 100644 --- a/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_IAR/Boot/config.h +++ b/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_IAR/Boot/config.h @@ -141,12 +141,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (256) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_IAR/Boot/hooks.c b/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_IAR/Boot/hooks.c index 85f20ad6..fccabe2d 100644 --- a/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_IAR/Boot/hooks.c +++ b/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_IAR/Boot/hooks.c @@ -159,6 +159,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/config.h b/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/config.h index 88dbd197..2c0855c7 100644 --- a/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/config.h +++ b/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/config.h @@ -130,12 +130,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (256) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/hooks.c b/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/hooks.c index 1cf07c2f..4d3a3b29 100644 --- a/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/hooks.c +++ b/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/hooks.c @@ -154,6 +154,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_GCC/Boot/config.h b/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_GCC/Boot/config.h index b3c58376..08196235 100644 --- a/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_GCC/Boot/config.h +++ b/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_GCC/Boot/config.h @@ -130,12 +130,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (256) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_GCC/Boot/hooks.c b/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_GCC/Boot/hooks.c index a5d7eea0..6b8cabe5 100644 --- a/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_GCC/Boot/hooks.c +++ b/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_GCC/Boot/hooks.c @@ -154,6 +154,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_IAR/Boot/config.h b/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_IAR/Boot/config.h index 9a3ae3a4..13cec3cf 100644 --- a/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_IAR/Boot/config.h +++ b/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_IAR/Boot/config.h @@ -132,12 +132,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (256) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_IAR/Boot/hooks.c b/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_IAR/Boot/hooks.c index dc95fd07..1e54f9d4 100644 --- a/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_IAR/Boot/hooks.c +++ b/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_IAR/Boot/hooks.c @@ -154,6 +154,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_Crossworks/Boot/config.h b/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_Crossworks/Boot/config.h index 96b07870..854df2bd 100644 --- a/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_Crossworks/Boot/config.h +++ b/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_Crossworks/Boot/config.h @@ -143,12 +143,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (128) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_Crossworks/Boot/hooks.c b/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_Crossworks/Boot/hooks.c index ceb1856d..b3aef8b6 100644 --- a/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_Crossworks/Boot/hooks.c +++ b/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_Crossworks/Boot/hooks.c @@ -239,6 +239,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_GCC/Boot/config.h b/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_GCC/Boot/config.h index 5f02e575..8945208f 100644 --- a/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_GCC/Boot/config.h +++ b/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_GCC/Boot/config.h @@ -143,12 +143,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (128) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_GCC/Boot/hooks.c b/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_GCC/Boot/hooks.c index e4937250..27a8d774 100644 --- a/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_GCC/Boot/hooks.c +++ b/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_GCC/Boot/hooks.c @@ -239,6 +239,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_IAR/Boot/config.h b/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_IAR/Boot/config.h index 255b4f03..83353ee8 100644 --- a/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_IAR/Boot/config.h +++ b/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_IAR/Boot/config.h @@ -145,12 +145,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (128) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_IAR/Boot/hooks.c b/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_IAR/Boot/hooks.c index 651b4960..3e6c68cd 100644 --- a/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_IAR/Boot/hooks.c +++ b/Target/Demo/ARMCM3_STM32_Olimex_STM32H103_IAR/Boot/hooks.c @@ -239,6 +239,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_Crossworks/Boot/config.h b/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_Crossworks/Boot/config.h index 0e4ab724..0bb9fe4c 100644 --- a/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_Crossworks/Boot/config.h +++ b/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_Crossworks/Boot/config.h @@ -166,12 +166,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (128) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_Crossworks/Boot/hooks.c b/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_Crossworks/Boot/hooks.c index 2f4f33e4..4ad04ef7 100644 --- a/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_Crossworks/Boot/hooks.c +++ b/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_Crossworks/Boot/hooks.c @@ -158,6 +158,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_GCC/Boot/config.h b/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_GCC/Boot/config.h index bfa7fdb7..7cd9d4b5 100644 --- a/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_GCC/Boot/config.h +++ b/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_GCC/Boot/config.h @@ -166,12 +166,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (128) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_GCC/Boot/hooks.c b/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_GCC/Boot/hooks.c index 849df52b..93c52089 100644 --- a/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_GCC/Boot/hooks.c +++ b/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_GCC/Boot/hooks.c @@ -158,6 +158,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_IAR/Boot/config.h b/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_IAR/Boot/config.h index 1665d431..daf862e6 100644 --- a/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_IAR/Boot/config.h +++ b/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_IAR/Boot/config.h @@ -168,12 +168,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (128) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_IAR/Boot/hooks.c b/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_IAR/Boot/hooks.c index d13b491c..0f0b1596 100644 --- a/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_IAR/Boot/hooks.c +++ b/Target/Demo/ARMCM3_STM32_Olimex_STM32P103_IAR/Boot/hooks.c @@ -158,6 +158,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_Crossworks/Boot/config.h b/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_Crossworks/Boot/config.h index eec20f60..f942aba3 100644 --- a/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_Crossworks/Boot/config.h +++ b/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_Crossworks/Boot/config.h @@ -139,12 +139,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (1024) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_Crossworks/Boot/hooks.c b/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_Crossworks/Boot/hooks.c index 3f4f2025..847c8694 100644 --- a/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_Crossworks/Boot/hooks.c +++ b/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_Crossworks/Boot/hooks.c @@ -31,6 +31,9 @@ * \endinternal ****************************************************************************************/ +/**************************************************************************************** +* Include files +****************************************************************************************/ #include "boot.h" /* bootloader generic header */ #if (BOOT_FILE_LOGGING_ENABLE > 0) #include "stm32f4xx.h" /* STM32 registers */ @@ -155,6 +158,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_GCC/Boot/config.h b/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_GCC/Boot/config.h index 67d0c60f..5e4f4fff 100644 --- a/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_GCC/Boot/config.h +++ b/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_GCC/Boot/config.h @@ -139,12 +139,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (1024) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_GCC/Boot/hooks.c b/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_GCC/Boot/hooks.c index bb4b86e7..616323f4 100644 --- a/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_GCC/Boot/hooks.c +++ b/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_GCC/Boot/hooks.c @@ -31,6 +31,9 @@ * \endinternal ****************************************************************************************/ +/**************************************************************************************** +* Include files +****************************************************************************************/ #include "boot.h" /* bootloader generic header */ #if (BOOT_FILE_LOGGING_ENABLE > 0) #include "stm32f4xx.h" /* STM32 registers */ @@ -155,6 +158,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_IAR/Boot/config.h b/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_IAR/Boot/config.h index 9365475c..4fa3c1e0 100644 --- a/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_IAR/Boot/config.h +++ b/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_IAR/Boot/config.h @@ -141,12 +141,16 @@ * present on the microcontroller. Through these hook functions the NVM driver can be * extended to support additional memory types such as external flash memory and serial * eeproms. The size of the internal memory in kilobytes is specified with configurable - * BOOT_NVM_SIZE_KB. + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. */ /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ #define BOOT_NVM_HOOKS_ENABLE (0) /** \brief Configure the size of the default memory device (typically flash EEPROM). */ #define BOOT_NVM_SIZE_KB (1024) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) /**************************************************************************************** diff --git a/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_IAR/Boot/hooks.c b/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_IAR/Boot/hooks.c index 4f8f81fb..8df5e3b6 100644 --- a/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_IAR/Boot/hooks.c +++ b/Target/Demo/ARMCM4_STM32_Olimex_STM32E407_IAR/Boot/hooks.c @@ -31,6 +31,9 @@ * \endinternal ****************************************************************************************/ +/**************************************************************************************** +* Include files +****************************************************************************************/ #include "boot.h" /* bootloader generic header */ #if (BOOT_FILE_LOGGING_ENABLE > 0) #include "stm32f4xx.h" /* STM32 registers */ @@ -155,6 +158,34 @@ blt_bool NvmDoneHook(void) #endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_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 ****************************************************************************************/ diff --git a/Target/Source/ARM7_LPC2000/nvm.c b/Target/Source/ARM7_LPC2000/nvm.c index 67c0f187..46edb6b9 100644 --- a/Target/Source/ARM7_LPC2000/nvm.c +++ b/Target/Source/ARM7_LPC2000/nvm.c @@ -47,6 +47,12 @@ extern blt_int8u NvmEraseHook(blt_addr addr, blt_int32u len); extern blt_bool NvmDoneHook(void); #endif +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +extern blt_bool NvmWriteChecksumHook(void); +extern blt_bool NvmVerifyChecksumHook(void); +#endif + + /************************************************************************************//** ** \brief Initializes the NVM driver. @@ -158,8 +164,13 @@ blt_bool NvmErase(blt_addr addr, blt_int32u len) ****************************************************************************************/ blt_bool NvmVerifyChecksum(void) { - /* check checksum */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) + /* check checksum using the application specific method. */ + return NvmVerifyChecksumHook(); +#else + /* check checksum using the interally supported method. */ return FlashVerifyChecksum(); +#endif } /*** end of NvmVerifyChecksum ***/ @@ -182,11 +193,21 @@ blt_bool NvmDone(void) return BLT_FALSE; } #endif - /* compute and write checksum, which is programmed by the internal driver */ + +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) + /* compute and write checksum, using the application specific method. */ + if (NvmWriteChecksumHook() == BLT_FALSE) + { + return BLT_FALSE; + } +#else + /* compute and write checksum, which is programmed by the internal driver. */ if (FlashWriteChecksum() == BLT_FALSE) { return BLT_FALSE; } +#endif + /* finish up internal driver operations */ return FlashDone(); } /*** end of NvmDone ***/ diff --git a/Target/Source/ARMCM3_EFM32/nvm.c b/Target/Source/ARMCM3_EFM32/nvm.c index 03a358a3..87eed159 100644 --- a/Target/Source/ARMCM3_EFM32/nvm.c +++ b/Target/Source/ARMCM3_EFM32/nvm.c @@ -47,6 +47,12 @@ extern blt_int8u NvmEraseHook(blt_addr addr, blt_int32u len); extern blt_bool NvmDoneHook(void); #endif +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +extern blt_bool NvmWriteChecksumHook(void); +extern blt_bool NvmVerifyChecksumHook(void); +#endif + + /************************************************************************************//** ** \brief Initializes the NVM driver. @@ -158,8 +164,13 @@ blt_bool NvmErase(blt_addr addr, blt_int32u len) ****************************************************************************************/ blt_bool NvmVerifyChecksum(void) { - /* check checksum */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) + /* check checksum using the application specific method. */ + return NvmVerifyChecksumHook(); +#else + /* check checksum using the interally supported method. */ return FlashVerifyChecksum(); +#endif } /*** end of NvmVerifyChecksum ***/ @@ -182,11 +193,21 @@ blt_bool NvmDone(void) return BLT_FALSE; } #endif - /* compute and write checksum, which is programmed by the internal driver */ + +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) + /* compute and write checksum, using the application specific method. */ + if (NvmWriteChecksumHook() == BLT_FALSE) + { + return BLT_FALSE; + } +#else + /* compute and write checksum, which is programmed by the internal driver. */ if (FlashWriteChecksum() == BLT_FALSE) { return BLT_FALSE; } +#endif + /* finish up internal driver operations */ return FlashDone(); } /*** end of NvmDone ***/ diff --git a/Target/Source/ARMCM3_LM3S/nvm.c b/Target/Source/ARMCM3_LM3S/nvm.c index bff5bc28..70de2f56 100644 --- a/Target/Source/ARMCM3_LM3S/nvm.c +++ b/Target/Source/ARMCM3_LM3S/nvm.c @@ -47,6 +47,12 @@ extern blt_int8u NvmEraseHook(blt_addr addr, blt_int32u len); extern blt_bool NvmDoneHook(void); #endif +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +extern blt_bool NvmWriteChecksumHook(void); +extern blt_bool NvmVerifyChecksumHook(void); +#endif + + /************************************************************************************//** ** \brief Initializes the NVM driver. @@ -158,8 +164,13 @@ blt_bool NvmErase(blt_addr addr, blt_int32u len) ****************************************************************************************/ blt_bool NvmVerifyChecksum(void) { - /* check checksum */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) + /* check checksum using the application specific method. */ + return NvmVerifyChecksumHook(); +#else + /* check checksum using the interally supported method. */ return FlashVerifyChecksum(); +#endif } /*** end of NvmVerifyChecksum ***/ @@ -182,11 +193,21 @@ blt_bool NvmDone(void) return BLT_FALSE; } #endif - /* compute and write checksum, which is programmed by the internal driver */ + +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) + /* compute and write checksum, using the application specific method. */ + if (NvmWriteChecksumHook() == BLT_FALSE) + { + return BLT_FALSE; + } +#else + /* compute and write checksum, which is programmed by the internal driver. */ if (FlashWriteChecksum() == BLT_FALSE) { return BLT_FALSE; } +#endif + /* finish up internal driver operations */ return FlashDone(); } /*** end of NvmDone ***/ diff --git a/Target/Source/ARMCM3_STM32/nvm.c b/Target/Source/ARMCM3_STM32/nvm.c index 184a9079..7912f1b9 100644 --- a/Target/Source/ARMCM3_STM32/nvm.c +++ b/Target/Source/ARMCM3_STM32/nvm.c @@ -47,6 +47,12 @@ extern blt_int8u NvmEraseHook(blt_addr addr, blt_int32u len); extern blt_bool NvmDoneHook(void); #endif +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +extern blt_bool NvmWriteChecksumHook(void); +extern blt_bool NvmVerifyChecksumHook(void); +#endif + + /************************************************************************************//** ** \brief Initializes the NVM driver. @@ -158,8 +164,13 @@ blt_bool NvmErase(blt_addr addr, blt_int32u len) ****************************************************************************************/ blt_bool NvmVerifyChecksum(void) { - /* check checksum */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) + /* check checksum using the application specific method. */ + return NvmVerifyChecksumHook(); +#else + /* check checksum using the interally supported method. */ return FlashVerifyChecksum(); +#endif } /*** end of NvmVerifyChecksum ***/ @@ -182,11 +193,21 @@ blt_bool NvmDone(void) return BLT_FALSE; } #endif - /* compute and write checksum, which is programmed by the internal driver */ + +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) + /* compute and write checksum, using the application specific method. */ + if (NvmWriteChecksumHook() == BLT_FALSE) + { + return BLT_FALSE; + } +#else + /* compute and write checksum, which is programmed by the internal driver. */ if (FlashWriteChecksum() == BLT_FALSE) { return BLT_FALSE; } +#endif + /* finish up internal driver operations */ return FlashDone(); } /*** end of NvmDone ***/ diff --git a/Target/Source/ARMCM4_STM32/nvm.c b/Target/Source/ARMCM4_STM32/nvm.c index ceeec7db..484841d9 100644 --- a/Target/Source/ARMCM4_STM32/nvm.c +++ b/Target/Source/ARMCM4_STM32/nvm.c @@ -47,6 +47,12 @@ extern blt_int8u NvmEraseHook(blt_addr addr, blt_int32u len); extern blt_bool NvmDoneHook(void); #endif +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +extern blt_bool NvmWriteChecksumHook(void); +extern blt_bool NvmVerifyChecksumHook(void); +#endif + + /************************************************************************************//** ** \brief Initializes the NVM driver. @@ -158,8 +164,13 @@ blt_bool NvmErase(blt_addr addr, blt_int32u len) ****************************************************************************************/ blt_bool NvmVerifyChecksum(void) { - /* check checksum */ +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) + /* check checksum using the application specific method. */ + return NvmVerifyChecksumHook(); +#else + /* check checksum using the interally supported method. */ return FlashVerifyChecksum(); +#endif } /*** end of NvmVerifyChecksum ***/ @@ -182,11 +193,21 @@ blt_bool NvmDone(void) return BLT_FALSE; } #endif - /* compute and write checksum, which is programmed by the internal driver */ + +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) + /* compute and write checksum, using the application specific method. */ + if (NvmWriteChecksumHook() == BLT_FALSE) + { + return BLT_FALSE; + } +#else + /* compute and write checksum, which is programmed by the internal driver. */ if (FlashWriteChecksum() == BLT_FALSE) { return BLT_FALSE; } +#endif + /* finish up internal driver operations */ return FlashDone(); } /*** end of NvmDone ***/ diff --git a/Target/Source/boot.h b/Target/Source/boot.h index 6df90cb6..8cc83c07 100644 --- a/Target/Source/boot.h +++ b/Target/Source/boot.h @@ -50,6 +50,17 @@ #include "xcp.h" /* xcp communication layer */ +/**************************************************************************************** +* Defines +****************************************************************************************/ +/** \brief Main version of the bootloader core. */ +#define BOOT_VERSION_CORE_MAIN (0u) +/** \brief Minor version of the bootloader core. */ +#define BOOT_VERSION_CORE_MINOR (96u) +/** \brief Bufgix version of the bootloader core. */ +#define BOOT_VERSION_CORE_BUGFIX (0u) + + /**************************************************************************************** * Function prototypes ****************************************************************************************/ diff --git a/Target/Source/plausibility.h b/Target/Source/plausibility.h index e375a712..e5735bed 100644 --- a/Target/Source/plausibility.h +++ b/Target/Source/plausibility.h @@ -292,6 +292,14 @@ #error "BOOT_NVM_SIZE_KB must be > 0" #endif +#ifndef BOOT_NVM_CHECKSUM_HOOKS_ENABLE +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) +#endif + +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE < 0) || (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 1) +#error "BOOT_NVM_CHECKSUM_HOOKS_ENABLE must be 0 or 1" +#endif + /**************************************************************************************** * W A T C H D O G D R I V E R C O N F I G U R A T I O N C H E C K