From a47468f5740141eb8078b8bde31c2bf3629fc945 Mon Sep 17 00:00:00 2001
From: Tangyuxin <462747508@qq.com>
Date: Wed, 29 Jun 2022 14:08:57 +0800
Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8F=AA=E8=BF=90=E8=A1=8C?=
=?UTF-8?q?=E5=9C=A8=E5=AE=89=E5=85=A8=E6=A8=A1=E5=BC=8F=E4=B8=8B=20(#6115?=
=?UTF-8?q?)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* [cpu][cm33] Support running in secure mode
* [bsp][lpc55sxx] Using the cortex cm33
---
bsp/lpc55sxx/lpc55s69_nxp_evk/.config | 83 +++------
bsp/lpc55sxx/lpc55s69_nxp_evk/Kconfig | 1 +
bsp/lpc55sxx/lpc55s69_nxp_evk/project.uvprojx | 173 ++++++++++--------
bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.h | 17 +-
bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py | 2 +-
libcpu/Kconfig | 3 +
libcpu/arm/cortex-m33/cpuport.c | 61 +++++-
7 files changed, 191 insertions(+), 149 deletions(-)
diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/.config b/bsp/lpc55sxx/lpc55s69_nxp_evk/.config
index 242ada221a..cc693baf35 100644
--- a/bsp/lpc55sxx/lpc55s69_nxp_evk/.config
+++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/.config
@@ -32,7 +32,7 @@ CONFIG_RT_TIMER_THREAD_STACK_SIZE=512
# CONFIG_RT_KSERVICE_USING_STDLIB is not set
# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set
# CONFIG_RT_USING_TINY_FFS is not set
-# CONFIG_RT_PRINTF_LONGLONG is not set
+# CONFIG_RT_KPRINTF_USING_LONGLONG is not set
CONFIG_RT_DEBUG=y
# CONFIG_RT_DEBUG_COLOR is not set
# CONFIG_RT_DEBUG_INIT_CONFIG is not set
@@ -81,9 +81,13 @@ CONFIG_RT_USING_DEVICE=y
CONFIG_RT_USING_CONSOLE=y
CONFIG_RT_CONSOLEBUF_SIZE=128
CONFIG_RT_CONSOLE_DEVICE_NAME="uart0"
-CONFIG_RT_VER_NUM=0x40100
-# CONFIG_RT_USING_CPU_FFS is not set
+CONFIG_RT_VER_NUM=0x40101
+CONFIG_ARCH_ARM=y
+CONFIG_RT_USING_CPU_FFS=y
+CONFIG_ARCH_ARM_CORTEX_M=y
CONFIG_ARCH_ARM_CORTEX_FPU=y
+CONFIG_ARCH_ARM_CORTEX_SECURE=y
+CONFIG_ARCH_ARM_CORTEX_M33=y
# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
#
@@ -111,6 +115,7 @@ CONFIG_FINSH_USING_DESCRIPTION=y
CONFIG_FINSH_ARG_MAX=10
# CONFIG_RT_USING_DFS is not set
# CONFIG_RT_USING_FAL is not set
+# CONFIG_RT_USING_LWP is not set
#
# Device Drivers
@@ -210,7 +215,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
#
# IoT - internet of things
#
-# CONFIG_PKG_USING_LWIP is not set
# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
# CONFIG_PKG_USING_PAHOMQTT is not set
# CONFIG_PKG_USING_UMQTT is not set
@@ -221,8 +225,12 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_KAWAII_MQTT is not set
# CONFIG_PKG_USING_BC28_MQTT is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set
+# CONFIG_PKG_USING_CJSON is not set
+# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_LIBMODBUS is not set
# CONFIG_PKG_USING_FREEMODBUS is not set
+# CONFIG_PKG_USING_LJSON is not set
+# CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set
#
@@ -260,9 +268,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_JIOT-C-SDK is not set
# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set
# CONFIG_PKG_USING_JOYLINK is not set
-# CONFIG_PKG_USING_EZ_IOT_OS is not set
# CONFIG_PKG_USING_NIMBLE is not set
-# CONFIG_PKG_USING_LLSYNC_SDK_ADAPTER is not set
# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
# CONFIG_PKG_USING_IPMSG is not set
# CONFIG_PKG_USING_LSSDP is not set
@@ -276,13 +282,16 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_ABUP_FOTA is not set
# CONFIG_PKG_USING_LIBCURL2RTT is not set
# CONFIG_PKG_USING_CAPNP is not set
+# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
# CONFIG_PKG_USING_AGILE_TELNET is not set
# CONFIG_PKG_USING_NMEALIB is not set
+# CONFIG_PKG_USING_AGILE_JSMN is not set
# CONFIG_PKG_USING_PDULIB is not set
# CONFIG_PKG_USING_BTSTACK is not set
# CONFIG_PKG_USING_LORAWAN_ED_STACK is not set
# CONFIG_PKG_USING_WAYZ_IOTKIT is not set
# CONFIG_PKG_USING_MAVLINK is not set
+# CONFIG_PKG_USING_RAPIDJSON is not set
# CONFIG_PKG_USING_BSAL is not set
# CONFIG_PKG_USING_AGILE_MODBUS is not set
# CONFIG_PKG_USING_AGILE_FTP is not set
@@ -293,7 +302,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_LORA_PKT_SNIFFER is not set
# CONFIG_PKG_USING_HM is not set
# CONFIG_PKG_USING_SMALL_MODBUS is not set
-# CONFIG_PKG_USING_NET_SERVER is not set
#
# security packages
@@ -307,23 +315,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
#
# language packages
#
-
-#
-# JSON: JavaScript Object Notation, a lightweight data-interchange format
-#
-# CONFIG_PKG_USING_CJSON is not set
-# CONFIG_PKG_USING_LJSON is not set
-# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
-# CONFIG_PKG_USING_RAPIDJSON is not set
-# CONFIG_PKG_USING_JSMN is not set
-# CONFIG_PKG_USING_AGILE_JSMN is not set
-
-#
-# XML: Extensible Markup Language
-#
-# CONFIG_PKG_USING_SIMPLE_XML is not set
-# CONFIG_PKG_USING_EZXML is not set
-# CONFIG_PKG_USING_LUATOS_SOC is not set
# CONFIG_PKG_USING_LUA is not set
# CONFIG_PKG_USING_JERRYSCRIPT is not set
# CONFIG_PKG_USING_MICROPYTHON is not set
@@ -338,7 +329,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
#
# CONFIG_PKG_USING_LVGL is not set
# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
-# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
#
# u8g2: a monochrome graphic library
@@ -364,11 +354,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
#
# CONFIG_PKG_USING_PAINTERENGINE is not set
# CONFIG_PKG_USING_PAINTERENGINE_AUX is not set
-# CONFIG_PKG_USING_MCURSES is not set
-# CONFIG_PKG_USING_TERMBOX is not set
-# CONFIG_PKG_USING_VT100 is not set
-# CONFIG_PKG_USING_QRCODE is not set
-# CONFIG_PKG_USING_GUIENGINE is not set
#
# tools packages
@@ -379,6 +364,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_SYSTEMVIEW is not set
# CONFIG_PKG_USING_SEGGER_RTT is not set
# CONFIG_PKG_USING_RDB is not set
+# CONFIG_PKG_USING_QRCODE is not set
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
# CONFIG_PKG_USING_ULOG_FILE is not set
# CONFIG_PKG_USING_LOGMGR is not set
@@ -411,8 +397,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_SOLAR_TERMS is not set
# CONFIG_PKG_USING_GAN_ZHI is not set
# CONFIG_PKG_USING_FDT is not set
-# CONFIG_PKG_USING_CBOX is not set
-# CONFIG_PKG_USING_SNOWFLAKE is not set
#
# system packages
@@ -425,14 +409,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set
-#
-# POSIX extension functions
-#
-# CONFIG_PKG_USING_POSIX_GETLINE is not set
-# CONFIG_PKG_USING_POSIX_WCWIDTH is not set
-# CONFIG_PKG_USING_POSIX_ITOA is not set
-# CONFIG_PKG_USING_POSIX_STRINGS is not set
-
#
# acceleration: Assembly language or algorithmic acceleration packages
#
@@ -455,10 +431,12 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_UC_CLK is not set
# CONFIG_PKG_USING_UC_COMMON is not set
# CONFIG_PKG_USING_UC_MODBUS is not set
-# CONFIG_PKG_USING_RTDUINO is not set
+# CONFIG_RT_USING_ARDUINO is not set
+# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_PKG_USING_CAIRO is not set
# CONFIG_PKG_USING_PIXMAN is not set
# CONFIG_PKG_USING_PARTITION is not set
+# CONFIG_PKG_USING_FAL is not set
# CONFIG_PKG_USING_FLASHDB is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
@@ -482,10 +460,10 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_TLSF is not set
# CONFIG_PKG_USING_EVENT_RECORDER is not set
# CONFIG_PKG_USING_ARM_2D is not set
+# CONFIG_PKG_USING_WCWIDTH is not set
# CONFIG_PKG_USING_MCUBOOT is not set
# CONFIG_PKG_USING_TINYUSB is not set
-# CONFIG_PKG_USING_CHERRYUSB is not set
-# CONFIG_PKG_USING_KMULTI_RTIMER is not set
+# CONFIG_PKG_USING_USB_STACK is not set
#
# peripheral libraries and drivers
@@ -509,7 +487,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_WM_LIBRARIES is not set
# CONFIG_PKG_USING_KENDRYTE_SDK is not set
# CONFIG_PKG_USING_INFRARED is not set
-# CONFIG_PKG_USING_MULTI_INFRARED is not set
# CONFIG_PKG_USING_AGILE_BUTTON is not set
# CONFIG_PKG_USING_AGILE_LED is not set
# CONFIG_PKG_USING_AT24CXX is not set
@@ -543,7 +520,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_SSD1306 is not set
# CONFIG_PKG_USING_QKEY is not set
# CONFIG_PKG_USING_RS485 is not set
-# CONFIG_PKG_USING_RS232 is not set
# CONFIG_PKG_USING_NES is not set
# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
# CONFIG_PKG_USING_VDEVICE is not set
@@ -561,12 +537,9 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_BLUETRUM_SDK is not set
# CONFIG_PKG_USING_MISAKA_AT24CXX is not set
# CONFIG_PKG_USING_MISAKA_RGB_BLING is not set
-# CONFIG_PKG_USING_LORA_MODEM_DRIVER is not set
# CONFIG_PKG_USING_BL_MCU_SDK is not set
# CONFIG_PKG_USING_SOFT_SERIAL is not set
# CONFIG_PKG_USING_MB85RS16 is not set
-# CONFIG_PKG_USING_CW2015 is not set
-# CONFIG_PKG_USING_RFM300 is not set
#
# AI packages
@@ -585,10 +558,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# miscellaneous packages
#
-#
-# project laboratory
-#
-
#
# samples: kernel and components samples
#
@@ -609,7 +578,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_SNAKE is not set
# CONFIG_PKG_USING_TETRIS is not set
# CONFIG_PKG_USING_DONUT is not set
-# CONFIG_PKG_USING_COWSAY is not set
# CONFIG_PKG_USING_LIBCSV is not set
# CONFIG_PKG_USING_OPTPARSE is not set
# CONFIG_PKG_USING_FASTLZ is not set
@@ -621,7 +589,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_CANFESTIVAL is not set
# CONFIG_PKG_USING_ZLIB is not set
# CONFIG_PKG_USING_MINIZIP is not set
-# CONFIG_PKG_USING_HEATSHRINK is not set
# CONFIG_PKG_USING_DSTR is not set
# CONFIG_PKG_USING_TINYFRAME is not set
# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
@@ -632,14 +599,14 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_PKG_USING_VI is not set
# CONFIG_PKG_USING_KI is not set
# CONFIG_PKG_USING_ARMv7M_DWT is not set
+# CONFIG_PKG_USING_VT100 is not set
# CONFIG_PKG_USING_UKAL is not set
# CONFIG_PKG_USING_CRCLIB is not set
# CONFIG_PKG_USING_LWGPS is not set
# CONFIG_PKG_USING_STATE_MACHINE is not set
-# CONFIG_PKG_USING_DESIGN_PATTERN is not set
-# CONFIG_PKG_USING_CONTROLLER is not set
-# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
-# CONFIG_PKG_USING_MFBD is not set
+# CONFIG_PKG_USING_MCURSES is not set
+# CONFIG_PKG_USING_COWSAY is not set
+# CONFIG_PKG_USING_TERMBOX is not set
CONFIG_SOC_LPC55S6X_SERIES=y
#
diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/Kconfig b/bsp/lpc55sxx/lpc55s69_nxp_evk/Kconfig
index b609832139..baad8f8087 100644
--- a/bsp/lpc55sxx/lpc55s69_nxp_evk/Kconfig
+++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/Kconfig
@@ -18,6 +18,7 @@ config PKGS_DIR
config SOC_LPC55S6x
bool
select ARCH_ARM_CORTEX_M33
+ select ARCH_ARM_CORTEX_SECURE
default y
source "$RTT_DIR/Kconfig"
diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/project.uvprojx b/bsp/lpc55sxx/lpc55s69_nxp_evk/project.uvprojx
index 0f1fe08b10..7b25f005a8 100644
--- a/bsp/lpc55sxx/lpc55s69_nxp_evk/project.uvprojx
+++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/project.uvprojx
@@ -334,9 +334,9 @@
0
--target=arm-arm-none-eabi
- CPU_LPC55S69JBD100_cm33_core0, __RTTHREAD__, RT_USING_ARM_LIBC, __CLK_TCK=RT_TICK_PER_SECOND
+ CPU_LPC55S69JBD100_cm33_core0, RT_USING_LIBC, __CLK_TCK=RT_TICK_PER_SECOND, __STDC_LIMIT_MACROS, __RTTHREAD__, RT_USING_ARM_LIBC
- applications;..\..\..\components\libc\compilers\common;..\..\..\components\libc\compilers\common\extension;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m4;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;board;board\MCUX_Config\board;..\Libraries\drivers;..\Libraries\drivers\config;..\..\..\components\finsh;.;..\..\..\include;..\Libraries\LPC55S6X\CMSIS\Include;..\Libraries\LPC55S6X\components\codec;..\Libraries\LPC55S6X\LPC55S6X;..\Libraries\LPC55S6X\LPC55S6X\drivers;..\Libraries\LPC55S6X\middleware\sdmmc\inc;..\Libraries\LPC55S6X\middleware\sdmmc\port;..\..\..\components\libc\posix\io\poll;..\..\..\components\libc\posix\io\stdio;..\..\..\components\libc\posix\ipc
+ applications;..\..\..\components\libc\compilers\common;..\..\..\components\libc\compilers\common\extension;..\..\..\components\libc\compilers\common\extension\fcntl\octal;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m33;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;board;board\MCUX_Config\board;..\Libraries\drivers;..\Libraries\drivers\config;..\..\..\components\finsh;.;..\..\..\include;..\Libraries\LPC55S6X\CMSIS\Include;..\Libraries\LPC55S6X\components\codec;..\Libraries\LPC55S6X\LPC55S6X;..\Libraries\LPC55S6X\LPC55S6X\drivers;..\Libraries\LPC55S6X\middleware\sdmmc\inc;..\Libraries\LPC55S6X\middleware\sdmmc\port;..\..\..\components\libc\posix\io\poll;..\..\..\components\libc\posix\io\stdio;..\..\..\components\libc\posix\ipc
@@ -422,9 +422,9 @@
CPU
- showmem.c
+ backtrace.c
1
- ..\..\..\libcpu\arm\common\showmem.c
+ ..\..\..\libcpu\arm\common\backtrace.c
@@ -436,23 +436,37 @@
- backtrace.c
+ showmem.c
1
- ..\..\..\libcpu\arm\common\backtrace.c
+ ..\..\..\libcpu\arm\common\showmem.c
context_rvds.S
2
- ..\..\..\libcpu\arm\cortex-m4\context_rvds.S
+ ..\..\..\libcpu\arm\cortex-m33\context_rvds.S
cpuport.c
1
- ..\..\..\libcpu\arm\cortex-m4\cpuport.c
+ ..\..\..\libcpu\arm\cortex-m33\cpuport.c
+
+
+
+
+ syscall_rvds.S
+ 2
+ ..\..\..\libcpu\arm\cortex-m33\syscall_rvds.S
+
+
+
+
+ trustzone.c
+ 1
+ ..\..\..\libcpu\arm\cortex-m33\trustzone.c
@@ -460,9 +474,9 @@
DeviceDrivers
- ringblk_buf.c
+ completion.c
1
- ..\..\..\components\drivers\ipc\ringblk_buf.c
+ ..\..\..\components\drivers\ipc\completion.c
@@ -479,6 +493,20 @@
..\..\..\components\drivers\ipc\pipe.c
+
+
+ ringblk_buf.c
+ 1
+ ..\..\..\components\drivers\ipc\ringblk_buf.c
+
+
+
+
+ ringbuffer.c
+ 1
+ ..\..\..\components\drivers\ipc\ringbuffer.c
+
+
waitqueue.c
@@ -493,20 +521,6 @@
..\..\..\components\drivers\ipc\workqueue.c
-
-
- completion.c
- 1
- ..\..\..\components\drivers\ipc\completion.c
-
-
-
-
- ringbuffer.c
- 1
- ..\..\..\components\drivers\ipc\ringbuffer.c
-
-
pin.c
@@ -524,13 +538,6 @@
Drivers
-
-
- pin_mux.c
- 1
- board\MCUX_Config\board\pin_mux.c
-
-
clock_config.c
@@ -540,16 +547,16 @@
- board.c
+ pin_mux.c
1
- board\board.c
+ board\MCUX_Config\board\pin_mux.c
- drv_pin.c
+ board.c
1
- ..\Libraries\drivers\drv_pin.c
+ board\board.c
@@ -566,6 +573,13 @@
..\Libraries\drivers\drv_led.c
+
+
+ drv_pin.c
+ 1
+ ..\Libraries\drivers\drv_pin.c
+
+
drv_uart.c
@@ -590,6 +604,13 @@
..\..\..\components\finsh\msh.c
+
+
+ msh_parse.c
+ 1
+ ..\..\..\components\finsh\msh_parse.c
+
+
cmd.c
@@ -602,30 +623,9 @@
Kernel
- mempool.c
+ clock.c
1
- ..\..\..\src\mempool.c
-
-
-
-
- kservice.c
- 1
- ..\..\..\src\kservice.c
-
-
-
-
- thread.c
- 1
- ..\..\..\src\thread.c
-
-
-
-
- irq.c
- 1
- ..\..\..\src\irq.c
+ ..\..\..\src\clock.c
@@ -635,20 +635,6 @@
..\..\..\src\components.c
-
-
- object.c
- 1
- ..\..\..\src\object.c
-
-
-
-
- timer.c
- 1
- ..\..\..\src\timer.c
-
-
device.c
@@ -656,6 +642,13 @@
..\..\..\src\device.c
+
+
+ idle.c
+ 1
+ ..\..\..\src\idle.c
+
+
ipc.c
@@ -665,9 +658,16 @@
- clock.c
+ irq.c
1
- ..\..\..\src\clock.c
+ ..\..\..\src\irq.c
+
+
+
+
+ kservice.c
+ 1
+ ..\..\..\src\kservice.c
@@ -677,6 +677,20 @@
..\..\..\src\mem.c
+
+
+ mempool.c
+ 1
+ ..\..\..\src\mempool.c
+
+
+
+
+ object.c
+ 1
+ ..\..\..\src\object.c
+
+
scheduler.c
@@ -686,9 +700,16 @@
- idle.c
+ thread.c
1
- ..\..\..\src\idle.c
+ ..\..\..\src\thread.c
+
+
+
+
+ timer.c
+ 1
+ ..\..\..\src\timer.c
diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.h b/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.h
index a69ffaef1f..7689ceb9ff 100644
--- a/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.h
+++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.h
@@ -48,8 +48,13 @@
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 128
#define RT_CONSOLE_DEVICE_NAME "uart0"
-#define RT_VER_NUM 0x40100
+#define RT_VER_NUM 0x40101
+#define ARCH_ARM
+#define RT_USING_CPU_FFS
+#define ARCH_ARM_CORTEX_M
#define ARCH_ARM_CORTEX_FPU
+#define ARCH_ARM_CORTEX_SECURE
+#define ARCH_ARM_CORTEX_M33
/* RT-Thread Components */
@@ -126,11 +131,6 @@
/* language packages */
-/* JSON: JavaScript Object Notation, a lightweight data-interchange format */
-
-
-/* XML: Extensible Markup Language */
-
/* multimedia packages */
@@ -151,9 +151,6 @@
/* enhanced kernel services */
-/* POSIX extension functions */
-
-
/* acceleration: Assembly language or algorithmic acceleration packages */
@@ -171,8 +168,6 @@
/* miscellaneous packages */
-/* project laboratory */
-
/* samples: kernel and components samples */
diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py b/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py
index 98b2a68e36..5e4d26af5e 100644
--- a/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py
+++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py
@@ -3,7 +3,7 @@ import sys
# toolchains options
ARCH='arm'
-CPU='cortex-m4'
+CPU='cortex-m33'
CROSS_TOOL='gcc'
BOARD_NAME = 'lpcxpresso'
BSP_LIBRARY_TYPE = 'LPC55S6X'
diff --git a/libcpu/Kconfig b/libcpu/Kconfig
index 580f4d94bc..4d2f9bf013 100644
--- a/libcpu/Kconfig
+++ b/libcpu/Kconfig
@@ -18,6 +18,9 @@ config ARCH_ARM_CORTEX_M
config ARCH_ARM_CORTEX_FPU
bool
+config ARCH_ARM_CORTEX_SECURE
+ bool
+
config ARCH_ARM_CORTEX_M0
bool
select ARCH_ARM_CORTEX_M
diff --git a/libcpu/arm/cortex-m33/cpuport.c b/libcpu/arm/cortex-m33/cpuport.c
index 71e1fea848..44e7c287f5 100644
--- a/libcpu/arm/cortex-m33/cpuport.c
+++ b/libcpu/arm/cortex-m33/cpuport.c
@@ -169,10 +169,65 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
stack_frame->exception_stack_frame.pc = (unsigned long)tentry; /* entry point, pc */
stack_frame->exception_stack_frame.psr = 0x01000000L; /* PSR */
- stack_frame->tz = 0x00;
- stack_frame->lr = 0xFFFFFFBC;
+ stack_frame->tz = 0x00; /* trustzone thread context */
+ /*
+ * Exception return behavior
+ * +--------+---+---+------+-------+------+-------+---+----+
+ * | PREFIX | - | S | DCRS | FType | Mode | SPSEL | - | ES |
+ * +--------+---+---+------+-------+------+-------+---+----+
+ * PREFIX [31:24] - Indicates that this is an EXC_RETURN value. This field reads as 0b11111111.
+ * S [6] - Indicates whether registers have been pushed to a Secure or Non-secure stack.
+ * 0: Non-secure stack used.
+ * 1: Secure stack used.
+ * DCRS [5] - Indicates whether the default stacking rules apply, or whether the callee registers are already on the stack.
+ * 0: Stacking of the callee saved registers is skipped.
+ * 1: Default rules for stacking the callee registers are followed.
+ * FType [4] - In a PE with the Main and Floating-point Extensions:
+ * 0: The PE allocated space on the stack for FP context.
+ * 1: The PE did not allocate space on the stack for FP context.
+ * In a PE without the Floating-point Extension, this bit is Reserved, RES1.
+ * Mode [3] - Indicates the mode that was stacked from.
+ * 0: Handler mode.
+ * 1: Thread mode.
+ * SPSEL [2] - Indicates which stack contains the exception stack frame.
+ * 0: Main stack pointer.
+ * 1: Process stack pointer.
+ * ES [0] - Indicates the Security state the exception was taken to.
+ * 0: Non-secure.
+ * 1: Secure.
+ */
+#ifdef ARCH_ARM_CORTEX_SECURE
+ stack_frame->lr = 0xfffffffdL;
+#else
+ stack_frame->lr = 0xffffffbcL;
+#endif
stack_frame->psplim = 0x00;
- stack_frame->control = 0x00;
+ /*
+ * CONTROL register bit assignments
+ * +---+------+------+-------+-------+
+ * | - | SFPA | FPCA | SPSEL | nPRIV |
+ * +---+------+------+-------+-------+
+ * SFPA [3] - Indicates that the floating-point registers contain active state that belongs to the Secure state:
+ * 0: The floating-point registers do not contain state that belongs to the Secure state.
+ * 1: The floating-point registers contain state that belongs to the Secure state.
+ * This bit is not banked between Security states and RAZ/WI from Non-secure state.
+ * FPCA [2] - Indicates whether floating-point context is active:
+ * 0: No floating-point context active.
+ * 1: Floating-point context active.
+ * This bit is used to determine whether to preserve floating-point state when processing an exception.
+ * This bit is not banked between Security states.
+ * SPSEL [1] - Defines the currently active stack pointer:
+ * 0: MSP is the current stack pointer.
+ * 1: PSP is the current stack pointer.
+ * In Handler mode, this bit reads as zero and ignores writes. The CortexM33 core updates this bit automatically onexception return.
+ * This bit is banked between Security states.
+ * nPRIV [0] - Defines the Thread mode privilege level:
+ * 0: Privileged.
+ * 1: Unprivileged.
+ * This bit is banked between Security states.
+ *
+ */
+ stack_frame->control = 0x00000000L;
/* return task's current stack address */
return stk;