From f1336c9f85d304fc3b5c3abab410853141ebbf12 Mon Sep 17 00:00:00 2001 From: Deepika Date: Mon, 11 Sep 2017 16:57:51 -0500 Subject: [PATCH] Set SAU Region present flag for M2351 device and include security header file. As per SAU documents, SAU is always present if the security extension is available. The functionality differs if the SAU contains SAU regions. If SAU regions are available it is configured with the macro __SAUREGION_PRESENT --- targets/TARGET_NUVOTON/TARGET_M2351/device/M2351.h | 1 + targets/TARGET_NUVOTON/TARGET_M2351/device/partition_M2351.h | 4 ++-- targets/TARGET_NUVOTON/TARGET_M2351/device/system_M2351.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/M2351.h b/targets/TARGET_NUVOTON/TARGET_M2351/device/M2351.h index 72b89b6a74..655ab0dfcb 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/M2351.h +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/M2351.h @@ -179,6 +179,7 @@ typedef enum IRQn /* -------- Configuration of the Cortex-ARMv8MBL Processor and Core Peripherals ------- */ #define __ARMv8MBL_REV 0x0000U /* Core revision r0p0 */ #define __SAU_PRESENT 1U /* SAU present */ +#define __SAUREGION_PRESENT 1U /* SAU regions are present */ #define __MPU_PRESENT 1U /* MPU present */ #define __VTOR_PRESENT 1U /* VTOR present */ #define __NVIC_PRIO_BITS 2U /* Number of Bits used for Priority Levels */ diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/partition_M2351.h b/targets/TARGET_NUVOTON/TARGET_M2351/device/partition_M2351.h index 58e035e19d..6f0a65c7df 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/partition_M2351.h +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/partition_M2351.h @@ -452,7 +452,7 @@ __STATIC_INLINE void TZ_SAU_Setup(void) { -#if defined (__SAU_PRESENT) && (__SAU_PRESENT == 1U) +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) #if defined (SAU_INIT_REGION0) && (SAU_INIT_REGION0 == 1U) SAU_INIT_REGION(0); @@ -488,13 +488,13 @@ __STATIC_INLINE void TZ_SAU_Setup(void) /* repeat this for all possible SAU regions */ +#endif /* defined (__SAUREGION_PRESENT ) && (__SAUREGION_PRESENT == 1U) */ #if defined (SAU_INIT_CTRL) && (SAU_INIT_CTRL == 1U) SAU->CTRL = ((SAU_INIT_CTRL_ENABLE << SAU_CTRL_ENABLE_Pos) & SAU_CTRL_ENABLE_Msk) | ((SAU_INIT_CTRL_ALLNS << SAU_CTRL_ALLNS_Pos) & SAU_CTRL_ALLNS_Msk) ; #endif -#endif /* defined (__SAU_PRESENT) && (__SAU_PRESENT == 1U) */ #if defined (SCB_CSR_AIRCR_INIT) && (SCB_CSR_AIRCR_INIT == 1U) SCB->SCR = (SCB->SCR & ~(SCB_SCR_SLEEPDEEPS_Msk)) | diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/system_M2351.c b/targets/TARGET_NUVOTON/TARGET_M2351/device/system_M2351.c index 9e313edcc6..5d70e34618 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/system_M2351.c +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/system_M2351.c @@ -9,7 +9,7 @@ * Copyright (C) 2016 Nuvoton Technology Corp. All rights reserved. * ******************************************************************************/ -//#include +#include #include #include #include "M2351.h"