From b402b7a8c655002407b9ec41ab06b74365004791 Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Fri, 18 Aug 2017 17:12:28 -0500 Subject: [PATCH] Fix crash on boot due to vector size mismatch If NVIC_NUM_VECTORS is larger than the space allocated by the vector table in ram (__ram_vector_table_size__) then the call to mbed_cpy_nvic during boot will corrupt valid data, which can lead to a crash. This patch fixes the declared number of vectors on the KL27Z, KL43Z and KL82Z to fix this crash. --- .../TARGET_MCUXpresso_MCUS/TARGET_KL27Z/device/cmsis_nvic.h | 2 +- .../TARGET_MCUXpresso_MCUS/TARGET_KL43Z/device/cmsis_nvic.h | 2 +- .../TARGET_MCUXpresso_MCUS/TARGET_KL82Z/device/cmsis_nvic.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL27Z/device/cmsis_nvic.h b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL27Z/device/cmsis_nvic.h index 93a590e880..84ad93b14f 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL27Z/device/cmsis_nvic.h +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL27Z/device/cmsis_nvic.h @@ -39,7 +39,7 @@ extern uint32_t __VECTOR_RAM[]; #endif /* Symbols defined by the linker script */ -#define NVIC_NUM_VECTORS (16 + 240) // CORE + MCU Peripherals +#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals #define NVIC_RAM_VECTOR_ADDRESS (__VECTOR_RAM) // Vectors positioned at start of RAM #endif diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL43Z/device/cmsis_nvic.h b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL43Z/device/cmsis_nvic.h index 93a590e880..84ad93b14f 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL43Z/device/cmsis_nvic.h +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL43Z/device/cmsis_nvic.h @@ -39,7 +39,7 @@ extern uint32_t __VECTOR_RAM[]; #endif /* Symbols defined by the linker script */ -#define NVIC_NUM_VECTORS (16 + 240) // CORE + MCU Peripherals +#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals #define NVIC_RAM_VECTOR_ADDRESS (__VECTOR_RAM) // Vectors positioned at start of RAM #endif diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/device/cmsis_nvic.h b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/device/cmsis_nvic.h index 93a590e880..84ad93b14f 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/device/cmsis_nvic.h +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/device/cmsis_nvic.h @@ -39,7 +39,7 @@ extern uint32_t __VECTOR_RAM[]; #endif /* Symbols defined by the linker script */ -#define NVIC_NUM_VECTORS (16 + 240) // CORE + MCU Peripherals +#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals #define NVIC_RAM_VECTOR_ADDRESS (__VECTOR_RAM) // Vectors positioned at start of RAM #endif