Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ihbai
rt-thread
提交
b08d699e
R
rt-thread
项目概览
ihbai
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b08d699e
编写于
1月 15, 2020
作者:
B
Bernard Xiong
提交者:
GitHub
1月 15, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3338 from karl-zh/RTT_TFM_PS_DEMO
Add TFM PS demo with RTT
上级
f390d79f
cd95e4cd
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
207 addition
and
2 deletion
+207
-2
bsp/lpc55sxx/lpc55s69_nxp_evk/applications/main.c
bsp/lpc55sxx/lpc55s69_nxp_evk/applications/main.c
+15
-1
bsp/lpc55sxx/lpc55s69_nxp_evk/applications/tfm_ps.c
bsp/lpc55sxx/lpc55s69_nxp_evk/applications/tfm_ps.c
+110
-0
bsp/lpc55sxx/lpc55s69_nxp_evk/project_ns.uvoptx
bsp/lpc55sxx/lpc55s69_nxp_evk/project_ns.uvoptx
+56
-0
bsp/lpc55sxx/lpc55s69_nxp_evk/project_ns.uvprojx
bsp/lpc55sxx/lpc55s69_nxp_evk/project_ns.uvprojx
+26
-1
未找到文件。
bsp/lpc55sxx/lpc55s69_nxp_evk/applications/main.c
浏览文件 @
b08d699e
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
* Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2019-10-24 Magicoe first version
* 2020-01-10 Kevin/Karl Add PS demo
*
*/
...
...
@@ -16,8 +18,12 @@
/* GPIO1_4 is Blue LED */
#define LEDB_PIN GET_PINS(1, 4)
extern
void
protected_storage_demo_thread
(
void
*
parameters
);
int
main
(
void
)
{
rt_thread_t
t_psa_ps_demo
;
#if defined(__CC_ARM)
rt_kprintf
(
"using armcc, version: %d
\n
"
,
__ARMCC_VERSION
);
#elif defined(__CLANG_ARM)
...
...
@@ -27,7 +33,15 @@ int main(void)
#elif defined(__GNUC__)
rt_kprintf
(
"using gcc, version: %d.%d
\n
"
,
__GNUC__
,
__GNUC_MINOR__
);
#endif
t_psa_ps_demo
=
rt_thread_create
(
"psa_ps_demo"
,
protected_storage_demo_thread
,
RT_NULL
,
512
,
(
RT_MAIN_THREAD_PRIORITY
-
1
),
50
);
if
(
t_psa_ps_demo
!=
RT_NULL
)
rt_thread_startup
(
t_psa_ps_demo
);
rt_pin_mode
(
LEDB_PIN
,
PIN_MODE_OUTPUT
);
/* Set GPIO as Output */
while
(
1
)
{
...
...
bsp/lpc55sxx/lpc55s69_nxp_evk/applications/tfm_ps.c
0 → 100644
浏览文件 @
b08d699e
/*
* Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-01-10 Kevin/Karl Add PS demo
*
*/
#include <rtdevice.h>
#include <string.h>
#include "tfm_ns_lock.h"
#include "psa_protected_storage.h"
#define TEST_UID_A 2U
#define ASSET_A "THEQUICKBROWNFOXJUMPSOVERALAZYDOG"
#define ASSET_A_SIZE (sizeof( ASSET_A ) - 1)
#define RESETDATA "THISIS"
#define RESETDATA_SIZE (sizeof( RESETDATA ) - 1)
#define READ_LENGTH (ASSET_A_SIZE > RESETDATA_SIZE ? \
ASSET_A_SIZE : RESETDATA_SIZE)
void
protected_storage_demo_thread
(
void
*
parameters
)
{
psa_ps_status_t
status
;
const
psa_ps_uid_t
uid
=
TEST_UID_A
;
const
psa_ps_create_flags_t
flags
=
PSA_PS_FLAG_NONE
;
uint8_t
write_data
[]
=
ASSET_A
;
const
uint32_t
data_length
=
ASSET_A_SIZE
;
uint8_t
rewrite_data
[]
=
RESETDATA
;
const
uint32_t
reset_data_length
=
RESETDATA_SIZE
;
uint8_t
get_data
[
READ_LENGTH
];
uint32_t
counter
=
0
;
tfm_ns_lock_init
();
for
(
;
;
)
{
/* Call TF-M protected storage service and set the asset. */
status
=
psa_ps_set
(
uid
,
data_length
,
write_data
,
flags
);
if
(
status
!=
PSA_PS_SUCCESS
)
{
rt_kprintf
(
"[Protected Storage Asset A Set Round %ld] Fail
\r\n
"
,
counter
);
for
(
;
;
);
}
rt_kprintf
(
"[Protected Storage Asset A Set Round %ld] Success
\r\n
"
,
counter
);
/* Read the asset. */
status
=
psa_ps_get
(
uid
,
0
,
data_length
,
get_data
);
if
(
status
!=
PSA_PS_SUCCESS
)
{
rt_kprintf
(
"[Protected Storage Asset A Get Round %ld] Fail
\r\n
"
,
counter
);
for
(
;
;
);
}
rt_kprintf
(
"[Protected Storage Asset A Get Round %ld] Success
\r\n
"
,
counter
);
/* Check the read data. */
if
(
memcmp
(
write_data
,
get_data
,
sizeof
(
write_data
)
-
1
)
!=
0
)
{
rt_kprintf
(
"[Protected Storage Asset A Get Round %ld] Get the wrong data
\r\n
"
,
counter
);
for
(
;
;
);
}
/* Change the asset. */
status
=
psa_ps_set
(
uid
,
reset_data_length
,
rewrite_data
,
flags
);
if
(
status
!=
PSA_PS_SUCCESS
)
{
rt_kprintf
(
"[Protected Storage Asset A Reset Round %ld] Fail
\r\n
"
,
counter
);
}
rt_kprintf
(
"[Protected Storage Asset A Reset Round %ld] Success
\r\n
"
,
counter
);
/* Read the asset. */
status
=
psa_ps_get
(
uid
,
0
,
reset_data_length
,
get_data
);
if
(
status
!=
PSA_PS_SUCCESS
)
{
rt_kprintf
(
"[Protected Storage Asset A Get Round %ld] Fail
\r\n
"
,
counter
);
for
(
;
;
);
}
rt_kprintf
(
"[Protected Storage Asset A Get Round %ld] Success
\r\n
"
,
counter
);
/* Check the read data. */
if
(
memcmp
(
rewrite_data
,
get_data
,
sizeof
(
rewrite_data
)
-
1
)
!=
0
)
{
rt_kprintf
(
"[Protected Storage Asset A Get Round %ld] Get the wrong data
\r\n
"
,
counter
);
for
(
;
;
);
}
/* Remove the asset. */
status
=
psa_ps_remove
(
uid
);
if
(
status
!=
PSA_PS_SUCCESS
)
{
rt_kprintf
(
"[Protected Storage Asset A Remove Round %ld] Fail
\r\n
"
,
counter
);
for
(
;
;
);
}
rt_kprintf
(
"[Protected Storage Asset A Remove Round %ld] Success
\r\n\n
"
,
counter
);
/* Wait for a second. */
rt_thread_mdelay
(
1000
);
counter
++
;
}
}
// end file
bsp/lpc55sxx/lpc55s69_nxp_evk/project_ns.uvoptx
浏览文件 @
b08d699e
...
...
@@ -370,6 +370,18 @@
<RteFlg>
0
</RteFlg>
<bShared>
0
</bShared>
</File>
<File>
<GroupNumber>
2
</GroupNumber>
<FileNumber>
16
</FileNumber>
<FileType>
1
</FileType>
<tvExp>
0
</tvExp>
<tvExpOptDlg>
0
</tvExpOptDlg>
<bDave2>
0
</bDave2>
<PathWithFileName>
.\applications\tfm_ps.c
</PathWithFileName>
<FilenameWithoutPath>
tfm_ps.c
</FilenameWithoutPath>
<RteFlg>
0
</RteFlg>
<bShared>
0
</bShared>
</File>
</Group>
<Group>
...
...
@@ -1808,4 +1820,48 @@
</File>
</Group>
<Group>
<GroupName>
TFM
</GroupName>
<tvExp>
0
</tvExp>
<tvExpOptDlg>
0
</tvExpOptDlg>
<cbSel>
0
</cbSel>
<RteFlg>
0
</RteFlg>
<File>
<GroupNumber>
10
</GroupNumber>
<FileNumber>
131
</FileNumber>
<FileType>
1
</FileType>
<tvExp>
0
</tvExp>
<tvExpOptDlg>
0
</tvExpOptDlg>
<bDave2>
0
</bDave2>
<PathWithFileName>
.\packages\trusted-firmware-m-v1.0-beta\interface\src\tfm_sst_api.c
</PathWithFileName>
<FilenameWithoutPath>
tfm_sst_api.c
</FilenameWithoutPath>
<RteFlg>
0
</RteFlg>
<bShared>
0
</bShared>
</File>
<File>
<GroupNumber>
10
</GroupNumber>
<FileNumber>
132
</FileNumber>
<FileType>
1
</FileType>
<tvExp>
0
</tvExp>
<tvExpOptDlg>
0
</tvExpOptDlg>
<bDave2>
0
</bDave2>
<PathWithFileName>
.\packages\trusted-firmware-m-v1.0-beta\interface\src\tfm_ns_lock_rt-thread.c
</PathWithFileName>
<FilenameWithoutPath>
tfm_ns_lock_rt-thread.c
</FilenameWithoutPath>
<RteFlg>
0
</RteFlg>
<bShared>
0
</bShared>
</File>
<File>
<GroupNumber>
10
</GroupNumber>
<FileNumber>
133
</FileNumber>
<FileType>
3
</FileType>
<tvExp>
0
</tvExp>
<tvExpOptDlg>
0
</tvExpOptDlg>
<bDave2>
0
</bDave2>
<PathWithFileName>
.\packages\trusted-firmware-m-v1.0-beta\cmake_build\install\export\tfm\veneers\s_veneers.o
</PathWithFileName>
<FilenameWithoutPath>
s_veneers.o
</FilenameWithoutPath>
<RteFlg>
0
</RteFlg>
<bShared>
0
</bShared>
</File>
</Group>
</ProjectOpt>
bsp/lpc55sxx/lpc55s69_nxp_evk/project_ns.uvprojx
浏览文件 @
b08d699e
...
...
@@ -339,7 +339,7 @@
<MiscControls>
--target=arm-arm-none-eabi
</MiscControls>
<Define>
CPU_LPC55S69JBD100_cm33_core0, RT_USING_ARM_LIBC, RT_USING_TFM
</Define>
<Undefine></Undefine>
<IncludePath>
.;..\..\..\include;applications;board;board\MCUX_Config\board;..\Libraries\drivers;..\Libraries\drivers\config;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m4;..\..\..\components\dfs\include;..\..\..\components\dfs\filesystems\devfs;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\spi;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\..\..\components\libc\compilers\armlibc;..\..\..\components\libc\compilers\common;..\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
</IncludePath>
<IncludePath>
.;..\..\..\include;applications;board;board\MCUX_Config\board;..\Libraries\drivers;..\Libraries\drivers\config;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m4;..\..\..\components\dfs\include;..\..\..\components\dfs\filesystems\devfs;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\spi;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\..\..\components\libc\compilers\armlibc;..\..\..\components\libc\compilers\common;..\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
;.\packages\trusted-firmware-m-v1.0-beta\interface\include
</IncludePath>
</VariousControls>
</Cads>
<Aads>
...
...
@@ -463,6 +463,11 @@
<FileType>
1
</FileType>
<FilePath>
applications\main.c
</FilePath>
</File>
<File>
<FileName>
tfm_ps.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
.\applications\tfm_ps.c
</FilePath>
</File>
</Files>
</Group>
<Group>
...
...
@@ -1144,6 +1149,26 @@
</File>
</Files>
</Group>
<Group>
<GroupName>
TFM
</GroupName>
<Files>
<File>
<FileName>
tfm_sst_api.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
.\packages\trusted-firmware-m-v1.0-beta\interface\src\tfm_sst_api.c
</FilePath>
</File>
<File>
<FileName>
tfm_ns_lock_rt-thread.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
.\packages\trusted-firmware-m-v1.0-beta\interface\src\tfm_ns_lock_rt-thread.c
</FilePath>
</File>
<File>
<FileName>
s_veneers.o
</FileName>
<FileType>
3
</FileType>
<FilePath>
.\packages\trusted-firmware-m-v1.0-beta\cmake_build\install\export\tfm\veneers\s_veneers.o
</FilePath>
</File>
</Files>
</Group>
</Groups>
</Target>
</Targets>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录