diff --git a/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.c b/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.c index daddc4fa9f..0c830a5dfc 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.c +++ b/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.c @@ -200,7 +200,10 @@ static void crypto_submodule_prestart(volatile uint16_t *submodule_done) static bool crypto_submodule_wait(volatile uint16_t *submodule_done) { while (! *submodule_done); - + + /* Ensure while loop above and subsequent code are not reordered */ + __DSB(); + return true; } diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.c b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.c index daddc4fa9f..0c830a5dfc 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.c @@ -200,7 +200,10 @@ static void crypto_submodule_prestart(volatile uint16_t *submodule_done) static bool crypto_submodule_wait(volatile uint16_t *submodule_done) { while (! *submodule_done); - + + /* Ensure while loop above and subsequent code are not reordered */ + __DSB(); + return true; }