diff --git a/Target/Demo/ARMCM3_STM32F1_Nucleo_F103RB_GCC/Boot/blt_conf.h b/Target/Demo/ARMCM3_STM32F1_Nucleo_F103RB_GCC/Boot/blt_conf.h index 61f2a711..ac49646a 100644 --- a/Target/Demo/ARMCM3_STM32F1_Nucleo_F103RB_GCC/Boot/blt_conf.h +++ b/Target/Demo/ARMCM3_STM32F1_Nucleo_F103RB_GCC/Boot/blt_conf.h @@ -146,7 +146,7 @@ * a different checksum location, because this one is added at the end of the * user program's vector table. */ -#define FLASH_VECTOR_TABLE_CS_OFFSET (0xec) +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0xec) /** \brief Enable support for a custom flash layout table. It is located in * flash_layout.c. This was done because the default flashLayout[] table * in the bootloader's core has more flash memory reserved for the bootloader diff --git a/Target/Demo/ARMCM3_STM32F1_Olimex_STM32H103_GCC/Boot/blt_conf.h b/Target/Demo/ARMCM3_STM32F1_Olimex_STM32H103_GCC/Boot/blt_conf.h index 289c7c6f..4e98b28e 100644 --- a/Target/Demo/ARMCM3_STM32F1_Olimex_STM32H103_GCC/Boot/blt_conf.h +++ b/Target/Demo/ARMCM3_STM32F1_Olimex_STM32H103_GCC/Boot/blt_conf.h @@ -128,7 +128,7 @@ * a different checksum location, because this one is added at the end of the * user program's vector table. */ -#define FLASH_VECTOR_TABLE_CS_OFFSET (0xec) +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0xec) /** \brief Enable support for a custom flash layout table. It is located in * flash_layout.c. This was done because the default flashLayout[] table * in the bootloader's core has more flash memory reserved for the bootloader diff --git a/Target/Demo/ARMCM3_STM32F1_Olimex_STM32H103_IAR/Boot/blt_conf.h b/Target/Demo/ARMCM3_STM32F1_Olimex_STM32H103_IAR/Boot/blt_conf.h index a174a8a6..c2f85289 100644 --- a/Target/Demo/ARMCM3_STM32F1_Olimex_STM32H103_IAR/Boot/blt_conf.h +++ b/Target/Demo/ARMCM3_STM32F1_Olimex_STM32H103_IAR/Boot/blt_conf.h @@ -128,7 +128,7 @@ * a different checksum location, because this one is added at the end of the * user program's vector table. */ -#define FLASH_VECTOR_TABLE_CS_OFFSET (0xec) +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0xec) /** \brief Enable support for a custom flash layout table. It is located in * flash_layout.c. This was done because the default flashLayout[] table * in the bootloader's core has more flash memory reserved for the bootloader diff --git a/Target/Demo/ARMCM3_STM32F1_Olimex_STM32P103_GCC/Boot/blt_conf.h b/Target/Demo/ARMCM3_STM32F1_Olimex_STM32P103_GCC/Boot/blt_conf.h index a94c9f66..a9f0d0d7 100644 --- a/Target/Demo/ARMCM3_STM32F1_Olimex_STM32P103_GCC/Boot/blt_conf.h +++ b/Target/Demo/ARMCM3_STM32F1_Olimex_STM32P103_GCC/Boot/blt_conf.h @@ -182,7 +182,7 @@ * a different checksum location, because this one is added at the end of the * user program's vector table. */ -#define FLASH_VECTOR_TABLE_CS_OFFSET (0xec) +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0xec) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_STM32F1_Olimex_STM32P103_IAR/Boot/blt_conf.h b/Target/Demo/ARMCM3_STM32F1_Olimex_STM32P103_IAR/Boot/blt_conf.h index 760e120f..4db355ce 100644 --- a/Target/Demo/ARMCM3_STM32F1_Olimex_STM32P103_IAR/Boot/blt_conf.h +++ b/Target/Demo/ARMCM3_STM32F1_Olimex_STM32P103_IAR/Boot/blt_conf.h @@ -182,7 +182,7 @@ * a different checksum location, because this one is added at the end of the * user program's vector table. */ -#define FLASH_VECTOR_TABLE_CS_OFFSET (0xec) +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0xec) /**************************************************************************************** diff --git a/Target/Demo/ARMCM3_STM32F1_Olimexino_STM32_GCC/Boot/blt_conf.h b/Target/Demo/ARMCM3_STM32F1_Olimexino_STM32_GCC/Boot/blt_conf.h index 4e5f01de..67191fa4 100644 --- a/Target/Demo/ARMCM3_STM32F1_Olimexino_STM32_GCC/Boot/blt_conf.h +++ b/Target/Demo/ARMCM3_STM32F1_Olimexino_STM32_GCC/Boot/blt_conf.h @@ -192,7 +192,7 @@ * a different checksum location, because this one is added at the end of the * user program's vector table. */ -#define FLASH_VECTOR_TABLE_CS_OFFSET (0xec) +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0xec) /**************************************************************************************** diff --git a/Target/Source/ARMCM0_STM32F0/flash.c b/Target/Source/ARMCM0_STM32F0/flash.c index 79b79ed7..4b8789c0 100644 --- a/Target/Source/ARMCM0_STM32F0/flash.c +++ b/Target/Source/ARMCM0_STM32F0/flash.c @@ -58,16 +58,16 @@ * of the checksum in the user program accordingly. Otherwise the checksum * verification will always fail. */ -#ifndef FLASH_VECTOR_TABLE_CS_OFFSET -#define FLASH_VECTOR_TABLE_CS_OFFSET (0xC0) +#ifndef BOOT_FLASH_VECTOR_TABLE_CS_OFFSET +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0xC0) #endif /**************************************************************************************** * Plausibility checks ****************************************************************************************/ -#if (FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) -#error "FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." +#if (BOOT_FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) +#error "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." #endif #ifndef BOOT_FLASH_CUSTOM_LAYOUT_ENABLE @@ -363,7 +363,7 @@ blt_bool FlashWriteChecksum(void) signature_checksum += 1; /* two's complement */ /* write the checksum */ - return FlashWrite(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET, + return FlashWrite(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET, sizeof(blt_addr), (blt_int8u *)&signature_checksum); } /*** end of FlashWriteChecksum ***/ @@ -386,7 +386,7 @@ blt_bool FlashVerifyChecksum(void) signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x10)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x14)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x18)); - signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET)); + signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET)); /* sum should add up to an unsigned 32-bit value of 0 */ if (signature_checksum == 0) { diff --git a/Target/Source/ARMCM0_XMC1/flash.c b/Target/Source/ARMCM0_XMC1/flash.c index 7ee0786e..2963e0b7 100644 --- a/Target/Source/ARMCM0_XMC1/flash.c +++ b/Target/Source/ARMCM0_XMC1/flash.c @@ -54,8 +54,8 @@ * of the checksum in the user program accordingly. Otherwise the checksum * verification will always fail. */ -#ifndef FLASH_VECTOR_TABLE_CS_OFFSET -#define FLASH_VECTOR_TABLE_CS_OFFSET (0x018) +#ifndef BOOT_FLASH_VECTOR_TABLE_CS_OFFSET +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0x018) #endif /** \brief Maximum time for a sector erase operation as specified by the XCM1xxx data- @@ -72,8 +72,8 @@ /**************************************************************************************** * Plausibility checks ****************************************************************************************/ -#if (FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) -#error "FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." +#if (BOOT_FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) +#error "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." #endif #ifndef BOOT_FLASH_CUSTOM_LAYOUT_ENABLE @@ -387,7 +387,7 @@ blt_bool FlashWriteChecksum(void) signature_checksum += 1; /* two's complement */ /* write the checksum */ - return FlashWrite(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET, + return FlashWrite(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET, sizeof(blt_addr), (blt_int8u *)&signature_checksum); } /*** end of FlashWriteChecksum ***/ @@ -409,7 +409,7 @@ blt_bool FlashVerifyChecksum(void) signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x0C)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x10)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x14)); - signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET)); + signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET)); /* sum should add up to an unsigned 32-bit value of 0 */ if (signature_checksum == 0) { diff --git a/Target/Source/ARMCM3_EFM32/flash.c b/Target/Source/ARMCM3_EFM32/flash.c index 6b2386ef..abea9476 100644 --- a/Target/Source/ARMCM3_EFM32/flash.c +++ b/Target/Source/ARMCM3_EFM32/flash.c @@ -51,16 +51,16 @@ * of the checksum in the user program accordingly. Otherwise the checksum * verification will always fail. */ -#ifndef FLASH_VECTOR_TABLE_CS_OFFSET -#define FLASH_VECTOR_TABLE_CS_OFFSET (0x0B8) +#ifndef BOOT_FLASH_VECTOR_TABLE_CS_OFFSET +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0x0B8) #endif /**************************************************************************************** * Plausibility checks ****************************************************************************************/ -#if (FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) -#error "FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." +#if (BOOT_FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) +#error "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." #endif #ifndef BOOT_FLASH_CUSTOM_LAYOUT_ENABLE @@ -360,7 +360,7 @@ blt_bool FlashWriteChecksum(void) signature_checksum += 1; /* two's complement */ /* write the checksum */ - return FlashWrite(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET, + return FlashWrite(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET, sizeof(blt_addr), (blt_int8u *)&signature_checksum); } /*** end of FlashWriteChecksum ***/ @@ -383,7 +383,7 @@ blt_bool FlashVerifyChecksum(void) signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x10)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x14)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x18)); - signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET)); + signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET)); /* sum should add up to an unsigned 32-bit value of 0 */ if (signature_checksum == 0) { diff --git a/Target/Source/ARMCM3_LM3S/flash.c b/Target/Source/ARMCM3_LM3S/flash.c index 2db075bc..4bcf16ce 100644 --- a/Target/Source/ARMCM3_LM3S/flash.c +++ b/Target/Source/ARMCM3_LM3S/flash.c @@ -55,16 +55,16 @@ * of the checksum in the user program accordingly. Otherwise the checksum * verification will always fail. */ -#ifndef FLASH_VECTOR_TABLE_CS_OFFSET -#define FLASH_VECTOR_TABLE_CS_OFFSET (0xF0) +#ifndef BOOT_FLASH_VECTOR_TABLE_CS_OFFSET +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0xF0) #endif /**************************************************************************************** * Plausibility checks ****************************************************************************************/ -#if (FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) -#error "FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." +#if (BOOT_FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) +#error "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." #endif #ifndef BOOT_FLASH_CUSTOM_LAYOUT_ENABLE @@ -361,7 +361,7 @@ blt_bool FlashWriteChecksum(void) signature_checksum += 1; /* two's complement */ /* write the checksum */ - return FlashWrite(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET, + return FlashWrite(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET, sizeof(blt_addr), (blt_int8u *)&signature_checksum); } /*** end of FlashWriteChecksum ***/ @@ -384,7 +384,7 @@ blt_bool FlashVerifyChecksum(void) signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x10)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x14)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x18)); - signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET)); + signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET)); /* sum should add up to an unsigned 32-bit value of 0 */ if (signature_checksum == 0) { diff --git a/Target/Source/ARMCM3_STM32F1/flash.c b/Target/Source/ARMCM3_STM32F1/flash.c index 2bacfcfb..0d2e4cf3 100644 --- a/Target/Source/ARMCM3_STM32F1/flash.c +++ b/Target/Source/ARMCM3_STM32F1/flash.c @@ -59,8 +59,8 @@ * of the checksum in the user program accordingly. Otherwise the checksum * verification will always fail. */ -#ifndef FLASH_VECTOR_TABLE_CS_OFFSET -#define FLASH_VECTOR_TABLE_CS_OFFSET (0x150) +#ifndef BOOT_FLASH_VECTOR_TABLE_CS_OFFSET +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0x150) #endif #define FLASH_KEY1 ((blt_int32u)0x45670123) @@ -78,8 +78,8 @@ /**************************************************************************************** * Plausibility checks ****************************************************************************************/ -#if (FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) -#error "FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." +#if (BOOT_FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) +#error "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." #endif #ifndef BOOT_FLASH_CUSTOM_LAYOUT_ENABLE @@ -392,7 +392,7 @@ blt_bool FlashWriteChecksum(void) signature_checksum += 1; /* two's complement */ /* write the checksum */ - return FlashWrite(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET, + return FlashWrite(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET, sizeof(blt_addr), (blt_int8u *)&signature_checksum); } /*** end of FlashWriteChecksum ***/ @@ -415,7 +415,7 @@ blt_bool FlashVerifyChecksum(void) signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x10)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x14)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x18)); - signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET)); + signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET)); /* sum should add up to an unsigned 32-bit value of 0 */ if (signature_checksum == 0) { diff --git a/Target/Source/ARMCM3_STM32F2/flash.c b/Target/Source/ARMCM3_STM32F2/flash.c index 5cd04189..e7386fdf 100644 --- a/Target/Source/ARMCM3_STM32F2/flash.c +++ b/Target/Source/ARMCM3_STM32F2/flash.c @@ -51,16 +51,16 @@ * of the checksum in the user program accordingly. Otherwise the checksum * verification will always fail. */ -#ifndef FLASH_VECTOR_TABLE_CS_OFFSET -#define FLASH_VECTOR_TABLE_CS_OFFSET (0x184) +#ifndef BOOT_FLASH_VECTOR_TABLE_CS_OFFSET +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0x184) #endif /**************************************************************************************** * Plausibility checks ****************************************************************************************/ -#if (FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) -#error "FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." +#if (BOOT_FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) +#error "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." #endif #ifndef BOOT_FLASH_CUSTOM_LAYOUT_ENABLE @@ -353,7 +353,7 @@ blt_bool FlashWriteChecksum(void) signature_checksum += 1; /* two's complement */ /* write the checksum */ - return FlashWrite(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET, + return FlashWrite(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET, sizeof(blt_addr), (blt_int8u *)&signature_checksum); } /*** end of FlashWriteChecksum ***/ @@ -376,7 +376,7 @@ blt_bool FlashVerifyChecksum(void) signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x10)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x14)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x18)); - signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET)); + signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET)); /* sum should add up to an unsigned 32-bit value of 0 */ if (signature_checksum == 0) { diff --git a/Target/Source/ARMCM4_STM32F3/flash.c b/Target/Source/ARMCM4_STM32F3/flash.c index 5058011c..a655f3a3 100644 --- a/Target/Source/ARMCM4_STM32F3/flash.c +++ b/Target/Source/ARMCM4_STM32F3/flash.c @@ -58,16 +58,16 @@ * of the checksum in the user program accordingly. Otherwise the checksum * verification will always fail. */ -#ifndef FLASH_VECTOR_TABLE_CS_OFFSET -#define FLASH_VECTOR_TABLE_CS_OFFSET (0x188) +#ifndef BOOT_FLASH_VECTOR_TABLE_CS_OFFSET +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0x188) #endif /**************************************************************************************** * Plausibility checks ****************************************************************************************/ -#if (FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) -#error "FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." +#if (BOOT_FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) +#error "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." #endif #ifndef BOOT_FLASH_CUSTOM_LAYOUT_ENABLE @@ -396,7 +396,7 @@ blt_bool FlashWriteChecksum(void) signature_checksum += 1; /* two's complement */ /* write the checksum */ - return FlashWrite(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET, + return FlashWrite(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET, sizeof(blt_addr), (blt_int8u *)&signature_checksum); } /*** end of FlashWriteChecksum ***/ @@ -419,7 +419,7 @@ blt_bool FlashVerifyChecksum(void) signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x10)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x14)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x18)); - signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET)); + signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET)); /* sum should add up to an unsigned 32-bit value of 0 */ if (signature_checksum == 0) { diff --git a/Target/Source/ARMCM4_STM32F4/flash.c b/Target/Source/ARMCM4_STM32F4/flash.c index f8db6882..4c0d56aa 100644 --- a/Target/Source/ARMCM4_STM32F4/flash.c +++ b/Target/Source/ARMCM4_STM32F4/flash.c @@ -52,16 +52,16 @@ * of the checksum in the user program accordingly. Otherwise the checksum * verification will always fail. */ -#ifndef FLASH_VECTOR_TABLE_CS_OFFSET -#define FLASH_VECTOR_TABLE_CS_OFFSET (0x188) +#ifndef BOOT_FLASH_VECTOR_TABLE_CS_OFFSET +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0x188) #endif /**************************************************************************************** * Plausibility checks ****************************************************************************************/ -#if (FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) -#error "FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." +#if (BOOT_FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) +#error "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." #endif #ifndef BOOT_FLASH_CUSTOM_LAYOUT_ENABLE @@ -376,7 +376,7 @@ blt_bool FlashWriteChecksum(void) signature_checksum += 1; /* two's complement */ /* write the checksum */ - return FlashWrite(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET, + return FlashWrite(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET, sizeof(blt_addr), (blt_int8u *)&signature_checksum); } /*** end of FlashWriteChecksum ***/ @@ -399,7 +399,7 @@ blt_bool FlashVerifyChecksum(void) signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x10)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x14)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x18)); - signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET)); + signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET)); /* sum should add up to an unsigned 32-bit value of 0 */ if (signature_checksum == 0) { diff --git a/Target/Source/ARMCM4_TM4C/flash.c b/Target/Source/ARMCM4_TM4C/flash.c index 35425e1e..e5626bad 100644 --- a/Target/Source/ARMCM4_TM4C/flash.c +++ b/Target/Source/ARMCM4_TM4C/flash.c @@ -57,16 +57,16 @@ * of the checksum in the user program accordingly. Otherwise the checksum * verification will always fail. */ -#ifndef FLASH_VECTOR_TABLE_CS_OFFSET -#define FLASH_VECTOR_TABLE_CS_OFFSET (0x26C) +#ifndef BOOT_FLASH_VECTOR_TABLE_CS_OFFSET +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0x26C) #endif /**************************************************************************************** * Plausibility checks ****************************************************************************************/ -#if (FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) -#error "FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." +#if (BOOT_FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) +#error "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." #endif #ifndef BOOT_FLASH_CUSTOM_LAYOUT_ENABLE @@ -363,7 +363,7 @@ blt_bool FlashWriteChecksum(void) signature_checksum += 1; /* two's complement */ /* write the checksum */ - return FlashWrite(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET, + return FlashWrite(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET, sizeof(blt_addr), (blt_int8u *)&signature_checksum); } /*** end of FlashWriteChecksum ***/ @@ -386,7 +386,7 @@ blt_bool FlashVerifyChecksum(void) signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x10)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x14)); signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+0x18)); - signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET)); + signature_checksum += *((blt_int32u *)(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET)); /* sum should add up to an unsigned 32-bit value of 0 */ if (signature_checksum == 0) { diff --git a/Target/Source/ARMCM4_XMC4/flash.c b/Target/Source/ARMCM4_XMC4/flash.c index 8687bdaf..a65b999d 100644 --- a/Target/Source/ARMCM4_XMC4/flash.c +++ b/Target/Source/ARMCM4_XMC4/flash.c @@ -53,8 +53,8 @@ * of the checksum in the user program accordingly. Otherwise the checksum * verification will always fail. */ -#ifndef FLASH_VECTOR_TABLE_CS_OFFSET -#define FLASH_VECTOR_TABLE_CS_OFFSET (0x200) +#ifndef BOOT_FLASH_VECTOR_TABLE_CS_OFFSET +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0x200) #endif /** \brief Minimum amount of bytes that can be programmed to flash at a time. It is @@ -84,8 +84,8 @@ /**************************************************************************************** * Plausibility checks ****************************************************************************************/ -#if (FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) -#error "FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." +#if (BOOT_FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) +#error "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." #endif #ifndef BOOT_FLASH_CUSTOM_LAYOUT_ENABLE @@ -377,7 +377,7 @@ blt_bool FlashWriteChecksum(void) signature_checksum = ~signature_checksum; /* one's complement */ /* write the checksum */ - return FlashWrite(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET, + return FlashWrite(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET, sizeof(blt_addr), (blt_int8u *)&signature_checksum); } /*** end of FlashWriteChecksum ***/ @@ -406,7 +406,7 @@ blt_bool FlashVerifyChecksum(void) /* read the checksum value from flash that was writtin by the bootloader at the end * of the last firmware update */ - signature_checksum_rom = *((blt_int32u *)(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET)); + signature_checksum_rom = *((blt_int32u *)(flashLayout[0].sector_start+BOOT_FLASH_VECTOR_TABLE_CS_OFFSET)); /* verify that they are both the same */ if (signature_checksum == signature_checksum_rom) diff --git a/Target/Source/HCS12/flash.c b/Target/Source/HCS12/flash.c index e55e0111..84ee43ae 100644 --- a/Target/Source/HCS12/flash.c +++ b/Target/Source/HCS12/flash.c @@ -45,8 +45,15 @@ #define FLASH_TOTAL_SECTORS (sizeof(flashLayout)/sizeof(flashLayout[0])) #define FLASH_LAST_SECTOR_IDX (FLASH_TOTAL_SECTORS-1) #define FLASH_ERASE_BLOCK_SIZE (512) -/** \brief Offset into the user program's vector table where the checksum is located. */ -#define FLASH_VECTOR_TABLE_CS_OFFSET (0x82) +/** \brief Offset into the user program's vector table where the checksum is located. + * Note that the value can be overriden in blt_conf.h, because the size of the + * vector table could vary. When changing this value, don't forget to update the + * location of the checksum in the user program accordingly. Otherwise the + * checksum verification will always fail. + */ +#ifndef BOOT_FLASH_VECTOR_TABLE_CS_OFFSET +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0x82) +#endif /** \brief Total size of the vector table, excluding the bootloader specific checksum. */ #define FLASH_VECTOR_TABLE_SIZE (0x80) /** \brief Start address of the bootloader programmable flash. */ @@ -101,6 +108,10 @@ /**************************************************************************************** * Plausibility checks ****************************************************************************************/ +#if (BOOT_FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) +#error "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." +#endif + #ifndef BOOT_FLASH_CUSTOM_LAYOUT_ENABLE #define BOOT_FLASH_CUSTOM_LAYOUT_ENABLE (0u) #endif @@ -562,7 +573,7 @@ blt_bool FlashWriteChecksum(void) /* write the checksum */ checksum_address = flashLayout[FLASH_LAST_SECTOR_IDX].sector_start + \ flashLayout[FLASH_LAST_SECTOR_IDX].sector_size - \ - FLASH_VECTOR_TABLE_CS_OFFSET; + BOOT_FLASH_VECTOR_TABLE_CS_OFFSET; return FlashWrite(checksum_address, sizeof(signature_checksum), (blt_int8u *)&signature_checksum); } /*** end of FlashWriteChecksum ***/ @@ -584,7 +595,7 @@ blt_bool FlashVerifyChecksum(void) /* get linear address of the checksum */ checksum_addr_lin = (flashLayout[FLASH_LAST_SECTOR_IDX].sector_start + \ flashLayout[FLASH_LAST_SECTOR_IDX].sector_size - \ - FLASH_VECTOR_TABLE_CS_OFFSET); + BOOT_FLASH_VECTOR_TABLE_CS_OFFSET); /* get linear address of the vector table start */ vector_table_addr_lin = (flashLayout[FLASH_LAST_SECTOR_IDX].sector_start + \ flashLayout[FLASH_LAST_SECTOR_IDX].sector_size - \ diff --git a/Target/Source/HCS12/flash_ecc.c b/Target/Source/HCS12/flash_ecc.c index b647aa8f..94819777 100644 --- a/Target/Source/HCS12/flash_ecc.c +++ b/Target/Source/HCS12/flash_ecc.c @@ -47,8 +47,15 @@ #define FLASH_TOTAL_SECTORS (sizeof(flashLayout)/sizeof(flashLayout[0])) #define FLASH_LAST_SECTOR_IDX (FLASH_TOTAL_SECTORS-1) #define FLASH_ERASE_BLOCK_SIZE (256) -/** \brief Offset into the user program's vector table where the checksum is located. */ -#define FLASH_VECTOR_TABLE_CS_OFFSET (0x82) +/** \brief Offset into the user program's vector table where the checksum is located. + * Note that the value can be overriden in blt_conf.h, because the size of the + * vector table could vary. When changing this value, don't forget to update the + * location of the checksum in the user program accordingly. Otherwise the + * checksum verification will always fail. + */ +#ifndef BOOT_FLASH_VECTOR_TABLE_CS_OFFSET +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0x82) +#endif /** \brief Total size of the vector table, excluding the bootloader specific checksum. */ #define FLASH_VECTOR_TABLE_SIZE (0x80) /** \brief Start address of the bootloader programmable flash. */ @@ -96,6 +103,10 @@ /**************************************************************************************** * Plausibility checks ****************************************************************************************/ +#if (BOOT_FLASH_VECTOR_TABLE_CS_OFFSET >= FLASH_WRITE_BLOCK_SIZE) +#error "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET is set too high. It must be located in the first writable block." +#endif + #ifndef BOOT_FLASH_CUSTOM_LAYOUT_ENABLE #define BOOT_FLASH_CUSTOM_LAYOUT_ENABLE (0u) #endif @@ -594,7 +605,7 @@ blt_bool FlashWriteChecksum(void) /* write the checksum */ checksum_address = flashLayout[FLASH_LAST_SECTOR_IDX].sector_start + \ flashLayout[FLASH_LAST_SECTOR_IDX].sector_size - \ - FLASH_VECTOR_TABLE_CS_OFFSET; + BOOT_FLASH_VECTOR_TABLE_CS_OFFSET; return FlashWrite(checksum_address, sizeof(signature_checksum), (blt_int8u *)&signature_checksum); } /*** end of FlashWriteChecksum ***/ @@ -616,7 +627,7 @@ blt_bool FlashVerifyChecksum(void) /* get global address of the checksum */ checksum_addr_glob = (flashLayout[FLASH_LAST_SECTOR_IDX].sector_start + \ flashLayout[FLASH_LAST_SECTOR_IDX].sector_size - \ - FLASH_VECTOR_TABLE_CS_OFFSET); + BOOT_FLASH_VECTOR_TABLE_CS_OFFSET); /* get global address of the vector table start */ vector_table_addr_glob = (flashLayout[FLASH_LAST_SECTOR_IDX].sector_start + \ flashLayout[FLASH_LAST_SECTOR_IDX].sector_size - \