From edee7c36a226e74f53d66b57a1907bb148799599 Mon Sep 17 00:00:00 2001 From: ccli8 Date: Fri, 14 Apr 2017 14:29:09 +0800 Subject: [PATCH] [NANO130] Add guard code to prevent from relocating vector table --- .../TARGET_NUVOTON/TARGET_NANO100/device/cmsis_nvic.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_NANO100/device/cmsis_nvic.c b/targets/TARGET_NUVOTON/TARGET_NANO100/device/cmsis_nvic.c index 0fa0fcaa28..f05d4c9eb1 100644 --- a/targets/TARGET_NUVOTON/TARGET_NANO100/device/cmsis_nvic.c +++ b/targets/TARGET_NUVOTON/TARGET_NANO100/device/cmsis_nvic.c @@ -14,13 +14,16 @@ * limitations under the License. */ #include "cmsis_nvic.h" +#include "platform/mbed_error.h" void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) { - //static volatile uint32_t *vectors = (uint32_t *) NVIC_RAM_VECTOR_ADDRESS; - - // Put the vectors in SRAM - //vectors[IRQn + 16] = vector; + // NOTE: On NANO130, relocating vector table is not supported due to just 16KB small SRAM. + // Add guard code to prevent from unsupported relocating. + uint32_t vector_static = NVIC_GetVector(IRQn); + if (vector_static != vector) { + error("No support for relocating vector table"); + } } uint32_t NVIC_GetVector(IRQn_Type IRQn)