From 8988b6e9dbe9b4aa1ec2e539ecec65bf540f4ee1 Mon Sep 17 00:00:00 2001 From: ccli8 Date: Mon, 11 Feb 2019 14:21:41 +0800 Subject: [PATCH] [M2351] Hook crypto interrupt handler without NVIC_SetVector --- .../TARGET_M2351/crypto/crypto-misc.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/crypto/crypto-misc.cpp b/targets/TARGET_NUVOTON/TARGET_M2351/crypto/crypto-misc.cpp index a2a8426a0a..9a6df270ab 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/crypto/crypto-misc.cpp +++ b/targets/TARGET_NUVOTON/TARGET_M2351/crypto/crypto-misc.cpp @@ -60,11 +60,6 @@ static SingletonPtr crypto_ecc_mutex; /* Atomic flag for crypto SHA AC management */ static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT; -/* NOTE: There's inconsistency in cryptography related naming, Crpt or Crypto. For example, cryptography IRQ - * handler could be CRPT_IRQHandler or CRYPTO_IRQHandler. To override default cryptography IRQ handler, see - * device/startup_{CHIP}.c for its name or call NVIC_SetVector regardless of its name. */ -void CRPT_IRQHandler(); - /* Crypto (AES, DES, SHA, etc.) init counter. Crypto's keeps active as it is non-zero. */ static uint16_t crypto_init_counter = 0U; @@ -104,8 +99,7 @@ void crypto_init(void) * NOTE: We must call secure version (from non-secure domain) because SYS/CLK regions are secure. */ CLK_EnableModuleClock_S(CRPT_MODULE); - - NVIC_SetVector(CRPT_IRQn, (uint32_t) CRPT_IRQHandler); + NVIC_EnableIRQ(CRPT_IRQn); } core_util_critical_section_exit(); @@ -315,8 +309,13 @@ static bool crypto_submodule_wait(volatile uint16_t *submodule_done) return false; } -/* Crypto interrupt handler */ -void CRPT_IRQHandler() +/* Crypto interrupt handler + * + * There's inconsistency in cryptography related naming, Crpt or Crypto. For example, + * cryptography IRQ handler could be CRPT_IRQHandler or CRYPTO_IRQHandler. To override + * default cryptography IRQ handler, see device/startup_{CHIP}.c for its correct name + * or call NVIC_SetVector() in crypto_init() regardless of its name. */ +extern "C" void CRPT_IRQHandler() { uint32_t intsts;