From 388076d36dd6d1793800a58ebbd1e0287eb462be Mon Sep 17 00:00:00 2001 From: ccli8 Date: Mon, 24 Dec 2018 10:36:11 +0800 Subject: [PATCH 1/3] [Nuvoton] Remove unnecessary mbed_rtos_storage.h in crypto_misc.cpp --- targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp | 1 - targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp b/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp index 36292622b58..95f72eaea99 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp +++ b/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp @@ -20,7 +20,6 @@ #include "mbed_critical.h" #include "mbed_error.h" #include "cmsis_os2.h" -#include "mbed_rtos_storage.h" #include #include #include "nu_modutil.h" diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp index 6653e37b4ff..e44d15cf968 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp @@ -20,7 +20,6 @@ #include "mbed_critical.h" #include "mbed_error.h" #include "cmsis_os2.h" -#include "mbed_rtos_storage.h" #include #include #include "nu_modutil.h" From 39f705e033913ca6978b2eea061fd4c2890f117b Mon Sep 17 00:00:00 2001 From: ccli8 Date: Mon, 24 Dec 2018 10:57:41 +0800 Subject: [PATCH 2/3] [Nuvoton] Fix crypto_misc.cpp compile error with RTOS-absent Replace Mutex with PlatformMutex which supports RTOS-absent --- .../TARGET_M480/crypto/crypto-misc.cpp | 12 +++++++----- .../TARGET_NUC472/crypto/crypto-misc.cpp | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp b/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp index 95f72eaea99..811715119a4 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp +++ b/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp @@ -19,14 +19,16 @@ #include "mbed_assert.h" #include "mbed_critical.h" #include "mbed_error.h" +#if defined(MBED_CONF_RTOS_PRESENT) && MBED_CONF_RTOS_PRESENT #include "cmsis_os2.h" +#endif #include #include #include "nu_modutil.h" #include "nu_bitutil.h" #include "crypto-misc.h" -#include "SingletonPtr.h" -#include "Mutex.h" +#include "platform/SingletonPtr.h" +#include "platform/PlatformMutex.h" /* Consideration for choosing proper synchronization mechanism * @@ -45,13 +47,13 @@ */ /* Mutex for crypto AES AC management */ -static SingletonPtr crypto_aes_mutex; +static SingletonPtr crypto_aes_mutex; /* Mutex for crypto DES AC management */ -static SingletonPtr crypto_des_mutex; +static SingletonPtr crypto_des_mutex; /* Mutex for crypto ECC AC management */ -static SingletonPtr crypto_ecc_mutex; +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; diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp index e44d15cf968..7f5b77cd9e5 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp @@ -19,14 +19,16 @@ #include "mbed_assert.h" #include "mbed_critical.h" #include "mbed_error.h" +#if defined(MBED_CONF_RTOS_PRESENT) && MBED_CONF_RTOS_PRESENT #include "cmsis_os2.h" +#endif #include #include #include "nu_modutil.h" #include "nu_bitutil.h" #include "crypto-misc.h" -#include "SingletonPtr.h" -#include "Mutex.h" +#include "platform/SingletonPtr.h" +#include "platform/PlatformMutex.h" /* Consideration for choosing proper synchronization mechanism * @@ -43,12 +45,12 @@ * (2) No biting CPU * Same reason as above. */ - + /* Mutex for crypto AES AC management */ -static SingletonPtr crypto_aes_mutex; +static SingletonPtr crypto_aes_mutex; /* Mutex for crypto DES AC management */ -static SingletonPtr crypto_des_mutex; +static SingletonPtr crypto_des_mutex; /* Atomic flag for crypto SHA AC management */ static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT; From ad1e57bdef0c4da67bd0965acc168bd9d5f7a747 Mon Sep 17 00:00:00 2001 From: ccli8 Date: Thu, 3 Jan 2019 09:21:05 +0800 Subject: [PATCH 3/3] [Nuvoton] Refine MBED_CONF_RTOS_PRESENT check in crypto_misc.cpp --- targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp | 2 +- targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp b/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp index 811715119a4..13000985af4 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp +++ b/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp @@ -19,7 +19,7 @@ #include "mbed_assert.h" #include "mbed_critical.h" #include "mbed_error.h" -#if defined(MBED_CONF_RTOS_PRESENT) && MBED_CONF_RTOS_PRESENT +#if MBED_CONF_RTOS_PRESENT #include "cmsis_os2.h" #endif #include diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp index 7f5b77cd9e5..f771a3e510a 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp @@ -19,7 +19,7 @@ #include "mbed_assert.h" #include "mbed_critical.h" #include "mbed_error.h" -#if defined(MBED_CONF_RTOS_PRESENT) && MBED_CONF_RTOS_PRESENT +#if MBED_CONF_RTOS_PRESENT #include "cmsis_os2.h" #endif #include