WEAK void __valid_user_code_checksum(void); void (* const g_pfnVectors[])(void) = { // Core Level - CM3 (void *)&_vStackTop, // The initial stack pointer ResetISR, // The reset handler NMI_Handler, // The NMI handler HardFault_Handler, // The hard fault handler MemManage_Handler, // The MPU fault handler BusFault_Handler, // The bus fault handler UsageFault_Handler, // The usage fault handler (void *)&__valid_user_code_checksum, // Checksum ... etc } |
/* Calculate NXP Cortex-M3 valid user code checksum. This is 0-(sum of first 7 entries in vector table), * Note that we must add 1 to each code space vector (LSB = marker for thumb code). */ PROVIDE(__valid_user_code_checksum = 0 - (_vStackTop + (ResetISR + 1) + (NMI_Handler + 1) + (HardFault_Handler + 1) + (MemManage_Handler + 1) + (BusFault_Handler + 1) + (UsageFault_Handler + 1))); |
Hi,
Sorry to re-open this topic, but i'm working on a LPC804 (Cortex-M0+), and I would like to know if I need to modify the linker script ?
/* ## Create checksum value (used in startup) ## */
PROVIDE(__valid_user_code_checksum = 0 -
(_vStackTop
+ (ResetISR + 1)
+ (( DEFINED(NMI_Handler) ? NMI_Handler : M0_NMI_Handler ) + 1)
+ (( DEFINED(HardFault_Handler) ? HardFault_Handler : M0_HardFault_Handler ) + 1)
)
);
Because my vector table looks like this :
void (* const g_pfnVectors[])(void) = {
// Core Level - CM0P
&_vStackTop, // The initial stack pointer
ResetISR, // The reset handler
NMI_Handler, // The NMI handler
HardFault_Handler, // The hard fault handler
0, // Reserved
0, // Reserved
0, // Reserved
__valid_user_code_checksum, // LPC MCU checksum
0, // ECRP
0, // Reserved
0, // Reserved
SVC_Handler, // SVCall handler
0, // Reserved
0, // Reserved
PendSV_Handler, // The PendSV handler
SysTick_Handler, // The SysTick handler
... etc
};
Do I need to add the SVC_Handler / PendSV_Handler / SysTick_Handler to the checksum operation ?
And do I need to add this to the vector table and checksum operation ?
MemManage_Handler, // The MPU fault handler BusFault_Handler, // The bus fault handler UsageFault_Handler, // The usage fault handler
Or all of this is okay ?
BR,
Loïc