Compare commits

...

1369 Commits

Author SHA1 Message Date
openharmony_ci
10e00b3047 !1120 【修复】OAT告警
Merge pull request !1120 from 石子怡/master
2024-06-05 08:04:36 +00:00
石子怡
88fd668b8f 修复OAT告警
Signed-off-by: 石子怡 <z15319797139@163.com>
2024-06-05 06:47:40 +00:00
openharmony_ci
ddaad05097 !1116 clear systick pending status
Merge pull request !1116 from hw_llm/master
2024-05-29 05:00:53 +00:00
openharmony_ci
c739d4a164 !1114 【修复】OAT告警
Merge pull request !1114 from 石子怡/master
2024-05-27 11:39:31 +00:00
hw_llm
92fbcaf074 Description: clear systick pending status
IssueNo: https://gitee.com/openharmony/kernel_liteos_m/issues/I93ZUQ
Feature Or Bugfix: Feature
Binary Source: No
Signed-off-by: hw_llm <liu.limin@huawei.com>
2024-05-25 11:03:53 +08:00
石子怡
441d552355 修复OAT告警
Signed-off-by: 石子怡 <z15319797139@163.com>
2024-05-25 02:21:53 +00:00
石子怡
e151e8369b 修复OAT告警
Signed-off-by: 石子怡 <z15319797139@163.com>
2024-05-25 01:17:11 +00:00
openharmony_ci
e539a6c951 !1102 fix:设置LOSCFG_PLATFORM_HWI_WITH_ARG为1后,编译失败问题修复
Merge pull request !1102 from zhangkt/master
2024-03-26 06:58:35 +00:00
openharmony_ci
e19155f49f !1108 删除bundle.json中的syscap信息,确保与架构信息平台设计信息一致
Merge pull request !1108 from hw_llm/master
2024-02-05 07:22:45 +00:00
hw_llm
76562c376c Description: 删除bundle.json中syscap信息
IssueNo: https://gitee.com/openharmony/kernel_liteos_a/issues/I90PKD
Feature Or Bugfix: Feature
Binary Source: No
Signed-off-by: hw_llm <liu.limin@huawei.com>
2024-02-02 15:40:05 +08:00
openharmony_ci
954c855528 !1107 cortex-m7支持iccarm 编译
Merge pull request !1107 from hw_llm/master
2024-01-27 08:20:41 +00:00
hw_llm
80f3e0f6b2 Description: cortex-m7支持iccarm 编译
IssueNo: https://gitee.com/openharmony/kernel_liteos_m/issues/I8ZCYS
Feature Or Bugfix: Feature
Binary Source: No
Signed-off-by: hw_llm <liu.limin@huawei.com>
2024-01-27 15:38:28 +08:00
zhangkt
36c0634ff5 fix:设置LOSCFG_PLATFORM_HWI_WITH_ARG为1后,编译失败问题修复
Signed-off-by: zhangkt <zhangkt1995@gmail.com>
2023-11-23 11:15:09 +08:00
openharmony_ci
e22e8525e9 !1094 增加内核queue可以在中断中进行读写操作的接口
Merge pull request !1094 from libnew/master
2023-09-12 11:36:36 +00:00
zengwenlong
1b778c4267 feat: 增加内核queue在中断中进行读写操作的接口
方案描述:
1,基于 OsQueueOperate增加支持queue在中断中进行读写操作的接口。
BREAKING CHANGE:
增加支持queue在中断中进行读写操作的接口,需要适配接口描述:
适配API:

新增API:
UINT32 LOS_QueueReadCopyIsr(UINT32 queueID,   VOID *bufferAddr, UINT32 *bufferSize);
UINT32 LOS_QueueWriteCopyIsr(UINT32 queueID, VOID *bufferAddr, UINT32 bufferSize);
UINT32 LOS_QueueReadIsr(UINT32 queueID,VOID *bufferAddr,  UINT32 bufferSize);
UINT32 LOS_QueueWriteIsr(UINT32 queueID, VOID *bufferAddr,  UINT32 bufferSize);
UINT32 LOS_QueueWriteHeadIsr(UINT32 queueID, VOID *bufferAddr,UINT32 bufferSize);
UINT32 LOS_QueueWriteHeadCopyIsr(UINT32 queueID,  VOID *bufferAddr,UINT32 bufferSize);

Signed-off-by: zengwenlong <zengwenlong@openvalley.net>
2023-09-11 20:47:44 -07:00
openharmony_ci
c70295cc30 !1096 xts用例
Merge pull request !1096 from 乔克叔叔/wxliu
2023-08-31 09:10:48 +00:00
liuwenxin
c19dc1bc94 fix:xts用例
Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
Change-Id: I2d3f856eb94e5ced0bc5a9c0211f10f453a4ad03
2023-08-31 16:49:50 +08:00
openharmony_ci
d2bf535696 !1091 支持可配置是否生成asm文件
Merge pull request !1091 from wangchen/0817_m
2023-08-18 01:52:50 +00:00
wangchen
bda25829af Fix: 支持可配置是否生成asm文件
Close #I7U2V4
Signed-off-by: wangchen <wangchen240@huawei.com>
2023-08-17 21:41:43 +08:00
openharmony_ci
a1e215f16a !1090 liteos_m内核xts用例补齐cmsis中task剩余
Merge pull request !1090 from zwx1232718/master
2023-08-17 02:14:08 +00:00
zwx1232718
5e36b8b599 test:xts用例,task补充
Signed-off-by: zwx1232718 <zhenghui23@huawei.com>
2023-08-17 09:06:40 +08:00
openharmony_ci
954aa6fb70 !1087 liteos_m内核xts用例补齐cmsis剩余task部分
Merge pull request !1087 from zwx1232718/master
2023-08-16 01:18:57 +00:00
zwx1232718
64a73724b3 test:xts用例补齐,cmsis中task部分
Signed-off-by: zwx1232718 <zhenghui23@huawei.com>
2023-08-15 10:40:53 +08:00
openharmony_ci
2a49ac7323 !1084 readme翻译问题修改
Merge pull request !1084 from wangchen/0804_m
2023-08-14 13:38:45 +00:00
openharmony_ci
cde26d8d68 !1080 Kconfig清理冗余代码
Merge pull request !1080 from 乔克叔叔/master
2023-08-11 02:49:30 +00:00
openharmony_ci
4140bd673e !1081 liteos_m内核xts用例补齐部分cmsis
Merge pull request !1081 from zwx1232718/master
2023-08-09 06:58:11 +00:00
openharmony_ci
2b81e524a1 !1085 Fix : 内核告警清理
Merge pull request !1085 from yinjiaming/fix
2023-08-09 02:14:05 +00:00
zwx1232718
1dae9259ef test:xts用例补齐,部分cmsis
Signed-off-by: zwx1232718 <zhenghui23@huawei.com>
2023-08-09 09:58:58 +08:00
yinjiaming
3ce50a610c fix:内核代码告警清理
内核代码经工具检测有告警,现予清理

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I3bf6c421296dfccd9c78cc6af47dcb1879da5cea
2023-08-08 16:22:32 +08:00
wangchen
cf980647d6 Fix: readme翻译问题修改
Close #I7QAKU
Signed-off-by: wangchen <wangchen240@huawei.com>
2023-08-04 10:28:10 +08:00
openharmony_ci
ab131703be !1079 liteos_m内核xts用例补齐net、time以及部分cmsis
Merge pull request !1079 from zwx1232718/master
2023-07-30 09:27:23 +00:00
liuwenxin
f42c36ac8e fix:kconfig清理冗余代码
Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
Change-Id: I45b8185b87b9c6cb03a470c9969239fdda5f6b4d
2023-07-29 15:57:26 +08:00
zwx1232718
f2ddeaebfd test:net、time以及部分cmsis
Signed-off-by: zwx1232718 <zhenghui23@huawei.com>
2023-07-28 17:36:06 +08:00
openharmony_ci
5d5e155f31 !1078 liteos_m内核xts用例补齐mem、process、sched、sys部分
Merge pull request !1078 from zwx1232718/master
2023-07-21 01:53:13 +00:00
zwx1232718
0c3dbb4c01 test:xts用例补齐,mem、process、sched、sys部分
Signed-off-by: zwx1232718 <zhenghui23@huawei.com>
2023-07-19 14:41:06 +08:00
openharmony_ci
873255af51 !1077 liteos_m内核xts用例补齐math部分及ipc中msg部分
Merge pull request !1077 from zwx1232718/master
2023-07-14 01:39:23 +00:00
zwx1232718
22702a27fc test:xts用例补齐,math及ipc中msg部分
Signed-off-by: zwx1232718 <zhenghui23@huawei.com>
2023-07-13 10:02:43 +08:00
openharmony_ci
b37358cb47 !1076 liteos_m内核xts用例补齐io部分
Merge pull request !1076 from zwx1232718/master
2023-07-10 02:07:07 +00:00
zwx1232718
b73eb72ba6 test:xts用力补齐,io部分
Signed-off-by: zwx1232718 <zhenghui23@huawei.com>
2023-07-08 14:22:06 +08:00
openharmony_ci
e98de4489f !1074 liteos_m内核xts用例补齐ipc部分
Merge pull request !1074 from zwx1232718/master
2023-06-30 07:46:54 +00:00
zwx1232718
4cfb20d7e9 test:测试用力补齐
Signed-off-by: zwx1232718 <zhenghui23@huawei.com>
2023-06-28 17:52:39 +08:00
openharmony_ci
9248d46457 !1073 fix:三方软件名称整改
Merge pull request !1073 from zhangdengyu/componentization_0627
2023-06-28 01:29:47 +00:00
zhangdengyu
808b9de5b8 fix:三方软件名称整改
Close:#I7G9O9

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I026d94ae8f068134d4047902203ea56122574bec
2023-06-27 20:58:18 +08:00
openharmony_ci
cfdad0f44b !1071 refactor:csky/xtensa/riscv中断管理框架重构
Merge pull request !1071 from zhangdengyu/IMF_0615
2023-06-16 07:45:56 +00:00
zhangdengyu
81c25c6d54 refactor: 优化csky/xtensa/riscv架构中断管理框架
方案描述:
1、在最外层arch/include/los_interrupt.h中定义数据结构、声明对外接口;
2、在arch/xxx/common实现xxx架构中断通用的接口定义与声明;
3、在arch/xxx/yyy中实现针对xxx架构的差异化实现;
4、修改宏数值,适配整个中断管理框架

BREAKING CHANGE:
优化csky/xtensa/riscv架构中断管理框架对外变更描述:
1、宏OS_ERRNO_HWI_OPS_FUNC_NULL数值改为0x0200090c

Close: #I7DRTP

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: Ic7cab8222ceab846b2557ff9047f7c6cd34b2b44
2023-06-15 21:37:31 +08:00
openharmony_ci
222960f6de !1067 refactor:中断管理框架完善
Merge pull request !1067 from zhangdengyu/IMF0523
2023-06-14 09:24:58 +00:00
zhangdengyu
eb7e307355 refactor:重构ARM架构下的中断管理框架
方案描述:
1、在最外层arch/include/los_interrupt.h中定义数据结构、声明对外接口;
2、在arch/arm/common实现arm架构中断通用的接口定义与声明;
3、在arch/arm/xxx中实现针对xxx架构的差异化实现;
4、在cortex-m7/gcc中未实现SysTickHandler函数,现将其实现

Close: #I76K6S

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I741df02efb808ac64568b591e7ff460d99e21c30
2023-06-14 16:15:37 +08:00
openharmony_ci
16dae422eb !1051 Fix : 修复gettimeofday对RTC钩子依赖的问题
Merge pull request !1051 from yinjiaming/fix
2023-06-06 00:59:38 +00:00
yinjiaming
96c16b0cbf fix: 修复gettimeofday接口获取时间方式依赖RTC钩子
gettimeofday 接口获取时间的方式依赖于RTC钩子,造成了精度的差异,
现去掉其依赖

BREAKING CHANGE:
修复gettimeofday接口获取时间方式依赖RTC钩子对外变更描述:
修改API:
int gettimeofday(struct timeval *tv, void *ptz);

Close #I6WV3V

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I87f46661a2b6edf9fd179e8c6e2cfe72da0c0c61
2023-05-29 17:27:55 +08:00
openharmony_ci
748e0a4447 !1036 fix: 修改一些拼写错误
Merge pull request !1036 from 程子丘/master
2023-05-24 04:03:47 +00:00
openharmony_ci
a1989614f4 !1068 GN绝对路径修改
Merge pull request !1068 from zhushengle/GN
2023-05-23 12:33:40 +00:00
zhushengle
3241a67dc6 feat: GN绝对路径修改
Close #I77PSG
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I095e5d0aac99eda1a8c238701e560655477b04d2
2023-05-23 20:08:02 +08:00
openharmony_ci
14868aebdc !1064 feat:内核time模块RTC与settimeofday接口逻辑修复
Merge pull request !1064 from zhangdengyu/RTC0515
2023-05-18 06:28:49 +00:00
zhangdengyu
b4873b06e8 feat: 修复time中TIMEZONE优先使用RTC模块的问题
方案描述:
1、time中timezone全局变量修改为优先从RTC获取
2、settimeofday接口,linux和posix标准有差异,m核中对齐posix标准,具体如下:
int settimeofday(const struct timeval *tv, const struct timezone *tz)
2.1、linux中:
        tz参数已弃用,一般设置为NULL;
        tv参数,为NULL时返回0,不设置错误码,表示不修改当前时间;
2.2、posix中:
        tv或tz全部为NULL时,返回-1,设置错误码EFAULT;
        tv或tz有一个不为NULL时,不设置相应的参数,返回0;不设置错误码;
3、新增settimeofday接口设置timezone相关测试用例

BREAKING CHANGE:
修复time中TIMEZONE优先使用RTC模块的问题对外变更描述:
修改int settimeofday(const struct timeval *tv, const struct timezone *tz)接口
settimeofday接口对入参的判断逻辑修改:
1、tv或tz全部为NULL时,返回-1,设置错误码EFAULT;
2、tv或tz有一个不为NULL时,不设置相应的参数,返回0;不设置错误码;

Close: #I73G40

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: Id536fc27d8bf0697765ac1543776e8105e6f62f4
2023-05-18 11:50:38 +08:00
openharmony_ci
bad1880ccb !1052 open时可能绕过fatfs 锁
Merge pull request !1052 from wangchen/0423_m
2023-05-15 12:49:09 +00:00
openharmony_ci
f996b22137 !1062 部件化整改
Merge pull request !1062 from zhushengle/deps
2023-05-09 14:55:21 +00:00
zhushengle
02147f4613 feat: 部件化整改
Close #I71QQ2

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I247fdc1cbc7cb48c8ff1c1c3e4553ad4e6ef87a9
2023-05-09 21:43:12 +08:00
openharmony_ci
da2429a003 !1040 Fix : 内核测试用例框架统一
Merge pull request !1040 from yinjiaming/test_framework
2023-05-09 03:09:42 +00:00
openharmony_ci
3b9e83c6b2 !1060 Fix : 部件化需求整改
Merge pull request !1060 from yinjiaming/bundle
2023-05-05 08:33:30 +00:00
yinjiaming
b35d3d952b fix:部件需求整改
修复了脚本扫描出的bundle.json的问题,整改了
不符合规范的路径引用

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ic45ef8f2cc54c071e7104c7c1a6e31fc2ae395d2
2023-04-28 17:11:31 +08:00
openharmony_ci
74e20c6f83 !1058 去除无用头文件
Merge pull request !1058 from 乔克叔叔/master
2023-04-27 09:29:44 +00:00
liuwenxin
24a0b3ca70 fix:去除无用头文件
Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2023-04-25 16:04:31 +08:00
wangchen
062235a60c fix: open时可能绕过fatfs 锁
方案描述:
1, malloc 之后 清空内存,避免使用上次的指针脏数据

fix I6XVKR
Signed-off-by: wangchen <wangchen240@huawei.com>
2023-04-24 15:36:35 +08:00
openharmony_ci
bcb4dea119 !1057 fix: 修复文档中的失效链接
Merge pull request !1057 from Hongjin Li/dev1
2023-04-24 02:21:52 +00:00
Hongjin Li
333045d11f fix: 修复文档死链
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2023-04-24 09:53:50 +08:00
openharmony_ci
04d5405d3f !1056 修复文档中的时效链接
Merge pull request !1056 from Hongjin Li/dev1
2023-04-23 14:19:35 +00:00
Hongjin Li
7028f96f9c fix: 修改文档中的时效链接
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2023-04-23 19:00:29 +08:00
openharmony_ci
f34362730a !1055 修复CHANGELOG.md中的无效超链接
Merge pull request !1055 from wangchen/0424_new
2023-04-23 10:46:47 +00:00
wangchen
bc1a352935 fix: 修复CHANGELOG.md中的无效超链接
方案描述:
1, 修改对应链接
fix #I6Y64T
Signed-off-by: wangchen <wangchen240@huawei.com>
2023-04-23 18:34:09 +08:00
openharmony_ci
39391d12e4 !1053 fix: 修复CHANGELOG.md中的无效超链接
Merge pull request !1053 from Hongjin Li/changelog_fix
2023-04-23 10:03:31 +00:00
Hongjin Li
41b73359a4 fix: 修复CHANGELOG.md中的无效超链接
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2023-04-23 16:06:56 +08:00
openharmony_ci
6babf78a8d !1048 kconfig增加shell StackSize大小的设置
Merge pull request !1048 from 乔克叔叔/cherry-pick-1681111046
2023-04-13 14:27:36 +00:00
openharmony_ci
18d07a809a !1049 回退los_panic相关修改
Merge pull request !1049 from wangchen/0412_back
2023-04-12 09:15:15 +00:00
wangchen
6d2dbdf0e8 fix: 回退los_panic相关修改
方案描述:
1, 暂时回退https://gitee.com/openharmony/kernel_liteos_m/pulls/1035的修改
fix #I6V3U5
Signed-off-by: wangchen <wangchen240@huawei.com>
2023-04-12 16:27:41 +08:00
nkj
ee9d5daeca fixed 088f88c from https://gitee.com/wenxin-liu_admin/kernel_liteos_m/pulls/991
feat: kconfig增加shell StackSize大小的设置

BREAKING CHANGE:

kconfig增加shell StackSize大小的设置:

新增配置项

Close #I6KHRF
Signed-off-by: nkj <tkyl01@yeah.net>
Change-Id: I9d3a7e7933a01a0f1ad2199c82825cc471c623b0

Change-Id: I0d732e0270ae6dc354aec05f2a50f9439550accb
2023-04-10 16:32:23 +08:00
openharmony_ci
556c10121b !1037 fix: 修复拼写错误
Merge pull request !1037 from Wang Jikai/master
2023-04-10 02:18:27 +00:00
yinjiaming
6c6fddb9a3 fix:统一M核unittest 和 sample所使用的测试框架
liteos_m 测试套中 unittest 和 sample 目录所使用的测试框架不同,
现将其统一,便于维护

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I4b690b621d754725c4d6a93772a043140de0bce1
2023-04-07 10:57:39 +08:00
openharmony_ci
fe69c9dd65 !1043 Fix : pthread_cond_timedwait 函数等待的信号丢失问题
Merge pull request !1043 from yinjiaming/fix
2023-03-31 09:11:33 +00:00
yinjiaming
2374c01bb9 fix:pthread_cond_timedwait解锁后清理的问题
该函数解锁mutex 后先清理事件,导致等的事件丢失

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I36f8658b1b850734bc029b486fec103f6bd10588
2023-03-31 16:14:31 +08:00
openharmony_ci
66278102ca !1035 使用vprintf来打印va_list类型
Merge pull request !1035 from 乔克叔叔/master
2023-03-22 02:40:55 +00:00
liuwenxin
ecdd47f0c5 fix:使用vprintf来打印va_list类型
Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2023-03-21 11:14:02 +08:00
openharmony_ci
7dbae99194 !1038 增加los错误码和posix错误码对接接口
Merge pull request !1038 from wangchen/0317_m
2023-03-17 13:02:35 +00:00
root
81784f1c6b fix: 增加los错误码和posix错误码对接接口
方案描述:
1, 增加一个内部接口, 用于los接口返回的错误码转换成posix错误码

BREAKING CHANGE:
无新增接口, 原有接口pthread_create错误时的错误码进行了区分

Close #I6NWNV
Signed-off-by: wangchen <wangchen240@huawei.com>
2023-03-17 16:23:31 +08:00
am009
20693c9424 fix: 修复拼写错误
Signed-off-by: am009 <wangjikai@hust.edu.cn>
2023-03-15 22:10:45 +08:00
Cheng Ziqiu
8b11135135 fix: 修改注释中的一些拼写错误
Signed-off-by: Cheng Ziqiu <chengziqiu@hust.edu.cn>
Change-Id: Icc152031144f9756f4da018e24d338c0d28a8fa9
2023-03-15 22:01:50 +08:00
openharmony_ci
5fa299b4aa !1026 修复task命令打印逻辑问题
Merge pull request !1026 from wangchen/0216_m
2023-03-14 07:54:35 +00:00
root
b02c64dc42 fix: posix用例存在mutex资源泄露
方案描述:
1, 对posix中使用锁之后,增加对锁的释放
2, 修改锁后进入shell, 发现task打印线程信息有异常, 又修复了打印相关的逻辑
fix #I64Y7G
Signed-off-by: wangchen <wangchen240@huawei.com>
2023-03-13 21:53:57 +08:00
openharmony_ci
c5a39437f7 !1007 fix: risc-v架构编译告警修复
Merge pull request !1007 from zhushengle/codex
2023-03-08 06:02:16 +00:00
zhushengle
f211029b12 fix: 修复编译告警
Close #I69TZD

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I5f837b7980b478a02524f8ba056916ca038c544c
2023-03-07 21:37:07 +08:00
openharmony_ci
36d55955ef !1031 newlib error处理
Merge pull request !1031 from 乔克叔叔/master
2023-03-01 08:13:50 +00:00
openharmony_ci
12f6c5d628 !1032 Fix : 配置LOSCFG_BASE_IPC_QUEUE_STATIC后编译错误
Merge pull request !1032 from yinjiaming/fix-1
2023-03-01 08:09:53 +00:00
openharmony_ci
17309e232a !1029 Fix : 打开 LWIP_IPV6 时会有编译错误
Merge pull request !1029 from yinjiaming/fix
2023-03-01 08:09:16 +00:00
liuwenxin
af1afcec6a fix:newlib error解决
close:#I6HL01

Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2023-03-01 11:52:34 +08:00
yinjiaming
9cef4da850 fix:配置LOSCFG_BASE_IPC_QUEUE_STATIC后编译错误
在target_config.h中配置了LOSCFG_BASE_IPC_QUEUE_STATIC之后编译内核测试套报错
现修复

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Idf99137f822d5040bdb19e489e0a9234f19e93be
2023-02-27 15:12:13 +08:00
yinjiaming
d058b640e2 fix:打开LWIP_IPV6时有编译错误
更改了出错的参与算数运算的指针的数据类型

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I6891797cd1afa801faeecf1bfb891f0ac7db7f68
2023-02-27 11:53:54 +08:00
openharmony_ci
4431b587f8 !1027 Panic支持ExcHook
Merge pull request !1027 from zhangdengyu/supportPanicHook
2023-02-22 06:18:48 +00:00
zhangdengyu
809db71acc feat:Panic支持ExcHook
方案描述:
1、在EXC_TYPE枚举中添加EXC_PANIC成员用于Panic支持ExcHook
2、在LOS_Panic接口执行异常处理钩子函数

BREAKING CHANGE:
无

Close: #I6GR6G

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I99d293622ff6ddbc49348c692512e5b7780460e6
2023-02-21 21:55:01 +08:00
openharmony_ci
b1a7711e15 !1025 Werror开启产生的告警
Merge pull request !1025 from 乔克叔叔/werrror
2023-02-21 06:58:16 +00:00
liuwenxin
3e83ce79c2 fix:告警清理包含三方库屏蔽
【修改说明】此次开启Werror,解决告警产生的报错,以及屏蔽三方库告警

 close #I6ELI9
Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2023-02-21 10:35:56 +08:00
openharmony_ci
2cadd65301 !1023 fix: pthread_create时序调整
Merge pull request !1023 from Zhaotianyu/20230210pthread_create
2023-02-10 10:31:43 +00:00
arvinzzz
f038492dbc fix: pthread_create内部逻辑时序调整
在线程创建成功后,pthread_create内部先将函数返回值设置好,再进行TaskResume就绪调度状态

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I795c115da612123b67f34cdc57e85eac955bbc08
2023-02-10 17:42:17 +08:00
openharmony_ci
e74deedba3 !1005 Werror开启告警清理
Merge pull request !1005 from 乔克叔叔/second
2023-02-07 03:08:26 +00:00
openharmony_ci
24f52e0259 !987 LMS特性安全合规整改
Merge pull request !987 from JerryH/lms
2023-02-02 01:42:12 +00:00
huangjieliang
d4df4d1e54 feat:LMS模块及堆内存模块非安全函数安全合规整改
Close #I68LEO

Signed-off-by: huangjieliang <huangjieliang@huawei.com>
Change-Id: I38b859dcd1856f27d4577f5311c920d2d8b96385
2023-02-01 16:49:44 +08:00
openharmony_ci
2d1e7e8c29 !1012 Fix : 内核告警清理
Merge pull request !1012 from yinjiaming/warning
2023-02-01 06:33:49 +00:00
liuwenxin
a96f535cd3 fix:Werror开启告警清理
清理Werror开启产生的告警

close:#I68YDW

Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2023-01-30 10:10:07 +08:00
openharmony_ci
1669455ba9 !972 feat:新增文件系统测试用例
Merge pull request !972 from zhangdengyu/addFsTestCase
2023-01-29 08:54:33 +00:00
zhangdengyu
b637b1d979 test:添加文件系统测试用例
方案描述:
1、对单个接口进行规格测试。
2、对多个接口组合测试模拟上层业务场景。
3、对各接口进行压力测试确保稳定性。

Close: #I62K4B

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I6c45631094884e0300faa994082d16dda6dd3f1d
2023-01-29 16:22:07 +08:00
openharmony_ci
c6d021bede !1016 refactor: 不同C库malloc归一
Merge pull request !1016 from Zhaotianyu/20230117libc_malloc
2023-01-18 09:56:58 +00:00
arvinzzz
d7f3aef326 refactor: 不同C库的malloc适配归一
1. 不同C库的malloc实现归一化,由原先//kal/libc/musl、//kal/libc/newlib、
   //../../third_party/musl/porting/liteos_m_iccarm/kernel 各自实现,
   统一至//kal/posix/src/malloc.c实现,并实现对三种C库的兼容

2. Kconfig归一化的配套调整,删除Top->"Compat"->"Choose libc implementation"下
   malloc API的开关控制,统一归入"Top"->"Compat"->"Enable POSIX API"下
   "Enable POSIX MALLOC API"进行能力开关控制

BREAKING CHANGE:
Kconfig变更:
删除:
LOSCFG_LIBC_ICCARM_MALLOC
LOSCFG_LIBC_NEWLIB_MALLOC
新增:
LOSCFG_POSIX_MALLOC_API

close: I6AGOW

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I584e337cdb36184cf40c36c4f7c73ab780c31a42
2023-01-18 11:22:01 +08:00
yinjiaming
db32ad90bf Fix:内核告警清理
清除内核代码中的敏感词

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I734525c036fcfe481d0781d459bc273ef8224791
2023-01-16 16:17:09 +08:00
openharmony_ci
59fbe91d8b !1009 Fix : OsLs 内存泄漏问题
Merge pull request !1009 from yinjiaming/fix
2023-01-13 08:54:49 +00:00
openharmony_ci
c7088f4d0f !1010 告警清理
Merge pull request !1010 from 乔克叔叔/release
2023-01-13 05:42:29 +00:00
liuwenxin
705bfbdc76 fix:release告警清理
release分支告警清理

close:#I6AD15

Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2023-01-13 11:34:52 +08:00
yinjiaming
9a4e9677bd fix:修复OsLs函数内存泄漏问题
当d = NULL时,path没有释放,现释放path所指向的内存

close #I6A07U

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Iee9fd8d2171c6fdcf353a48e7af385bbd1660520
2023-01-12 15:30:19 +08:00
openharmony_ci
6134d4bd22 !989 修复-Werror编译选项产生的告警
Merge pull request !989 from 乔克叔叔/lwx
2023-01-11 07:55:48 +00:00
openharmony_ci
c119b7e9e2 !1006 Fix : statfs函数内部判断错误
Merge pull request !1006 from yinjiaming/fix
2023-01-11 07:37:51 +00:00
openharmony_ci
dbf0498bab !1008 fix: 非gcc形态下FUNC_ALIAS编译错误
Merge pull request !1008 from Zhaotianyu/20230111symbol_fix
2023-01-11 06:49:43 +00:00
arvinzzz
68b142cf78 fix: 修复非gcc形态FUNC_ALIAS编译错误
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I7f199366d8173d9fc504f89b26329ea5f7d1eb9e
2023-01-11 10:45:18 +08:00
openharmony_ci
22b7eb87ca !998 fix: 不同C库下gettimeofday特性规格统一
Merge pull request !998 from Zhaotianyu/20230107gettimeofday
2023-01-11 00:46:21 +00:00
arvinzzz
ed50f7e373 fix: 不同libc下gettimeofday特性规格统一
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Iaaf1fed24101f43c636737294dbe870d2f467b0a
2023-01-10 20:36:34 +08:00
yinjiaming
2f2a0b7a75 fix:修复statfs函数内部判断错误
修复函数调用的是statfs却用stat!=NULL来判断,当文件系统是little_fs时导致死机的问题。

close #I69BXB

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ib9784c017f4260433c3f12e352470108ea83ec19
2023-01-10 15:49:01 +08:00
openharmony_ci
1ae62ebf2e !1000 fix:mutex trace中ArchLRGet等接口改变实现方式
Merge pull request !1000 from zhangdengyu/mutexTraceFix
2023-01-10 06:44:48 +00:00
zhangdengyu
25278a02eb fix:mutex trace中ArchLRGet接口改变实现方式
方案描述:
将ArchLRGet接口的实现方式由内联函数修改为宏,
防止产品添加--no_inline等编译选项导致函数无法在调用点展开,
造成由于函数调用过程中函数栈帧的变化带来的LR寄存器中存储的值的变化。

Close #I69D9N

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: If417bc2ec9febf064c63da198faf4ac000d70c52
2023-01-10 14:28:15 +08:00
liuwenxin
52bc16c3db fix:修复-Werror编译选项产生的告警
清理框架定义未使用告警,宏重定义,以及变量定义未使用等告警。

Close #I68RLA

Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2023-01-10 10:26:22 +08:00
openharmony_ci
733b6e6c6c !988 fix: mktime测试用例不依赖固定时区
Merge pull request !988 from Zhaotianyu/20230104fix_mktime_test
2023-01-04 09:36:32 +00:00
arvinzzz
6562536db7 fix: mktime testcase
Eliminate the effects of different time zones

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I22f0dc7057df642e255bec9a8b663c2b544b107e
2023-01-04 16:39:01 +08:00
openharmony_ci
ddf3dc8237 !985 fix: mktime测试用例配套修改
Merge pull request !985 from Zhaotianyu/20230103fix_mktime_test
2023-01-03 07:45:12 +00:00
arvinzzz
399e7647bb fix: mktime testcase
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I50e0252aa8611e9a269b836c552bfdf33ade8f44
2023-01-03 11:27:26 +08:00
openharmony_ci
f7af2cdf9b !983 修复codecheck告警
Merge pull request !983 from 夏不白/codecheck
2022-12-30 06:19:55 +00:00
xiacong
07091c5a75 fix:修复codecheck告警
1、修复空格、空行使用错误告警;
2、将超过10行的inline函数去除内联符号

fix #I685E3

Signed-off-by: xiacong <xiacong4@huawei.com>
2022-12-30 12:11:01 +08:00
openharmony_ci
6633aabf89 !979 fix: mktime获取的时间缺少时区信息
Merge pull request !979 from Zhaotianyu/20221228mktime_fix
2022-12-29 10:21:38 +00:00
arvinzzz
2a4282f912 fix: The tm struct obtained by mktime lacks timezone information
BREAKING CHANGE:
The tm struct obtained by mktime lacks timezone information
变更API:
time_t mktime(struct tm *tmptr)
原先mktime从入参中获取时区信息进行计算,变更后tm结构体和返回值time_t的计算使用系统g_timezone时区环境变量。

Close I67UIA

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I766cffbff3c1a25bb33cbd245225ee117909af3a
2022-12-29 16:26:08 +08:00
openharmony_ci
685688b21c !977 Fixed compilation problems with niobe407 and neptune100
Merge pull request !977 from 张亚雷/master
2022-12-27 07:21:39 +00:00
mrzhang
67ee38e1e3 fix: Fixed compilation problems with niobe407 and neptune100
Signed-off-by: mrzhang <zhangyalei8@h-partners.com>
2022-12-26 18:25:44 -08:00
openharmony_ci
6cd48f6f90 !965 VfsMpFind接口优化
Merge pull request !965 from Far/vfsmpfind
2022-12-24 03:12:29 +00:00
Far
662aefb700 fix: VfsMpFind optimize
1. provide VfsMpFind which doesn't support mounting recursively;
2. provide a macro to set whether supporting recursive-mount or not.
3. adding path length checking

BREAKING CHANGE:
new config option:
LOSCFG_FS_SUPPORT_MOUNT_TARGET_RECURSIVE

fix #I65XE6
Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I7ae371f0e6fff46db0e2368f905aa22bac864b79
2022-12-24 10:44:11 +08:00
openharmony_ci
83fc93cc84 !974 fix: misc_config中defines未初始化导致编译失败
Merge pull request !974 from Zhaotianyu/20221222misc_config
2022-12-22 07:44:57 +00:00
arvinzzz
b817c490ba fix: 修复misc_config中defines未初始化的错误
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I4eecfc1af2b0cdc39922a8ce299eb8ab6b7c6e8c
2022-12-22 11:28:31 +08:00
openharmony_ci
705e4c323a !973 【重新提交】修复文件系统中不合理的锁操作
Merge pull request !973 from Far/master
2022-12-22 03:10:43 +00:00
Far
b7f906ef8a fix: 修复文件系统不合理的锁操作
1. 移除了fatfs和littlefs中冗余的加锁操作。
2. 增加了配置选项FS_LOCK_TIMEOUT(宏LOSCFG_FS_LOCK_TIMEOUT),提供配置
   文件系统获取锁超时能力。
3. 新增对外接口LOS_FsLock()和LOS_FsUnlock()接口,提供HAL层与文件系统的
   互斥操作。

BREAKING CHANGE:
修复文件系统不合理的锁操作
新增API:
los_fs.h:
int LOS_FsLock(void)
int LOS_FsUnlock(void)
新增配置项:
LOSCFG_FS_LOCK_TIMEOUT(menuconfig FS_LOCK_TIMEOUT)

fix #I66S2J

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I2ae9b6b5e2c788b2f4a00d9678a0240d00c335eb
2022-12-22 10:41:31 +08:00
openharmony_ci
f9c59d361f !971 回退 'Pull Request !938 : 修复文件系统不合理的锁操作'
Merge pull request !971 from openharmony_ci/revert-merge-938-master
2022-12-19 09:34:33 +00:00
openharmony_ci
fa142daffb 回退 'Pull Request !938 : 修复文件系统不合理的锁操作' 2022-12-19 08:57:11 +00:00
openharmony_ci
4bd0e73512 !969 open接口内存泄漏修复
Merge pull request !969 from wangchen/1217_m
2022-12-17 08:47:28 +00:00
wangchen
0a03a4d875 fix: open接口内存泄漏修复
方案描述:
1, 修改路径正确时打开失败可能的异常

fix #I66KGT
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-12-17 08:16:12 +00:00
openharmony_ci
2a70466456 !963 修复文件系统close中的不合理操作
Merge pull request !963 from Far/NFILE
2022-12-16 03:12:42 +00:00
openharmony_ci
b30349d8ed !938 修复文件系统不合理的锁操作
Merge pull request !938 from Far/master
2022-12-16 03:03:54 +00:00
Far
59ecf4cae8 fix: 修复close接口中无法正常关闭文件的问题
1. close未考虑保留描述符0、1和2,导致fd合法性判断出现错误,这会导致
上限附近的fd不能被正常的关闭
2. 释放file结构体时未在锁的保护中进行,可能存在问题

fix #I65U8S

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: Iaa03a70e18fcb352ca3b99232f50b43d8b13ecf0
2022-12-16 10:53:03 +08:00
Far
9038b6522e fix: 修复文件系统不合理的锁操作
1. 移除了fatfs和littlefs中冗余的加锁操作。
2. 增加了配置选项FS_LOCK_TIMEOUT(宏LOSCFG_FS_LOCK_TIMEOUT),提供文件
   系统锁超时判定能力。
3. 新增对外接口LOS_FsLock()和LOS_FsUnlock()接口,提供HAL层与文件系统的
   互斥操作。

BREAKING CHANGE:
修复文件系统不合理的锁操作
新增API:
int LOS_FsLock(void)
int LOS_FsUnlock(void)
新增配置项:
LOSCFG_FS_LOCK_TIMEOUT(menuconfig FS_LOCK_TIMEOUT)

fix #I6355A

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: Ia980abfac0ee761088313496c7e3c3e9568450b3
2022-12-16 10:42:03 +08:00
openharmony_ci
abb83fd23b !962 refactor: vfs优化
Merge pull request !962 from Zhaotianyu/20221210vfs_opt
2022-12-16 02:03:04 +00:00
arvinzzz
98da8bbdfb refactor: vfs opt
1. vfs重构优化,统一fs模块的对外接口,减少不必要的冗余调用,由fs组件直接提供posix对外接口
  2. vfs与libc关系整理
  3. fs接口实现规范化

BREAKING CHANGE:
删除API:
int LOS_Open(const char *path, int flags, ...);
int LOS_Close(int fd);
ssize_t LOS_Read(int fd, void *buff, size_t bytes);
ssize_t LOS_Write(int fd, const void *buff, size_t bytes);
off_t LOS_Lseek(int fd, off_t off, int whence);
int LOS_Stat(const char *path, struct stat *stat);
int LOS_Statfs(const char *path, struct statfs *buf);
int LOS_Unlink(const char *path);
int LOS_Rename(const char *oldpath, const char *newpath);
int LOS_Fsync(int fd);
DIR *LOS_Opendir(const char *path);
struct dirent *LOS_Readdir(DIR *dir);
int LOS_Closedir(DIR *dir);
int LOS_Mkdir(const char *path, mode_t mode);
int LOS_Rmdir(const char *path);
int LOS_Lstat(const char *path, struct stat *buffer);
int LOS_Fstat(int fd, struct stat *buf);
int LOS_Fcntl(int fd, int cmd, ...);
int LOS_Ioctl(int fd, int req, ...);
ssize_t LOS_Readv(int fd, const struct iovec *iovBuf, int iovcnt);
ssize_t LOS_Writev(int fd, const struct iovec *iovBuf, int iovcnt);
ssize_t LOS_Pread(int fd, void *buff, size_t bytes, off_t off);
ssize_t LOS_Pwrite(int fd, const void *buff, size_t bytes, off_t off);
int LOS_Isatty(int fd);
int LOS_Access(const char *path, int amode);
int LOS_Ftruncate(int fd, off_t length);
int LOS_FsUmount(const char *target);
int LOS_FsUmount2(const char *target, int flag);
int LOS_FsMount(const char *source, const char *target,
                const char *fsType, unsigned long mountflags,
                const void *data);
int OsFcntl(int fd, int cmd, va_list ap);
int OsIoctl(int fd, int req, va_list ap);

Close #I65MNQ

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I3d16852ffb87ab061c22b22f5873eba384842101
2022-12-13 16:56:18 +08:00
openharmony_ci
c7da881469 !934 fix: 对外提供CONFIG_NFILE_DESCRIPTORS宏表示最大可打开fd数量
Merge pull request !934 from Hongjin Li/fs1
2022-12-06 12:10:31 +00:00
openharmony_ci
9cbddd412d !955 feat: 优化CPUP计算方式, 解耦系统调频
Merge pull request !955 from zhushengle/cpup
2022-12-06 07:11:08 +00:00
openharmony_ci
b50b5e7cba !953 对内核模块暴露OsMemNodeHead/OsMemPoolHead等结构体
Merge pull request !953 from Far/los_memory
2022-12-06 04:08:13 +00:00
zhushengle
974182d50c feat: 优化CPUP计算方式, 解耦系统调频
Close #I5R9XG

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I07cb388732b1190943374802f792d32bd666c06e
2022-12-06 10:41:20 +08:00
Hongjin Li
a3ce436841 fix: 提供CONFIG_NFILE_DESCRIPTORS宏标识最大可打开fd数量
提供CONFIG_NFILE_DESCRIPTORS宏,标识最大可打开fd数量。
提供FAT_MAX_OPEN_FILES宏,标识FAT文件系统中最大可打开fd数量。

如果只有FAT文件系统,那么CONFIG_NFILE_DESCRIPTORS等于FAT_MAX_OPEN_FILES。
如果有多个文件系统,比如fat+little+yaffs,那么CONFIG_NFILE_DESCRIPTORS应该定义为多个文件系统可打开fd数量之和。

BREAKING CHANGE:

对外提供的CONFIG_NFILE_DESCRIPTORS宏,用来标识最大可打开fd数量。

开发者可以在target_config.h中自定义CONFIG_NFILE_DESCRIPTORS和FAT_MAX_OPEN_FILES宏。

Close #I62WDU

Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2022-12-06 10:11:13 +08:00
openharmony_ci
588abc0645 !952 fix: 修复低功耗下时间更新缺陷
Merge pull request !952 from zhushengle/pm_timer
2022-12-05 13:02:02 +00:00
zhushengle
7657aadc20 feat: 修复低功耗下时间更新缺陷
1.注释说明低功耗框架中tickLock和tickUnlock两个钩子函数的要求
2.解决极端情况下OsTickTimerBaseReset断言失败的问题

BREAKING CHANGE:
修复低功耗下时间更新缺陷对外变更描述:

低功耗启用另一个低功耗timer时:

LosPmTickTimer 中tickLock函数的功能实现描述由原来的:暂停系统tick timer 修改为:关闭系统tick timer,并将timer的count值清零

LosPmTickTimer 中tickUnlock函数的功能实现描述由原来的:恢复系统tick timer 修改为:重新启动系统tick timer

Close #I5O80Z

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I2ee17518e4a388ff5a1f9e3d8d7c61c81aa3e569
2022-12-05 17:01:37 +08:00
Far
0d1c77c1e0 feat: 对内核模块暴露OsMemNodeHead/OsMemPoolHead
对内核其他模块暴露OsMemNodeHead/OsMemPoolHead等结构体,
以便于对堆内存管理的调测及管理。

fix #I64ONE

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I2e47d90412368dfdc8d82e6b30c9196e1fdf42f1
2022-12-05 16:41:20 +08:00
openharmony_ci
795c2db917 !933 fs增加注册接口
Merge pull request !933 from wangchen/1124_m
2022-12-01 06:18:16 +00:00
wangchen
2f334bed21 feat: fs增加注册接口
方案描述:
增加注册机制, 并增加重复注册判断

BREAKING CHANGE:
fs增加注册接口
新增API:
int LOS_FsRegister(const char *fsType, const struct MountOps *fsMops,
                   const struct FileOps *fsFops, const struct FsManagement *fsMgt);

fix #I611L2
Signed-off-by: wangchen <wangchen240@huawei.com>
https://gitee.com/openharmony/kernel_liteos_m/issues/I611L2
2022-12-01 02:50:05 +00:00
openharmony_ci
9e4978f57f !947 fix: 使用LOSCFG_FS_FREE_HOOK释放内存
Merge pull request !947 from Hongjin Li/max_open_dirs
2022-12-01 02:50:03 +00:00
Hongjin Li
a859329f28 fix: 使用LOSCFG_FS_FREE_HOOK释放内存
文件系统中使用LOSCFG_FS_FREE_HOOK代替free()来释放内存。

close #I6412J

Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2022-12-01 09:33:32 +08:00
openharmony_ci
68b8deea89 !937 添加MAX_OPEN_DIRS宏,标识最大可打开dir数量
Merge pull request !937 from Hongjin Li/max_open_dirs
2022-11-29 11:38:36 +00:00
Hongjin Li
a288718c2c fix: 添加LOSCFG_MAX_OPEN_DIRS标识最大可打开dir数量
提供LOSCFG_MAX_OPEN_DIRS宏定义,标识最大可打开dir数量。新增g_dirNum静态变量,标识已打开的dir数量。
在opendir成功时g_dirNum++,在closedir成功时g_dirNum--。

BREAKING CHANGE:
新增LOSCFG_MAX_OPEN_DIRS宏定义,标识最大可打开dir数量。

fix: I62XEA

Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2022-11-29 19:05:00 +08:00
openharmony_ci
2e7b59b659 !944 feat: 回合liteos_m架构图
Merge pull request !944 from zhushengle/arch
2022-11-29 02:46:53 +00:00
zhushengle
0c577f3e7f feat: 回合liteos_m内核架构图
Close #I63MI5
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I69a978aee465662a9265426975f13e57b41972ab
2022-11-29 10:15:41 +08:00
openharmony_ci
019dab8db4 !941 文件系统提供动态内存分配器钩子
Merge pull request !941 from Far/LOS_FS_MALLOC
2022-11-28 14:36:29 +00:00
openharmony_ci
af6863f436 !940 vfs 分区格式化逻辑修改
Merge pull request !940 from wangchen/1128_m_part
2022-11-28 14:17:42 +00:00
Far
f190275664 feat: 文件系统提供动态内存分配器钩子
增加LOS_FS_MALLOC/LOS_FS_FREE宏以提供用户配置动态内存分配器的能力。
用户只需要在components/fs/vfs/los_fs.h中修改对应的函数即可。

BREAKING CHANGE:
文件系统提供动态内存分配器钩子
新增宏:
LOS_FS_MALLOC
LOS_FS_FREE

fix #I63IJW

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I20cb41f621a2e22d74749583f546d550ba127b72
2022-11-28 20:02:20 +08:00
openharmony_ci
1bdee9f58e !939 feat: 更新PR模板, 添加对外变更
Merge pull request !939 from zhushengle/pr
2022-11-28 11:59:22 +00:00
wangchen
97a638bc1c fix: vfs 分区格式化逻辑修改
方案描述:
1,删除fat分区时调用的adddevice的动作
2,修改格式化的判断逻辑

fix #I63FDV
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-11-28 03:53:54 +00:00
zhushengle
55238c805a feat: 更新PR模板, 添加对外变确认项
在PR模板中添加对外变更的确认选项

fix #I636LO

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I96025b27f771f86cc03c8e60d0e307a9a6c0e404
2022-11-26 17:17:02 +08:00
openharmony_ci
0841ece718 !930 Fix : 内核告警清理
Merge pull request !930 from yinjiaming/fix
2022-11-23 04:09:25 +00:00
yinjiaming
a4087a6537 Fix: 内核告警清理
消除了多余的空格

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ibe90fcf8c46ef9a60c0a8f4dbba07d399e139b8c
2022-11-23 10:49:31 +08:00
openharmony_ci
9f19fd2e7a !918 Fix : POSIX 测试用例补充
Merge pull request !918 from yinjiaming/test-3
2022-11-22 06:58:12 +00:00
openharmony_ci
c10037d379 !877 更新liteos_m内核架构图
Merge pull request !877 from zhushengle/arch
2022-11-22 03:44:02 +00:00
yinjiaming
b483627ec7 fix: POSIX 测试用例后续补充
【背景】
kernel_litos_m 中需要补充 POSIX 相关的测试用例

【修改方案】
从 A 核中移植了一部分的POSIX 相关的测试用例
到 sample/posix/mqueue 目录下

【影响】
对现有的产品编译不会有影响

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I64efeb7d3ae3dbd966b716bf8e296a9eb0f5db06
2022-11-21 19:29:44 +08:00
openharmony_ci
d120f1e57a !921 其他分区已mount时会引起格式化失败
Merge pull request !921 from wangchen/1117_m
2022-11-18 09:34:41 +00:00
openharmony_ci
765add9660 !917 告警清理
Merge pull request !917 from 乔克叔叔/master
2022-11-18 09:15:46 +00:00
openharmony_ci
a650df0575 !916 修复用例告警
Merge pull request !916 from xuxinyu/1116
2022-11-18 09:14:03 +00:00
wangchen
08436dec9e fix: 其他分区已mount时会引起格式化失败
【背景】其他分区已mount时会引起格式化失败

【修改方案】
1, 格式化时判断方式修改为路径

【影响】
对现有的产品编译不会有影响。
re #I61P4K
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-11-18 06:31:12 +00:00
openharmony_ci
0818b28aa7 !919 fix:逗号格式错误
Merge pull request !919 from Hongjin Li/warning
2022-11-17 12:57:15 +00:00
Hongjin Li
2dc3998956 fix: add space after comma
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2022-11-17 20:15:53 +08:00
zhushengle
266a49fb88 feat: 更新liteos_m内核架构图
Close #I61OZZ

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I90afb1c83a9a34597e7b9699a784ad0fbff30f81
2022-11-17 18:41:40 +08:00
liuwenxin
fa6f0c393d fix:告警清理
Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2022-11-17 17:23:44 +08:00
openharmony_ci
3019311435 !910 Fix : POSIX 测试用例补充
Merge pull request !910 from yinjiaming/test-2
2022-11-16 09:50:31 +00:00
xuxinyu
b25148107b fix:修复用例告警
Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: Ide6f04adcd3bb12ae296f981cab84f9d7ce867fc
2022-11-16 15:55:34 +08:00
openharmony_ci
aee957bb1f !909 修复mount接口对MS_REMOUNT的支持
Merge pull request !909 from Far/master
2022-11-15 14:17:19 +00:00
Far
64d15df9ea fix: fix the MS_REMOUNT support
The mount interface can't deal with MS_REMOUNT flag now, fix it.

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: Id0960c8d92ce767b8d8ef98b3ba2e1d1ab7db15d
2022-11-15 17:05:21 +08:00
yinjiaming
8e58b984ea fix: POSIX 测试用例后续补充
【背景】
kernel_litos_m 中需要补充 POSIX 相关的测试用例

【修改方案】
从 A 核中移植了一部分的POSIX 相关的测试用例
到 sample/posix/mqueue 目录下

【影响】
对现有的产品编译不会有影响

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I64efeb7d3ae3dbd966b716bf8e296a9eb0f5db06
2022-11-15 16:54:28 +08:00
openharmony_ci
be1267fafa !903 fix: 修复测试用例断言宏使用不规范的问题
Merge pull request !903 from Zhaotianyu/20221110test_fix_assert
2022-11-14 09:41:12 +00:00
openharmony_ci
6cb544b158 !892 m告警清理
Merge pull request !892 from 乔克叔叔/master
2022-11-14 08:50:22 +00:00
openharmony_ci
5e8225273f !904 Fix : 内核告警清理
Merge pull request !904 from yinjiaming/fix
2022-11-14 08:35:08 +00:00
openharmony_ci
aec7a45411 !894 Fix : POSIX 测试用例补充
Merge pull request !894 from yinjiaming/test-1
2022-11-14 08:34:29 +00:00
liuwenxin
2806c4af75 Fix:m核告警清理
Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2022-11-11 17:40:25 +08:00
yinjiaming
7e442ddd61 fix: POSIX 测试用例后续补充
【背景】
kernel_litos_m 中需要补充 POSIX 相关的测试用例

【修改方案】
从 A 核中移植了一部分的POSIX 相关的测试用例
到 sample/posix/mqueue 目录下

【影响】
对现有的产品编译不会有影响

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I64efeb7d3ae3dbd966b716bf8e296a9eb0f5db06
2022-11-11 11:56:13 +08:00
openharmony_ci
527cec6e27 !906 RISC-V架构解依赖平台soc.h
Merge pull request !906 from zhushengle/soc
2022-11-10 12:47:40 +00:00
zhushengle
d68b5f0ab3 task: RISC-V架构解依赖平台soc.h
Close #I5M7JE

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I98f9f2a5d69576540a270778bf37899594c527f2
2022-11-10 18:45:27 +08:00
openharmony_ci
1cd2ae7b4e !901 risc-v系统异常时无法输出异常信息
Merge pull request !901 from zhushengle/medeleg
2022-11-10 10:30:50 +00:00
arvinzzz
27ed27eb89 fix: 修复测试用例断言宏使用不规范的问题
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
2022-11-10 17:45:43 +08:00
yinjiaming
098c5ea24d fix: 内核告警清理
Change-Id: Ic6d335964da545bc71edd40669c82b6f85e1bad6
Signed-off-by: yinjiaming <yinjiaming@huawei.com>
2022-11-10 17:32:52 +08:00
zhushengle
914913fab6 task: risc-v系统异常时取消对medeleg寄存器的保存
部分开源架构不支持该寄存器,且非常用寄存器

Close #I60IS5
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I8db31f84a24cc6143513c725691e4ba780ca99e9
2022-11-10 16:29:27 +08:00
openharmony_ci
2f08268983 !895 fix: buffersize paramter type error
Merge pull request !895 from Hongjin Li/fix
2022-11-09 09:29:57 +00:00
Hongjin Li
807c7e64cb fix: buffersize parameter type error
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2022-11-09 16:49:59 +08:00
openharmony_ci
fc87e459d1 !891 在LOS_QueueReadCopy 和 LOS_QueueWriteCopy中增加hook函数
Merge pull request !891 from Hongjin Li/add_hook_call
2022-11-09 08:41:16 +00:00
lihongjin
c3d75f64b1 feat: add hook call in LOS_QueueReadCopy and LOS_QueueWriteCopy
Signed-off-by: lihongjin <lihongjin1@huawei.com>
Change-Id: I0c8ecb6e364d8e01b48f78847c25da6bc4cb961c
2022-11-08 18:32:41 +08:00
openharmony_ci
f447d15e78 !893 M核fs用例整改
Merge pull request !893 from wangchen/1108_test
2022-11-08 08:04:55 +00:00
wangchen
642d5ef709 fix: M核fs用例整改
【背景】M核fs用例整改

【修改方案】
1,增加部分判断,适配fatfs
2,增加部分接口

【影响】
对现有的产品编译不会有影响。
re #I5Z4DL
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-11-08 07:26:06 +00:00
openharmony_ci
74bbfa4893 !853 fix:修复文档中失效链接
Merge pull request !853 from zhangdengyu/fix_links_1019
2022-11-08 03:31:18 +00:00
openharmony_ci
fe5a091ca2 !864 feat: 支持mutex trace
Merge pull request !864 from zhangdengyu/add_mutex_trace_1028
2022-11-08 03:07:54 +00:00
openharmony_ci
c83b98ecbf !868 告警清理
Merge pull request !868 from 乔克叔叔/master
2022-11-07 10:57:34 +00:00
openharmony_ci
c9a96bc4b3 !886 cortex-m4支持iar编译器的gn适配
Merge pull request !886 from yiweiniunan/master
2022-11-07 10:34:19 +00:00
yiweiniunan
62cd8fec46 cortex-m4支持iar编译器的gn适配
Signed-off-by: yiweiniunan <michael.likai@huawei.com>
2022-11-07 16:15:29 +08:00
liuwenxin
8b54493665 fix:告警清理
Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2022-11-07 14:58:48 +08:00
zhangdengyu
a940dda69a feat: 增加mutex trace功能
Close: #I5YJOZ

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: Id36ed4f4d23b9aa59ae9ee8cdb17c06d7e3c151b
2022-11-07 08:42:06 +08:00
openharmony_ci
1bc63d743b !881 feat: 提供死机场景下dump文件能力
Merge pull request !881 from Zhaotianyu/20221105vfs_lock
2022-11-07 00:41:11 +00:00
arvinzzz
474201593d feat: 提供死机场景下dump文件的能力
死机场景下,vfs层锁会放开,提供dump文件的能力

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Id8c9e63fbf011dbc6690b9b4557bd3370353bf21
2022-11-05 17:58:37 +08:00
openharmony_ci
3f54fdc898 !846 修复shell删除命令误删目录的问题
Merge pull request !846 from 方烨/master
2022-11-04 08:24:17 +00:00
openharmony_ci
8ac6771e0d !869 Fix : 给LOS_MuxDelete 函数前添加(VOID)
Merge pull request !869 from yinjiaming/fix
2022-11-04 08:23:38 +00:00
openharmony_ci
7101ddbeb8 !874 feat: pm idle添加到menuconfig中
Merge pull request !874 from zhushengle/pm_ilde
2022-11-03 14:10:34 +00:00
openharmony_ci
abbed4430e !847 解决部分平台ping失败
Merge pull request !847 from huohongpeng/ping_checksum
2022-11-03 14:05:50 +00:00
zhushengle
98d20e90ed feat: pm idle添加到menuconfig中
Close #I5ZD5L
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ibdedff3043a0902aa3cd9539497ef97fb6a1ce6c
2022-11-03 21:32:45 +08:00
openharmony_ci
9767191392 !859 Fix : POSIX 测试用例补充
Merge pull request !859 from yinjiaming/test-4
2022-11-03 02:17:32 +00:00
openharmony_ci
e540254ed9 !862 feature:支持厂商自定义malloc替换系统默认实现
Merge pull request !862 from Zhaotianyu/20221028iar_malloc
2022-11-01 13:48:15 +00:00
yinjiaming
ad4ef11410 fix: POSIX 测试用例后续补充
【背景】
kernel_litos_m 中需要补充 POSIX 相关的测试用例

【修改方案】
从 A 核中移植了一部分的POSIX 相关的测试用例
到 sample/posix 目录下

【影响】
对现有的产品编译不会有影响

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I65adfd00faec185bcad3c1e38e305ce9e8cb9346
2022-11-01 16:26:56 +08:00
yinjiaming
20ffd89865 fix: 给函数LOS_MutexDelete 前添加(VOID)
Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I49a7c305e955bccca78b80ddeea66330e8b03ac0
2022-11-01 15:43:18 +08:00
arvinzzz
ae8d4fd275 feature: 支持厂商定制malloc替换系统默认实现
malloc的相关支持可以通过make menuconfig配置

close: #I5YBPE

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ic40968aa83f43f539f7551c1dcec05f4f9832983
2022-10-28 18:53:53 +08:00
openharmony_ci
972d765c6e !861 Test : POSIX 测试用例补充
Merge pull request !861 from vincent-zhang/myfeature
2022-10-28 02:09:45 +00:00
vincent
47f883c11a zhangadong@huawei.com
Signed-off-by: vincent <zhangadong@huawei.com>
2022-10-28 09:33:36 +08:00
openharmony_ci
478b41b457 !857 Fix : POSIX 测试用例补充
Merge pull request !857 from yinjiaming/test-2
2022-10-26 06:33:41 +00:00
yinjiaming
69d17d522c fix: POSIX 测试用例后续补充
【背景】
kernel_litos_m 中需要补充 POSIX 相关的测试用例

【修改方案】
从 A 核中移植了一部分的POSIX 相关的测试用例
到 sample/posix 目录下

【影响】
对现有的产品编译不会有影响

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ib8ab772f9893e243ace9319cb7af1486a6bd2937
2022-10-25 15:45:33 +08:00
fangye
d4bfb577ef fix: 修复shell删除命令误删目录的问题
Signed-off-by: fangye <fangye@talkweb.com.cn>
Change-Id: Ia8f26ff4b250a6540f5644e2dd38fb22cd85d326
2022-10-25 12:19:46 +08:00
openharmony_ci
6e6cbe5de6 !855 Fix : POSIX 测试用例补充
Merge pull request !855 from yinjiaming/test-1
2022-10-24 11:11:57 +00:00
yinjiaming
383a1d23e9 fix: POSIX 测试用例补充
【背景】
kernel_litos_m 中需要补充 POSIX 相关的测试用例

【修改方案】
从 A 核中移植了一部分的POSIX 相关的测试用例
到 sample/posix 目录下

【影响】
对现有的产品编译不会有影响

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ib8ab772f9893e243ace9319cb7af1486a6bd2937
2022-10-24 15:39:20 +08:00
openharmony_ci
b24353cf4b !854 Fix : 使用 newlibc 编译测试用例时报错
Merge pull request !854 from yinjiaming/master
2022-10-21 09:58:50 +00:00
openharmony_ci
f1ad086665 !842 cmsis测试用例补充
Merge pull request !842 from 乔克叔叔/branchname
2022-10-21 09:12:17 +00:00
yinjiaming
8fff50f59f fix: newlibc 编译错误修正
【背景】
使用newlibc 编译测试用例时会有编译错误

【修改方案】
删去了 newlibc 中没有的宏定义

【影响】
对现有的产品编译不会有影响。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Id753640253e1b297654b3e523ddd5ca0abdca698
2022-10-20 19:52:32 +08:00
zhangdengyu
373d4f5649 fix: 修复文档中失效链接
Close: #I5WGWU

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I8c37da09e85e823edd59ebf65a3e284596b7bef9
2022-10-19 10:21:05 +08:00
Hongpeng Huo
3c8d20a89e fix: icmp hardware checksum failed for dwc gmac ip core
Signed-off-by: Hongpeng Huo <hongpeng.huo@hpmicro.com>
2022-10-17 20:33:11 +08:00
openharmony_ci
e268ef95a9 !851 清除一些静态检查工具发现的问题
Merge pull request !851 from Far/master
2022-10-17 01:38:58 +00:00
Far
296a546bcd fix: 修复一些静态扫描工具发现的问题
Change-Id: I4890de0066f33bf44e913b550edfa3639bce7caf
Signed-off-by: Far <yesiyuan2@huawei.com>
2022-10-15 17:36:26 +08:00
openharmony_ci
a7135e252d !838 fix: 测试用例修复
Merge pull request !838 from Zhaotianyu/20220925iccarm_test_fix
2022-10-13 12:58:17 +00:00
openharmony_ci
e76dd685c2 !845 Fix : POSIX测试用例补充
Merge pull request !845 from yinjiaming/test-2
2022-10-10 11:28:30 +00:00
yinjiaming
54a5365a25 fix: POSIX 测试用例后续补充
【背景】
POSIX 测试用例不完善

【修改方案】
继续将 A 核posix 相关的测试用例移植一部分到M核

【影响】
对现有的产品编译不会有影响。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I9a7fff077c5bc00609e51ba9121d93dc67895656
2022-10-10 17:14:45 +08:00
openharmony_ci
2d1160fdc4 !844 Fix : POSIX测试用例补充
Merge pull request !844 from yinjiaming/test-1
2022-10-10 09:10:10 +00:00
yinjiaming
f3d606b6dd fix: POSIX测试用例后续补充
【背景】
posix 测试用例补充

【修改方案】
继续将A核 相关POSIX测试用例移植到 M核

【影响】
对现有的产品编译不会有影响。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I91f996a4b4db47a417c9f32c9e04924cc264afbb
2022-10-10 11:46:07 +08:00
openharmony_ci
392e4c2cec !843 Fix : POSIX测试用例补充
Merge pull request !843 from yinjiaming/test
2022-10-09 08:23:53 +00:00
yinjiaming
b334658723 fix: POSIX测试用例补充
【背景】
POSIX测试用例需要补充

【修改方案】
此次修改将部分A核的测试用例移植到M核, 补充到testsuites/sample/posix/pthread
目录下

【影响】
对现有的产品编译不会有影响。

re #I5TIRQ

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: If4c45ca18dec53be809f6309ef1cfb1b9ac0eb20
2022-10-09 10:49:10 +08:00
wenxin-liu_admin
a502a0917c :cmsis 测试用例补充
Signed-off-by: wenxin-liu_admin <liuwenxin11@huawei.com>
Change-Id: Iaa133871c465e20170a3bf2204cb1c6ba40fda72
2022-09-30 15:53:58 +08:00
openharmony_ci
2b1f2d554e !833 解决网络模块封装的ioctl等接口重定义
Merge pull request !833 from wangchen/0923_up_net
2022-09-27 10:54:02 +00:00
wangchen
2cf290bb7c fix: 删除网络模块封装的ioctl等接口
【背景】删除网络模块封装的ioctl等接口

【修改方案】
1, 删除网络模块封装的ioctl等接口

【影响】
对现有的产品编译不会有影响。
re #I5SRE6
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-09-27 09:28:07 +00:00
openharmony_ci
8fc9852e34 !830 lfs_mount 不能多实例
Merge pull request !830 from wangchen/0922_m
2022-09-26 13:09:18 +00:00
openharmony_ci
816d03f5c1 !832 LOS_FsMount 接口存在多处功能问题
Merge pull request !832 from wangchen/0923_m
2022-09-26 13:02:50 +00:00
openharmony_ci
61877ec97a !831 fix: 修复内核低功耗模式调整后同步问题
Merge pull request !831 from zhushengle/pm
2022-09-26 09:40:24 +00:00
arvinzzz
0f952132c0 fix: iccarm test's problem fix
close: #I5T02Y

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I29385bb25f487adafa2dbc064310817790d831bb
2022-09-25 18:54:03 +08:00
openharmony_ci
f94d3ee119 !835 内核告警清理:修复内存泄漏、空指针未判断等问题
Merge pull request !835 from 夏不白/fix_tscan
2022-09-25 08:24:10 +00:00
xiacong
784429d0dc <fix>
修复报警信息,为以下修复点
1、修复空指针未判断
2、修复open后未及时close 导致内存泄露
3、修复strdup后未free
4、修复赋值后未使用等问题
5、修复编码中判断条件中无符号变量小于零的情况

Signed-off-by: xiacong <xiacong4@huawei.com>
Change-Id: I13d046141afeb8a116e6a04304a3793bf8e12bee
Signed-off-by: xiacong <xiacong4@huawei.com>
2022-09-24 22:11:27 +08:00
openharmony_ci
1a764df92a !816 fix:trace模块编译修复
Merge pull request !816 from Zhaotianyu/20220902trace_fix
2022-09-23 09:39:15 +00:00
wangchen
cf50cde1b7 fix: lfs_mount 不能多实例
【背景】最后一个调用lfs_mount()的分区是有效的,前面的会被冲掉

【修改方案】
1, 增加一个存放cfg的空间, 每个mount点有独自的配置存储空间

【影响】
对现有的产品编译不会有影响。
re #I5RIGH
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-09-23 06:44:53 +00:00
wangchen
bfef7bfb2e fix: LOS_FsMount 接口存在多处功能问题
【背景】LOS_FsMount 接口存在多处功能问题

【修改方案】
1, 修改goto逻辑
2,把过长的函数重新封装

【影响】
对现有的产品编译不会有影响。
re #I5SP1I
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-09-23 03:45:18 +00:00
zhushengle
5bae8b58c6 fix: 修复内核低功耗模式调整后同步问题
Close #I5SNYA
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I4df212bbf3e522ea371b5340848ba5adf2668ad7
2022-09-23 09:32:32 +08:00
openharmony_ci
044cf59583 !825 M核用例编译问题修复, 内核补充fcntl
Merge pull request !825 from wangchen/0917_m
2022-09-22 09:06:20 +00:00
wangchen
0adbafb9c2 \fix: M核用例编译问题修复
【背景】M核用例编译问题修复

【修改方案】
1, 添加musl缺失的fcntl
2,删除musl下对fcntl和ioctl的依赖
3,修改fs和vfs种fcntl入参的处理

【影响】
对现有的产品编译不会有影响。
re #I5PKBJ
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-09-21 07:20:12 +00:00
openharmony_ci
3398937b1b !822 Fix : 内核告警清理
Merge pull request !822 from yinjiaming/fix
2022-09-21 04:42:39 +00:00
openharmony_ci
3c010b4717 !828 【轻量级 PR】:【OpenHarmony开源贡献者计划2022】fix warning: 'return' with a value, in function returning void
Merge pull request !828 from wangziyi0929/N/A
2022-09-21 03:09:31 +00:00
yinjiaming
c237ff63fa fix: 内核告警修复
【背景】
内核代码经扫描工具检测发现有可以修改的
告警

【修改方案】
1. 对只有单一语句的if, while等添加括号使之符合编程规范
2. 将C 风格的类型转换变为 C++ 风格的

【影响】
对现有的产品编译不会有影响。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I0b7659882eec777cade3ee21e76a42a86e2ce822
2022-09-21 10:30:30 +08:00
wangziyi0929
3508110f6d fix warning: 'return' with a value, in function returning void
Signed-off-by: wangziyi0929 <915619048@qq.com>
2022-09-19 07:55:05 +00:00
openharmony_ci
ffa868a81c !827 M核对公共基础类库路径依赖修改
Merge pull request !827 from wangchen/0919_m
2022-09-19 07:06:17 +00:00
wangchen
7d391c9bbf fix: M核对公共基础类库路径依赖修改
【背景】M核对公共基础类库路径依赖修改

【修改方案】
1, 修改lwip依赖的路径

【影响】
对现有的产品编译不会有影响。
re #I5RSMC
Signed-off-by: wangchen <wangchen240@huawei.com>
https://gitee.com/openharmony/kernel_liteos_m/issues/I5RSMC
2022-09-19 06:28:16 +00:00
openharmony_ci
e4a1c18d40 !826 【OpenHarmony开源贡献者计划2022】 删除未初始化的变量ret
Merge pull request !826 from 刘淦/master
2022-09-19 02:38:00 +00:00
liugan
83790f4f9b remove unused variable ret
Signed-off-by: liugan <liugan_public@163.com>
2022-09-17 17:16:17 +08:00
arvinzzz
6377f98e9e fix: trace模块编译修复
close: #I5PD6D

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I727ddaa78c5ca7b6626347659f584f54191efabe
2022-09-02 11:37:42 +08:00
openharmony_ci
b8f8ab5a36 !807 非安全函数告警清理
Merge pull request !807 from xuxinyu/function_s
2022-08-26 04:45:26 +00:00
xuxinyu
a0b776a709 非安全函数告警清理
Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: I45bbaa3568be3679b34b1e8b072d19d878fdbf02
2022-08-25 20:50:48 +08:00
openharmony_ci
f5f18ca669 !812 fix:iccarm下fs的编译错误
Merge pull request !812 from Zhaotianyu/20220824iccarm_fs_fix
2022-08-24 10:49:19 +00:00
arvinzzz
5756d45e84 fix: 修复fs在iccarm下的编译错误
close: #I5NXFL

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
2022-08-24 16:59:42 +08:00
openharmony_ci
8a25f31aa4 !809 unittest关联issue
Merge pull request !809 from Hongjin Li/dev2
2022-08-24 06:36:20 +00:00
Hongjin Li
f7cc6ff14e test: unittest 关联 issue number
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: I0a735c85c004ef3171eb170effacc034e3c8cd1a
2022-08-24 11:31:55 +08:00
openharmony_ci
bf9e0c9e2b !805 补充unittest用例描述
Merge pull request !805 from Hongjin Li/dev1
2022-08-23 14:03:19 +00:00
Hongjin Li
e9de74a94a test: testcase description
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: I1f8067dfbde2c12c092d5c9570f6ad45430f58ef

Change-Id: Ifad39593d943a29771691b6c23289d9774f5dfab
2022-08-23 21:20:54 +08:00
openharmony_ci
b38f135242 !795 低功耗增加idle选项
Merge pull request !795 from zhushengle/pm
2022-08-23 13:06:03 +00:00
openharmony_ci
0cb50baa55 !801 编译构建规范优化
Merge pull request !801 from Hongjin Li/dev
2022-08-23 12:26:15 +00:00
Hongjin Li
565049f1eb style: string format in python
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: I0d6ffb978bf4f96fd546868a6dd5f20d2cefbfd6
2022-08-23 18:52:42 +08:00
zhushengle
9add4b4b92 feat: 低功耗增加idle选项
Close #I5N9J2

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I066ff415709145e585f1eb94e70263361d3d71af
2022-08-22 17:04:08 +08:00
openharmony_ci
5992506c75 !796 feature:允许device_path指向vendor
Merge pull request !796 from Zhaotianyu/20220820build.gn
2022-08-20 08:38:20 +00:00
arvinzzz
d4db5a5a75 feature: BUILD.gn中device_path允许指向vendor
close: #I5N9NC

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: If6a05871a0c78a92d6370b73528674e411642e20
2022-08-20 15:54:44 +08:00
openharmony_ci
fe8b68826a !792 fix: iccarm fatfs编译问题修复
Merge pull request !792 from Zhaotianyu/20220818iccarm_fatfs
2022-08-18 11:38:21 +00:00
arvinzzz
99640e9977 fix: fatfs iccarm编译修复
close: #I5MZ62

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ie3882e443406d5055ff58c780cd376ddd6054bbf
2022-08-18 17:47:34 +08:00
openharmony_ci
0dc3c7ae9e !782 【轻量级 PR】:删除未使用的ret变量
Merge pull request !782 from fanhonglin/N/A
2022-08-17 06:11:28 +00:00
openharmony_ci
699bb81fc3 !721 完善文件系统vfs层初始化函数
Merge pull request !721 from LeonChan/oh
2022-08-17 04:35:45 +00:00
leonchan5
f2c4b59773 feat: liteos-m文件系统初始化函数支持littlefs
VFS初始化函数LOS_DiskPartition及LfsFormat支持littlefs,支持对flash设备进行分区和格式化操作
1,VFS层记录Fat/littlefs设备名称、分区等信息,后续在本层做处理
2,flash设备的相关配置及驱动操作接口通过LOS_DiskPartition配置,产品不用直接面向具体文件系统

close: #I5CYKI

Signed-off-by: leonchan5 <chenwei26@huawei.com>
2022-08-16 18:55:53 +08:00
openharmony_ci
b656553c5c !786 【OpenHarmony开源贡献者计划2022】change LOS_IntLock() to (VOID)LOS_IntLock()
Merge pull request !786 from chianqi/LOS_IntLock
2022-08-16 01:21:18 +00:00
openharmony_ci
7653bd8da1 !780 【OpenHarmony开源贡献者计划2022】remove unnecessary extern "C"
Merge pull request !780 from 宋晓丽/cpp
2022-08-16 01:14:55 +00:00
openharmony_ci
1275ecbc8a !778 【OpenHarmony开源贡献者计划2022】+ store拼写不对
Merge pull request !778 from 虚竹/master
2022-08-16 01:13:02 +00:00
openharmony_ci
ebc57397f0 !785 【OpenHarmony开源贡献者计划2022】change memset to (VOID)memset when not handling the return value
Merge pull request !785 from qian8888/lms
2022-08-16 01:12:07 +00:00
anqi
cce6365f4f change LOS_IntLock() to (VOID)LOS_IntLock()
Signed-off-by: anqi <anqi@liuxiuhai.cn>
2022-08-15 20:51:29 +08:00
zq
04f391d814 change memset to (VOID)memset when not handling the return value
Signed-off-by: zq <zhangqian@liuxiuhai.cn>
2022-08-15 19:56:39 +08:00
openharmony_ci
14e64fc89b !783 修改littlefs readdir在完全读完后,会设置错误码EBADF
Merge pull request !783 from wangchen/0812_m
2022-08-12 09:44:29 +00:00
wangchen
2ce5ce9397 fix: littlefs readdir在完全读完后,会设置错误码EBADF
【背景】littlefs readdir在完全读完后,会设置错误码EBADF

【修改方案】
1,  fsFops->readdir 执行返回非0时,有可能是正常情况,因此删除else赋值错误码

【影响】
对现有的产品编译不会有影响。
re #I5M1OE
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-08-12 09:25:20 +00:00
openharmony_ci
eb40e4a068 !775 【OpenHarmony开源贡献者计划2022】void TcpIpPortingInit()无参数时需要修改为(void)
Merge pull request !775 from sinall/master
2022-08-12 03:50:54 +00:00
openharmony_ci
dc5feb9e19 !774 【OpenHarmony开源贡献者计划2022】fix mempry to memory、satck to stack
Merge pull request !774 from rtos_ding/typo
2022-08-12 02:28:07 +00:00
openharmony_ci
7a61f8d836 !781 【OpenHarmony开源贡献者计划2022】change uwtimeout to timeout
Merge pull request !781 from 红叶电脑/timeout
2022-08-12 02:27:15 +00:00
openharmony_ci
330760dbb3 !779 【OpenHarmony开源贡献者计划2022】+ release拼写错误
Merge pull request !779 from 王小二/master
2022-08-12 02:24:20 +00:00
openharmony_ci
2739a00c55 !777 【OpenHarmony开源贡献者计划2022】+ 信号量 应该是 semaphore
Merge pull request !777 from 哈哈哈/master
2022-08-12 02:23:42 +00:00
openharmony_ci
7f14b060d4 !776 【OpenHarmony开源贡献者计划2022】修复一些规范小问题
Merge pull request !776 from VinceCarter123/void
2022-08-12 02:20:06 +00:00
fanhonglin
8be6e129fc 删除未使用的ret变量
Signed-off-by: fanhonglin <1064581928@qq.com>
2022-08-12 01:34:32 +00:00
wx880216
f465c15d7a change uwtimeout to timeout
Signed-off-by: wx880216 <wx880216@liuxiuhai.cn>
2022-08-12 01:15:13 +08:00
songxiaoli4790
0af2577498 remove unnecessary extern "C"
Signed-off-by: songxiaoli4790 <songxiaoli4790@liuxiuhai.cn>
2022-08-12 00:54:29 +08:00
王小二
238ff396b8 release拼写错误
Signed-off-by: 王小二 <x1234567890801@126.com>

Signed-off-by: 王小二 <x1234567890801@126.com>
2022-08-11 15:33:34 +00:00
虚竹
5917c4b01b store拼写不对
Signed-off-by: 虚竹 <x18919883794@163.com>

Signed-off-by: 虚竹 <x18919883794@163.com>
2022-08-11 15:23:12 +00:00
哈哈哈
5c4edb9b1a 信号量单词不合适
Signed-off-by:哈哈哈 <x16739329869@163.com>

Signed-off-by: 哈哈哈 <x16739329869@163.com>
2022-08-11 15:13:36 +00:00
danhao
ce176e77e6 add VOID to swtmr test function parameter list
Signed-off-by: danhao <danhao@liuxiuhai.cn>
2022-08-11 22:54:14 +08:00
Gao Rui
8ef012bdad Fix TcpIpPortingInit() to TcpIpPortingInit(void)
Signed-off-by: Gao Rui <gaoruinan@163.com>
2022-08-11 22:00:22 +08:00
juan
933efffba7 fix mempry to memory、satck to stack
Signed-off-by: juan <juan@liuxiuhai.cn>
2022-08-11 21:23:46 +08:00
openharmony_ci
ae692bfbc4 !768 feature: C库补充access、remove接口
Merge pull request !768 from Zhaotianyu/20220806fs_add
2022-08-11 11:05:50 +00:00
arvinzzz
ab46b9c836 feature: C库补充fs接口
close: #I5J5YD

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I21c11106b24b6e050d4061a98ad69b2b10a5a318
2022-08-11 15:43:02 +08:00
openharmony_ci
b83d17039e !771 补充cmsis queue测试用例
Merge pull request !771 from xuxinyu/CmsisTestCase
2022-08-11 06:42:40 +00:00
xuxinyu
08404f3252 补充cmsis queue测试用例
Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: Ic717514a92c5b98f247ad7185122722878d16506
2022-08-11 11:43:12 +08:00
openharmony_ci
8b19c3cbe4 !770 新增静态队列用例
Merge pull request !770 from xuxinyu/StaticQueueTest
2022-08-09 11:38:03 +00:00
xuxinyu
192a2a6e61 新增静态队列用例
Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: Ib07ab22ee884475d5bc4de54fb43c89eed2c1305
2022-08-09 16:47:27 +08:00
openharmony_ci
2ec2c369e7 !755 内核告警清理
Merge pull request !755 from yinjiaming/fix
2022-08-09 08:37:39 +00:00
openharmony_ci
f2b280bdbd !769 feature:支持queue地址外部部署共功能及queue名字设置
Merge pull request !769 from xuxinyu/static_by_id
2022-08-08 15:34:36 +00:00
xuxinyu
c09b3a8774 feature:支持queue地址外部部署共功能及queue名字设置
Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: I1984014956a92d61d65b68f79279b2aa593a72e1
2022-08-08 23:11:11 +08:00
openharmony_ci
04cded2f0a !765 Fix : 修复了OsTraceInit() 参数错误问题
Merge pull request !765 from yinjiaming/dev
2022-08-05 10:16:12 +00:00
openharmony_ci
ddfb363675 !766 fix: iccarm编译修复
Merge pull request !766 from Zhaotianyu/20220801iccarm_fix
2022-08-02 01:47:08 +00:00
arvinzzz
d0c50a4af0 fix: iccarm编译修复
close: #I5JXMJ

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I3fbaf459ad4807a44396f319a4d53d3cc1e7700c
2022-08-01 16:53:18 +08:00
yinjiaming
6affe19d5a fix: OsTraceInit参数错误修正
【背景】
los_init.c 中存在 OsTraceInit()参数不正确的
错误

【修改方案】
修改OsTraceInit()参数错误的地方, 并包含了相应的头文件

 【影响】
对现有的产品编译不会有影响。

re #I5H4UT

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I112067819d1850003ba0b36bd344b4ab9a8878d5
2022-07-30 09:17:23 +00:00
yinjiaming
a36d5d9058 fix: 内核告警修复
【背景】
内核代码经代码扫描工具发现存在一些关于代码格式的告警,
现经修改解除掉告警。

【修改方案】
修改了代码中格式不规范的地方,修改的点有:
1.代码中一行过长
2.没有合理的添加空格和空行
3.没有按照规范进行缩进
4.括号的格式没有按照规范
5.注释的格式不对以及存在魔数字
6.函数的声明与定义的格式不一致
并更新了修改文件的版权头时间

【影响】
对现有的产品编译不会有影响。

re #I5H6F5
Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Id8eb0450d03fae537ea4c73190fdadb76b29253d
2022-07-29 08:30:38 +00:00
openharmony_ci
63bf098b0f !758 refactor:Kconfig选项解耦
Merge pull request !758 from Zhaotianyu/20220723Kconfig
2022-07-27 09:11:40 +00:00
openharmony_ci
252052f024 !757 M核time模块支持调用RTC接口
Merge pull request !757 from wangchen/0722_m
2022-07-26 15:05:28 +00:00
wangchen
8c46636052 fix: M核time模块支持调用RTC接口
【背景】M核time模块支持调用RTC接口

【修改方案】
1, 增加注册接口
2, 读写时间时判断是否有rtc

【影响】
对现有的产品编译不会有影响。
re #I5IKMN
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-07-26 14:23:08 +00:00
openharmony_ci
6ff615b9ca !756 拼写错误修正
Merge pull request !756 from yinjiaming/dev
2022-07-25 11:06:31 +00:00
arvinzzz
732a346399 refactor: Kconfig选项解耦
close: #I5I7LX

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ieaf3bc6bf0c345a7d7945abb9133bd40fbe9d5b8
2022-07-23 21:21:59 +08:00
yinjiaming
2931dc6013 fix: 拼写错误修正
【背景】
代码中存在拼写错误

【修改方案】
修改存在拼写错误的地方

 【影响】
对现有的产品编译不会有影响。

re #I5IA7P

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Iba87369fef7dbcbcd974e07d4cb279874ff697fb
2022-07-21 11:18:24 +00:00
openharmony_ci
df30bc4e0a !753 M4 qemu newlibc与musl差异用例隔离
Merge pull request !753 from wangchen/0712_m
2022-07-18 06:18:00 +00:00
openharmony_ci
1599669290 !748 Use rv32i substring as RISC-V architecture selector
Merge pull request !748 from Dmytro Kosmii/master
2022-07-18 02:15:55 +00:00
wangchen
d8104f6290 fix: M4 qemu 开启newlibc编译报错
【背景】M4 qemu 开启newlibc编译报错

【修改方案】
删除musl依赖路径

【影响】
对现有的产品编译不会有影响。
re #I5GIAR
Signed-off-by: wangchen <wangchen240@huawei.com>
2022-07-16 10:47:21 +00:00
Dmytro Kosmii
3a190a1a1b Added missed includes.
Signed-off-by: Dmytro Kosmii <dmytro.kosmii@telink-semi.com>
Change-Id: I172a68a1ad6ca194399a6d47d46c54ebcfbd9338
2022-07-12 19:45:07 +03:00
openharmony_ci
e1f986305b !745 iccarm工具链支持
Merge pull request !745 from wish/tag_iccarm
2022-07-12 11:05:34 +00:00
openharmony_ci
0c8b7d2a1b !751 refactor:编译框架对不同工具链的解耦优化
Merge pull request !751 from Zhaotianyu/20220712buildframework_opt
2022-07-12 09:40:58 +00:00
i-wangliangliang
62eb96dd8d iccarm工具链编译适配
Signed-off-by: i-wangliangliang <willfox@126.com>
Change-Id: I9360dc232c35ec4db7a9bee08f3c288e22941e39
2022-07-12 17:01:44 +08:00
arvinzzz
009d2503fb refactor: 编译框架对不同工具链的解耦优化
close: #I5GQ9A

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I3e371a67bdab75c53e769e08c1c54ec83c741a69
2022-07-12 16:54:35 +08:00
openharmony_ci
39839d313c !749 feature: 编译框架支持iccarm
Merge pull request !749 from Zhaotianyu/20220711buildframework_iccarm
2022-07-12 08:27:37 +00:00
arvinzzz
d92c10d92d feature: 编译框架支持iccarm
close: #I5GL0C

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I94babac4d748b0c714835522a31f02b4f70de3e9
2022-07-12 14:54:15 +08:00
openharmony_ci
915b97b18e !746 Fix : 删除了不用的库文件
Merge pull request !746 from yinjiaming/master
2022-07-11 11:45:42 +00:00
openharmony_ci
9d0460b546 !741 Fix : 修复了测试用例返回值不匹配的问题
Merge pull request !741 from yinjiaming/fix
2022-07-11 11:19:21 +00:00
yinjiaming
12e8541b6f fix: 内核目录规范整改
【背景】
内核仓库中有一些废弃的二进制文件

【修改方案】
删去已不用的二进制文件与对应的头文件

【影响】
对现有的产品编译不会有影响。

re #I5GHWE

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I62ff61630b08e90022f3b1fb37a569d5b3627aa9
2022-07-11 07:20:06 +00:00
openharmony_ci
8170152730 !743 feature:新增cortex-m55的iar与trustzone支持
Merge pull request !743 from Zhaotianyu/20220707adapt_m55
2022-07-09 07:31:03 +00:00
Dmytro Kosmii
f7d79148b7 Use rv32i substring as RISC-V architecture selector.
Signed-off-by: Dmytro Kosmii <dmytro.kosmii@telink-semi.com>
Change-Id: Ie5b0b2be987f112bc150ec817080b59a332cbac1
2022-07-08 15:37:22 +03:00
arvinzzz
ad29f69777 feature: 新增cortex-m55的iar与trustzone支持
close: #I5G26W

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I1fbcbc6530085902afa86dc04c1760ffe5e97483
2022-07-07 19:45:33 +08:00
openharmony_ci
85663b9258 !739 fix: gcc低版本时BOOL类型重定义
Merge pull request !739 from Zhaotianyu/0630bool_fix
2022-07-06 08:43:43 +00:00
arvinzzz
4bd88ffb1f fix: gcc低版本时兼容与ohos_types.h的类型重定义
close: #I5EW48

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I897803addf5609b2f783d7b89ced9fb039e08f07
2022-07-06 15:37:24 +08:00
yinjiaming
6f92337be2 fix: 修复测试用例返回值不匹配的问题
【背景】
部分测试用例所使用的宏的返回值与函数本身返回值不匹配

【修改方案】
修改不匹配的宏和函数

【影响】
对现有的产品编译不会有影响。

re #I58CP5

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Id7b93e215cd760dbe36caea392db5abe3a1dd5f1
2022-07-05 12:13:58 +00:00
openharmony_ci
7add94de1f !737 【OpenHarmony开源贡献者计划2022】Fixed typos.
Merge pull request !737 from Mr_YX/master
2022-07-04 01:20:36 +00:00
openharmony_ci
dd36f4482c !738 Fix : 修改内核目录不规范的问题
Merge pull request !738 from yinjiaming/targets
2022-06-30 00:10:22 +00:00
yinjiaming
dcb2dbee77 fix: 修复内核目录不规范的问题
【背景】
内核中targets目录的位置不规范

【修改方案】
从内核仓库中删除targets目录

【影响】
对现有的产品编译不会有影响。

re #I5EFBF

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ic77eac4583c4ce141050ed1fe661d837408413ac
2022-06-29 08:13:29 +00:00
openharmony_ci
6a7a18e2d3 !723 Fix: 对测试用例中的POSIX相关的测试用例添加入口
Merge pull request !723 from yinjiaming/master
2022-06-29 07:36:42 +00:00
yinjiaming
7ecdbbe6d7 fix: 对与POSIX相关的测试用例添加入口
【背景】
posix 相关的测试用例中需要添加一个入口

【修改方案】
添加了对应的程序文件,并在该文件中调用所有POSIX相关的测试用例的函数

【影响】
对现有的产品编译不会有影响

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I107dd5d7ec2691c8e1d8677b916b4b00c628506f
2022-06-28 08:20:09 +00:00
Mr_YX
e9425d1833 update kernel/src/los_sched.c.
Signed-off-by: mr-yx <496043997@qq.com>
2022-06-27 14:08:10 +00:00
mr-yx
527f6cf86e fixed typos
Signed-off-by: mr-yx <496043997@qq.com>
2022-06-27 22:05:19 +08:00
openharmony_ci
df9387c28f !725 fix: 修复系统时间比RTC时间过快的问题
Merge pull request !725 from zhushengle/tick_master
2022-06-25 09:41:52 +00:00
openharmony_ci
d08a3e3f13 !732 LOSCFG_PLATFORM_HWI_WITH_ARG开启后M核编译失败修改
Merge pull request !732 from wangchen/0623_hwi
2022-06-24 11:49:12 +00:00
openharmony_ci
48ff5189b8 !727 OsShellCmdFreeInfo打印换行修改
Merge pull request !727 from wangchen/0622_m
2022-06-24 10:37:52 +00:00
zhushengle
600283a96f fix: 修复系统时间比RTC时间过快的问题
1.标记在时间接口中更新base后在中断中不再更新base
2.优化tick计算

Close #I5DCRB

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ic3df09142519357353906d40e3fd3cdca5cac71d
2022-06-24 17:47:06 +08:00
openharmony_ci
a333e8f88e !734 删除osTimerNew接口中对传入的定时器类型的重复判断
Merge pull request !734 from Mr.W/dev
2022-06-24 06:41:02 +00:00
wangmeng
ce49331798 删除osTimerNew接口中对传入的定时器类型的重复判断
Signed-off-by: wangmeng <wangmeng90798@talkweb.com.cn>
2022-06-24 10:05:39 +08:00
wangchen
fc8c547b05 fix: LOSCFG_PLATFORM_HWI_WITH_ARG开启后M核编译失败修改
【背景】LOSCFG_PLATFORM_HWI_WITH_ARG开启后M核编译失败

【修改方案】
对涉及的函数指针进行强制转换

【影响】
对现有的产品编译不会有影响。
re #I4W4GM
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-06-23 11:43:29 +00:00
openharmony_ci
8cfadb9b4d !729 禁止导出符号被编译器优化掉
Merge pull request !729 from xuxinyu/master
2022-06-23 11:17:05 +00:00
openharmony_ci
2c5b750a46 !731 so 解析脚本单位表示错误
Merge pull request !731 from xuxinyu/FixdylinkSO_pares
2022-06-23 11:16:40 +00:00
x_xiny
3df936f1a1 禁止导出符号被编译器优化掉
re #I4XQC1

Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: I79a59e70ddaba746a50bd92aea647778c4e90a0c
2022-06-23 17:31:57 +08:00
x_xiny
6fa1fe5993 so 解析脚本单位表示错误
re #I4X3AL

Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: Idd6d3c171b785ebd332402d3f29ffb484e644545
2022-06-23 17:18:57 +08:00
openharmony_ci
8a05eb6e08 !722 修复liteos_m仓库中存在的一些拼写错误
Merge pull request !722 from Hongjin Li/dev
2022-06-23 04:10:35 +00:00
lihongjin
243fe55c68 style: Misspelling
Signed-off-by: lihongjin <lihongjin1@huawei.com>
Change-Id: Ie14607b483d31a6efdf17e40e9937fe4bc2484c2
2022-06-23 09:46:16 +08:00
openharmony_ci
a7341d81d1 !702 【OpenHarmony开源贡献者计划2022】更新readme中的目录结构
Merge pull request !702 from yjzhkh/master
2022-06-23 00:51:41 +00:00
wangchen
c8ce65f408 fix: OsShellCmdFreeInfo打印换行格式混用修改
【背景】OsShellCmdFreeInfo打印换行格式混用

【修改方案】
删除\r

【影响】
对现有的产品编译不会有影响。
re #I52MES
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-06-22 07:50:26 +00:00
openharmony_ci
c1e3856bbe !714 eat: normalize drivers framework component and repos
Merge pull request !714 from yuanbo/master
2022-06-17 06:40:26 +00:00
yuanbo
3a887c616a feat: normalize drivers framework component and repos
Signed-off-by: yuanbo <yuanbo@huawei.com>
2022-06-15 20:07:10 +08:00
openharmony_ci
3303cd7bc1 !709 feature: C库适配iar
Merge pull request !709 from xuxinyu/master
2022-06-14 11:57:16 +00:00
x_xiny
7c5a05f352 feature: C库适配iar
re #I5BUG3

Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: I84591c7593622de22a33f411b7011d17034c6d55
2022-06-14 15:46:29 +08:00
openharmony_ci
5df101eae5 !703 TCB结构体扩展宏添加分号
Merge pull request !703 from 方烨/master
2022-06-14 05:47:21 +00:00
fangye
128c3dffb5 TCB结构体扩展宏添加分号
Signed-off-by: fangye <fangye@talkweb.com.cn>
Change-Id: Ic31310a1da1842adb1b19a0afb1448aa0f4720ef
2022-06-14 11:31:18 +08:00
openharmony_ci
e8f3f9674c !708 fix:测试套问题修复
Merge pull request !708 from Zhaotianyu/0613test_fix
2022-06-13 11:10:51 +00:00
arvinzzz
5cfec18d24 fix: 测试套问题修复
CLOCK_REALTIME在musl与newlib中的定义值不一致,测试套中不能写死某一个值,要用CLOCK_REALTIME

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ie88eaf3af2ae938a7c02f7acf08526dcf333fb93
2022-06-13 16:44:59 +08:00
openharmony_ci
def41f8edd !701 内存水线shell命令
Merge pull request !701 from wangchen/0607_water
2022-06-10 06:00:05 +00:00
yangjinzhuang
3387c32b8a 更新readme
Signed-off-by: yangjinzhuang <yangjinzhuang@kaihongdigi.com>
2022-06-10 10:32:37 +08:00
wangchen
6881d3da46 fix: 内存水线shell命令
【背景】内存水线shell命令

【修改方案】
1,添加shell命令, 通过LOS_MemInfoGet获取水线
2, 增加task命令显示任务的alloc情况
影响范围:
【影响】
对现有的产品编译不会有影响。
re #I5B6VT
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-06-09 02:55:32 +00:00
openharmony_ci
e21e8753d1 !700 debugtools 自验问题修复
Merge pull request !700 from wangchen/0607_up
2022-06-07 10:40:24 +00:00
wangchen
397f24dd6f fix: debugtools 自验问题修复
【背景】debugtools 自验问题修复

【修改方案】
1,hwi打印可能存在负数,不能使用%u
2,LOS_SchedTraceStop函数可能被单独调用,导致重复释放

影响范围:
【影响】
对现有的产品编译不会有影响。
re #I5B668
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-06-07 10:17:32 +00:00
openharmony_ci
831d089652 !697 M核函数命名错误
Merge pull request !697 from wangchen/0601_up
2022-06-06 07:02:07 +00:00
wangchen
f5fa92feff fix: M核函数命名错误
【背景】OsRecyleFinishedTask拼写问题

【修改方案】
Recyle -> Recycle

影响范围:
【影响】
对现有的产品编译不会有影响。
re #I56JB1
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-06-01 06:48:13 +00:00
openharmony_ci
bed1d28df8 !689 M核添加维测, 调度信息dump
Merge pull request !689 from wangchen/0512_track
2022-05-28 08:48:37 +00:00
wangchen
efebc00f87 fix: M核添加维测接口
【背景】M核添加维测接口

【修改方案】
1, 添加任务栈dump接口
2, 添加中断dump接口
3, 添加任务调度流程dump
【影响】
对现有的产品编译不会有影响。
re #I55DJV
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-05-28 08:24:30 +00:00
openharmony_ci
28c1529e2f !695 开启cpup后启动挂死
Merge pull request !695 from wangchen/0526_up
2022-05-26 11:55:22 +00:00
wangchen
159d304275 fix: 开启cpup后启动挂死
【背景】开启cpup后启动挂死

【修改方案】
1, cpup开启后,task模块会在g_cpup初始化前赋值。
    因此需提前cpup模块的初始化。
【影响】
对现有的产品编译不会有影响。
re #I59DDE
Signed-off-by: wangchen <wangchen64@huawei.com>
https://gitee.com/openharmony/kernel_liteos_m/issues/I59DDE
2022-05-26 11:42:02 +00:00
openharmony_ci
18f65ae0b3 !694 修复RISCV32 newlib情况下FD_ISSET设置问题
Merge pull request !694 from 大仙/master
2022-05-24 11:08:44 +00:00
openharmony_ci
5363e4b472 !690 【OpenHarmony 开源贡献者计划 2022】fix: fix warning while compiling test suites
Merge pull request !690 from rtos_shang/master
2022-05-23 12:03:34 +00:00
openharmony_ci
c65d908905 !692 【OpenHarmony 开源贡献者计划 2022】fix: fix warning: 'PthreadFuncTestSuiteTearDown' defined but not used
Merge pull request !692 from rtos_shang/warning2
2022-05-23 12:03:08 +00:00
openharmony_ci
1b9d59aa9a !691 【OpenHarmony 开源贡献者计划 2022】fix: fix warning label 'EXIT' defined but not used
Merge pull request !691 from rtos_shang/warning
2022-05-23 12:02:42 +00:00
大仙
c6958aa181 修复SoftBusSocketFdIsset在M核RISCV32架构的newlib情况下设置的问题
fix #I52ACL

Signed-off-by: 大仙 <leicx@digitalchina.com>
2022-05-20 16:55:27 +08:00
zhumingxian
315a448142 fix: fix warning: 'PthreadFuncTestSuiteTearDown' defined but not used
fix warning: 'PthreadFuncTestSuiteTearDown' defined but not used
fix warning: 'PthreadFuncTestSuiteSetUp' defined but not used

close #I58COM

Signed-off-by: zhumingxian <zhuwanshu@ohos.com.cn>
2022-05-19 21:28:46 +08:00
zhumingxian
32a2e193f4 fix: fix warning label 'EXIT' defined but not used
fix testsuites/sample/kernel/hwi/it_los_hwi_039.c:39:1: warning: label 'EXIT' defined but not used [-Wunused-label]

close #I58CNP

Signed-off-by: zhumingxian <zhumingxian@ohos.com.cn>
2022-05-19 21:13:46 +08:00
zhumingxian
b35792fa6c fix: fix warning while compiling test suites
fix testsuites/include/iCunit.h:248:20: warning: 'return' with a value, in function returning void

close #I58CM9

Signed-off-by: zhumingxian <zhumingxian@ohos.com.cn>
2022-05-19 20:59:50 +08:00
openharmony_ci
a5e651cb01 !673 Fix : liteos_m核 内存waterline 缺陷BUG
Merge pull request !673 from yinjiaming/fix
2022-05-19 09:19:42 +00:00
yinjiaming
f12dd8bbe6 fix: 修复liteos_m核 内存waterline 缺陷BUG
【背景】
OsMemWaterUsedRecord的第二个参数错误,导致waterline统计错误

【修改方案】
将OsMemWaterUsedRecord的第二个入参修改为
OS_MEM_NODE_GET_SIZE(node->sizeAndFlag) - nodeSize

【影响】
对现有的产品编译不会有影响

re #I4QBG2

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I1cc213d98230ec9723c6bf1871b4e46da3b3467d
2022-05-19 02:44:54 +00:00
openharmony_ci
3f41c36926 !686 M核添加维测, 中断信息dump
Merge pull request !686 from wangchen/0505_hwidump
2022-05-12 07:17:01 +00:00
openharmony_ci
a3daa77e53 !688 fix: 修改内核子系统markdown文件目录错误问题
Merge pull request !688 from Kiita/220510_md
2022-05-11 02:17:31 +00:00
wangchen
fb740f9b23 fix: M核添加维测接口
【背景】M核添加维测接口

【修改方案】
1, 添加任务栈dump接口
2, 添加中断dump接口
3, 添加任务调度流程dump
【影响】
对现有的产品编译不会有影响。
re #I5644Y
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-05-11 01:44:36 +00:00
zhangyan
a45bf8797c fix:修改内核子系统markdown文件目录错误问题
re #I535PJ
Signed-off-by: Kiita <zhanyan@huawei.com>
Change-Id: I772ec6ff9cf1d45d9decd0f4f11535fe1dfa5e7b
2022-05-10 07:10:59 +00:00
openharmony_ci
84f89b9660 !683 「OpenHarmony 开源贡献者计划」SWTMR模块无法关闭
Merge pull request !683 from yangzelin/fix_swtmr
2022-05-10 00:51:11 +00:00
openharmony_ci
03b4650a16 !685 M核添加维测, 任务栈dump
Merge pull request !685 from wangchen/0505_stackdump
2022-05-06 08:35:18 +00:00
wangchen
728aca27f5 fix: M核添加维测接口
【背景】M核添加维测接口

【修改方案】
1, 添加任务栈dump接口
2, 添加中断dump接口
3, 添加任务调度流程dump
【影响】
对现有的产品编译不会有影响。
re #I50KLG
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-05-06 07:44:02 +00:00
yangzelin
91743d3ea4 Signed-off-by: yangzelin <yangzelin@talkweb.com.cn>
fix: 解决关闭SWTMR模块后无法编译的问题

关闭SWTMR模块后, 屏蔽相关全局变量以及函数调用
2022-04-28 09:49:15 +08:00
openharmony_ci
fcd677feba !671 在riscv32_virt中新增graphic适配,将riscv32_virt编译从musl调整为newlib
Merge pull request !671 from xiexg-dc/riscv32-virt
2022-04-24 13:23:12 +00:00
openharmony_ci
c4fd9be138 !680 Delete redundancy third party unity
Merge pull request !680 from peitaiyi/master
2022-04-24 12:06:31 +00:00
taiyipei
81249a0384 delete redundancy third party unity deps
Signed-off-by: taiyipei <peitaiyi@huawei.com>
2022-04-24 00:21:25 -07:00
xiexg-dc
8746f5abe5 feat: 在riscv32_virt中新增graphic适配,将musl调整为newlib
在riscv32_virt中新增graphic适配,将riscv32_virt编译从musl调整为newlib。

fix #I52IID

Signed-off-by: xiexg-dc <xiexg@digitalchina.com>
Change-Id: I1a774666609172c5de6310fe43b33185f86ac872
2022-04-13 15:05:51 +08:00
openharmony_ci
56565beeb6 !668 修复fatfs中GetLdPath无法正常返回结果
Merge pull request !668 from xiexg-dc/riscv32-virt
2022-04-11 06:18:21 +00:00
openharmony_ci
a77aa7de98 !670 fix: 告警修复
Merge pull request !670 from Zhaotianyu/0408codex_fix
2022-04-11 02:05:02 +00:00
openharmony_ci
db8c284cd1 !670 fix: 告警修复
Merge pull request !670 from Zhaotianyu/0408codex_fix
2022-04-11 02:05:01 +00:00
arvinzzz
b1daca7f82 fix: 告警修复
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: If3c36a8b2d3ad3c825bc3e5ef68efa8896d54884
2022-04-08 16:11:12 +08:00
xiexg-dc
46546688c9 fix: 修复fatfs中GetLdPath无法正常返回结果
fix: #I4XBJ6

Signed-off-by: xiexg-dc <xiexg@digitalchina.com>
Change-Id: I919d48de744f01f56b6fb7376b8b770386380197
2022-04-06 10:37:03 +08:00
openharmony_ci
d017af7459 !669 refactor: 优化任务状态,EXIT状态仅表示任务已退出
Merge pull request !669 from zhushengle/exit
2022-04-02 08:10:15 +00:00
zhushengle
4e9f8c71f9 refactor: 优化任务状态,EXIT状态仅表示任务已退出
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I53e98540af4deb44e64f6879df340b27efb201b8
2022-04-02 14:55:20 +08:00
openharmony_ci
e34c4050f9 !666 解决taskCB未定义以及初始化的问题
Merge pull request !666 from 夏不白/master
2022-04-01 03:18:21 +00:00
xia-bubai
67b579161d Description: add initialize of taskCB in function ArchTskStackInit
IssueNo:https://gitee.com/openharmony/kernel_liteos_m/issues/I50NRJ
Feature or Bugfix: Bugfix

Signed-off-by: xia-bubai <xiacong4@huawei.com>
2022-04-01 10:33:45 +08:00
openharmony_ci
d5b90399b7 !622 feat:增加玄铁ck804ef架构内核支持文件
Merge pull request !622 from qubo/master
2022-03-31 06:22:56 +00:00
bob_qu
1ab2ffcd4a fix:按照评审意见,调整目录到V2下,修改代码review问题
合入原因:按照规划增加winnermicro w800芯片OH适配
          需要新增CK804芯片架构支持代码
修改:在kernel/liteos_m、device/soc、device/board、vendor/hihope
       仓下增加CK804芯片架构、芯片SDK、开发板和产品配置文件
影响:由于是新增芯片架构,与其他平台编译隔离,无副作用

Signed-off-by: bob_qu <qu_bo@hoperun.com>
2022-03-30 21:57:04 +08:00
openharmony_ci
ec9f0e47e9 !660 fix: 低功耗tick timer休眠时间计算有误
Merge pull request !660 from zhushengle/pm
2022-03-28 13:27:56 +00:00
zhushengle
8550117b01 fix: 低功耗tick timer休眠时间计算有误
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I3dfa2a8ec7562a1182dae74cc706c7a660ae867a
2022-03-28 15:54:06 +08:00
openharmony_ci
f29973e995 !658 fix: 修复README格式问题
Merge pull request !658 from zhushengle/readme
2022-03-24 13:51:28 +00:00
zhushengle
9e0e39f277 fix: 修复README格式问题
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I35a67592ceaab7bdaaf3c2bf4122f6a4bc4a66bb
2022-03-24 21:40:56 +08:00
openharmony_ci
2f19ba3653 !645 队列支持变长读
Merge pull request !645 from chenliming_kh/master
2022-03-24 01:51:31 +00:00
openharmony_ci
fe7191183e !657 fix:告警修复
Merge pull request !657 from Zhaotianyu/0323codex_fix_1
2022-03-23 09:37:33 +00:00
arvinzzz
d84471ff29 fix: 告警修复
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I1c00ca1dda35c62b06bff78353737f7943a647e9
2022-03-23 17:15:52 +08:00
openharmony_ci
45654cee93 !635 Fix : menuconfig配置Enable Dynamic Link Feature后编译报错
Merge pull request !635 from yinjiaming/master
2022-03-23 08:49:46 +00:00
openharmony_ci
110ee01118 !635 Fix : menuconfig配置Enable Dynamic Link Feature后编译报错
Merge pull request !635 from yinjiaming/master
2022-03-23 08:49:45 +00:00
openharmony_ci
b51e7f93d4 !637 Fix : 开启lwip后编译失败
Merge pull request !637 from yinjiaming/fix
2022-03-23 08:49:19 +00:00
openharmony_ci
2d9e476c0b !652 fix:告警修复
Merge pull request !652 from Zhaotianyu/0322codex_fix_2
2022-03-22 13:56:49 +00:00
openharmony_ci
9ee49f1bb8 !647 feat: L0支持systick动态调频
Merge pull request !647 from zhushengle/freq
2022-03-22 13:46:21 +00:00
openharmony_ci
befe8ecf9d !647 feat: L0支持systick动态调频
Merge pull request !647 from zhushengle/freq
2022-03-22 13:46:21 +00:00
arvinzzz
637de91170 fix: 告警修复
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I4c69ab116920db527b39070038d36e7f0bd4e331
2022-03-22 21:39:09 +08:00
zhushengle
390a488a97 feat: L0支持systick动态调频
Close #I4YXW9
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I052fe71e507f76184c8ac5d6349e368494033cde
2022-03-22 20:44:25 +08:00
openharmony_ci
9d3d983376 !650 fix:告警修复
Merge pull request !650 from Zhaotianyu/0322codex_fix_1
2022-03-22 12:06:53 +00:00
arvinzzz
0e2dded346 fix: 告警修复
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I09d6e86c958838d95297176c235fe1a7ad34c88c
2022-03-22 19:47:03 +08:00
openharmony_ci
b0393151a6 !648 fix: 告警修复
Merge pull request !648 from Zhaotianyu/0322codex_fix
2022-03-22 11:15:34 +00:00
arvinzzz
38f8472ddb fix: 告警修复
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Iaec45e835737c0ae7eea88408b2a1a4a79f1a40c
2022-03-22 18:29:16 +08:00
chenliming
7167ba7578 chenliming@kaihongdigi.com: 队列支持变长读
Signed-off-by: chenliming <chenliming@kaihongdigi.com>
2022-03-22 17:04:06 +08:00
openharmony_ci
d28c8a0423 !643 fix: 内源检视修复
Merge pull request !643 from Zhaotianyu/0321codex_fix
2022-03-21 03:44:17 +00:00
arvinzzz
17daa50fa2 fix: 内源检视修复
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ic8f63a512a5b2c88e7abee6c167473f37ecc9f3b
2022-03-21 11:02:16 +08:00
openharmony_ci
57a0002252 !642 fix:3.1内源代码检视问题
Merge pull request !642 from xuxinyu/master
2022-03-19 12:50:08 +00:00
x_xiny
4f12ab9a2a fix:3.1代码检视问题
Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: Ib69620ebf3c139b0e69c3fb5347eaf54cab275de
2022-03-19 19:37:23 +08:00
openharmony_ci
e703376d68 !636 修改menuconfig关闭VFS选项后编译无法通过
Merge pull request !636 from wangchen/0317_m
2022-03-19 08:24:14 +00:00
openharmony_ci
8f1dc3a1ff !636 修改menuconfig关闭VFS选项后编译无法通过
Merge pull request !636 from wangchen/0317_m
2022-03-19 08:24:14 +00:00
openharmony_ci
9bf8ff9ce5 !641 fix: 规范整改
Merge pull request !641 from zhushengle/sample
2022-03-19 08:02:11 +00:00
zhushengle
a09d4882c4 fix: 规范整改
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I7be78853291d53636fd199104b4c72bbab222bcd
2022-03-19 15:46:10 +08:00
openharmony_ci
98a82ba357 !640 Fix : 修改了源码检视过程中的一些问题
Merge pull request !640 from yinjiaming/latest
2022-03-18 08:52:24 +00:00
yinjiaming
e7e850a6a6 fix: 修复3.1代码检视中的问题
【背景】
3.1 代码检视中有一些问题需要修改

【修改方案】
在可能内存泄露的地方进行了修改,在安全函数前加void转换

【影响】
对现有的产品编译不会有影响。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I8a37ecf7c8d81d24ebe153d0c0a7db008cc3e4b9
2022-03-18 08:14:18 +00:00
wangchen
3ad47afec4 fix: 通过menuconfig关闭VFS选项后,代码编译无法通过
【背景】关闭VFS时,编译无法通过

【修改方案】
1,添加对fs依赖的模块中对fs开启情况的判断

【影响】
对现有的产品编译不会有影响。

re #I4X5DX
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-03-18 06:48:47 +00:00
openharmony_ci
6f04b5345c !639 【liteos_m】线程id判断存在问题
Merge pull request !639 from LiteOS/master
2022-03-18 05:04:13 +00:00
LiteOS2021
83b6331aad fix(线程id判断有误,cmsis优先级创建修改): 线程id判断有误,cmsis优先级创建修改
线程id判断有误,cmsis优先级创建修改

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2022-03-18 11:16:51 +08:00
yinjiaming
67a5b580f6 fix: 修复配置Enable Dynamic Link Feature后编译报错的问题
【背景】
在menuconfig中开启Enable Dynamic Link Feature后,内核编译报错

【修改方案】
将Kconfig 文件中的DYNLINK 改为 KERNEL_DYNLINK

【影响】
对现有的产品编译不会有影响。

re #I4XZN3

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I0a91b0f48fef78791307810e3780c53c17d7d0c8
2022-03-17 11:10:32 +00:00
yinjiaming
f5ee192962 fix: 修复开启lwip后编译失败的问题
【背景】
LWIP_STATS宏定义为0时开启lwip会有编译失败

【修改方案】
给可能重复定义的宏LWIP_STATS_DISPLAY 添加了相应的条件判断

【影响】
对现有的产品编译不会有影响。

re #I4X2DP

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Id1a4769dbbce4c56e8b681d9174be5aa54e74c02
2022-03-17 10:55:46 +00:00
openharmony_ci
a42ba7aed6 !633 chore:Kconfig调整
Merge pull request !633 from Zhaotianyu/0315Kconfig
2022-03-15 09:37:35 +00:00
arvinzzz
1fc024a158 chore: Kconfig 修改
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I3a6839a55cd63cab1493929269df86c19d278a90
2022-03-15 17:10:59 +08:00
openharmony_ci
21ee0b2c1d !631 C库性能优化
Merge pull request !631 from Zhaotianyu/0314libc_opt
2022-03-14 14:13:08 +00:00
openharmony_ci
b0cfa5e52c !632 Fix:内源代码检视用例问题
Merge pull request !632 from xuxinyu/Fixmem
2022-03-14 13:52:53 +00:00
x_xiny
543732f522 fix:根据内源代码检视意见对用例进行整改
【背景】3.1代码review问题修改

    【修改方案】
     修复用例问题

     Signed-off-by: xuiny <xuxinyu6@huawei.com>

Change-Id: I8ee5d8f5f5765e469cf72c810af8a3831a3879f9
2022-03-14 21:38:55 +08:00
arvinzzz
dab1a0d62f feature: libc opt
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I9252c83e5b8a40f23e0df04ea165b9f51a4482b3
2022-03-14 19:47:45 +08:00
openharmony_ci
6a8f24ba01 !626 Fix : 修改了源码检视过程中的一些问题
Merge pull request !626 from yinjiaming/master
2022-03-14 11:08:14 +00:00
openharmony_ci
40bbb4d6c4 !628 fix: 删除测试用例中的工号
Merge pull request !628 from zhushengle/sample
2022-03-14 08:24:05 +00:00
zhushengle
90a027090a fix: 删除测试用例中的工号
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I7f83a26a5bbf2bc53b614e9fce68e26ed2c6352b
2022-03-14 15:15:52 +08:00
yinjiaming
bcd177bbd3 fix: 修复3.1代码检视中的问题
【背景】
3.1 代码检视中有一些问题需要修改

【修改方案】
在README 中添加了文档链接,更改了非可执行文件的权限

【影响】
对现有的产品编译不会有影响。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I25eb1a2bfcbfdf7bc40b0516bcf9262c2d67f8b4
2022-03-14 06:57:32 +00:00
openharmony_ci
cde2b3bd31 !627 修复L0 fs Opendir打开失败返回值不为空问题
Merge pull request !627 from 龙幸开/master
2022-03-11 06:53:18 +00:00
longxingkai
e3e9b2f5a5 fix fs opendir bug
Signed-off-by: longxingkai <longxingkai@talkweb.com.cn>
2022-03-11 10:23:38 +08:00
openharmony_ci
536e9b4584 !619 fix: 内源代码检视问题
Merge pull request !619 from xuxinyu/fix
2022-03-10 12:15:52 +00:00
x_xiny
632ea10418 fix:内源代码检视修改
【背景】3.1代码review问题修改

    【修改方案】

     re #I4WV56

     Signed-off-by: xuiny <xuxinyu6@huawei.com>

Change-Id: I1f3d98ab84b739c5d3a924559b1825659dc0ea74
2022-03-10 19:33:41 +08:00
openharmony_ci
73b77d11a1 !625 修复FileSystem menuconfig配置问题
Merge pull request !625 from 方烨/develop
2022-03-10 01:58:53 +00:00
fangye
9aa32ae743 fix: 修复FileSystem menuconfig配置问题
Signed-off-by: fangye <fangye@talkweb.com.cn>
Change-Id: Ibbac507ec290657489e47a708d2926ec709fa6b8
2022-03-10 09:27:16 +08:00
openharmony_ci
133e87b1b1 !380 refactor: liteos-m vfs refactory
Merge pull request !380 from MGY917/m-vfs
2022-03-09 07:34:01 +00:00
Guangyao Ma
09034de68a refactor: liteos-m vfs refactory
close #I4RV26

Change-Id: I76d5d5128d37efa5fbcde6d105c78f4d7be607de
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2022-03-09 12:07:15 +08:00
openharmony_ci
867a6edcdc !621 M核内源代码检视问题修改
Merge pull request !621 from wangchen/0308_m
2022-03-09 02:27:20 +00:00
bob_qu
3dceae52aa feat:增加玄铁ck804ef架构内核支持文件
合入原因:按照规划增加winnermicro w800芯片OH适配
          需要新增CK804芯片架构支持代码
修改:在kernel/liteos_m、device/soc、device/board、vendor/hihope
       仓下增加CK804芯片架构、芯片SDK、开发板和产品配置文件
影响:由于是新增芯片架构,与其他平台编译隔离,无副作用

Signed-off-by: bob_qu <qu_bo@hoperun.com>
2022-03-08 20:17:49 +08:00
wangchen
43baa4fdc4 fix: 内源代码检视问题
【背景】内源代码检视问题

【修改方案】
1,按检视意见,进行资源泄露等问题的修改

【影响】
对现有的产品编译不会有影响。

re #I4WV56
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-03-08 09:38:03 +00:00
openharmony_ci
bedef30658 !615 fix: 修复codex及合规问题
Merge pull request !615 from Zhaotianyu/0307codex_fix
2022-03-08 08:06:30 +00:00
openharmony_ci
7e284239b3 !613 fix: 文档与实际代码目录保持一致
Merge pull request !613 from Zhaotianyu/0305md_fix
2022-03-07 12:18:31 +00:00
arvinzzz
f34b94e98d fix: codex等问题修复
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ib2c46be5e117fab5506bb7b5229f31e611195f1b
2022-03-07 16:16:26 +08:00
arvinzzz
bc33bcd319 fix: 文档与实际代码目录不符
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ic07896cac1c32de38d86206a5cae9f419f0cf8dd
2022-03-05 17:14:24 +08:00
openharmony_ci
ae7a374ebb !573 M核安全隔离
Merge pull request !573 from Zhaotianyu/0117sec_init
2022-03-03 13:42:06 +00:00
arvinzzz
fb76350771 feature:M核安全隔离
新增用户态,上层业务进行box隔离,共享C库

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ib6ecc3fcb230a7539f9e0f3663290900198d2ba9
2022-03-03 20:41:15 +08:00
openharmony_ci
ea5b2e8ae4 !612 代码检视意见清零
Merge pull request !612 from JerryH/pipe_poll
2022-03-03 07:01:44 +00:00
JerryH
c5a3ed4fb1 fix: 处理检视出来的代码问题
close #I4VY0A

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: I3bc2d3da95ecae53b3d124d086b8296ea4608d3a
2022-03-02 16:02:32 +08:00
openharmony_ci
7688a3f52d !604 fix: 修复任务栈对齐问题及补充posix和cmsis测试用例
Merge pull request !604 from zhushengle/test
2022-02-26 08:09:07 +00:00
openharmony_ci
590ab9182d !609 feature: 补充pread/pwrite接口
Merge pull request !609 from Zhaotianyu/0224fs_pwrite
2022-02-25 09:33:10 +00:00
zhushengle
ed863e90dd fix: 修复任务栈对齐问题及补充posix和cmsis测试用例
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I2075f1821c46aea17bbec498f533905d720621c4
2022-02-25 11:39:57 +08:00
arvinzzz
491cefae76 feature: 补充pread/pwrite接口
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ie31cacd18131113e51a6949dfba57a86ca4eb0e5
2022-02-24 19:57:30 +08:00
openharmony_ci
36887d467d !608 fix: 修复调度时间最大值不一致问题
Merge pull request !608 from zhushengle/time
2022-02-23 08:47:37 +00:00
zhushengle
9f393bcc6d fix: 修复调度时间最大值不一致问题
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I1f31f343aebcc6565eec8bc2456a6dd9dfcde6e9
2022-02-23 12:07:57 +08:00
openharmony_ci
fe4db41b7c !606 【liteos_m】修复testTimes测试
Merge pull request !606 from LiteOS/master
2022-02-22 10:21:55 +00:00
LiteOS2021
5c982f1087 fix(time_func_test_01.c): 修复testTimes测试单板配置LOSCFG_BASE_CORE_TICK_PER_SECOND = 1000的问题
修复testTimes测试单板配置LOSCFG_BASE_CORE_TICK_PER_SECOND = 1000的问题

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2022-02-22 17:51:22 +08:00
openharmony_ci
9a3745384a !605 shell 输入不识别命令时内存泄漏
Merge pull request !605 from wangchen/shell_free
2022-02-22 09:30:56 +00:00
wangchen
0245b1a7b2 fix: shell 输入不识别命令时内存泄漏
【背景】shell 输入不识别命令时内存泄漏

【修改方案】
1,添加识别命令失败时释放内存

【影响】
对现有的产品编译不会有影响。

re #I4UR9P
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-02-22 08:12:01 +00:00
openharmony_ci
d4d59cf08f !603 cpup和测试套解耦,使用cpup相关宏来管理相关内容。
Merge pull request !603 from LiteOS/master
2022-02-22 07:04:53 +00:00
LiteOS2021
692651fe40 fix(testsuites): cpup和测试套解耦
cpup和测试套解耦,使用相关宏来管理cpup相关内容。

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2022-02-22 14:22:06 +08:00
openharmony_ci
e4d08ba896 !602 修复irqNum = HwiNumGet()编译错误
Merge pull request !602 from yinjiaming/master
2022-02-21 08:56:35 +00:00
openharmony_ci
021e5299ab !593 feat: 支持任务栈可配置
Merge pull request !593 from zhushengle/task_stack
2022-02-21 06:48:37 +00:00
yinjiaming
16e87d78d8 fix: 修复irqNum = HwiNumGet()编译错误的问题
【背景】
L0,M33内核,编译时返回错误,
irqNum = HwiNumGet()编译错误

【修改方案】
删去引起编译错误的变量,直接用函数的返回值代替

【影响】
对现有的产品编译不会有影响。

re #I4S81B
Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I7dba42cb158cbb969053a83ddd22d76ee30646d1
2022-02-21 03:33:58 +00:00
zhushengle
96cc92d035 feat: 支持任务栈可配置
支持liteos_m 任务栈可配置
支持pthread 任务栈可配置
支持cmsis 任务栈可配置

BREAKING CHANGE:
pthread_create 支持任务栈设置
osThreadNew 支持任务栈设置
TSK_INIT_PARAM_S 结构体添加stackAddr 字段

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ifa2a3581b705631cc83cbde6182a39c28d66de2a
2022-02-21 09:08:05 +08:00
openharmony_ci
4983542b46 !598 feat:统一LOS_HwiCreate接口的中断处理函数参数,与kernel_liteos_a、 liteos一致,保证应用可平滑迁移到鸿蒙,降低用户成本
Merge pull request !598 from LiteOS/master
2022-02-19 10:37:16 +00:00
LiteOS2021
6c68adad4d feat: synchronous los_hwicreate interface
BREAKING CHANGE:
    涉及接口修改:
    LOS_HwiCreate
    LOS_HwiDelete
    改动内容:
    中断处理函数参数类型由HWI_ARG_T统一改为HwiIrqParam,封装原有arg参数及riscv部分实际使用变量pDevId, 这样一方面统一LiteOS接口,也统一了中断处理函数的arg参数
    同步LOS_HwiDelete接口入参,新增HWI_IRQ_PARAM_S *irqParam参数,为后续共享中断功能的添加预留

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2022-02-18 17:30:29 +08:00
openharmony_ci
6efd469a4f !601 fix: 修复pthread 编译告警
Merge pull request !601 from zhushengle/pthread
2022-02-17 03:36:42 +00:00
zhushengle
cc57f81ab8 fix: 修复pthread 编译告警
Close #I4U16U
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I67ba2469f2a4697bcb6da9f342bd8d18835cc874
2022-02-17 10:06:15 +08:00
openharmony_ci
5dbac3ab4c !599 fix: posix线程和LOS_TaskCreate任务不兼容,补齐接口防护,防止访问野指针
Merge pull request !599 from zhushengle/pthread
2022-02-16 11:15:25 +00:00
zhushengle
60805e1a7c fix: posix线程和LOS_TaskCreate任务不兼容,补齐接口防护,防止访问野指针
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I03040e86a5ac618d3ede671c497a0ae88a3717ae
2022-02-16 14:47:35 +08:00
openharmony_ci
7cf08722a0 !597 修复未使用的参数和类型比较编译报错问题
Merge pull request !597 from 方烨/develop
2022-02-16 06:42:11 +00:00
fangye
21b46e82f3 fix: 修复未使用的参数和类型比较编译报错问题
Signed-off-by: fangye <fangye@talkweb.com.cn>
Change-Id: I64f9e0cd20b62f877f353340b81922ddd45fbf7c
2022-02-15 18:53:30 +08:00
openharmony_ci
35971d660e !591 littlefs最大打开文件个数修改为可通过menuconfig配置
Merge pull request !591 from 方烨/master
2022-02-15 06:55:09 +00:00
openharmony_ci
289ad2c57d !591 littlefs最大打开文件个数修改为可通过menuconfig配置
Merge pull request !591 from 方烨/master
2022-02-15 06:55:09 +00:00
openharmony_ci
e20444cda6 !591 littlefs最大打开文件个数修改为可通过menuconfig配置
Merge pull request !591 from 方烨/master
2022-02-15 06:55:08 +00:00
openharmony_ci
b9830c61f5 !592 【liteos_m】kernel接口融合修改
Merge pull request !592 from LiteOS/master
2022-02-15 06:30:43 +00:00
LiteOS2021
cee9714a90 fix: kernel接口融合,添加/修改kernel函数
kernel接口融合,添加/修改kernel函数

BREAKING CHANGE:
新增接口:
LOS_TaskResRecycle
LOS_CurrNanosec
LOS_MDelay
接口修改:
LOS_QueueCreate:第一个入参添加const修饰并增加一种异常情况处理
los_memory.c中 OS_ERROR 修改为LOS_NOK,重定义LOS_NOK为(UINT32)-1。
接口位置转移:
LOS_UDelay 由los_task.h/.c 转移到los_tick.h/.c 
宏修改:
LOS_ERRNO_MUX_PEND_INTERR 改名为 LOS_ERRNO_MUX_IN_INTERR
增加宏:

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2022-02-15 09:47:58 +08:00
openharmony_ci
ffd228cd8d !595 fix: los_interrupt.c存在未使用的参数编译出错
Merge pull request !595 from kenneth/compile_error
2022-02-14 13:16:38 +00:00
kenneth
5af4c2e213 fix: los_interrupt.c存在未使用的参数编译出错
修复los_interrupt.c存在未使用的参数编译出错

close #I4SJPZ

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2022-02-14 20:14:40 +08:00
openharmony_ci
b423d9f7bb !589 feat: 同步调度部分优化至liteos_m
Merge pull request !589 from zhushengle/sched_timer
2022-02-13 04:17:46 +00:00
zhushengle
fb11ab181e feat: 同步调度部分优化至liteos_m
1.tick timer与调度进一步剥离
2.性能敏感函数内敛化

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I00c27216e286dd7ca9c02db3e2377707d628a786
2022-02-12 14:52:36 +08:00
openharmony_ci
c811efbf37 !590 feat: cortex-m55支持psplimit
Merge pull request !590 from Harylee/m55
2022-02-11 07:26:26 +00:00
fangye
9bc9f3aa53 feat: littlefs最大打开文件个数修改为可通过menuconfig配置
Signed-off-by: fangye <fangye@talkweb.com.cn>
Change-Id: Iba141821200b6044d89ec50b7ddb1047490f5229
2022-02-11 14:52:42 +08:00
Haryslee
db7d641c22 feat: cortex-m55支持psplimit
cortex-m55增加栈溢出检测特性

close #I4T7R3

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: Ie24adbb672c47404b56aa5bfc9f22e0f7f947540
2022-02-11 11:35:38 +08:00
openharmony_ci
a68323683d !587 fix: cortex-m55栈优化
Merge pull request !587 from Harylee/m55
2022-02-10 13:37:30 +00:00
Haryslee
59e9c6ed73 fix: cortex-m55栈优化
利用EXC_RETURN可判断出上下文是否使用FPU寄存器,进而确定是否对FPU寄存器进行压栈操作

close #I4SQIQ

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: Ib8b3a8b359486b3b7851278365860be1bfed65f2
2022-02-10 21:17:27 +08:00
openharmony_ci
d1d412255c !570 fix:shell 命令 ctrl +c 打印使用多余的参数
Merge pull request !570 from 拓维信息候鹏飞/master
2022-02-10 12:16:07 +00:00
openharmony_ci
b534083056 !569 shell命令行输入增加回退支持
Merge pull request !569 from 方烨/master
2022-02-10 11:56:34 +00:00
openharmony_ci
968c00f049 !588 【liteos_m】posix接口融合,接口规范兼容性修改
Merge pull request !588 from LiteOS/master
2022-02-10 11:43:16 +00:00
openharmony_ci
df0ed8d219 !588 【liteos_m】posix接口融合,接口规范兼容性修改
Merge pull request !588 from LiteOS/master
2022-02-10 11:43:15 +00:00
LiteOS2021
4b607fd074 fix(posix接口融合): posix接口融合,接口规范兼容性修改
posix接口融合,接口规范兼容性修改

BREAKING CHANGE:
接口修改:
calloc
pthread_mutex_init
mq_unlink
pthread_join
pthread_exit
pthread_attr_init
pthread_attr_destroy
pthread_condattr_destroy
pthread_cond_timedwait
pthread_mutexattr_init
pthread_mutexattr_settype
pthread_mutex_destroy
pthread_mutex_timedlock
pthread_mutex_trylockk
pthread_mutex_unlock
sem_getvalue
sem_timedwait
pthread_cond_timedwait
nanosleep
timer_create
timer_settime
timer_gettime
testStdlibStrtoull005
testStdlibStrtol011
testStdlibStrtoul007
testPthread004

新增接口:
CheckForCancel
pthread_setcancelstate
pthread_setcanceltype
pthread_once
pthread_setschedprio
pthread_attr_setstack
pthread_attr_getstack
pthread_condattr_getpshared
pthread_condattr_setpshared
pthread_condattr_getclock
pthread_mutexattr_gettype
CheckMutexAttr
OsMuxPreCheck
sem_trywait
MuxPendForPosix
MuxPostForPosix
增加overrun功能

接口变化:
mq_getsetattr 改为内部接口MqGetSetAttr
GetTickTimeFromNow->OsGetTickTimeFromNow

接口位置转移:
pthread_equal接口由newlib下转移到kal/posix/src/pthread.c中

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2022-02-10 16:41:12 +08:00
openharmony_ci
1013f24209 !583 posix兼容回退
Merge pull request !583 from LiteOS/master
2022-01-30 23:49:31 +00:00
LiteOS2021
207efc15b8 fix(posix): posix兼容回退
posix兼容回退

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2022-01-30 23:09:20 +08:00
openharmony_ci
f2e55bd6a3 !576 支持cortex-m55
Merge pull request !576 from Harylee/m55
2022-01-30 13:21:28 +00:00
openharmony_ci
607152c434 !566 【liteos_m】posix接口融合,接口规范兼容性修改
Merge pull request !566 from LiteOS/master
2022-01-30 02:27:56 +00:00
LiteOS
39558ae1a3 Merge branch 'master' of gitee.com:openharmony/kernel_liteos_m into master
Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2022-01-29 19:30:28 +08:00
openharmony_ci
eae638be6c !575 【liteos_m】posix单元测试融合
Merge pull request !575 from LiteOS/master
2022-01-29 11:11:00 +00:00
LiteOS2021
e0b12758da fix(posix): posix接口融合,接口规范兼容性修改
posix接口融合,接口规范兼容性修改

BREAKING CHANGE:
接口修改:
calloc
pthread_mutex_init
mq_unlink
pthread_join
pthread_exit
pthread_attr_init
pthread_attr_destroy
pthread_condattr_destroy
pthread_cond_timedwait
pthread_mutexattr_init
pthread_mutexattr_settype
pthread_mutex_destroy
pthread_mutex_timedlock
pthread_mutex_trylockk
pthread_mutex_unlock
sem_getvalue

新增接口:
CheckForCancel
pthread_setcancelstate
pthread_setcanceltype
pthread_once
pthread_setschedprio
pthread_attr_setstack
pthread_attr_getstack
pthread_condattr_getpshared
pthread_condattr_setpshared
pthread_condattr_getclock
pthread_mutexattr_gettype
CheckMutexAttr
OsMuxPreCheck
sem_trywait

接口变化:
mq_getsetattr 改为内部接口OsMqGetSetAttr

接口位置转移:
pthread_equal接口由newlib下转移到kal/posix/src/pthread.c中

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2022-01-29 16:57:49 +08:00
Haryslee
6e1780546c feat: 支持cortex-m55
基于qemu支持cortex-m55处理器,包括MVE功能使能。

close #I4Q9OQ

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I571702ac8e8f52769afdf600b48451f1f1806a88
2022-01-28 15:40:37 +08:00
LiteOS2021
ad6f249d1e fix(posix unittest): posix unittest 融合
posix unittest 融合

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2022-01-26 14:50:44 +08:00
openharmony_ci
907dfc63f3 !572 kernel部件化编译构建(liteos_m仓库修改)
Merge pull request !572 from Hongjin Li/lihongjin/br_dev
2022-01-24 13:27:49 +00:00
openharmony_ci
5a2c176651 !571 支持select.h的FD_SETSIZE宏配置
Merge pull request !571 from SimonLi/master
2022-01-24 12:48:31 +00:00
likailong
05642f05ae feat: 支持select.h的FD_SETSIZE宏配置
1. FD_SETSIZE由普通文件+网络文件的文件句柄个数之和决定。
2. 以前vfs_config.h引入fatfs.h和lfs_api.h又会引入其他头文件,
导致变异问题。因此需要将配置宏拆分出来放到fatfs_conf.h和
lfs_conf.h 头文件中。
3. lwipopts.h会提供网络的句柄个数,依赖FD_SETSIZE,而select.h会提供FD_SETSIZE,
依赖网络句柄个数,因此会形成相互依赖的情况,需要通过顺序来解决。
4. 网络中新增ntohl的定义。

close: #I4RYK4

Signed-off-by: likailong <likailong@huawei.com>
2022-01-24 17:24:26 +08:00
Hongjin Li
300e83214d chore: kernel部件化编译构建
liteos_m部件只包括两个子部件:kernel和build_kernel_image

Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: I0c96f103641d2bba52b093a014dd07b75c6d28e1
2022-01-24 16:24:23 +08:00
houpengfei
8b586fb2bf 删除不必要的参数
Signed-off-by: houpengfei <houpengfei@talkweb.com.cn>
2022-01-24 09:07:36 +08:00
fangye
d986648e9c shell命令行增加回退支持
Signed-off-by: fangye <fangye@talkweb.com.cn>
2022-01-23 21:11:43 +08:00
openharmony_ci
e133ce6865 !513 CMSIS接口融合修改
Merge pull request !513 from LiteOS/master
2022-01-22 04:53:32 +00:00
openharmony_ci
168fde70d4 !513 CMSIS接口融合修改
Merge pull request !513 from LiteOS/master
2022-01-22 04:53:32 +00:00
openharmony_ci
fede33b32a !568 liteos-m kernel 部件标准化
Merge pull request !568 from Hongjin Li/lihongjin/br_dev
2022-01-22 03:45:24 +00:00
LiteOS
3eba6cb2af add cmsis change
Signed-off-by: LiteOS <dinglu@huawei.com>
Signed-off-by: ou-yangkan <519689417@qq.com>
2022-01-22 09:28:55 +08:00
openharmony_ci
d8e7a477f3 !567 fix: pr模板补充说明
Merge pull request !567 from Harylee/mmu
2022-01-22 00:54:59 +00:00
openharmony_ci
2d1b6f1cc0 !567 fix: pr模板补充说明
Merge pull request !567 from Harylee/mmu
2022-01-22 00:54:59 +00:00
openharmony_ci
30ff05c6a5 !567 fix: pr模板补充说明
Merge pull request !567 from Harylee/mmu
2022-01-22 00:54:59 +00:00
openharmony_ci
295681f08f !563 newlib支持signal接口
Merge pull request !563 from JerryH/newlib
2022-01-21 09:45:12 +00:00
openharmony_ci
161e631dcd !555 feat:内核提供Interrupt框架,支持多架构多平台通用化
Merge pull request !555 from 王树林/master
2022-01-21 09:29:43 +00:00
Haryslee
7b86f69cc0 fix: pr模板补充说明
Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I97159bd21d3d8768a8a9c59a895368d90442a304
2022-01-21 17:10:14 +08:00
openharmony_ci
8a034a6202 !565 修改kernel原子测试套中不规范的命名
Merge pull request !565 from ouyk/master
2022-01-21 08:58:05 +00:00
ou-yangkan
e8538d041a feat: 内核提供Interrupt框架,支持多架构多平台通用化
BREAKING CHANGE:
    新增接口:
    LOS_HwiTrigger ArchIntTrigger
    LOS_HwiEnable ArchIntEnable
    LOS_HwiDisable ArchIntDisable
    LOS_HwiClear ArchIntClear
    LOS_HwiSetPriority ArchIntSetPriority

https://gitee.com/openharmony/kernel_liteos_m/issues/I4RDNJ
Signed-off-by: wang-shulin93 <15173259956@163.com>
2022-01-21 16:40:45 +08:00
ou-yangkan
5b1380ebfd 修改kernel原子测试套中不规范的命名
Signed-off-by: ou-yangkan <519689417@qq.com>
2022-01-21 09:43:47 +08:00
JerryH
017adac7a4 feature: Newlib support signal.
修改signal适配支持Newlic

close #I4RD3H

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: I59f59856a275f5a4f802a1ea7d08e9405a2fb6aa
2022-01-20 18:50:17 +08:00
openharmony_ci
1b78e6ae78 !541 fix: 补充newlib库对curl的支持
Merge pull request !541 from Kiita/220115_curl
2022-01-20 09:41:31 +00:00
openharmony_ci
911043ed4b !541 fix: 补充newlib库对curl的支持
Merge pull request !541 from Kiita/220115_curl
2022-01-20 09:41:31 +00:00
openharmony_ci
a641899cd9 !562 修复esp32编译缺少result定义问题
Merge pull request !562 from ouyk/master
2022-01-20 09:11:51 +00:00
ou-yangkan
08921dc7a0 修复esp32编译报错问题
Signed-off-by: ou-yangkan <519689417@qq.com>
2022-01-20 16:42:29 +08:00
openharmony_ci
1edfa86bc9 !552 支持signal
Merge pull request !552 from JerryH/signal
2022-01-20 06:15:24 +00:00
openharmony_ci
f4add1711a !557 修复esp32编译告警导致编译失败问题
Merge pull request !557 from ouyk/master
2022-01-20 05:54:31 +00:00
JerryH
8d7468b44c feature: Support kernel signal and POSIX API.
内核支持信号功能,支持注册、屏蔽、等待及触发等操作。

close #I4R72Q

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: I26fb11a03d1899c6f7e665f0798824c578d592a6
2022-01-20 11:17:40 +08:00
openharmony_ci
93e1edf81e !559 fix: 针对pr是否同步至release分支,增加原因说明规则
Merge pull request !559 from Harylee/mmu
2022-01-20 00:47:27 +00:00
ou-yangkan
af0db5562b 修复kernel_liteos_m的pr526后esp32编译告警导致编译失败问题
Signed-off-by: ou-yangkan <519689417@qq.com>
2022-01-20 00:10:06 +08:00
Kiita
bd04d9f29a fix: 将curl依赖的函数新增至newlib库
re #I4RG71
Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: I9bd13f7232015f1ec0da383f7063936a2745ee71
2022-01-19 18:17:03 +08:00
Hongjin Li
9314b2fe81 chore: liteos-m kernel 部件标准化
1、添加liteos-m kernel的部件描述文件bundle.json
2、依赖三方开源软件的编译脚本修改,取消直接include头文件,改为引用三方开源软件提供的公共配置。

Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: I345c105a75c5cd87144c821fae123abf1f53e9f7
2022-01-19 17:44:49 +08:00
openharmony_ci
1f8151649b !556 fix:当前仓代码编译告警的问题
Merge pull request !556 from 拓维信息候鹏飞/master
2022-01-19 08:34:36 +00:00
houpengfei
1e5aeb9eed fix:当前仓代码编译告警的问题
Signed-off-by: houpengfei <houpengfei@talkweb.com.cn>
2022-01-19 16:11:39 +08:00
openharmony_ci
5a535f9f1f !526 处理M核编译告警
Merge pull request !526 from yinjiaming/yjm-kernel-20220105
2022-01-19 02:56:01 +00:00
openharmony_ci
3a978d51b8 !526 处理M核编译告警
Merge pull request !526 from yinjiaming/yjm-kernel-20220105
2022-01-19 02:56:01 +00:00
yinjiaming
194ac5898d fix: 当前仓代码编译告警的问题
【背景】
当前仓代码存在编译告警需要处理

【修改方案】
在测试用例中屏蔽了-Werror选项
在对应的代码处添加了相应函数的声明头文件

【影响】
对现有的产品编译不会有影响。

re #I4N50W

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I7dc1e38105aa3d60f9f991f34f88875cccb48463
2022-01-19 02:27:14 +00:00
Haryslee
1ee543d5d3 fix: 针对pr是否同步至release分支,增加原因说明规则
Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I01cdf45204c73d2b94d41e5350969d0356604b91
2022-01-18 21:32:17 +08:00
openharmony_ci
a305119a4a !539 fix:修复iar、keil版本原子接口编译报错问题
Merge pull request !539 from 王树林/master
2022-01-18 11:27:09 +00:00
ou-yangkan
a906dfaa99 fix atomic compile error of iar
Signed-off-by: wang-shulin93 <15173259956@163.com>
2022-01-18 18:59:29 +08:00
openharmony_ci
c2d3518c42 !538 支持pipe管道通信机制以及poll多文件描述符检测接口
Merge pull request !538 from JerryH/pipe
2022-01-18 10:29:15 +00:00
openharmony_ci
4a8d3a52ec !553 fix: 队列相关的API实现中,参数的校验不完全,导致程序异常
Merge pull request !553 from Lyb/master
2022-01-18 09:30:03 +00:00
openharmony_ci
2c07ddb2b0 !551 fix:backtrace严重BUG
Merge pull request !551 from 拓维信息候鹏飞/master
2022-01-18 09:01:34 +00:00
JerryH
4890222e7c feature: Support pipe and poll interfaces.
支持pipe管道驱动,支持poll多文件描述符检测接口。

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: Ida1f29709affbc91a26b8518e4a77b8e5469be19
2022-01-18 16:47:35 +08:00
Lyb
eef7c80a72 fix: 队列相关的API实现中,参数的校验不完全,导致程序异常
Signed-off-by: Lyb <1576988680@qq.com>
2022-01-18 16:36:15 +08:00
openharmony_ci
2294ff93d8 !544 OsGetAllTskInfo调用和异常时无任务回调函数地址
Merge pull request !544 from wangchen/tskinfo
2022-01-18 08:33:43 +00:00
openharmony_ci
ca6801dce8 !546 L0 pthread_cond_timedwait接口存在计算溢出
Merge pull request !546 from wangchen/cond
2022-01-18 03:33:25 +00:00
houpengfei
566f46dee2 fix:backtrace严重BUG
Signed-off-by: houpengfei <houpengfei@talkweb.com.cn>
2022-01-17 20:35:04 +08:00
openharmony_ci
10fd031b09 !550 新增newlib的uio的接口支持
Merge pull request !550 from SimonLi/master
2022-01-17 12:14:26 +00:00
SimonLi
25a1eb522d feati(newlib): 新增newlib的uio的接口支持
Signed-off-by: SimonLi <likailong@huawei.com>
2022-01-17 19:16:59 +08:00
openharmony_ci
382872d998 !540 fix: 补充newlib对net的支持
Merge pull request !540 from Zhaotianyu/0113newlib_add
2022-01-17 09:02:37 +00:00
wangchen
2219c32784 fix: L0 pthread_cond_timedwait接口实现存在的几个问题
【背景】L0 pthread_cond_timedwait接口存在计算溢出

【修改方案】
1,新增abstick 相关修改,先判断再转成32位,避免截断
2,LOS_Event相关函数返回值的处理已存在,无需处理
【影响】
对现有的产品编译不会有影响。

re #I4N9P8
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-01-17 07:34:39 +00:00
arvinzzz
93f616b64e fix: 补充net相关头文件
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I32f713800b5451bfd5350c10273f1513366d473a
2022-01-17 11:57:29 +08:00
wangchen
1c605a338a fix: OsGetAllTskInfo调用和异常时无任务回调函数地址
【背景】OsGetAllTskInfo调用和异常时无任务回调函数地址

【修改方案】
1,新增tskinfo内容

【影响】
对现有的产品编译不会有影响。

re #I4MG2T
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-01-15 08:14:53 +00:00
openharmony_ci
570f2785bd !537 补充完善原子接口测试用例及部分原子接口修复
Merge pull request !537 from ouyk/master
2022-01-13 10:44:04 +00:00
ou-yangkan
3900785b8f 补充完善原子接口测试用例及部分原子接口修复
Signed-off-by: ou-yangkan <519689417@qq.com>
2022-01-13 15:22:14 +08:00
openharmony_ci
d50c106304 !536 xtensa架构增加alloc异常入口
Merge pull request !536 from ouyk/master
2022-01-13 03:06:19 +00:00
ou-yangkan
697a0cbdeb xtensa架构增加alloc异常入口
Signed-off-by: ou-yangkan <519689417@qq.com>
2022-01-12 16:12:48 +08:00
openharmony_ci
b9c9936270 !509 libatomic底层实现补充
Merge pull request !509 from wangchen/atomic
2022-01-12 03:00:44 +00:00
openharmony_ci
852114d9d2 !532 kernel测试套适配xtensa及csky架构
Merge pull request !532 from gsshch/master
2022-01-12 01:35:56 +00:00
openharmony_ci
68cd62733f !535 feat: newlib支持pthread_equal
Merge pull request !535 from zhushengle/equal
2022-01-12 01:33:08 +00:00
zhushengle
ce5357eee1 feat: newlib支持pthread_equal
Close #I4QERS
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ife2c6afdd47b4bc0407e07f6f629716d4d0f2d1e
2022-01-11 21:27:57 +08:00
LiteOS2021
dcda9dcfa3 kernel测试套适配xtensa及csky架构
Signed-off-by: gsshch <17326005269@163.com>
2022-01-11 19:58:39 +08:00
openharmony_ci
4a9d1f0c51 !531 fix: 修复liteos-m在iar环境下的编译问题
Merge pull request !531 from zhushengle/iar
2022-01-11 10:46:48 +00:00
zhushengle
4c4784e33d fix: 修复liteos-m在iar环境下的编译问题
1.数据类型转换
2.使用未初始化数据
3.无用的标签
4.pthread 线程退出后name指向野指针

Close #I4Q5Q5
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ib89390d8f61a355788da77651bf9aeee816561bb
2022-01-11 18:01:01 +08:00
openharmony_ci
47c6ef37d7 !527 支持IAR C++ thread_local特性
Merge pull request !527 from JerryH/iar_thread_local
2022-01-10 13:09:23 +00:00
JerryH
b98aa4eacd feature: 支持IAR C++ thread_local特性
在需要IAR的thread_local特性时,在targets_config.h中包含los_iar_tls.h,覆盖los_config.h的默认定义,使能该特性。

close #I4PTVZ

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: I92d3f960555f95cb3618dd5e3915824105eb13a4
2022-01-10 20:10:35 +08:00
openharmony_ci
4a120d7533 !528 修复内核gn模板编译依赖的问题
Merge pull request !528 from SimonLi/master
2022-01-08 07:53:08 +00:00
SimonLi
11215e111a build: 修复内核gn编译依赖的问题
背景:
1. //kernel/liteos_m/BUILD.gn通过excutable生成config.gni文件到
out目录下
2. //kernel/liteos_m/liteos.gni定义内核模板,依赖out目录下的config.gni
意味着使用内核模板的模块(例如device/board、device/soc)需要依赖
kernel/liteos_m/BUILD.gn先加载,有这个顺序依赖约束。

解决方案:
将生成config.gni部分移到liteos.gni模块定义处,解决这个约束。

Signed-off-by: SimonLi <likailong@huawei.com>
2022-01-08 14:58:38 +08:00
openharmony_ci
9d5668e52c !497 Clang triple renaming
Merge pull request !497 from maweiye/master
2022-01-07 03:19:29 +00:00
openharmony_ci
9fe091bd42 !525 fix: 修正liteos-m内核README不准确信息
Merge pull request !525 from zhushengle/readme
2022-01-07 02:03:02 +00:00
openharmony_ci
ba1d7e7b90 !517 feat:added assembly atomic interface
Merge pull request !517 from 王树林/master
2022-01-06 13:29:56 +00:00
openharmony_ci
b89759c678 !517 feat:added assembly atomic interface
Merge pull request !517 from 王树林/master
2022-01-06 13:29:56 +00:00
zhushengle
0e067b2393 fix: 修正liteos-m内核README不准确信息
1.修正README不准确信息
2.新增内核编码规范指导

Close #I4PLWP

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Iac96fb0a2e2bc80f82338921287c8ca987e89652
2022-01-06 17:21:10 +08:00
ou-yangkan
1513f50a47 feat: added assembly atomic interface
added 32-bit assembly atomic interface:

BREAKING CHANGE:
Assembly implementation:
    ArchAtomicRead
    ArchAtomicSet
    ArchAtomicAdd
    ArchAtomicSub
    ArchAtomicInc
    ArchAtomicIncRet
    ArchAtomicDec
    ArchAtomicDecRet

https://gitee.com/openharmony/kernel_liteos_m/issues/I4O1UC
Signed-off-by: wang-shulin93 <15173259956@163.com>
2022-01-06 10:37:54 +08:00
openharmony_ci
f3fbeb87db !523 fix: tick timer时钟频率赋值修改为运行时赋值
Merge pull request !523 from zhushengle/tick_timer
2022-01-05 09:06:07 +00:00
zhushengle
ae02afc850 fix: tick timer时钟频率赋值修改为运行时赋值
OS_SYS_CLOCK 宏由产品定义,该宏可能为函数,在编译时赋值无法覆盖该场景

Close #I4PGUR
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I60e3f4fcd8f94b26c23cc88e0622408a24fbebe2
2022-01-05 15:51:11 +08:00
openharmony_ci
3c19b017fc !522 fix: 修复pthread_create相关问题
Merge pull request !522 from zhushengle/pthread
2022-01-04 11:16:07 +00:00
zhushengle
cd949ddae0 fix: 修复pthread_create相关问题
1. 系统调度未起时,调用pthread_create失败
  系统调度未起时,系统无运行任务,获取当前线程失败
2. 先创建任务再给任务赋值name,且未加锁保护,和shell存在静态

Close #I4P78J

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I2570dcf90953ced06400a0a22193cc81719fb546
2022-01-04 15:06:13 +08:00
openharmony_ci
67f8149640 !480 feat: 内核提供tick timer框架,支持多架构多平台通用化
Merge pull request !480 from zhushengle/timer
2022-01-04 01:12:29 +00:00
openharmony_ci
9ebad7d291 !521 fix: 修复newlib缺省PTHREAD_KEYS_MAX 问题
Merge pull request !521 from zhushengle/key
2021-12-31 08:51:16 +00:00
zhushengle
65f04bf093 fix: 修复newlib缺省PTHREAD_KEYS_MAX 问题
Close #I4OX47
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I4c6b07a77dca5eb5b24f462e639ff173f06d5da0
2021-12-31 15:38:18 +08:00
openharmony_ci
1af387098f !520 pm codex告警清零
Merge pull request !520 from zhushengle/codex
2021-12-31 07:22:52 +00:00
zhushengle
96663805ec fix: pm codex告警清零
Close #I4OWPE
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I07f6db919062090b917ce991198f769032365472
2021-12-31 14:55:20 +08:00
zhushengle
f635450d7c feat: 内核提供tick timer框架,支持多架构多平台通用化
背景:
      当前Arch下tick timer的实现依赖于弱函数机制,三方适配时出错及限制较大,且tick
  timer作为内核必须模块,未模块化,当前散落在tick和调度等模块中,且当前存在arch依赖
  内核,内核也依赖arch的情况,为了解决上述问题,将tick timer模块化,通过提供tick
  timer框架实现内核依赖Arch而Arch不依赖内核,并且可以减少对外暴漏的接口,使得三方
  适配时更加明确需要实现的接口。

方案描述:
1.tick timer结构
  在kernel_liteos_m/arch/include/los_timer.h,中定义结构:

  typedef struct {
    UINT32        freq;
    INT32         irqNum;
    UINT32        (*init)(HWI_PROC_FUNC tickHandler);
    UINT64        (*getCycle)(UINT32 *period);
    VOID          (*reload)(UINT64 time);
    VOID          (*lock)(VOID);
    VOID          (*unlock)(VOID);
    HWI_PROC_FUNC tickHandler;
  } ArchTickTimer;
  并声明对外获取tick timer的接口:

  ArchTickTimer *ArchSysTickTimerGet(VOID)
  define LOS_SysTickTimerGet ArchSysTickTimerGet
2.在每个架构下提供默认的tick timer操作:

  STATIC ArchTickTimer g_archTickTimer = {
    .freq = xxx, 必填
    .irqNum = xxx, 必填
    .init = xxx, 必填
    .getCycle = xxx, 必填
    .reload = xxx, 必填
    .lock = xxx, 必填
    .unlock = xxx, 必填
    .tickHandler = NULL, 可选
  }
  并实现:ArchTickTimer *ArchSysTickTimerGet(VOID) 接口
3.内核los_tick.c中提供对外(其它模块)和公共的tick timer初始化操作函数,
  如果用户不想启用系统默认的tick timer,则需要在 "内核初始化之前" 调用接口:
  LOS_TickTimerRegister(const ArchTickTimer *timer, const HWI_PROC_FUNC tickHandler)
  将用户自己的tick timer或中断处理函数 注册进去。
  用户也可以注册自己的中断处理函数(用户不提供,默认使用系统提供的)。

BREAKING CHANGE:
  原来版本中每个架构下提供的tick timer相关操作函数为弱函数:
    WEAK UINT32 HalTickStart(OS_TICK_HANDLER handler);
    WEAK VOID HalSysTickReload(UINT64 nextResponseTime);
    WEAK UINT64 HalGetTickCycle(UINT32 *period);
    WEAK VOID HalTickLock(VOID);
    WEAK VOID HalTickUnlock(VOID);
  用户如果需要启用自己的tick timer需要自己实现相关接口(强属性),在 "内核初始化之前" 通过调用:
  LOS_TickTimerRegister 接口替换系统默认提供的tick timer相关接口。
  无论用户提供的tick timer 还是系统默认提供的,均在内核初始化时启动。

Close #I4N7XV:arch 重构

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I83ad0bdf303904f0e73f808b57b60183619fddcd
2021-12-31 10:50:33 +08:00
openharmony_ci
909a18ec8f !510 feat: 支持posix线程私有数据能力
Merge pull request !510 from zhushengle/pthread_key
2021-12-30 06:34:28 +00:00
openharmony_ci
bd0ae07bcf !511 fix: 公版gcc编译内核,调用calloc崩溃
Merge pull request !511 from Zhaotianyu/1228newlib_calloc
2021-12-30 01:12:29 +00:00
openharmony_ci
ad6bdba415 !460 fix: 中断向量表对齐大小支持可配置
Merge pull request !460 from kenneth/align
2021-12-29 00:55:39 +00:00
zhushengle
a856303b9c feat: 支持posix线程私有数据能力
BREAKING CHANGE:
  int pthread_key_create(pthread_key_t *k, void (*dtor)(void *))
  int pthread_key_delete(pthread_key_t k)
  int pthread_setspecific(pthread_key_t k, const void *x)
  void *pthread_getspecific(pthread_key_t k)

Close #I4ODEB
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I60ce26c20d1e2033922d2d1b01d73fc8938c8019
2021-12-28 19:55:10 +08:00
arvinzzz
8d0ced2069 fix: 修复公版gcc编译内核,调用calloc崩溃
使用内核提供的calloc接口替换工具链的实现

close: #I4OFG6

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ia979f2b613c8bab89b5df3aa4bd340f6cc6fabd7
2021-12-28 16:12:26 +08:00
kenneth
cf9c8387e3 fix: 中断向量表对齐大小支持可配置
根据板端实际设置中断向量表对齐大小,支持可配置。

fix #I4M20E

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-12-28 09:52:13 +08:00
openharmony_ci
5a7fabe4f8 !498 fix: liteos_kernel_only=true编译内核报错
Merge pull request !498 from kenneth/mk
2021-12-28 00:59:20 +00:00
openharmony_ci
d7fd58b986 !496 fix the compile warning
Merge pull request !496 from laojr1/master
2021-12-28 00:58:24 +00:00
wangchen
2f7f6f0cbb 【背景】使用公版gcc编译m核时,会缺少部分底层函数
【修改方案】
1,补充这部分接口

【影响】
对现有的产品编译不会有影响。

re #I4OAY9
Signed-off-by: wangchen <253227059@qq.com>
2021-12-27 12:55:53 +00:00
openharmony_ci
28d0761b85 !505 解决m核开启ipv6功能的编译的问题
Merge pull request !505 from xieshen9527/master
2021-12-27 06:23:03 +00:00
zhangyang
c7843926b8 refactor: 解决m核开启ipv6功能的编译
close #I4NOIP

Signed-off-by: zhangyang <zhangyang349@huawei.com>
2021-12-27 12:00:30 +08:00
openharmony_ci
900f183260 !504 在arch\csky\v2\gcc\los_exc.S中添加IrqEntry函数实现
Merge pull request !504 from ouyk/master
2021-12-27 03:38:51 +00:00
wcc0
79d42b7976 在arch\csky\v2\gcc\los_exc.S中添加IrqEntry函数实现
Signed-off-by: wcc0 <917033401@qq.com>
2021-12-27 11:10:45 +08:00
openharmony_ci
85a1ce43c6 !493 feat:Synchronizing arch api
Merge pull request !493 from LiteOS/master
2021-12-25 10:42:15 +00:00
LiteOS2021
04bf3a682f feat: synchronizing arch api
命名规范:修改少量Arch接口,命名规范化调整:
1.修改arch/include下接口声明,所有arch对外提供调用函数均以ArchXX命名
2.提取多个架构均有实现的公共函数声明至arch/include对应头文件中以供外部调用,并修改命名格式为ArchXX
3.修改OS_HWI_WITH_ARG为LOSCFG_PLATFORM_HWI_WITH_ARG并移至los_config.h中
4.typedef VOID (*OS_TICK_HANDLER)(VOID);暂时移至arch/include/los_timer.h中
5.实现atomic原子操作相关接口,位于arch/include/los_atomic.h,arm架构部分与汇编指令相关原子操作接口使用ARCH_ARM宏进行控制是否编译

BREAKING CHANGE: 1.修改arch/include下接口,以ArchXX命名函数
2.提取公共函数声明:ArchAtomicXchg32bits、ArchAtomicDecRet、ArchAtomicCmpXchg32bits
3.新增部分原子操作c内联实现

Close #I4N7XV

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2021-12-25 18:36:09 +08:00
kenneth
adc21052b2 fix: liteos_kernel_only=true编译内核报错
修复单独编译内核报错的问题

close #I4O204

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-12-25 14:10:01 +08:00
maweiye
5a185df69d clang triple renaming
Signed-off-by: maweiye <maweiye@huawei.com>
2021-12-24 16:46:46 +08:00
老家荣
cbcd297a3a chore: 解决 cmsis_liteos2.c:115:23: warning 编译告警
Signed-off-by: laojr1 <laojr1@midea.com>
2021-12-23 17:55:11 +08:00
openharmony_ci
4334b3e18b !473 fix:修复拼写错误
Merge pull request !473 from ouyk/master
2021-12-22 02:46:46 +00:00
openharmony_ci
b998978561 !474 fix: 修复L0_Emulator 门禁高概率失败的问题
Merge pull request !474 from zhushengle/Emulator
2021-12-20 08:18:56 +00:00
zhushengle
7ad2f62a03 fix: 修复L0_Emulator 门禁高概率失败的问题
内存测试用例002中对全局的内存池进行了重复申请释放操作,
释放之后全局的测试内存池为无效的野指针,而该内存已被网络
分配并使用,从而导致出现踩内存的现象。

Close #I4NB0N

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Iffd631fcdaa020afefd108c189850ef3e75d1e4b
2021-12-20 15:34:08 +08:00
ou-yangkan
c082d77f55 fix:Fix spelling errors
Signed-off-by: ou-yangkan <519689417@qq.com>
2021-12-20 09:35:58 +08:00
openharmony_ci
7e9d84362f !442 M核posix接口fs模块用例完善
Merge pull request !442 from wangchen/posix_test
2021-12-19 08:12:27 +00:00
openharmony_ci
b56c6e86d4 !470 fix: 补充newlib对ipv6的支持
Merge pull request !470 from Zhaotianyu/1218newlib_ipv6
2021-12-18 11:58:52 +00:00
arvinzzz
f7400fbcb2 fix: 添加newlib对ipv6的支持
补充业务中需要的ipv6相关宏定义

close: #I4M1DB

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I6835fb0673874ed8efff01c8e4f79c2d64ea0d46
2021-12-18 19:35:10 +08:00
openharmony_ci
e6dd09733d !469 修复posix的Kconfig
Merge pull request !469 from Zhaotianyu/1217Kconfig_fix
2021-12-17 04:05:20 +00:00
arvinzzz
bb04582910 fix: 修复Kconfig信息错误
close: #I4MZ1F

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I9216b28ab5b2a43d77512d529a6a6637998e19ea
2021-12-17 11:35:04 +08:00
openharmony_ci
41a3cb0233 !468 fix:修复异常处理入口条件判断范围错误的问题
Merge pull request !468 from 王树林/master
2021-12-17 03:20:15 +00:00
wcc0
d09d46ff75 fix:fix bug of exception
Signed-off-by: wcc0 <917033401@qq.com>
2021-12-17 09:37:03 +08:00
openharmony_ci
6f7ceb3e72 !464 转移csky架构中断入口由device到kernel中
Merge pull request !464 from ouyk/master
2021-12-16 12:03:15 +00:00
ou-yangkan
ee79364748 转移csky架构中断入口由device到kernel中
Signed-off-by: ou-yangkan <519689417@qq.com>
2021-12-16 19:43:47 +08:00
openharmony_ci
91e5b3054e !466 修改csky和xtensa架构的g_intCount变量使用
Merge pull request !466 from ouyk/modify_g_intCount
2021-12-16 08:01:06 +00:00
ou-yangkan
d6aa3bf44b 修改csky和xtensa架构的g_intCount变量使用
Signed-off-by: ou-yangkan <519689417@qq.com>
2021-12-16 13:50:48 +08:00
openharmony_ci
d03b490d3d !462 OsMuxInit函数中增加对owner成员的初始化
Merge pull request !462 from fangye945a/master
2021-12-15 02:34:24 +00:00
openharmony_ci
939414ea9a !456 fix: tick中断处理时,无挂起任务时应更新当前运行任务的时间片, 并触发一次调度
Merge pull request !456 from zhushengle/tick
2021-12-15 01:57:10 +00:00
fangye
d1f7b8e465 OsMuxInit函数中增加对owner成员的初始化
Signed-off-by: fangye <fangye@talkweb.com.cn>
2021-12-14 22:45:29 +08:00
openharmony_ci
12b66edbe3 !459 解决kernel目录下一些函数入参过剩导致编译错误的问题
Merge pull request !459 from 苏宗耀/master
2021-12-14 02:15:40 +00:00
suzongyao
eff6b5533c fix: 解决kernel目录下一些函数入参过剩导致编译错误的问题
Signed-off-by: suzongyao <suzongyao@talkweb.com.cn>
2021-12-13 17:15:26 -08:00
openharmony_ci
4b43e360a2 !458 解决_SEM_MAGIC宏定义数据类型错误导致的编译问题
Merge pull request !458 from 苏宗耀/master
2021-12-13 10:14:32 +00:00
szy
58ebbf0a71 fix: 解决宏定义_SEM_MAGIC数据类型错误导致的编译问题
Signed-off-by: suzongyao <suzongyao@talkweb.com.cn>
2021-12-13 01:52:13 -08:00
openharmony_ci
3aff6c572f !434 feat: 低内存资源回收low memory killer
Merge pull request !434 from kenneth/lmk1130
2021-12-13 08:56:26 +00:00
kenneth
ab886d848a feat: 低内存资源回收low memory killer
低内存资源回收特性,支持维护可杀低重要任务,当高内存任务申请不到足够内存时,临时释放低重要性的任务来释放内存来满足高内存任务正常运行;
当高内存任务退出运行时,自动恢复被杀的低重要性任务。设计文档归档位置 https://gitee.com/rtos_yuan/lmk/tree/design/

BREAKING CHANGE: 增加低内存资源回收注册相关接口LOS_LmkOpsNodeRegister、LOS_LmkOpsNodeUnregister和内存资源释放和任务恢复接口LOS_LmkTasksKill和LOS_LmkTasksRestore.

close #I4ID0M

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-12-13 12:07:33 +08:00
zhushengle
ea12d40caf fix: tick中断处理时,无挂起任务时应更新当前运行任务的时间片, 并触发一次调度
Close #I4LRZG

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I4472fb50c775b832688aa7a555498901a80e2999
2021-12-13 11:37:50 +08:00
openharmony_ci
16259a955e !455 清除因g_tm变量没有使用引入的编译告警
Merge pull request !455 from JerryH/warning
2021-12-11 03:18:19 +00:00
JerryH
9689522a8e fix: 清除因g_tm变量没有使用引入的编译告警
close #I4LW3H

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: I8f1be047ce5af5e7d50822c22764f9b2f04167d9
2021-12-11 10:38:35 +08:00
openharmony_ci
ff11e86c42 !452 解除net对cmsis的依赖,net属于内核模块,不应该依赖内核对外接口
Merge pull request !452 from SimonLi/master
2021-12-10 06:46:40 +00:00
SimonLi
99826240d9 fix: 解除net对cmsis的依赖,net属于内核模块,不应该依赖内核对外接口
Signed-off-by: SimonLi <likailong@huawei.com>
2021-12-10 10:22:17 +08:00
openharmony_ci
a1b4ebd479 !454 解决gmtime和localtime接口由于g_tm全局变量导致的竞态问题
Merge pull request !454 from JerryH/time
2021-12-10 02:20:33 +00:00
JerryH
1454b76482 fix: 解决gmtime和localtime接口由于g_tm全局变量导致的竞态问题
删除全局变量,接口使用自己的内部静态变量,避免竞态

Close #I4LW3H

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: I3c74b1897b3909df93d21b9d521af270cc6fc610
2021-12-10 09:24:30 +08:00
openharmony_ci
48fd327654 !453 fix: FD_SETSIZE compatible newlibc
Merge pull request !453 from besyangjian/master
2021-12-09 14:42:33 +00:00
openharmony_ci
2037e4de37 !451 fix: adapt net
Merge pull request !451 from besyangjian/master
2021-12-09 13:54:03 +00:00
yangjian
82c6d5f174 fix: FD_SETSIZE compatible newlibc
Signed-off-by: yangjian <jianyang@bestechnic.com>
Change-Id: I9d6b708772e63b2dc797d7305801be617fb32e75
2021-12-09 21:53:56 +08:00
yangjian
8594ee469a feat: adapt net
Signed-off-by: yangjian <jianyang@bestechnic.com>
Change-Id: I91d1ef2b5b77be7ec84af939db202a8b06a9b68f
2021-12-09 21:08:04 +08:00
openharmony_ci
4a95944fc5 !446 支持删除已经超时但还在队列中未执行的软件定时器
Merge pull request !446 from JerryH/swtmr
2021-12-09 03:10:36 +00:00
openharmony_ci
555b0a05b8 !444 fix: 调度中将pm相关的部分用LOSCFG_KERNEL_PM包含
Merge pull request !444 from zhushengle/pm
2021-12-09 03:04:30 +00:00
openharmony_ci
c0091d5fda !450 feature: newlib支持lwip
Merge pull request !450 from Zhaotianyu/1208newlib_lwip
2021-12-08 15:09:14 +00:00
arvinzzz
885027dc91 feature: newlib支持lwip
close: #I4LPB2

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I01fcc0ef35e69103562d4c59e52b335a5695dfc7
2021-12-08 22:06:12 +08:00
openharmony_ci
24f970ab34 !449 将内核静态库的complete_static_lib设置为fasle,解决链接灌段缺失问题
Merge pull request !449 from Caoruihong/complete_static_lib_false
2021-12-08 13:43:10 +00:00
Caoruihong
02e6a0a7ea chore(build): set complete_static_lib false for libkernel
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ia3da4f963f44babdc802c58c0afbb1adc1f16ee9
2021-12-08 17:53:53 +08:00
JerryH
ecce17ea48 fix: 解决定时器超时但还在队列中无法删除的问题
利用每次创建时,软件定时器timerId都是唯一的(0~0xffffffff循环),在超时写队列时,同时记录软件定时器id,删除的时候更新软件定时器id,那么在处理软件定时器前,
通过队列中记录的id获取软件定时器控制块,如果控制块的id不等于记录的id,那么说明该软件定时器被删除过,将不执行对应回调函数,表现为删除该定时器。

BREAKING CHANGE: SwtmrHandlerItem结构体新增swtmrID字段,用于标识超时队列中软件定时器id

Close #I4LFVD

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: I716176f177c4bc07adb348936d5568fbadcbebe7
2021-12-08 15:27:49 +08:00
openharmony_ci
ee754f1f46 !440 优化构建脚本
Merge pull request !440 from Caoruihong/support_gcc
2021-12-08 07:20:43 +00:00
openharmony_ci
ffda523f2d !443 fix:Kconfig中打开littlefs默认关联打开LOSCFG_SUPPORT_LITTLEFS宏
Merge pull request !443 from Zhaotianyu/1206newlib_fix_Kconfig
2021-12-06 13:56:15 +00:00
zhushengle
d7c0059dc4 fix: 调度中将pm相关的部分用LOSCFG_KERNEL_PM包含
Close #I4L00F
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I0dbe0954dcb881c0079677c215aceb099d6d1b94
2021-12-06 19:12:55 +08:00
arvinzzz
b2bcab3a5b fix: Kconfig中打开littlefs选项默认关联打开LOSCFG_SUPPORT_LITTLEFS宏
close: #I4ENQ1

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ib86ba0e35860e225e57c8da9f481de55ba154a40
2021-12-06 18:14:56 +08:00
lnlan
ee380fb9be fix: M核posix接口fs模块用例完善
【背景】M核posix接口fs模块用例无平台进行验证,在qemu上运行时会有报错。

【修改方案】
1,对部分用例进行修改,增加对qeum的适配度

【影响】
对现有的产品编译不会有影响。

re #I4L7BF
Signed-off-by: wangchen <253227059@qq.com>
2021-12-06 09:31:15 +00:00
Caoruihong
84ea5528e2 chore(build): optimize build scripts
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I672b7e6109563d457d493c08903bb5a1dff118ad
2021-12-05 02:29:49 +08:00
openharmony_ci
cd31fc9a8b !368 【feature】内核支持musl与newlib C库切换
Merge pull request !368 from Zhaotianyu/1020newlib
2021-12-04 14:19:55 +00:00
arvinzzz
753d86014b feature: 支持newlib与musl切换
系统支持newlib,并且可以与musl-C自由切换

1. 新增newlib支持,适配newlib的预留钩子,针对系统能力适配newlib头文件(补充宏定义,结构体定义,posix能力开关),
  采用标准C与自研posix接口声明与结构体定义混合作为C库
2. 梳理kal的依赖关系,kal作为内核对外提供的标准接口,下属包含cmsis、libc、posix。
  cmsis为内核对cmsis接口的支持,libc为内核对三方C库的适配及使用,posix为内核自研提供的posix标准接口。
  若采用musl-C,则kal中选取libc/musl,posix共同作为C库对外支持;
  若采用newlib-C,则kal中选取libc/newlib,部分posix共同作为C库对外支持。
3. fs整理,components/fs下提供基于posix标准的接口改为内部对外接口,供musl以及newlib切换 适配使用

close: #I4ENQ1

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I72eda5ac5499f72c67e800e22b0f39eb288f2b94
2021-12-04 21:43:55 +08:00
openharmony_ci
746acf55e4 !433 fix: 去掉编译选项-fno-short-enums
Merge pull request !433 from kenneth/short_enum
2021-12-03 07:02:45 +00:00
openharmony_ci
1c9703b049 !436 LOS_Panic接口中增加需要增加LOS_BackTrace(),方便定位主动异常位置
Merge pull request !436 from zhangfanfan2/master
2021-12-02 04:05:33 +00:00
openharmony_ci
d3bf180b7f !428 对arch.c文件里面的方法进行防空处理
Merge pull request !428 from xieshen9527/master
2021-12-02 02:19:31 +00:00
openharmony_ci
da135662f3 !437 test: 修正测试用例中固定的资源设定,修改为动态获取
Merge pull request !437 from zhushengle/test
2021-11-30 12:58:16 +00:00
zhushengle
143e8a7df6 test: 修正测试用例中固定的资源设定,修改为动态获取
Close #I4KH68

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I9d23f63cd751a804966a7c6366590897f3858b72
2021-11-30 19:04:12 +08:00
openharmony_ci
d0692abae9 !435 fix: 取消cpu进入低功耗前开中断操作,优化注册机制
Merge pull request !435 from zhushengle/pm
2021-11-30 09:51:35 +00:00
zhangfanfan2
f51d675fee fix: LOS_Panic接口中增加需要增加LOS_BackTrace(),方便定位主动异常位置
close: #I4IGGY

Signed-off-by: zff <zhangfanfan2@huawei.com>
2021-11-30 07:24:29 +00:00
zhushengle
bd39e9e6d6 fix: 取消cpu进入低功耗前开中断操作
开中断导致低功耗流程非原子,容易造成流程出错。
    提供低功耗默认处理函数,优化注册机制

Close #I4KDP8
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ied8bab691e7725e207b8b3cfb058f851eafe3052
2021-11-30 10:47:04 +08:00
openharmony_ci
d0d51b4a29 !393 feat: 支持Lms轻量级地址消毒
Merge pull request !393 from LiteOS/lms
2021-11-29 14:22:21 +00:00
kenneth
b542aab09d fix: 去掉编译选项-fno-short-enums
编译选项-fno-short-enums是liteos-m支持kconfig(https://gitee.com/openharmony/kernel_liteos_m/pulls/371)时从Liteos-a核引入的编译选项。添加该编译选项后会输出警告信息,
需要去掉该编译选项。

fix #I4JY32

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-11-29 19:07:10 +08:00
openharmony_ci
6a3f7d85f2 !432 fix: 修正部分编码风格问题
Merge pull request !432 from zhushengle/code
2021-11-29 06:52:07 +00:00
openharmony_ci
f460976604 !431 修改测试代码里的敏感词
Merge pull request !431 from LeonChan/master
2021-11-29 06:46:27 +00:00
zhushengle
91903a3716 fix: 修正部分编码风格问题
Close #I4K8M7

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: If34d5c632cbb06f639434d8c35fb226a0253f4a7
Signed-off-by: zhushengle <zhushengle@huawei.com>
2021-11-29 14:22:39 +08:00
Leon Chan
8e2248c062 fix: change the sensitive words
close: #I4K7LL

Signed-off-by: Leon Chan <chenwei26@huawei.com>
2021-11-29 11:45:13 +08:00
LiteOS2021
7b838e8a7b feat: 支持Lms
1.【需求描述】:
   支持内核态堆内存非法访问检测,包括:越界访问、double free、释放后使用;支持libc常用高频函数内存检测;支持安全函数内存检测;读写检测可配可裁剪。
2.【方案描述】:
   (1).影子内存映射与标记
   (2).编译器使能-fsanitize=kernel-address 自动插桩检测点
   (3).实时校验影子内存的合法性;
   (4).错误访问打印回溯栈

BREAKING CHANGE: 新增支持API:

LOS_LmsCheckPoolAdd使能检测指定内存池
LOS_LmsCheckPoolDel不检测指定内存池
LOS_LmsAddrProtect为指定内存段上锁,不允许访问
LOS_LmsAddrDisableProtect去能指定内存段的访问保护

Close #I4HYBG

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
Change-Id: Ia356a003088b9df37df667ea8ba91c80f5a41967
2021-11-27 11:31:12 +08:00
openharmony_ci
2ad9dc0eac !426 feat: 调度、任务及pm解耦
Merge pull request !426 from zhushengle/pm
2021-11-27 02:08:29 +00:00
openharmony_ci
9af519b3f0 !429 kernel/liteos_m/OAT.xml文件中路径错误
Merge pull request !429 from Hongjin Li/local_hongjin-li
2021-11-26 10:19:04 +00:00
Hongjin Li
4b4a1ad943 修复OAT.xml文件中路径错误。
Change-Id: I432c5241b67139a958874f6705173e4f6bce16de
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2021-11-26 17:37:55 +08:00
openharmony_ci
2cf3b19563 !427 refactor: 将安全函数库的编译由三方移至内核进行控制
Merge pull request !427 from Zhaotianyu/1125libsec
2021-11-26 06:46:01 +00:00
zhangyang
690b8f3627 refactor: 对arch.c文件中方法里面参数进行防空处理
close #I4JV90

Signed-off-by: zhangyang <zhangyang349@huawei.com>
2021-11-26 11:11:10 +08:00
arvinzzz
e45bcc9d4f refactor: 将安全函数库的编译行为由三方移至内核进行控制
close: #I4JUKM

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I201507aae937a01f49eafcf5909c07eae4a60123
2021-11-26 11:07:37 +08:00
zhushengle
cc8a794229 feat: 调度、任务及pm解耦
pm中冻结线程的操作,融合至OsSchedSuspend和OsSchedResume,
使得调度模块提供对应完整的方法给任务模块,做到之间的相互解耦,
方便其它调度算法的融入。

Close #I4JTN6
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ifde7077166a2fe67e7246fa68f777844640d67db
2021-11-25 16:54:02 +08:00
openharmony_ci
119e2d328a !392 补充内存释放函数。
Merge pull request !392 from pef/master
2021-11-25 08:32:36 +00:00
openharmony_ci
e47bbdaa1b !411 make //kernel/liteos_m:kernel avaliable to all targets
Merge pull request !411 from yaoxiaoyu_903c/master
2021-11-25 05:06:02 +00:00
openharmony_ci
d8e512cd7b !422 【轻量级 PR】:[fix] fix target build error
Merge pull request !422 from bh6bao/N/A
2021-11-25 02:45:17 +00:00
openharmony_ci
b3ae1a9002 !423 fix: 修复arch目录调整影响到的target目录下的文件
Merge pull request !423 from kenneth/rename_arch_dir
2021-11-25 02:44:48 +00:00
yaoxiaoyu
9b4386380c make //kernel/lite_m:kernel available for all targets
Signed-off-by: yaoxiaoyu <yaoxiaoyu1@huawei.com>
Change-Id: Ibec8b49c6ece051301fd4d298c7a3b9b20d53409
2021-11-24 15:30:08 +08:00
kenneth
d5725b2264 fix: 修复arch目录调整影响到的target目录下的文件
将arch目录从kernel中移到根目录下 影响target目录下面的readme、makefile文件。

close #I4JM7Z

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-11-24 15:10:22 +08:00
bh6bao
7920eb38fc [fix] fix target build error
Signed-off-by: bh6bao <904710733@qq.com>

Fix compile error caused by arch directory change
2021-11-24 06:13:44 +00:00
openharmony_ci
25d1d68db5 !401 fix: ReadMe中无对动态加载模块待加载的共享库的限制说明。
Merge pull request !401 from Harylee/readme
2021-11-24 05:57:05 +00:00
openharmony_ci
57a8e03e89 !407 fix issues I4J4TK cat can not work well on big file
Merge pull request !407 from 冷钦街/cat_big2
2021-11-24 05:56:08 +00:00
openharmony_ci
a1e97964c6 !415 fix(shell):cp命令执行时 通配出多个源文件时错误提示不正确
Merge pull request !415 from 冷钦街/cp_hit
2021-11-24 05:55:43 +00:00
openharmony_ci
431fcd2443 !412 fix: 在头文件中补充LOSCFG_MEM_FREE_BY_TASKID函数的声明
Merge pull request !412 from kenneth/freeTask
2021-11-24 05:55:13 +00:00
openharmony_ci
36712dcbb6 !421 修改lwip_porting.gni路径为全量路径,方便产品适配
Merge pull request !421 from 刘建东/master
2021-11-24 05:54:18 +00:00
openharmony_ci
ed02106eef !416 【轻量级 PR】:修复一处资源泄漏
Merge pull request !416 from Caoruihong/N/A
2021-11-24 05:53:25 +00:00
YOUR_NAME
321cb9d193 refactor: use all path of lwip_porting.gni for other product
use all path of lwip_porting.gni for other product

close: #I4JKX9

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-11-24 11:53:41 +08:00
openharmony_ci
8310aba4ea !410 宏_BSD_SOURCE放在头文件中定义,其他模块使用lwip头文件时,可不用单独再定义
Merge pull request !410 from 刘建东/master
2021-11-24 01:41:39 +00:00
openharmony_ci
ed64fb1b2f !409 littlefs新增FileOps->Fstat接口
Merge pull request !409 from Hongjin Li/liteos_m_add_fstats_to_littlefs
2021-11-24 01:38:39 +00:00
Caoruihong
b73898a022 修复一处资源泄漏
Signed-off-by: Caoruihong <crh.cao@huawei.com>
2021-11-23 07:15:06 +00:00
lengqinjie
8675abcec9 fix(shell):cp命令执行时 通配出多个源文件时错误提示不正确
close #I4JETR
Signed-off-by: lengqinjie <15390014138@163.com>
2021-11-23 14:09:12 +08:00
openharmony_ci
05a487dcf6 !408 refactor(shell):减少命令行参数的解析次数到1次(原来为2次)
Merge pull request !408 from 冷钦街/reduce
2021-11-22 21:10:48 +00:00
kenneth
ad18026a59 fix: 在头文件中补充LOSCFG_MEM_FREE_BY_TASKID函数的声明
LOSCFG_MEM_FREE_BY_TASKID函数在头文件kernel\include\los_memory.h中没有声明,使用会有警告,补充声明该函数。

close #I4JBOV

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-11-22 20:40:32 +08:00
YOUR_NAME
57208d6e14 refactor: define _BSD_SOURCE in cc.h instead of gn file
define _BSD_SOURCE in cc.h instead of gn file

close: #I4J8OT

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-11-22 15:27:00 +08:00
Hongjin Li
36b7577c5e liteos_m文件系统中,components/fs/littlefs/lfs_api.c中新增注册.Fstat = LfsFstat接口。
Change-Id: Ic56364d1df71b369abfa5be617fc63b77a65b27b
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
2021-11-22 11:45:52 +08:00
lengqinjie
078bd0c4b1 refactor(shell):减少命令行参数的解析次数到1次(原来为2次)
通过调整获取命令类型的代码位置,达到减少解析次数的目的
经过分析,本修订无明确的副作用。

Signed-off-by: lengqinjie <15390014138@163.com>
2021-11-22 09:32:17 +08:00
lengqinjie
d518bad0dc fix(shell): cat针对大文件无法工作
close #I4J4TK

Signed-off-by: lengqinjie <15390014138@163.com>
2021-11-22 09:07:58 +08:00
openharmony_ci
4e0bf74f4a !403 Board 和 SoC分离,编译适配
Merge pull request !403 from SimonLi/master
2021-11-21 02:17:37 +00:00
SimonLi
3f1c04dd57 feat: Board 和 SoC分离,编译适配
1. BUILD.gn 根据device_path中是否包含board,来判别 SoC 和 Board 分离特性是否打开,
根据特性开关兼容以前老的Build.gn编译方式

2. Makefile 中新增BOARD_COMPANY环境变量传给Kconfig,确定选择哪一个 Board

3. Kconfig 兼容老的形式,新增 device 路径下 Kconfig.liteos_m.xxxx 表示为 liteos_m
适配 Kconfig 功能,不会影响其他内核适配。主要是同个device 路径下,会有多个不同的
内核进行适配Kconfig。

Signed-off-by: SimonLi <likailong@huawei.com>
Change-Id: Iaa2ffc6e56ab9127bb13dbbb934414f63dfbcdc2
2021-11-20 08:17:52 +08:00
openharmony_ci
b7de7f6085 !398 清理YES/NO宏
Merge pull request !398 from Caoruihong/remove_yesno
2021-11-18 09:32:42 +00:00
openharmony_ci
dd90483e39 !394 m核ioctl增加选项支持
Merge pull request !394 from 刘建东/master
2021-11-18 06:28:09 +00:00
openharmony_ci
b537f8733d !397 将arch目录从kernel中移到根目录下
Merge pull request !397 from Caoruihong/move_arch
2021-11-18 03:38:10 +00:00
Haryslee
f86b97180f fix: ReadMe中无对动态加载模块待加载的共享库的限制说明。
背景:动态加载模块需要确保待加载共享库的安全性,由用户保证。

close #I4ICK8

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I6390ab3059ce6d134669c62a14f913e5b09b291d
2021-11-17 10:22:23 +08:00
Caoruihong
5196818d47 chore: replace YES/NO macros to 1/0
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I80f8b23cac10bc714dea921ed1fd43b687ce3748
2021-11-16 01:21:00 +08:00
Caoruihong
201da62e1f chore: move kernel/arch to arch
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I0f0b6f5cff967c47acf58be133a12a0fd98f4643
2021-11-16 00:45:24 +08:00
openharmony_ci
c9f2c110c6 !396 fix:在非静态初始化条件下pthread_mutex_lock,没有经过init初始化就可以对已销毁的锁进行加锁
Merge pull request !396 from x_xiny/master
2021-11-15 11:10:09 +00:00
openharmony_ci
afc362db23 !390 清理"bits/xxx.h"类头文件包含
Merge pull request !390 from Caoruihong/clean_bits
2021-11-15 09:35:10 +00:00
x-xiny
9c8377fcc6 fix:在非静态初始化条件下pthread_mutex_lock,没有经过init初始化就可以对已销毁的锁进行加锁
【背景】
 在非静态初始化条件下pthread_mutex_lock,没有经过init初始化就可以对已销毁的锁进行加锁

【修改方案】
 在pthread_mutex_destroy中将mutex的magic标记字段清除

 re #I4I7OA

 Signed-off-by: x-xiny <1301913191@qq.com>

Change-Id: I5d4cceff852e20e659a7cd06acf27cc6f381962c
2021-11-15 06:47:03 +00:00
YOUR_NAME
5e8ac4b888 feat: add option for ioctl
add option for ioctl

close: #I4I3W5

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-11-15 14:34:58 +08:00
openharmony_ci
09d972c9af !395 增加module_group模板,先注释掉arch_config
Merge pull request !395 from Caoruihong/build
2021-11-13 12:46:06 +00:00
Caoruihong
e5636f7aca feat(build): add module_group and comment out arch_cflags
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I83a248d313ec64a5bca6eb860fb84385aac446a0
2021-11-13 19:59:04 +08:00
openharmony_ci
f12e710c3c !381 #I4FDAU已完成翻译,请验收
Merge pull request !381 from Annie_wang/master
2021-11-12 01:00:29 +00:00
pef
0ceb7426c8 补充内存释放函数。
【背景】
有手动申请内存在return前未释放。

【修改方案】
1. 添加free(fullpath),释放内存。

【影响】
 对现有的产品编译不会有影响。

Change-Id: I9168bd78e9137fc764292a5faa6bc7e732f82e66
Signed-off-by: pef <cyd1997@126.com>
2021-11-11 09:58:47 +00:00
openharmony_ci
942c614995 !371 支持Kconfig配置
Merge pull request !371 from Caoruihong/kconfig
2021-11-11 06:04:28 +00:00
Caoruihong
931df01e2e chore: clean "bits/xx.h" includes
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ia4db457ec704121aa5f0daac17ecee6da8395d63
2021-11-11 11:57:07 +08:00
openharmony_ci
1553e3ed88 !386 chore: shell体验优化
Merge pull request !386 from huangshan/chore
2021-11-10 08:49:51 +00:00
openharmony_ci
3e507d8cec !387 清理kernel/arch/arm/cortex-m33/gcc下无用的代码
Merge pull request !387 from Caoruihong/clean_unused
2021-11-10 02:07:59 +00:00
Caoruihong
4546ff92f7 chore: clean unused files
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I1ebc5d066a854f502c9f5e31b7acab8d8cdb69b1
2021-11-09 22:06:44 +08:00
huangshan
57cff794ae chore: shell完善帮助信息,特殊处理不可见字符
Signed-off-by: huangshan <huangshan9@huawei.com>
Change-Id: I3cbc559c388b5d5a524783c1f55c1e569a44465c
2021-11-09 20:42:18 +08:00
openharmony_ci
72928ca12e !385 fix: 修复cortex-m系列系统提供的timer在低频下时间不准的问题
Merge pull request !385 from zhushengle/timer
2021-11-09 08:57:07 +00:00
openharmony_ci
4422285b24 !383 lwip可通过宏单独提供read,write等接口操作socket,可以不依赖文件系统
Merge pull request !383 from 刘建东/master
2021-11-08 08:08:11 +00:00
zhushengle
3e569bac58 fix: 修复cortex-m系列系统提供的timer在低频下时间不准的问题
触发场景:
    cpu主频比较高,timer频率较低时,当SysTick->VAL == 0时,
触发tick中断,在中断中系统将当前周期累加到基准时间里,在中
断结束更新tick响应时间时,会更新系统基准时间(为了让时间更
加准确)此时由于SysTick->VAL任然等于0,接口HalGetTickCycle
返回的仍然是当前周期,导致该周期被累加了两次。

解决方案:
    接口HalGetTickCycle在SysTick->VAL == 0时返回0.
因为SysTick->VAL == 0时,必然会触发tick中断,周期
的累加是由中断处理的,此时只需要返回0即可。

Close #I4HBGR
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Iba6e8799b0ae851fc94aa23867b2360a4245994d
2021-11-08 14:49:52 +08:00
YOUR_NAME
d044eda3c3 feat: provide read write for socket by #define
provide read write for socket by #define

close: #I4H8TL

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-11-08 11:20:01 +08:00
openharmony_ci
c488edd707 !370 修正编译告警称解引用void指针
Merge pull request !370 from Caoruihong/void_ptr
2021-11-05 13:45:54 +00:00
Caoruihong
7e673430dc feat(build): support Kconfig
Kconfig usages are the same with liteos_a

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I9aacbb69da88d5427cced89d1a49cb1041afa998
2021-11-05 12:18:04 +08:00
Annie_wang
9f2765cfa8 update README.md.
Signed-off-by: Annie_wang <annie.wangli@huawei.com>
2021-11-05 03:43:45 +00:00
Annie_wang
cfc5a0a1ba update README.md.
Signed-off-by: Annie_wang <annie.wangli@huawei.com>
2021-11-04 07:34:32 +00:00
Annie_wang
03941ee363 update README.md.
Signed-off-by: Annie_wang <annie.wangli@huawei.com>
2021-11-04 07:31:35 +00:00
Annie_wang
14fe10a3ff update README.md.
Signed-off-by: Annie_wang <annie.wangli@huawei.com>
2021-11-04 07:28:05 +00:00
Annie_wang
55a68dcd2d update README.md.
Signed-off-by: Annie_wang <annie.wangli@huawei.com>
2021-11-04 07:21:18 +00:00
annie_wangli
2b5f52236a update docs
Signed-off-by: annie_wangli <annie.wangli@huawei.com>
2021-11-04 15:09:56 +08:00
openharmony_ci
f3631fa266 !357 修复 shell 模块存在大量的编译告警及 codeCheck
Merge pull request !357 from pef/codecheck-1018
2021-11-02 13:30:50 +00:00
openharmony_ci
5568d3ac89 !359 fix:修复shcmd.h需要用宏包起来的问题
Merge pull request !359 from yinjiaming/2021-10-18
2021-11-02 02:34:35 +00:00
openharmony_ci
c5b7a7315b !378 feat: 支持pthread_mutex属性相关接口
Merge pull request !378 from zhushengle/mutex
2021-11-01 02:20:25 +00:00
zhushengle
d2be4d7a46 feat: 支持pthread_mutex属性相关接口
接口列表:
pthread_mutexattr_init
pthread_mutexattr_settype
pthread_mutexattr_destroy

Close #I4G4RQ

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I7aea47e375ffe961a3dcbf39da6b84561e3d0a8f
2021-10-30 15:25:56 +08:00
openharmony_ci
f8cad5301b !377 修改inet_addr等宏为函数,外层调用可不包含lwip头文件
Merge pull request !377 from 刘建东/master
2021-10-30 07:25:42 +00:00
YOUR_NAME
b30e9139d5 fix: switch inet_addr to a function
switch inet_addr to a function

close: #I4G4I4

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-10-30 14:46:29 +08:00
openharmony_ci
3bd6076697 !375 优化lwip默认配置
Merge pull request !375 from 刘建东/master
2021-10-29 02:18:35 +00:00
YOUR_NAME
b2e3849bfb fix: optimize default configuration
optimize default configuration

close: #I4FSC9

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-10-28 17:40:59 +08:00
openharmony_ci
454c234512 !354 m4核在任务中异常时backtrace使用的是MSP所在的栈,而不是PSP所在的栈
Merge pull request !354 from zhangfanfan2/exc
2021-10-27 13:51:47 +00:00
zff
3e8aea224e fix: m4核在任务中异常时backtrace使用的是MSP所在的栈,而不是PSP所在的栈
m4核开启浮点运算时,异常处理流程未将浮点压栈,导致异常上下文信息错位,
进而导致backtrace时使用的SP值错误,从而出现backtrace时使用的栈信息不对。

close: #I4D7GE

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: If7d5198d1f808de4f1cd9c2bc5c6f68185a4ffac
2021-10-27 11:18:57 +08:00
openharmony_ci
844c5952ed !356 系统pend类接口未对软件定时器任务进行限制,容易引发软件定时器任务非正常挂起,出现响应不及时的问题。
Merge pull request !356 from zhangfanfan2/swtmr
2021-10-26 11:19:31 +00:00
openharmony_ci
3fefeba1f0 !362 fix: 修复los_interrupt.c文件中HalHwiInit函数里未使能未对齐异常问题
Merge pull request !362 from kenneth/unaligned
2021-10-26 06:11:22 +00:00
openharmony_ci
28bf057ded !367 fix:修复Fault异常模块中FPU宏等问题
Merge pull request !367 from kenneth/fpu_simple
2021-10-26 06:10:25 +00:00
openharmony_ci
d4c0390218 !372 fix: 修复readme中文档链接错误
Merge pull request !372 from kenneth/docs
2021-10-26 06:09:47 +00:00
kenneth
8ee70a0f8f fix: 修复readme中文档链接错误
gitee docs文档链接更新同步修改

close #I4FD5G

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-10-26 10:11:15 +08:00
Caoruihong
29126a98fe fix: fix compile warning saying dereference void * pointer
Signed-off-by: Caoruihong <crh.cao@huawei.com>
2021-10-22 22:39:36 +08:00
openharmony_ci
1d5c6ee961 !369 修正testsuits目录拼写错误
Merge pull request !369 from Caoruihong/testsuites
2021-10-22 07:36:07 +00:00
Caoruihong
9c69e6039e chore: fix typo: testsuits --> testsuites
keep testsuites the same directory name as in liteos_a

Signed-off-by: Caoruihong <crh.cao@huawei.com>
2021-10-21 21:39:32 +08:00
openharmony_ci
93c1eb54a0 !366 feat: 支持pthread_condattr_setclock
Merge pull request !366 from zhushengle/cond
2021-10-21 09:52:58 +00:00
zhushengle
68dad2ccc9 feat: 支持pthread_condattr_setclock
Close #I4ETLN
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I0b3ddbb0d99000c67f9b41944ab0ab4878094a8b
2021-10-21 11:42:23 +08:00
openharmony_ci
aed479813d !360 m核ioctl支持SIOCGIFBRDADDR选项
Merge pull request !360 from 刘建东/master
2021-10-21 01:51:11 +00:00
kenneth
2da043ce16 fix:修复Fault异常模块中FPU宏等问题
去掉不必要的宏判断__FPU_PRESENT;参数变量名称 uwPid改为pid,和函数HalExcHandleEntry的参数保持一致

close #I4D575

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-10-20 16:49:43 +08:00
openharmony_ci
fe68a93ded !355 修复qemu和csky编译使用问题
Merge pull request !355 from LiteOS/master
2021-10-20 08:13:47 +00:00
pef
e0d8b5328f fix: 修复shell 模块存在大量的编译告警及codeCheck。
【背景】
代码中存在规范问题和编译告警。
如:error: unused variable 'taskID2' [-Werror=unused-variable]
应该去掉不用的变量。

【修改方案】
1. 修改变量类型宏的使用。
2. 根据告警信息修复问题代码。

【影响】
 对现有的产品编译不会有影响。

re #I48V2J

Change-Id: I7f364fcf974d2a439639f35ba428e04f7de7338a
Signed-off-by: pef <cyd1997@126.com>
2021-10-20 07:50:23 +00:00
openharmony_ci
f886283b3b !364 fix:修复文件系统vfs层未正确判空g_fs的问题
Merge pull request !364 from Far/master
2021-10-20 03:41:43 +00:00
Far
269b330989 fix:修复文件系统vfs层未正确判空g_fs的问题
Close #I4ELJN

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-10-20 11:14:51 +08:00
openharmony_ci
f11095cf28 !363 fix: los_exc.S中_ExcInMsp主栈中异常处理函数中异常返回类型错误
Merge pull request !363 from kenneth/_ExcInMsp
2021-10-20 01:10:48 +00:00
kenneth
c51df7a94c fix: los_exc.S中_ExcInMsp主栈中异常处理函数中异常返回类型错误
修复los_exc.S中_ExcInMsp主栈中异常处理函数中异常返回类型错误

close #I4EJI4

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-10-19 20:01:50 +08:00
kenneth
d32e25f3ae fix: 修复los_interrupt.c文件中HalHwiInit函数里未使能未对齐异常问题
修复los_interrupt.c文件中HalHwiInit函数里未使能未对齐异常问题

close #I4EJGR

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-10-19 19:45:24 +08:00
YOUR_NAME
33ee492953 feat: add option SIOCGIFBRDADDR for ioctl
add option SIOCGIFBRDADDR for ioctl

close: #I4EGNG

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-10-19 17:10:09 +08:00
openharmony_ci
d8a6a4bdb9 !347 去掉没有使用的入参consoleid。
Merge pull request !347 from pef/tocommit2
2021-10-19 01:53:57 +00:00
openharmony_ci
4bc6a14914 !346 【fix】api_shell.c 宏修改
Merge pull request !346 from pef/tocommit
2021-10-19 01:52:10 +00:00
yinjiaming
a7a8a62bcb fix: 修复shcmd.h需要用宏包起来的问题
【背景】
api_shell.c中使用了头文件shcmd.h,没有用宏包起来
[ERR] :#include<shcmd.h>:45

【修改方案】
删去包含的头文件shcmd.h,代码中没有用到该头文件中的内容
为能够顺利编译过,添加了头文件<sys/time.h>

【影响】
对现有的产品编译不会有影响。

re #I45FU2

Change-Id: I1727515883adcca1e9aaa25fc46ef1fee11fa1a9
Signed-off-by: yinjiaming <yinjiaming@huawei.com>
2021-10-18 09:23:23 +00:00
zff
c886629e27 fix:系统pend类接口未对软件定时器任务进行限制,容易引发软件定时器任务非正常挂起,
出现响应不及时的问题

close: #I44CI9

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I6aa612f3c34eef274eaa0c98efed0a3c4736de6e
2021-10-18 16:35:51 +08:00
LiteOS2021
f2f8a865f0 修复qemu和csky编译使用问题
Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2021-10-18 13:34:48 +08:00
openharmony_ci
28bdb690ba !344 内核ERR打印,无进程和线程信息,不方便问题定位
Merge pull request !344 from zhangfanfan2/master
2021-10-18 03:03:30 +00:00
openharmony_ci
80263488e9 !345 【fix】los_trace.h注释修正
Merge pull request !345 from Zhaotianyu/1012trace_fix
2021-10-15 07:42:20 +00:00
openharmony_ci
c68b67a4e3 !351 fix: 调用LOS_TaskDetach操作已退出的joinable的任务时,未正确回收该任务
Merge pull request !351 from zhushengle/detach
2021-10-15 07:40:54 +00:00
zhushengle
49c93b37c5 fix: 调用LOS_TaskDetach操作已退出的joinable的任务时,未正确回收该任务
Close #I4DZL7
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Iac88818317c07807d0636712025f2c75b3b1f766
2021-10-15 10:56:02 +08:00
openharmony_ci
c313c189b5 !348 fix: 删除LOS_TRACE 记录SWTMR_START中的无效字段
Merge pull request !348 from LiteOS/trace
2021-10-14 09:06:25 +00:00
LiteOS2021
afbc9a593b fix: 优化trace buffer初始化,删除swtmr 桩中的无效参数
close #I4DPR7

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2021-10-14 09:48:49 +08:00
pef
a62795304d fix: 去掉没有使用的入参consoleid。
【背景】
https://gitee.com/openharmony/kernel_liteos_m/blob/master/components/shell/src/base/show.c
L49 consoleid 函数中没有使用,应该改为VOID。

【修改方案】
1. 将consoleid改为VOID。

【影响】
对现有的产品编译不会有影响。

re #I43CVE

Change-Id: Ieac29d16ec06c4fa45652c7106b63f6dd8397ebf
Signed-off-by: pef <cyd1997@126.com>
2021-10-13 08:09:17 +00:00
pef
9819eb5676 fix: 将未定义小写"true","false"改为"TRUE","FALSE"。
【背景】
    api_shell.c文件使用小写的true和false 却没有定义
    [OHOS ERROR] ../../../kernel/liteos_m/components/net/lwip-2.1/porting/src/api_shell.c:342:25: error: 'false' undeclared (first use in this function)
    [OHOS ERROR]      BOOL timeout_flag = false;
    编译报错。
    【修改方案】
    1. 将未定义的 true,false改为已定义的宏TRUE,FALSE。

    【影响】
    对现有的产品编译不会有影响。

    re #I43D20

Change-Id: If66adab35f2315d0caca2a487960be887567126b
Signed-off-by: pef <cyd1997@126.com>
2021-10-12 10:59:18 +00:00
arvinzzz
693468e527 fix: los_trace.h接口注释错误修正
1. LOS_TraceStop接口的功能描述应该是stop

close: #I4CYPZ

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I09da24e9a57abde288ccd3f558ba9e65ca1092e3
2021-10-12 10:35:14 +08:00
zff
232fec27ac fix: 内核ERR打印,线程信息,不方便问题定位。
close: #I4DAKM

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I10a61d87fa516dcccd5ce0ebca18680a20e2f452
2021-10-11 17:27:13 +08:00
openharmony_ci
badf1e9557 !341 fix: csky等新增模块的HalTickStart函数定义和实现不一致
Merge pull request !341 from kenneth/HalTickStart
2021-10-11 09:19:08 +00:00
openharmony_ci
68a3f9e6dd !342 fix: 移除los_arch_interrupt.h文件中冗余声明的函数VOID OsExcInit(VOID)
Merge pull request !342 from kenneth/OsExcInit
2021-10-11 09:18:26 +00:00
openharmony_ci
6c1587bf03 !343 fix: gcc编译testsuite编译问题修复
Merge pull request !343 from kenneth/testsuite
2021-10-11 09:17:47 +00:00
kenneth
f7d26b8e12 fix: gcc编译testsuite编译问题修复
修复It_los_mem.h中没有定义LOS_DLNK_NODE_HEAD_SIZE、MIN_DLNK_POOL_SIZE,编译告警等问题。

close #I4DAOU

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-10-11 14:30:51 +08:00
kenneth
136952f193 fix: 移除los_arch_interrupt.h文件中冗余声明的函数VOID OsExcInit(VOID)
VOID OsExcInit(VOID)函数的注释中参数描述错误,并且该函数并没有在C源文件中使用到,需要删除。

close #I4D9OO

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-10-11 10:36:26 +08:00
openharmony_ci
fe06d0cbb9 !335 适配xtensa和csky qemu版本
Merge pull request !335 from LiteOS/master
2021-10-11 02:01:24 +00:00
kenneth
07ab6a5b77 fix: csky等新增模块的HalTickStart函数定义和实现不一致
修复HalTickStart函数定义和实现中的参数类型保持一致

close #I4D1HY

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-10-09 17:37:08 +08:00
openharmony_ci
adaefc6133 !337 fix: 删除C文件中无用的__cplusplus
Merge pull request !337 from kenneth/cplusplus
2021-10-09 09:06:00 +00:00
openharmony_ci
9dbcb43b51 !338 fix: c-sky等芯片架构的BUILD.gn优化
Merge pull request !338 from kenneth/BUILD.gn
2021-10-09 09:05:04 +00:00
openharmony_ci
9bcc9f5706 !340 fix: 解决los_pm.c:743:19: warning 编译告警
Merge pull request !340 from kenneth/pm
2021-10-09 09:04:36 +00:00
kenneth
0c72c8bf94 fix: 解决los_pm.c:743:19: warning 编译告警
修复PRINT_ERR函数格式化参数数目不一致。

close #I4D4L8

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-10-09 15:56:27 +08:00
kenneth
7fe3aaddf5 fix: 删除C文件中无用的__cplusplus
新增的c-sky等模块一些c文件中的依旧保留了无用的__cplusplus需要删除;修复注释中的部分不规范内容修改,缩进,空行,错别字等。

close #I4D0YK

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-10-09 09:21:45 +08:00
kenneth
3311d73406 fix: c-sky等芯片架构的BUILD.gn优化
新增加的c-sky等模块的BUILD.gn实现和其他芯片架构不一致,已优化为一致

close #I4D129

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-10-09 09:07:40 +08:00
LiteOS2021
a7765e2a83 适配xtensa和csky qemu版本,并修复一些已知问题
Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2021-10-09 08:58:13 +08:00
openharmony_ci
892d6981e7 !336 fix: 删除OsMemboxExcInfoGetSub内存调测方法中多余的赋值语句
Merge pull request !336 from kenneth/membox
2021-10-08 02:39:05 +00:00
openharmony_ci
3eb4679f13 !324 【fix】hook层LOS_HOOK_TYPE_SEM_PEND的runningTask入参可能为空
Merge pull request !324 from Zhaotianyu/0926hook_fix
2021-10-08 01:06:22 +00:00
kenneth
94db0fe7a3 fix: 删除OsMemboxExcInfoGetSub内存调测方法中多余的赋值语句。
OsMemboxExcInfoGetSub内存调测方法中存在对memExcInfo->size多次赋值,size含义不清晰,删除多余的赋值语句。

close #I4CFNX

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-09-29 14:51:14 +08:00
openharmony_ci
6134dcd428 !332 fix: LOS_QueueInfoGet函数统计等待读写任务有误
Merge pull request !332 from kenneth/queue
2021-09-29 02:51:19 +00:00
openharmony_ci
91bd0c2e2b !331 fix: OS_TASK_STACK_PROTECT_SIZE undeclared error
Merge pull request !331 from kenneth/mpu
2021-09-29 02:50:25 +00:00
openharmony_ci
3b20e902c4 !323 fix: 修复risc-v异常时,异常信息混乱且backtrace无法输出的问题
Merge pull request !323 from zhushengle/backtrace
2021-09-29 00:15:31 +00:00
zhushengle
0fb49d4422 fix: 修复risc-v异常时,异常信息混乱且backtrace无法输出的问题
1.修复risc-v backtrace无法输出的问题
异常时未将fp传入,且backtrace校验不足,容易导致再次异常
2.优化task 输出信息格式
3.shell中task命令代码重复
4.OSBackTraceInit 拼写有误

Close #I4BPHX:riscv32_virt 异常时无法输出backtrace信息

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I141d5e7808fc967d846f425422f5dcf2ac01d1d1
2021-09-28 11:39:42 +08:00
kenneth
56e234b300 fix: fix OS_TASK_STACK_PROTECT_SIZE undeclared error
当开启LOSCFG_EXC_HARDWARE_STACK_PROTECTION宏时,增加定义OS_TASK_STACK_PROTECT_SIZE宏

close #I4C5RW

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-09-28 10:27:52 +08:00
openharmony_ci
8dfcf71288 !330 feat: 添加L0测试门禁
Merge pull request !330 from zhushengle/test
2021-09-28 02:18:08 +00:00
kenneth
a0b6f98e20 fix: LOS_QueueInfoGet函数统计等待读写任务有误
LOS_QueueInfoGet使用32位无符号数组来记录阻塞队列的任务,每个数组元素的每个bit位对应一个任务编号。
比如第一个数组元素的32个bit位对应任务编号0-31,第二个数组元素的32个bit位对应任务编号32-63....计算任务对应的数组的bit位数时使用
掩码OS_WAIT_TASK_ARRAY_ELEMENT_MASK的值应该为31,不应该依赖任务最大数目。

close #I4C6P2

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-09-28 09:40:23 +08:00
zhushengle
5c168fc3e0 fix: 添加L0 测试门禁
Close #I4C5R4
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I2900175e2507027d61e8fb47277a940250bea8b5
2021-09-27 20:09:36 +08:00
arvinzzz
3fd22ac2b0 fix: 修复hook层LOS_HOOK_TYPE_SEM_PEND的runningTask入参可能为空
在校验完semPend之后,就获取好runningTask并且与semPend关联

close: #I4BU4P
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ib56a1a1db8e4471d9e2adb0b7c3d8b17b1f87b8d
2021-09-27 09:48:02 +08:00
openharmony_ci
3c6f422162 !318 去除backtrace冗余代码
Merge pull request !318 from LiteOS/master
2021-09-26 12:03:00 +00:00
openharmony_ci
1d414d18eb !325 fix: 添加文件版权头等信息
Merge pull request !325 from Harylee/shm
2021-09-26 09:34:20 +00:00
openharmony_ci
56fa29a319 !327 解决dailycheck告警
Merge pull request !327 from Caoruihong/update_url
2021-09-26 09:30:52 +00:00
Caoruihong
4aba2c06b5 chore: fix dailycheck issues
master --> HEAD
remove useless @since

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Id3452cccdcc823c374f873cf4905015351580d15
2021-09-26 17:13:13 +08:00
Haryslee
cf4e017970 fix: 添加文件版权头等信息
close #I4BXBH

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: Id798eec0473a9b8e18b1c8be31f3dd6babb879b0
2021-09-26 16:30:17 +08:00
LiteOS2021
db1f9c797c 去除backtrace冗余代码
Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2021-09-26 15:41:26 +08:00
openharmony_ci
87ecfac438 !321 feat: backtrace for arm9
Merge pull request !321 from Harylee/shm
2021-09-24 09:11:12 +00:00
Haryslee
03de7f3745 feat: backtrace for arm9
arm9架构支持栈回溯功能

close #I4BMLG

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: Iba30a6853391c4cad3ed59ddfc05ef2530a4de89
2021-09-24 16:56:58 +08:00
openharmony_ci
af8a6d5047 !259 完善CMSIS-RTOS V2部分接口(osSemaphoreNew,osThreadJoin)
Merge pull request !259 from Caoruihong/cmsis
2021-09-24 02:24:11 +00:00
openharmony_ci
8be34cb78e !293 三方库FatFs升级至r0.14a版本
Merge pull request !293 from Far/fatfs_update
2021-09-24 00:53:41 +00:00
openharmony_ci
4061deaae8 !311 feat: 支持posix 和 cmsis join能力
Merge pull request !311 from zhushengle/join
2021-09-24 00:30:44 +00:00
zhushengle
ecfdf7ff9b feat: 支持posix 和 cmsis join能力
支持API:
  LOS_TaskJoin
  LOS_TaskDeatch
  pthread_join
  pthread_deatch
  osThreadJoin
  osThreadDetach
Close #I44V26

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ib61e69c280eef2e4b3b79d9bba7bbd5a300c7fe4
2021-09-23 18:54:14 +08:00
Caoruihong
d478152762 feat(cmsis): support max_count for osSemaphoreNew
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Iacb6cb7771ae32ea1ca645c72fda241e8e85d422
2021-09-23 16:32:21 +08:00
openharmony_ci
565649c1c1 !316 fix: 测试用例任务栈的宏定义重复定义,导致在osTest.h中修改不生效
Merge pull request !316 from zhushengle/test
2021-09-23 01:30:55 +00:00
Far
92ea355756 feat: 适配三方库FatFs升级至r0.14a版本
适配了f_mkfs接口的修改

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-09-22 15:02:40 +08:00
zhushengle
ce6cf6879f fix: 测试用例任务栈的宏定义重复定义,导致在osTest.h中修改不生效
Close #I4BA5F

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I0960eb70664bf188b9f8b2a76689a85c3c2dd4ce
2021-09-22 11:40:43 +08:00
openharmony_ci
25441ec1b5 !314 fix: risc-v 低功耗下存在功能问题
Merge pull request !314 from zhushengle/list
2021-09-18 06:14:40 +00:00
zhushengle
9f185b5b52 fix: pm模块解冻线程时存在删除空链表且时间片频繁唤醒系统
1.如果冻结线程状态为delay,则此时pendlist为NULL,解冻时不需要delete
2.低功耗时关闭时间片,减少时间片频繁唤醒系统
3.risc-v 中64位相加存在溢出
Close #I4AKUS

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Icb9e8f7df8488635f9660d3932b06fa6f57e6133
2021-09-18 11:42:08 +08:00
openharmony_ci
03bbc750ce !305 fix: 修复OsQueueMailFree提早释放内存的问题
Merge pull request !305 from hpline/master
2021-09-17 09:33:45 +00:00
openharmony_ci
89fea841c0 !310 shell模块task命令踩内存问题修改
Merge pull request !310 from wangchen/m_task
2021-09-17 03:55:35 +00:00
openharmony_ci
f1ac6bf160 !312 fix:修复测试用例导致系统异常及中断用例失败问题
Merge pull request !312 from zhushengle/test
2021-09-17 00:58:44 +00:00
zhushengle
9ca65adf32 fix:修复测试用例导致系统异常及中断用例失败问题
1.系统异常
  任务栈过小,导致踩内存
2.中断测试用例失败
  shell占用了测试用例的中断号,导致创建中断失败
Close #I4AENS

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I35512a5634aed328561c760ba6fcce4ec944aa2e
2021-09-16 20:53:33 +08:00
wangchen
6ffd55dcd0 fix: shell模块task命令踩内存问题修改
【背景】task命令获取内存时传入的参数过大,可能引起踩内存问题。

【修改方案】
1,对task命令中获取内存信息时的入参进行调整,避免引起内存问题

【影响】
对现有的产品编译不会有影响。

re #I4A70V
Signed-off-by: wangchen <253227059@qq.com>
2021-09-16 15:56:38 +08:00
lurix
902efbcea9 chore: update the comment.
Signed-off-by: lurix <lurix@foxmail.com>
2021-09-15 12:57:40 +00:00
openharmony_ci
4700ba6973 !308 fix: 修复pthread_create行为与posix不一致问题
Merge pull request !308 from zhushengle/pthread
2021-09-15 08:07:55 +00:00
zhushengle
2b1e5a7a13 fix: 修复pthread_create行为与posix不一致问题
1.提升posix接口和LOS接口的兼容性
2.支持优先级继承属性

Close #I49W9F
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I4d9df778a559f094dd3062e5e7030e3a03c884ec
2021-09-15 14:21:01 +08:00
openharmony_ci
2c525c0fd9 !298 feat: 低功耗支持冻结线程等需求
Merge pull request !298 from zhushengle/suspend
2021-09-14 12:29:10 +00:00
zhushengle
9b5739ab11 feat: 低功耗支持冻结线程等需求
1.支持低功耗时冻结线程
2.支持延时锁
3.低功耗与idle分离
4.支持对接电源管组件的低功耗接口
LOS_PmReadLock --- 常阻塞,低功耗线程阻塞于该接口,当系统无任何模块持锁时会唤醒低功耗线程, 触发低功耗流程
LOS_PmSuspend --- 进入低功耗流程
Close #I49FJF

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I009255cfa1852b109dd8bfaf9c779e976660d621
2021-09-14 19:55:26 +08:00
lurix
9c3a6901f1 chore: 解决代码风格导致的编译报错
Signed-off-by: lurix <lurix@foxmail.com>
2021-09-14 02:04:02 +00:00
lurix
ec88d16289 fix: 修复OsQueueMailFree提早释放内存的问题
Signed-off-by: lurix <lurix@foxmail.com>
2021-09-13 10:04:25 +00:00
openharmony_ci
c77c178ec1 !301 fix: 修复pm编译告警导致内核编译失败
Merge pull request !301 from zhushengle/error
2021-09-11 07:51:37 +00:00
zhushengle
18b052458e fix: 修复pm编译告警导致内核编译失败
Close #I49MIN
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I6b448790b170bf5980d16698ecfff27bda6c3600
2021-09-11 15:27:21 +08:00
openharmony_ci
eebd5f16d3 !300 修复不能开启硬浮点选项的问题
Merge pull request !300 from Zhaotianyu/0910fix_fpu_hard
2021-09-10 23:07:44 +00:00
arvinzzz
988fd85fae fix: 支持硬浮点编译
1. 通过本工程的gn编译时,需要在device目录下,单板的关于内核的config.gn中指定-mfloat-abi的等级,并在单板相关代码的编译选项中保持-mfloat-abi一致
2. 通过本工程的Makefile编译时,需要在kernel/liteos_m/targets/下添加单板相关的代码配置,在Makefile中设置-mfloat-abi即可
3. 通过IDE编译本工程时,需要在IDE的汇编文件相关编译选项中加入 -imacros $(LITEOSTOPDIR)/kernel/include/los_config.h,保证浮点等级在汇编文件中生效

close: #I48KJP
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ibf9b750b922be2530de349981d55e40b5919933f
2021-09-10 17:30:46 +08:00
openharmony_ci
3c0d17fc63 !281 fix: 优化低功耗流程
Merge pull request !281 from zhushengle/pm_optimize
2021-09-09 06:55:55 +00:00
zhushengle
c6600d9ddd fix: 优化低功耗流程
1.normal和其它模式分离,流程分层化,使得结构较为清晰
2.tick timer处理实现优化为注册对应机制则默认支持,不注册则不执行,简化使用逻辑
3.添加 pm测试用例
Close #I46VXK

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I7810ce0ca12dce96972399adf88e8319bb487905
2021-09-09 11:46:23 +08:00
openharmony_ci
0715126021 !289 add xtensa and csky arch support
Merge pull request !289 from LiteOS/master
2021-09-08 06:55:10 +00:00
openharmony_ci
fd8ca3f5dc !289 add xtensa and csky arch support
Merge pull request !289 from LiteOS/master
2021-09-08 06:55:10 +00:00
lanche1024
8bcab9ab7a add csky arch support
Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2021-09-07 17:11:10 +08:00
openharmony_ci
1d9a5820f2 !291 修复HalTickStart错误的函数参数定义
Merge pull request !291 from 野生毛霉君/master
2021-09-07 06:11:28 +00:00
mucor
4443b74ea6 fix: fix bad params def in HalTickStart
close: #I48YWT

Signed-off-by: mucor <mucorwang@gmail.com>
2021-09-07 11:40:17 +08:00
openharmony_ci
6e1bdfe1de !275 fix: 内核模块编译增加-Werror编译选项,且清除内核编译告警
Merge pull request !275 from zhushengle/Werror
2021-09-06 11:16:42 +00:00
zhushengle
3798091d87 fix: 内核模块编译增加-Werror编译选项,且清除内核编译告警
Close #I46E6S

Change-Id: If1362c02a0a344da881a9bf90e41f0a43ba33609
Signed-off-by: zhushengle <zhushengle@huawei.com>
2021-09-06 16:16:43 +08:00
openharmony_ci
459cabf7de !286 按任务统计已经alloc的内存大小
Merge pull request !286 from lnlan/taskinfo
2021-09-01 01:48:21 +00:00
lnlan
475db62db1 feat: los_memory.c代码重复率处理
【背景】
los_memory.c中有4处遍历内存节点的操作,重复率较高
【修改方案】
1.提取一个遍历内存节点的函数,入参可传入处理函数来应对不同处理场景
【影响】
对现有的产品编译不会有影响。

re #I44WNU

Signed-off-by: lanleinan <lanleinan@163.com>

Change-Id: Iafd25be39e76ee29e4fb27e5ef65f1888cc23f02
2021-08-31 02:30:30 +00:00
openharmony_ci
d46c69ee78 !266 新增内存分析工具
Merge pull request !266 from Denny/memtools
2021-08-30 07:14:07 +00:00
openharmony_ci
047203b7fb !287 修复software timer线程 readsize在第一次循环后可能未被正确赋值的问题
Merge pull request !287 from xfan1024/master
2021-08-28 09:06:20 +00:00
xiaofan
61cbf83f5d fix:修复software timer线程
readsize在第一次循环后可能未被正确赋值的问题

Signed-off-by: xiaofan <xiaofan@iscas.ac.cn>
2021-08-28 16:23:37 +08:00
lnlan
53117f9f47 feat: 按任务统计已经alloc的内存大小
【背景】
m核需补充shell命令,按任务统计已经alloc的内存大小
【修改方案】
1.新增在task命令中,在打印task
info前遍历所有内存节点,统计各任务所占用的内存节
点大小,在打印时将其打出。
2.内存节点中,taskid所占位数随系统最大任务数调整
【影响】
对现有的产品编译不会有影响。

re #I44WNU

Signed-off-by: lanleinan <lanleinan@163.com>
Change-Id: I080b5dd056966784c0752408f9e320ca0e97c7f7
2021-08-28 06:14:34 +00:00
openharmony_ci
75f975c424 !279 feat: 完善m核qemu串口驱动,支持shell输入
Merge pull request !279 from lnlan/shell_fix
2021-08-26 02:03:22 +00:00
lnlan
c4dc5ab0f8 feat: 完善m核qemu串口驱动,支持shell输入
【背景】
m核qemu需完善串口驱动,支持shell输入
【修改方案】
1.完善串口驱动
2.添加shell任务,获取串口输入并下发处理
【影响】
对现有的产品编译不会有影响。

re #I46N7F

Signed-off-by: lanleinan <lanleinan@163.com>
Change-Id: Ib58d4e633081743e64412cb65aa209d3356d6c1c
2021-08-26 01:15:17 +00:00
openharmony_ci
c8015dcb49 !282 m核lwip增加dhcp_is_bound接口
Merge pull request !282 from 刘建东/master
2021-08-24 10:30:36 +00:00
openharmony_ci
7719bb28e5 !283 M核编译配置修改
Merge pull request !283 from wangchen/gn_codex
2021-08-24 07:05:59 +00:00
YOUR_NAME
84a180d585 feat: add interface of dhcp_is_bound
add interface of dhcp_is_bound

close: #I46W08

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-08-24 11:34:03 +08:00
wangchen
deff7c921f fix: M核编译配置修改
【背景】完善M核编译配置选项。

【修改方案】
1,在build.gn中添加config.gni的包含
2,修改部分build.gn中的格式规范问题

【影响】
对现有的产品编译不会有影响。

re #I46XEA
Signed-off-by: wangchen <253227059@qq.com>
2021-08-24 10:57:48 +08:00
openharmony_ci
e4e3caccf2 !272 m核lwip和hilog解耦,简化配置
Merge pull request !272 from 刘建东/master
2021-08-23 02:48:58 +00:00
openharmony_ci
19aa1bb5bc !278 M核告警消除
Merge pull request !278 from wangchen/m_codex
2021-08-21 09:34:31 +00:00
openharmony_ci
9996ef80d6 !269 M33平台GCC环境下TZ增加默认选项适配
Merge pull request !269 from wangchen/new_tz
2021-08-21 09:31:36 +00:00
wangchen
f63c45930c 【背景】M33平台GCC环境下TZ默认开启TZ。
【修改方案】
1,在M33平台下增加默认选项及开关
2,删除build.gn编译tz的部分,该部分由使用者编译在安全态
3,修改tz初始化的一个问题

【影响】
对现有的产品编译不会有影响。

re #I45UYU
Signed-off-by: wangchen <253227059@qq.com>
2021-08-20 20:01:01 +08:00
wangchen
5a9d53b644 fix: M核告警消除
【背景】定期M核代码消除。

【修改方案】
1,根据工具扫描结果,对代码告警进行更改

【影响】
对现有的产品编译不会有影响。

re #I46LHG
Signed-off-by: wangchen <253227059@qq.com>
2021-08-20 18:44:33 +08:00
YOUR_NAME
be03374c3c refactor: decouple lwip and hilog for liteos_m
decouple lwip and hilog for liteos_m

close: #I46DAH

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-08-20 16:17:32 +08:00
openharmony_ci
4e11ded476 !267 fix: 删除延时节点后,存在时间无法有效刷新的场景
Merge pull request !267 from zhushengle/sched
2021-08-19 00:39:21 +00:00
openharmony_ci
8023547244 !270 解决中断操作等接口头文件位置变更,引入的编译问题
Merge pull request !270 from JerryH/hwi
2021-08-18 07:31:59 +00:00
JerryH
013a953926 fix: 修复中断操作接口头文件位置变更,导致的编译错误
close #I4665Z

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: I5596179dea198dfe571420a7640abb00587abee1
2021-08-18 14:47:59 +08:00
openharmony_ci
97c4a5813f !249 堆内存算法支持多段非连续性内存区域
Merge pull request !249 from kenneth/multiple_mem
2021-08-17 07:43:18 +00:00
openharmony_ci
ada151d89b !268 删除m核lwip未使用的头文件和宏
Merge pull request !268 from 刘建东/master
2021-08-17 07:26:21 +00:00
kenneth
0facb0c017 feat: support non-continuous memory regions
The multiple non-continuous memory regions are supported when the macro
LOSCFG_MEM_MUL_REGIONS is enabled. The array of the type LOS_MEM_REGION should be defined,
and each array element defines the start address and the length for each memory regions, \
begining from the lower address to the higher memory address.

close #I43XOP

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-08-17 09:07:04 +08:00
YOUR_NAME
7ad3a22b4d fix: delete unused symbols for default config
delete unused symbols for default config

close: #I45HN3

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-08-16 17:54:52 +08:00
zhushengle
0a87c04d58 fix: 删除延时节点后,存在时间无法有效刷新的场景
1.从延时队列上删除延时节点时,如果该延时节点的响应时间比当前系统tick的响应时间小时,
将tick的响应时间修改为OS_SCHED_MAX_RESPONSE_TIME,以保证tick响应时间能够被刷新。
2.任务切换时,若g_schedResponseID为旧任务的taskID时(tick的响应时间为旧任务的时间片
结束时间),将tick的响应时间修改为OS_SCHED_MAX_RESPONSE_TIME。
Close #I45I9Y

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ia77b789a10112935b719e8f733ba33835894e060
2021-08-14 15:53:28 +08:00
denny
ee3403deaf feat: 新增ROM/RAM分析工具
Signed-off-by: denny <denny.shenwei@huawei.com>
2021-08-14 15:19:47 +08:00
openharmony_ci
02beb6b04d !265 fix: 以g_sysSchedStartTime是否为0判断时间轴是否生效存在极限场景导致调度时间不生效
Merge pull request !265 from zhushengle/sched_time
2021-08-14 06:23:30 +00:00
zhushengle
509cf59bef fix: 以g_sysSchedStartTime是否为0判断时间轴是否生效存在极限场景导致调度时间不生效
初始化调度时间不以g_sysSchedStartTime是否为0为界限,而以g_sysSchedStartTime是否为64位最大值,
为界限, 避免特殊以下场景:调度开启时系统时间为0,导致初始化的g_sysSchedStartTime还是0,导致
调度启动后获取的调度时间轴始终为0.

Close #I45HP5

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ie0ef4e7d149f09ac466c649c0f2d6538f5322439
2021-08-14 11:30:46 +08:00
openharmony_ci
2868891bc8 !264 feat: L0 arm qemu剥离工具链头文件
Merge pull request !264 from give-me-five/master
2021-08-12 09:07:09 +00:00
silen
67d74559d1 feat: L0 armquem 剥离工具链
Change-Id: I19c13fd24141271087948fad9434558b823df62b
Signed-off-by: silen <wuyunjie@huawei.com>
2021-08-12 16:23:31 +08:00
openharmony_ci
251a597bb4 !263 fix: 修复文档链接失效问题
Merge pull request !263 from Harylee/qemu
2021-08-12 07:51:49 +00:00
Haryslee
5d53c84812 fix: 修复文档链接失效问题
close #I4529I

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: Ia3c885789f11bcbfeafaabf1c835bee93bcc54c0
2021-08-12 14:59:13 +08:00
openharmony_ci
af5bc32e38 !261 宏LOSCFG_SUPPORT_FATFS在fs.c中存在使用问题,导致无fatfs的情况下,编译出错
Merge pull request !261 from zhangfanfan2/master
2021-08-12 02:01:00 +00:00
zhangfanfan2
c1614ce2b4 fix: 宏LOSCFG_SUPPORT_FATFS在fs.c中存在使用问题,导致无fatfs的情况下,编译出错
代码中使用#ifdef LOSCFG_SUPPORT_FATFS控制业务逻辑,但LOSCFG_SUPPORT_FATFS的
默认定义为:#define LOSCFG_SUPPORT_FATFS 0,这样#ifdef LOSCFG_SUPPORT_FATFS控制
的逻辑一定会被编译。修改方式:使用的地方统一为#if的形式

close: #I44XNR

Signed-off-by: zff <zhangfanfan2@huawei.com>
2021-08-11 09:32:09 +00:00
openharmony_ci
93f029b430 !250 某些编译器下编译告警消除
Merge pull request !250 from 野生毛霉君/master
2021-08-11 09:23:07 +00:00
openharmony_ci
fa0b8b0dcb !227 feat: 支持native动态加载组件
Merge pull request !227 from Harylee/mem
2021-08-11 03:14:24 +00:00
Haryslee
d75383400e feat: 支持native动态加载组件
1.【需求描述】
动态库开发部分:
gcc的sample code。
提供生成暴露接口生成机制,并允许产品新增需要暴露的接口。
提供可以判断库允许资源大小的能力,并提供相关工具辅助开发者确定开发的库要求的资源是否可以满足。

动态库运行部分:
提供elf load的api,可以加载指定路径下的库,并完成符号重映射等运行准备。
提供elf 暴露符号调用的api,用于调用库的api。
elf加载&链接异常时,有明确错误记录,返回明确错误类型。
提供elf 卸载的api。

2.【方案描述】
(1) 通过灌段的形式记录需要导出符号的地址信息,用于暴露内核对外的接口,在加载链接器中通过查询
对应的符号信息获取符号地址。
(2) 加载链接时,解析共享库并将共享库中可加载段通过文件系统读入内存中,并对共享库中未定义的、
需要重定位的符号进行重定位。需要调用符号时,根据符号名通过哈希表即可查询共享库提供的对应符号
的地址。

BREAKING CHANGE:
新增4个对外接口,声明在los_dynlink.h文件中,分别为:
(1) LOS_DynlinkInit: 动态加载模块初始化。
(2) LOS_SoLoad: 加载指定路径的共享库。
(3) LOS_FindSym: 根据共享库句柄查找指定符号。
(4) LOS_SoUnload: 卸载共享库。

close #I418HJ

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I7669b7ef20096294f9d1094c85ac6602fefad354
2021-08-10 20:26:40 +08:00
openharmony_ci
669f619040 !258 添加MPU功能的开关宏
Merge pull request !258 from JerryH/mpu
2021-08-10 12:01:26 +00:00
JerryH
9709d29b87 fix: 增加MPU功能的开关宏,默认关闭
close #I3WE0S

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: Id193fd555877ac0c6b5b43e5dd5ede32531b86c4
2021-08-10 19:27:14 +08:00
openharmony_ci
11bca47b6e !247 fix: tick 动态化计算优化,减小中断执行时间对系统总体时间的影响,保证软件定时器的响应精度。
Merge pull request !247 from zhushengle/tick_sched
2021-08-10 06:16:34 +00:00
zhushengle
2118c84616 fix: tick 动态化计算优化,减小中断执行时间对系统总体时间的影响,保证软件定时器的响应精度。
方案描述:
    1.周期软件定时器超时添加一个startTime字段,用于记录当前软件定时器的开始计时的时间,
    在定时器响应时,开始时间修改为上一次响应的结束时间(消除了中断执行时间对软件定时器
    的影响)。
    2. 在执行tick中断的过程当中,持有tick动态计算锁,保证在该过程中不会触发tick周期
    的计算,在tick中断结束时统一计算设置。 --- 提升tick中断的执行效率
    3. 在设置tick周期时,减掉tick中断执行的时间,减小周期动态化带来的时间误差
    4.新增LOSCFG_BASE_CORE_TICK_PER_SECOND_MINI配置宏,用于配置tick中断的最小响应精度
Close #I3YGP1

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ia53e4accce497bce870557c2c3387ce51fa3fed3
2021-08-09 21:16:22 +08:00
openharmony_ci
7fe9cc9aa0 !253 fix: L0 net 编译修复
Merge pull request !253 from give-me-five/master
2021-08-09 03:46:44 +00:00
silen
299813cdb4 fix: net compile fix
Change-Id: Ieb264f28e831f867d833a66fa25fec57e740a162
Signed-off-by: silen <wuyunjie@huawei.com>
2021-08-09 10:01:23 +08:00
openharmony_ci
870cf67c51 !252 新增OAT配置文件,用作oat扫描
Merge pull request !252 from SimonLi/master
2021-08-05 16:42:50 +00:00
SimonLi
f64457162c chore(oat): 新增OAT配置文件,用作oat扫描
Signed-off-by: SimonLi <likailong@huawei.com>
2021-08-06 00:29:03 +08:00
openharmony_ci
c8064436dd !251 修复licese
Merge pull request !251 from lnlan/fix_stl
2021-08-05 15:16:52 +00:00
lnlan
218d16f85f style:修改 liteos_a unittest 测试文件的 licence 注释
【背景】解除告警
【修改方案】
 格式化修改告警文件的文件头注释格式

re #I44497

Signed-off-by: lanleinan <lanleinan@163.com>
Change-Id: Id2d61deb9d9a14d5e29b915c3a64c75e11e12eda
2021-08-05 14:32:21 +00:00
mucor
8dea15c4fc fix: compile warning fix
close: #I4330B
Signed-off-by: mucor <mucorwang@gmail.com>
2021-08-05 21:02:42 +08:00
openharmony_ci
56dfd80ea5 !242 cmsis添加ThreadFlags接口支持
Merge pull request !242 from 野生毛霉君/master
2021-08-05 12:31:09 +00:00
mucor
cea551e99e feat: add cmsis ThreadFlags support
close: I43AYB

Signed-off-by: mucor <mucorwang@gmail.com>
2021-08-05 17:01:20 +08:00
openharmony_ci
b195b40bf2 !245 解决arm9编译冲突的问题
Merge pull request !245 from JerryH/arm9
2021-08-03 11:57:47 +00:00
openharmony_ci
1a56599021 !244 backatrace代码段判断函数解耦
Merge pull request !244 from JerryH/backtrace-bugfix
2021-08-03 11:37:55 +00:00
JerryH
c1a6245368 fix: 解决arm9编译冲突问题
close #I420PQ

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: I788de96b176ae73541f1dc0577262b57179151a7
2021-08-03 10:27:20 +08:00
JerryH
8692ed33a3 fix: backtrace代码段判断函数定义成弱函数,如果有多个代码段,那么可根据实际情况重定义
close #I420SD

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: Id2e89e11df8aeb906cdd36b2c40c51c2e140a569
2021-08-02 15:43:01 +08:00
openharmony_ci
ff7da435cf !243 fix: qemu中,timer模块缺少头文件
Merge pull request !243 from give-me-five/master
2021-08-02 03:43:09 +00:00
silen
12fed74722 fix: timer qemu 头文件缺失
Change-Id: I763ee6f0d013d84f36da9a7cb6d369f3d02e6c45
Signed-off-by: silen <wuyunjie@huawei.com>
2021-08-02 10:37:47 +08:00
openharmony_ci
4fd6a663ac !235 fix: 修复QUEUE_INFO_S中waitReadTask无法保存大于32的任务编号
Merge pull request !235 from kenneth/master
2021-08-02 02:07:12 +00:00
openharmony_ci
23d56f4b2a !241 M核代码告警清零
Merge pull request !241 from wangchen/m_codex
2021-07-31 03:40:50 +00:00
openharmony_ci
8f5cefe41a !225 fix: 在内核初始化前期启动tick timer
Merge pull request !225 from zhushengle/tick
2021-07-31 02:59:35 +00:00
openharmony_ci
1d33f5e4b0 !234 feat: L0 支持Trace
Merge pull request !234 from LiteOS/master
2021-07-31 02:58:59 +00:00
wangchen
cb5f862eaf fix: M核代码告警清零
【背景】定期M核代码告警清零。

【修改方案】
根据工具扫描结果,对代码告警进行更改。

【影响】
对现有的产品编译不会有影响。

re #I4386N
Signed-off-by: wangchen <253227059@qq.com>
2021-07-30 18:34:08 +08:00
openharmony_ci
3027311003 !239 fix: L0 支持smoke测试用例
Merge pull request !239 from zhushengle/smoke_test
2021-07-30 06:06:21 +00:00
openharmony_ci
3b37750f37 !240 Mutex锁释放后,无任务持有的情况下,owner未清空
Merge pull request !240 from zhangfanfan2/master
2021-07-30 03:21:26 +00:00
YOUR_NAME
c136cfdf97 fix: Mutex锁释放后,无任务持有的情况下,owner未清空
close: #I40OC8

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: Ia06c4dc7f6d0a24a9ea05b37599ffac4f359a29f
2021-07-30 09:44:41 +08:00
LiteOS2021
56c93a641b feat: L0 支持Trace
1.【需求描述】
 L0 支持Trace,提供两种工作模式:在线模式、离线缓存模式, 用于按时间线追踪系统事件,如任务切换、中断、ipc等。
2.【方案描述】
 (1).在内核模块预置静态代码桩
  (2).触发桩后,收集系统上下文信息
  (3).离线模式则写入内存,用户可通过dump导出;
  (4).在线模式通过pipeline对接IDE进行可视化解析和展示;

BREAKING CHANGE:
1.新增一系列trace的对外API,位于los_trace.h中.
LOS_TRACE_EASY简易插桩
LOS_TRACE标准插桩
LOS_TraceInit配置Trace缓冲区的地址和大小
LOS_TraceStart开启事件记录
LOS_TraceStop停止事件记录
LOS_TraceRecordDump输出Trace缓冲区数据
LOS_TraceRecordGet获取Trace缓冲区的首地址
LOS_TraceReset清除Trace缓冲区中的事件
LOS_TraceEventMaskSet设置事件掩码,仅记录某些模块的事件
LOS_TraceHwiFilterHookReg注册过滤特定中断号事件的钩子函数

Close #I41Y9Y

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
2021-07-30 09:29:37 +08:00
openharmony_ci
285d90979b !238 M33 平台 trust zone 适配修改
Merge pull request !238 from wangchen/tz_fix
2021-07-29 12:40:50 +00:00
zhushengle
3ad5942301 fix: 支持smoke 测试用例
默认只运行smoke测试用例,如需要运行全量测试用例,
请在target_config.h中添加配置项: LOS_KERNEL_TEST_FULL
或在config.json中配置enable_ohos_kernel_liteos_m_test_full
Close #I424RX

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I1f72a7666bf30631090e3e00faf6c432105dec17
2021-07-29 20:31:22 +08:00
openharmony_ci
7bd5a806e9 !232 feat: open shell
Merge pull request !232 from give-me-five/master
2021-07-29 07:06:08 +00:00
silen
911a767992 fix: open shell & fix qemu compile
Change-Id: Ia7488c02db7a41e0f681d008882b7c2721e6b207
Signed-off-by: silen <wuyunjie@huawei.com>
2021-07-29 11:19:03 +08:00
wangchen
15a2c17f79 fix: trustzone 中断适配
【背景】当前无法使用 trustzone。

【修改方案】
由于tz需要使用svc中断,因此删除之前使用的HalExcSvcCall的地方,改为HalSVCHandler

【影响】
对现有的产品编译不会有影响。

re #I42TFV
Signed-off-by: wangchen <253227059@qq.com>
2021-07-28 17:40:03 +08:00
kenneth
704cca97b1 fix: 修复QUEUE_INFO_S中waitReadTask无法保存大于32的任务编号
根据任务最大数创建waitReadTask数组来保存任务编号信息

close #I41N78

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-07-28 11:19:39 +08:00
openharmony_ci
6b732ca351 !237 fix: risc-v 锁中断在调度后失效
Merge pull request !237 from zhushengle/risc-v
2021-07-28 02:40:28 +00:00
openharmony_ci
71c76e8b08 !236 补充两个获取最高\最低优先级的接口
Merge pull request !236 from lnlan/add_prio
2021-07-28 02:11:05 +00:00
zhushengle
70f3aa1c11 fix: risc-v 锁中断在调度后失效
risc-v架构中,由于执行完mret指令之后,未将mstatus.mpie位清除,
导致锁中断后调度保存上下文信息后, 恢复上下文时误将中断打开。

Close #I42OLJ
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ib97b8bd0fc56bd4b2a7e5c474cb240db4e9c2419
2021-07-28 08:57:45 +08:00
lnlan
c24c38b084 feat(kernel): 补充获取最高、最低优先级接口
【背景】
补充获取最高、最低优先级接口
【修改方案】
pthread补充这两个接口
int sched_get_priority_min(int policy)
int sched_get_priority_max(int policy)
【影响】
对现有的产品编译不会有影响。

re #I42HM7

Signed-off-by: lnlanc <lanleinan@163.com>
Change-Id: Id2ffc07e606ad497e8036f45dab1fa6a5ba981b3
2021-07-27 11:21:05 +00:00
openharmony_ci
403d6dc428 !231 riscv_nuclei 编译失败
Merge pull request !231 from zhushengle/riscv_nuclei
2021-07-21 09:27:34 +00:00
zhushengle
d3fb23cca0 fix: riscv_nuclei 编译失败
riscv_nuclei编译失败原因:
1.采用Makefile编译,未包含power模块
2.安全函数库重复包含,导致链接时报重定义错误

Close #I41PQJ
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Id3d20cdb6050fa01aff432be8a9e21dc3c590e29
2021-07-21 14:56:33 +08:00
zhushengle
b3841ed1dd fix: 在内核初始化前期启动tick timer
解决系统未初始化完成前无timer可用的问题。

Close #I410F0
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I3799b9b0ff03cb1dfe80a97816a484df28ae49fd
2021-07-21 10:02:42 +08:00
openharmony_ci
10f683da91 !230 fix: ping cmd compile fail
Merge pull request !230 from give-me-five/master
2021-07-21 01:39:06 +00:00
silen
ae05de3ffd fix: ping cmd compile fail
Change-Id: I692de82275b8da03ac51b493b2f74148c96574d0
Signed-off-by: silen <wuyunjie@huawei.com>
2021-07-21 08:50:28 +08:00
openharmony_ci
d5e46ad863 !229 los_swtmr.h不满足自包含要求对los_config.h存在依赖,但未包含los_config.h
Merge pull request !229 from zhangfanfan2/master
2021-07-20 08:09:27 +00:00
YOUR_NAME
ad8e96a00f fix: los_swtmr.h不满足自包含要求对los_config.h存在依赖,但未包含los_config.h
close: #I40DHM

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I6903d2ece13ab0a4aadbc65f737c5f5a0f0a357a
2021-07-20 14:23:40 +08:00
openharmony_ci
b3481b1fa1 !228 fix: 修复L0的cpup功能失效,恢复功能。
Merge pull request !228 from give-me-five/master
2021-07-19 13:40:49 +00:00
silen
c842251bab fix: cpup funciton repair
Change-Id: I42951b0c0aa16267b6a86a0e95929ae4dccf28ad
Signed-off-by: silen <wuyunjie@huawei.com>
2021-07-19 14:44:03 +08:00
openharmony_ci
ba27241b02 !226 fix: L0 shell去除冗余头文件及优化代码
Merge pull request !226 from give-me-five/master
2021-07-19 02:15:52 +00:00
openharmony_ci
0526c14017 !224 feat: 新增LOSCFG_BASE_CORE_TSK_SWITCH_HOOK 宏定义配置
Merge pull request !224 from zhushengle/task
2021-07-19 01:37:43 +00:00
silen
fd2227e5c8 fix: l0 shell adapt new master
Change-Id: Ia4e0c848b76e8fda7c5a2f9e1b2246b2a09947a4
Signed-off-by: silen <wuyunjie@huawei.com>
2021-07-17 19:54:44 +08:00
zhushengle
39efd6fb30 feat: 新增LOSCFG_BASE_CORE_TSK_SWITCH_HOOK 宏定义配置
优化原任务切换对外函数钩子调用为通过宏定义实现

Close #I40Q9O

Change-Id: Ie5ab75d04e2a63cb992be968d25e876fd91ee591
Signed-off-by: zhushengle <zhushengle@huawei.com>
2021-07-15 09:44:03 +08:00
openharmony_ci
f2466c4165 !223 fix: task命令的打印偏位,以及copyright遗漏
Merge pull request !223 from give-me-five/master
2021-07-15 01:37:55 +00:00
silen
ad15bbd6a4 fix: 修复task命令格式错误,增加copyright
Change-Id: Ib573f981b2a83ab6f75741dd4a670c0ef3adf3f8
Signed-off-by: silen <wuyunjie@huawei.com>
2021-07-14 16:27:30 +08:00
openharmony_ci
bbce405227 !218 feat: L0 新增shell功能,增加命令ls cd等
Merge pull request !218 from give-me-five/master
2021-07-14 03:33:18 +00:00
openharmony_ci
c7b91d7a31 !222 优化arm9调度汇编代码,任务执行默认system模式,解决多种模式使用混乱问题
Merge pull request !222 from JerryH/arm9
2021-07-14 03:11:52 +00:00
silen
97283b7c5d feat: add L0 shell function
Change-Id: I7f10bd365455c32006c22a9f6e2368fe6c229a6a
Signed-off-by: silen <wuyunjie@huawei.com>
2021-07-13 22:04:30 +08:00
JerryH1011
97b5b0837b feat: Support arm9 fiq swi mode and using system mode.
close: #I3WLCN

Change-Id: Id14c4e903ca3c3271faf2ecdf6791163ac93b9a8
Signed-off-by: JerryH1011 <huangjieliang@huawei.com>
2021-07-13 20:23:21 +08:00
openharmony_ci
73a99977de !215 [待合并]fix: 清理残留无效的trace代码
Merge pull request !215 from Zhaotianyu/0708trace_delete
2021-07-13 09:01:57 +00:00
arvinzzz
3c48951857 fix: 清理残留无效的trace代码
1. 删除残留无用的trace代码
2. 调整los_error.h中失效的错误类型定义
3. 整理los_config.h中的特性控制宏

close: #I3ZMB4
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I9f03c486b54ae66308f0dac1aa003dd2a5ef5b84
2021-07-13 11:31:32 +08:00
openharmony_ci
453f91d09c !216 m核增加getifaddrs接口
Merge pull request !216 from 刘建东/master
2021-07-12 06:37:18 +00:00
YOUR_NAME
948501ac73 feat: provide getifaddrs for liteos_m
provide getifaddrs for liteos_m

close: #I400S5

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-07-12 10:49:33 +08:00
openharmony_ci
1ab9813256 !205 L0 LiteOS-M支持ARM9架构
Merge pull request !205 from JerryH/master
2021-07-12 00:44:56 +00:00
JerryH1011
6d7c9dfe59 feat: Support arm9
close: #I3WLCN

Change-Id: Id8e3ce9a9a7749cb27b52562e6d506803b38d9af
Signed-off-by: JerryH1011 <huangjieliang@huawei.com>
2021-07-12 06:39:24 +08:00
openharmony_ci
bf045e3eba !213 消除编译告警
Merge pull request !213 from x_xiny/master
2021-07-09 08:37:18 +00:00
x_xiny
d8c8c22666 fix:消除编译告警
【背景】
 消除编译告警

【修改方案】
 消除编译告警

 re #I3ZC1R

 Change-Id: If5748c7ed420a9ff822c20ffb17dee2815e9bddc

 Signed-off-by: x-xiny <1301913191@qq.com>

Change-Id: Id78631543b0c41f11e1c3594200a3ad43543bbf5
2021-07-09 10:05:31 +08:00
openharmony_ci
cda85bf1b0 !214 删除README中多余的changelog信息
Merge pull request !214 from 野生毛霉君/master
2021-07-06 12:41:48 +00:00
mucor
37ef8ca7ae fix: remove changelog in README
close: #I3ZECY

Signed-off-by: mucor <mucorwang@gmail.com>
2021-07-06 20:37:15 +08:00
openharmony_ci
2e621bc323 !212 littlefs stat 接口支持获取文件类型
Merge pull request !212 from LeonChan/little-stat
2021-07-06 09:31:36 +00:00
Leon Chan
ceaed2dc86 feat: add file type support for LfsStat
close #I3ZCDR
Signed-off-by: Leon Chan <chenwei26@huawei.com>
2021-07-06 16:00:13 +08:00
openharmony_ci
aa6385ce16 !210 risc-v gn 编译框架添加汇编编译选项
Merge pull request !210 from zhushengle/CI
2021-07-05 06:54:51 +00:00
zhushengle
76dc343c88 feat: risc-v gn 编译框架添加汇编编译选项
Close #I3YS5Y

Change-Id: I380bc3442222ba18a0eebba4022ad6ca032e3de2
Signed-off-by: zhushengle <zhushengle@huawei.com>
2021-07-05 09:26:45 +08:00
openharmony_ci
77338f4c2b !209 littlefs错误码设置不正确
Merge pull request !209 from LeonChan/little-errno
2021-07-01 07:36:01 +00:00
openharmony_ci
e5179be5b5 !208 feat: L0 测试用例支持risc-v qemu 编译运行
Merge pull request !208 from zhushengle/test
2021-07-01 03:34:31 +00:00
Leon Chan
452f36403d fix: littlefs inappropriate return value and errno
return value and errno conforming to the POSIX.1.2008 standards

close: #I3YIVT
Signed-off-by: Leon Chan <chenwei26@huawei.com>
2021-06-30 18:38:01 +08:00
zhushengle
2dd6c080da feat: L0 测试用例支持risc-v qemu 编译运行
Close #I3YILG

Change-Id: I85e77596ae390ff153e1a423a6ec1b7cb9247bcc
Signed-off-by: zhushengle <zhushengle@huawei.com>
2021-06-30 16:17:43 +08:00
openharmony_ci
c56f5bc7bd !203 M33平台支持GCC环境的Trustzone
Merge pull request !203 from wangchen/tz
2021-06-30 00:38:05 +00:00
wangchen
d469da29c6 feat: M33平台支持GCC环境的Trustzone
【背景】M33平台当前仅支持IAR环境的tz,不满足云雀平台需求。

【修改方案】
1. 将 M33当前已有的IAR trustzone修改为gcc可用。

【影响】
对现有的产品编译不会有影响。

re #I3Y85I
Signed-off-by: wangchen <253227059@qq.com>
2021-06-29 15:16:57 +08:00
openharmony_ci
7fcf7ee3e6 !202 m核lwip提供gn编译脚本
Merge pull request !202 from 刘建东/master
2021-06-28 12:32:54 +00:00
YOUR_NAME
8515f0dc8f chore: provide lwip gn file for liteos_m
provide lwip gn file for liteos_m

close: #I3Y2WZ

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-06-28 17:13:44 +08:00
openharmony_ci
66f242f85b !201 littlefs编译告警消除
Merge pull request !201 from LeonChan/lc-compile-warnings
2021-06-28 09:11:23 +00:00
openharmony_ci
80f02595d7 !200 littlefs opendir失败时增加错误回滚
Merge pull request !200 from LeonChan/lc-opendir-bug-fix
2021-06-28 09:10:32 +00:00
Leon Chan
75f61870a0 fix: compile warnings
1, function prototypes: LfsSeek, LfsCloseDir
2, fix some other minor warnings and remove some while spaces

close: #I3Y57X
Signed-off-by: Leon Chan <chenwei26@huawei.com>
Change-Id: Id8b77c8a6b2e8d2b9bc5f02e22bfc6a15d70f648
2021-06-28 15:42:28 +08:00
Leon Chan
82fad6c36f fix: rollback resources when opendir failed
close: #I3Y577
Signed-off-by: Leon Chan <chenwei26@huawei.com>
2021-06-28 15:29:31 +08:00
openharmony_ci
59225cb6df !198 重构kal/posix的BUILD.gn编译脚本,添加对musl c库的依赖
Merge pull request !198 from Caoruihong/liteos_m_build_gn
2021-06-28 00:35:34 +00:00
Caoruihong
bfa25fcaa3 feat: add deps to musl and securec
add deps to musl, and securec.
fwrap.c's contents are moved to musl.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ib451736798efd9745c6fbbbe5f355eea13477031
2021-06-26 18:04:27 +08:00
openharmony_ci
586d9a18b3 !199 M核littlefs当文件open失败时,需要回收fd,否则会有fd泄露
Merge pull request !199 from li_zan/master
2021-06-26 08:22:24 +00:00
li_zan
b458e12ed5 fix: M核littlefs当文件open失败时,需要回收fd,否则会有fd泄露
close:#I3XU6R

Signed-off-by: li_zan <371442490@qq.com>
2021-06-26 09:33:57 +08:00
openharmony_ci
eca03e5ed6 !195 feat: L0新增posix接口sem_getvalue
Merge pull request !195 from x_xiny/master
2021-06-24 07:15:06 +00:00
openharmony_ci
2e92427d8f !194 修复littlefs的多分区挂载时,对pathname的处理逻辑异常
Merge pull request !194 from li_zan/master
2021-06-24 05:05:07 +00:00
openharmony_ci
ef4bdf6d10 !197 调度过程低概率触发OsSchedTaskEnQueue断言,导致系统异常
Merge pull request !197 from zhangfanfan2/master
2021-06-24 05:03:00 +00:00
x_xiny
8649b14591 feat: m核新增posix接口sem_getvalue
【背景】
 m核新增posix接口适配

【修改方案】
 接口新增sem_getvalue,并在内核适配相应接口

【影响】
 无

 re #I3WW8S

 Signed-off-by: x_xiny <1301913191@qq.com>
 Change-Id: I65a4baa242aaedc2fec9b6ed705dbb1ddb6e70c9

Change-Id: Id4c38a5dd4ac4e90f1bd032a39dcb97ce29de5f9
2021-06-24 10:43:44 +08:00
li_zan
b0119f6185 Merge branch 'master' of gitee.com:openharmony/kernel_liteos_m into master 2021-06-24 01:33:46 +00:00
li_zan
b55cfc1ba7 fix: 修复littlefs的多分区挂载时,对pathname的处理逻辑异常
close:#I3WWFA

Signed-off-by: li_zan <371442490@qq.com>
2021-06-24 09:31:15 +08:00
YOUR_NAME
e5e9289a08 fix: 调度过程低概率触发OsSchedTaskEnQueue断言,导致系统异常
当任务A调用LOS_EventRead阻塞开中断后,突然响应中断B,此时任务A已入阻塞链表,
任务状态为OS_TASK_STATUS_PEND | OS_TASK_STATUS_RUNNING;而B的回调函数中调用
LOS_EventWrite唤醒任务A,这个过程会调用OsSchedTaskWake,将任务A从阻塞链表中
取出,并去除OS_TASK_STATUS_PEND状态,且调用OsSchedTaskEnQueue将任务A添
加到调度队列并增加OS_TASK_STATUS_READY状态。OsSchedTaskWake全部流程完成后,
会开中断并调用LOS_Schedule,在LOS_Schedule流程中由于当前任务为A,且状态为
OS_TASK_STATUS_RUNNING | OS_TASK_STATUS_READY,会再次调用OsSchedTaskEnQueue,
从而被OsSchedTaskEnQueue断言拦住。修改方式:当任务状态含有OS_TASK_STATUS_RUNNING时
OsSchedTaskWake中不调用OsSchedTaskEnQueue。

close: #I3VX9Y

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I28f33d25504ade47469980fd6bb0b922bf4756da
2021-06-23 19:25:58 +08:00
openharmony_ci
1f4b7aa85d !196 新增函数regcomp,regfree和regexec支持
Merge pull request !196 from zhangfanfan2/master
2021-06-23 10:31:36 +00:00
YOUR_NAME
86d5544a3f fix: 新增函数regcomp,regfree和regexec支持
close: #I3U9LE

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: Iff1180b89958b4d8c339a73f9a5f59cb47707c74
2021-06-23 15:27:50 +08:00
openharmony_ci
d0efdfc20d !169 feat: L0支持低功耗投票框架
Merge pull request !169 from zhushengle/PM
2021-06-22 11:55:22 +00:00
zhushengle
558ce14bec feat: L0 支持低功耗框架
1.【需求描述】
 L0 支持低功耗投票框架, 使内核与应用、驱动分离开,通过注册及投票机制控制系统的低功耗模式,
  减低系统功耗,提升设备电池寿命。
2.【方案描述】
 (1).提供注册机制,使驱动与内核分离
  (2).提供投票机制,判断系统运行模式
  (3).记录持锁设备,便于回溯
  进入:系统运行进入idle任务时判断当前的功耗模式,如果上层应用未对当前功耗模式(deep和shutdown)
 持锁,则系统准备进入当前模式,首先所有设备依次进入当前模式,如果有设备进入当前模式失败,则恢复
 已进入当前模式的所有设备,并且功耗模式变为normal模式;设备依次进入当前功耗模式后cpu再进入当前
 功耗模式。
  恢复:功耗模式为deep时,需要恢复逻辑,时系统恢复运行。当有中断出发时,系统会退出低功耗模式,
  恢复顺序为:首先cpu先恢复,然后设备依次恢复。

BREAKING CHANGE:
1.原调度中基于tick timer的低功耗扩展和当前的pm模块合并,删除原对外接口LOS_SchedSleepInit,
 变为pm模块统一提供的LOS_PmRegistered接口.
2.原来在arch los_timer.h下提供的低功耗模式为枚举LOS_SysSleepEnum,其中OS_SYS_NORMAL_SLEEP
  和OS_SYS_DEEP_SLEEP不符合对外定义,统一修改为LOS_SYS_NORMAL_SLEEP和LOS_SYS_DEEP_SLEEP,
  并移至los_pm.h中.
3.VOID HalEnterSleep(LOS_SysSleepEnum sleep) 变更为UINT32 HalEnterSleep(VOID).

Close #I3UDNV

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Id5382c42c8055ba7850895a3f575130a73e38a65
2021-06-22 13:15:06 +08:00
openharmony_ci
9fc34614d1 !184 feat: add LOS_ListHeadInsert function
Merge pull request !184 from kenneth/LOS_ListHeadInsert
2021-06-21 12:39:25 +08:00
openharmony_ci
8df07fe3cc !182 fix: add API LOS_HwiCreate、LOS_HwiDelete
Merge pull request !182 from kenneth/HWI
2021-06-21 12:38:07 +08:00
openharmony_ci
0f7d2fcf07 !193 fix: 延时队列为NULL时,返回的响应时间为64位最大值,导致无法更新tick timer的响应周期
Merge pull request !193 from zhushengle/sched
2021-06-18 10:09:31 +08:00
openharmony_ci
0247e421c7 !192 修复M核上musl库缺失strdup.c的问题
Merge pull request !192 from li_zan/master
2021-06-18 09:43:14 +08:00
kenneth
430b186be7 feat: add LOS_ListHeadInsert function
注释中@see部分提到了函数LOS_ListHeadInsert,但是该函数没有定义,增加该函数的定义。

close #I3TAQA

Signed-off-by: kenneth <459864689@qq.com>
2021-06-18 09:01:25 +08:00
kenneth
eb668eb9e0 fix: add API LOS_HwiCreate and LOS_HwDelete
新增对外接口LOS_HwiCreate、LOS_HwiDelete

close #I3R75F

Signed-off-by: kenneth <459864689@qq.com>
2021-06-18 08:53:22 +08:00
li_zan
139f83af39 fix: 修复M核上musl库缺失strdup,c的问题
close:#I3VZSI

Signed-off-by: li_zan <371442490@qq.com>
2021-06-17 20:28:47 +08:00
zhushengle
bcec32e389 fix: 延时队列为NULL时,返回的响应时间为64位最大值,导致无法更新tick timer的响应周期
问题描述:
  当g_schedResponseTime = OS_SCHED_MAX_RESPONSE_TIME,且nextExpireTime =(UINT64-1时,
  表示系统的延时队列已为NULL, 此时tick timer 中应该设置为最大值,但由于判断
  g_schedResponseTime - nextExpireTime >= OS_CYCLE_PER_TICK,导致条件不成立,直接返回,
  无法将其设置为最大值,导致tick 中断一直频繁响应。
解决方案:
  将延时队列为NULL时的返回值以及idle线程的时间片修改为OS_SCHED_MAX_RESPONSE_TIME - OS_CYCLE_PER_TICK,
  保证延时队列为NULL,能够正常设置tick响应的最大值。

Close #I3W1LF

Change-Id: I0d09119240ae5a50ddcb0c96fb23cd3d6e70b892
Signed-off-by: zhushengle <zhushengle@huawei.com>
2021-06-17 20:23:13 +08:00
openharmony_ci
491920548c !191 修复littlefs编译fs.c缺少头文件件依赖配置
Merge pull request !191 from li_zan/master
2021-06-17 19:24:50 +08:00
li_zan
7259289bd9 fix: 修复littlefs编译fs.c缺少头文件件依赖配置+若干musl库的缺失问题+多分区规格宏配置问题
close:#I3VT11

Signed-off-by: li_zan <371442490@qq.com>
2021-06-17 17:03:41 +08:00
openharmony_ci
6e162a9318 !190 修正有关makefile文件中bounds_checking_function的路径配置
Merge pull request !190 from Caoruihong/master
2021-06-17 09:30:40 +08:00
openharmony_ci
94e620acd0 !189 fix: fix backtrace check issue
Merge pull request !189 from rtos-lover/bt_fix
2021-06-16 21:00:44 +08:00
Caoruihong
5c0a6fffea chore: bounds_checking_function is under //third_party
the copy of bounds_checking_function under components was removed,
we should use the copy of bounds_checking_function under //third_party

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ib5c392f4d592a2fe6f26f6c1e1ea60f1faa836b9
2021-06-16 17:54:58 +08:00
rtos-lover
b6664e66f1 fix: fix backtrace check issue
fix issue that when memleak check is enabled, backtace is not enabled

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3VTKD

Signed-off-by: rtos-lover <zhushangyuan@hotmail.com>
2021-06-16 17:12:41 +08:00
openharmony_ci
468ce69f27 !180 update: rename LOS_BackTraceInit
Merge pull request !180 from kenneth/BackTraceInit
2021-06-16 13:45:04 +08:00
openharmony_ci
48067a0596 !178 littlefs三方源码采用GN编译修改上库+默认Mount路径可配置
Merge pull request !178 from li_zan/master
2021-06-16 10:58:13 +08:00
kenneth
a0a32188ff update: rename LOS_BackTraceInit
change function name LOS_BackTraceInit and involve it in los_init.c when macro is not set to 0

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3SYQQ

Signed-off-by: kenneth <459864689@qq.com>
2021-06-16 08:51:00 +08:00
li_zan
bdb614bc2b fix: littlefs三方源码采用GN编译修改上库
close:I3VJ6X

Signed-off-by: li_zan <371442490@qq.com>
2021-06-15 19:56:50 +08:00
openharmony_ci
3c35617816 !179 通过public_configs方式对外提供cmsis和posix的对外头文件路径
Merge pull request !179 from Caoruihong/master
2021-06-15 16:48:41 +08:00
Caoruihong
420e781f33 chore: adjust path of posix header files
path of posix header files are exposed via public_configs
of //kernel/liteos_m/kal/posix

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Id838549e1a952d6ddb8664792570f265edfbd91c
2021-06-15 12:11:12 +08:00
openharmony_ci
749bd8a481 !176 musl归一化后调整libc的构建
Merge pull request !176 from Caoruihong/porting2
2021-06-11 17:36:29 +08:00
openharmony_ci
9b656ac3c1 !172 fix: fix print format compilation warning
Merge pull request !172 from kenneth/printf_format_warning
2021-06-11 13:19:52 +08:00
Caoruihong
a5660c2217 chore: remove the files copied from musl
copied and auto-generated files are redundant and should not be tracked.

Change-Id: I22bb3a1873ba6e0be3008306624b50772cdc91b5
Signed-off-by: Caoruihong <crh.cao@huawei.com>
2021-06-11 11:26:58 +08:00
openharmony_ci
a3ab46ec31 !175 修复M核littlefs GN编译的若干错误
Merge pull request !175 from li_zan/master
2021-06-11 11:23:45 +08:00
li_zan
d77828e206 fix: 修复M核littlefs GN编译的若干错误
close:I3V7ZH

Signed-off-by: li_zan <371442490@qq.com>
2021-06-11 09:48:32 +08:00
kenneth
ef12c89c7a fix: fix print format compilation warning
fix print format compilation warning by changing 0x%x to 0x%p

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3OFSQ

Signed-off-by: kenneth <459864689@qq.com>
2021-06-10 14:52:47 +08:00
openharmony_ci
db89b353e9 !166 修复fatfs文件系统中部分指针访问前未判空、全局变量保护不完全问题。
Merge pull request !166 from JING/fatfs
2021-06-10 13:21:37 +08:00
openharmony_ci
9781662cea !135 添加backtrace for riscv在不打开frame-pointer的提前下
Merge pull request !135 from JerryH/backtrace
2021-06-09 11:46:03 +08:00
JerryH
97a5b6d8dc Merge branch 'master' of gitee.com:openharmony/kernel_liteos_m into backtrace 2021-06-09 10:41:58 +08:00
openharmony_ci
0ba33abcd1 !174 m核上littlefs新增错误码功能
Merge pull request !174 from li_zan/master
2021-06-09 09:48:44 +08:00
li_zan
a062378631 fix: m核上littlefs新增错误码功能
close:#I3UVMQ

Signed-off-by: li_zan <371442490@qq.com>
2021-06-08 19:13:44 +08:00
openharmony_ci
bd307591b4 !173 fs接口用例补充
Merge pull request !173 from wangchen/testsuit
2021-06-07 23:02:46 +08:00
wangchen
2a95af5bf1 feat: 补充fs相关函数用例
【背景】当前fs部分函数缺少配套用例。

【修改方案】
1. 在unittest目录下新增fopen等17个接口的用例。

【影响】
对现有的产品编译不会有影响。

re #I3UQ4F
Signed-off-by: wangchen <253227059@qq.com>
2021-06-07 21:59:22 +08:00
openharmony_ci
2f6ab80a06 !170 解决fclose等函数工具链重定义问题
Merge pull request !170 from wangchen/master
2021-06-07 21:02:56 +08:00
openharmony_ci
f3a3114ac7 !163 mbedtls适配l0
Merge pull request !163 from 野生毛霉君/master
2021-06-07 14:38:27 +08:00
openharmony_ci
7ab7ae7ae7 !137 fix: fix typos
Merge pull request !137 from rtos-lover/los_sched.c
2021-06-05 13:53:35 +08:00
wangchen
b244ad4ad0 feat: 解决fclose等函数工具链重定义问题
【背景】当前部分单板编译fclose等函数时与对应的gcc工具链重定义。

【修改方案】
1. fclose等函数新增weak定义,并恢复与musl源码一致。
2.外层添加wrap函数,用于配合gcc的--wrap选项。

【影响】
对现有的产品编译不会有影响,报重定义的工程需单独在自己的build.gn中添加
--wrap=xxx。

re #I3UG6O

Signed-off-by: wangchen <253227059@qq.com>
2021-06-05 11:30:16 +08:00
chenjing
bc7a914bce fix: protect from accssing NULL pointer, access g_handle after fslock
close #I3UCX3

Signed-off-by: chenjing <chenjing139@huawei.com>
Change-Id: Ie4d5c1923c2d49e283c77f46d01784bed065a507
2021-06-04 16:20:11 +08:00
mucor
761b86096c fix(mbedtls): mbedtls l0 support
close: #I3UBJA
Signed-off-by: mucor <mucorwang@gmail.com>
2021-06-04 16:07:06 +08:00
openharmony_ci
beea9963f7 !161 fix: fix NULL、UNUSED redefined issue
Merge pull request !161 from kenneth/NULL_redefined3
2021-06-04 14:51:52 +08:00
openharmony_ci
3d2a102d35 !160 fix: fatfs中宏FS_LOCK_TIMEMOUT_SEC拼写错误
Merge pull request !160 from zhushengle/fs
2021-06-04 14:47:51 +08:00
openharmony_ci
58c330f594 !159 fix: remove project files
Merge pull request !159 from kenneth/README.md
2021-06-04 14:46:21 +08:00
openharmony_ci
af9b9ee7fe !157 fix: comment error
Merge pull request !157 from kenneth/los_backtrace.h2
2021-06-04 14:44:56 +08:00
openharmony_ci
9d77efe6aa !156 fix: correct the counter of exception type
Merge pull request !156 from kenneth/los_arch_interrupt.h2
2021-06-04 14:44:41 +08:00
openharmony_ci
70713c705f !155 fix: fix typo in comment
Merge pull request !155 from kenneth/los_queue_want2
2021-06-04 14:44:09 +08:00
openharmony_ci
162673b546 !154 fix: change cpup retval range
Merge pull request !154 from kenneth/LOS_HistorySysCpuUsage2
2021-06-04 14:43:42 +08:00
kenneth
765bd55199 fix: fix NULL UNUSED redefined issue
change NULL、 UNUSED macro definition

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3E9S3

Signed-off-by: kenneth <459864689@qq.com>
2021-06-04 10:58:43 +08:00
zhushengle
42dc308369 fix: Fixed a spelling error in FS_LOCK_TIMEOUT_SEC.
Close #I3TL66

Change-Id: Id7facf210d7bc3c29c631e2f0b48a332e7f1348c
Signed-off-by: zhushengle <zhushengle@huawei.com>
2021-06-04 10:40:44 +08:00
kenneth
4ad01ced93 fix: remove project files
update README.md file to remove the project files

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3U5QQ

Signed-off-by: kenneth <459864689@qq.com>
2021-06-04 09:43:39 +08:00
kenneth
a37b73d759 fix: comment error
correct typo in comments

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3SLNU

Signed-off-by: kenneth <459864689@qq.com>
2021-06-03 20:49:18 +08:00
kenneth
bff65877a2 fix: correct the counter of exception type
correct the counter of exception type from 19 to 21

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3SR54

Signed-off-by: kenneth <459864689@qq.com>
2021-06-03 20:45:12 +08:00
kenneth
811d3fae8a fix: fix typo in comment
The word wantted is misspelled and should be changed to wanted. And expected-size is better than wanted size.

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3RW6C

Signed-off-by: kenneth <459864689@qq.com>
2021-06-03 20:39:33 +08:00
kenneth
d00a35ba92 fix: change cpup retval range
change cpup range from 100 to 1000

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3SXJ7

Signed-off-by: kenneth <459864689@qq.com>
2021-06-03 20:34:28 +08:00
openharmony_ci
a9857c8b2f !151 修复littlefs部分缺失功能:1、open接口的flag适配。2、mount功能增强
Merge pull request !151 from li_zan/master
2021-06-03 20:18:46 +08:00
li_zan
51335629d0 Fix: littlefs some bug
Signed-off-by: li_zan <371442490@qq.com>
2021-06-03 19:33:09 +08:00
openharmony_ci
d636a6f27c !152 删除MQ内冗余的重复宏定义
Merge pull request !152 from give-me-five/master
2021-06-03 18:27:50 +08:00
give-me-five
6d7291660a fix: 删除MQ内冗余的重复宏定义
【背景】
去除多余宏定义
【修改方案】
宏定义规格有重复定义问题,需要删除。
【影响】
无
re #I3U5BE:删除重复定义的mq宏
2021-06-03 17:42:15 +08:00
openharmony_ci
05937ee49c !144 调整hook类型和位置,提升调试的易用性
Merge pull request !144 from Zhaotianyu/0529hook_fix
2021-06-03 15:18:33 +08:00
openharmony_ci
804f5a809f !130 fix: fix macro typo
Merge pull request !130 from kenneth/STACK_PROTECTION
2021-06-03 15:14:10 +08:00
Zhaotianyu
b4cfdcfbf5 Merge branch 'master' of gitee.com:openharmony/kernel_liteos_m into 0529hook_fix 2021-06-03 11:08:31 +08:00
openharmony_ci
caba05985b !147 fix: fix readme link issue
Merge pull request !147 from kenneth/readme_update
2021-06-02 17:10:22 +08:00
openharmony_ci
5bd69a9ea6 !143 修复timer_settime接口功能缺陷
Merge pull request !143 from Zhaotianyu/0529timer_fix
2021-06-02 17:06:36 +08:00
openharmony_ci
fb2117c598 !146 修复不规范的copyright
Merge pull request !146 from Zhaotianyu/0524copyright
2021-06-02 16:50:56 +08:00
arvinzzz
a5f4e37e53 fix: 修复timer_settime只设置第一次到期时间时,到期时间不准的缺陷
close: #I3TCHA

Change-Id: Ie5c2ab74a8cbbd86dce913b53ae791f8f2da5133

Signed-off-by: arvinzzz <fcykztyu@163.com>
Change-Id: I571b0a3577026011aabcb0235985ea3e9be4441c
2021-06-02 16:37:53 +08:00
kenneth
9e332c69a5 fix: fix readme link issue
update links to docs

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3TX4Q

Signed-off-by: kenneth <459864689@qq.com>
2021-06-02 15:37:34 +08:00
openharmony_ci
d4409bfba4 !142 fix: update arch_spec.md
Merge pull request !142 from rtos_shang/arch_spec_md
2021-06-02 15:34:41 +08:00
arvinzzz
2d9bbd2769 fix: 修复不规范的copyright
close: #I3SPJ1
Change-Id: I6cb01024ef342a0190f5dc9f6cb3a1e815692832

Signed-off-by: arvinzzz <fcykztyu@163.com>
Change-Id: I45c63592b08d29587778209de6af17f932dc86d0
2021-06-02 11:07:59 +08:00
arvinzzz
369320de37 fix: 调整hook类型和位置,方便调试
close: #I3TGZS
Change-Id: Idba021ec7595d2f25a23102b6610e0f29cdd1209
Signed-off-by: arvinzzz <fcykztyu@163.com>

Change-Id: I9f1f745c6389de8bd8ca589bd1a3dc5311962527
2021-06-02 10:28:24 +08:00
arvinzzz
e4b5d4ebe9 fix: 修复timer_settime只设置第一次到期时间时,到期时间不准的缺陷
close: #I3TCHA

Change-Id: Ie5c2ab74a8cbbd86dce913b53ae791f8f2da5133
Signed-off-by: arvinzzz <fcykztyu@163.com>
2021-06-02 09:44:20 +08:00
YOUR_NAME
ca1792aa4b feat(liteos_m): support backtrace for riscv
Support backtrace for riscv when the compilation option(-fno-omit-frame-pointer) is not turned on.

fix #I3RVXY

Change-Id: Ie7d8a223167e5c540367bc96db646b821dae9fd0
2021-05-25 11:10:28 +08:00
rtos_shang
2a2ef7d708 change according to comments 2021-05-25 10:12:19 +08:00
rtos_shang
0752400a10 change according to review comments 2021-05-25 10:08:42 +08:00
rtos_shang
cf43988523 fix: update arch_spec.md
update arch_spec.md, add Chinese edition of arch_spec_zh.md and add link to readme files

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3QQ93 https://gitee.com/openharmony/kernel_liteos_m/issues/I3J7RS
2021-05-21 11:33:24 +08:00
openharmony_ci
6e1fb96998 !139 修复hook模块在c99编译标准下编译出错
Merge pull request !139 from Zhaotianyu/0520hook_fix
2021-05-20 17:07:39 +08:00
openharmony_ci
8856114e62 !134 M核littlefs支持多分区挂载
Merge pull request !134 from li_zan/master
2021-05-20 16:26:16 +08:00
arvinzzz
a078c3086f fix: The hook module fails to compile under the c99 compilation standard.
close: #I3S4ME

Change-Id: I335dde049e1646cb7fb32f8e156878994f254c8b
2021-05-20 15:42:20 +08:00
li_zan
3181b4395d Add Multi mount func 2021-05-20 15:36:54 +08:00
li_zan
45c72e7927 Add Multi mount func 2021-05-20 14:21:04 +08:00
openharmony_ci
2b6a7d91e9 !136 fix: fix LOS_TaskNameGet comment
Merge pull request !136 from rtos-lover/los_task.h
2021-05-20 11:30:23 +08:00
openharmony_ci
619fd42ded !101 将符号链接改回实体文件或目录
Merge pull request !101 from Caoruihong/remove_third_party
2021-05-20 09:32:26 +08:00
rtos-lover
191644e441 fix: fix typos
Correct words function、procedure

close  https://gitee.com/openharmony/kernel_liteos_m/issues/I3RR6A
2021-05-19 14:49:13 +08:00
rtos-lover
c70b28bf78 fix: fix LOS_TaskNameGet comment
fix comment for the function LOS_TaskNameGet

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3QJVY
2021-05-19 14:33:51 +08:00
openharmony_ci
930e92ebe2 !131 fix: fix destroy typo
Merge pull request !131 from kenneth/los_event.h
2021-05-19 13:37:20 +08:00
openharmony_ci
be5344ae75 !132 fix: correct ECB in comment
Merge pull request !132 from kenneth/los_sem.c
2021-05-19 13:35:43 +08:00
openharmony_ci
456bef2141 !133 fix: fix length typo
Merge pull request !133 from kenneth/los_queue.h
2021-05-19 13:35:03 +08:00
kenneth
e772ccb3cc fix: change queuePosion to queuePosition 2021-05-19 08:35:48 +08:00
openharmony_ci
0e14ddffd3 !129 fix: fix __cplusplus typo
Merge pull request !129 from kenneth/task_sample.h
2021-05-18 14:02:05 +08:00
openharmony_ci
c66e3cb52e !128 fix: fix comment typo issue
Merge pull request !128 from kenneth/resource.h
2021-05-18 14:01:15 +08:00
kenneth
98d65801de fix: fix length typo
correct length、there、necessary spell

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3QQA8
2021-05-18 11:23:43 +08:00
kenneth
e2aeb1ff1d fix: correct ECB in comment
change ECBs to semaphore CBs, and remove extra blank

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3RPRQ
2021-05-18 11:09:48 +08:00
kenneth
4ba6259e94 fix: fix destroy typo
change LOS_ERRNO_EVENT_SHOULD_NOT_DESTORY to LOS_ERRNO_EVENT_SHOULD_NOT_DESTROYED

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3RQXS
2021-05-18 10:53:39 +08:00
kenneth
16003604a9 fix: fix macro typo
change LOSCFG_EXC_HRADWARE_STACK_PROTECTION to LOSCFG_EXC_HARDWARE_STACK_PROTECTION

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3NUX6
2021-05-18 10:02:03 +08:00
kenneth
c3eb3e59e6 fix: fix __cplusplus typo
remove extra c in macro definition  __cpluscplus

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3QQAF
2021-05-18 09:51:34 +08:00
kenneth
0c2a675e2d fix: fix comment typo issue
The extentions is changed to extensions

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3R970
2021-05-18 09:45:49 +08:00
openharmony_ci
bb84279cc2 !112 fix: fix function name
Merge pull request !112 from rtos-lover/los_sched
2021-05-18 09:42:55 +08:00
Caoruihong
8d353084d6 remove symlinks which is not supported on windows platform
use submodules instead of symlinks for bounds_checking_function and cmsis_os2.h

Change-Id: I105c3d2c537d9c3c725adf1265a3312df4286916
2021-05-17 22:28:19 +08:00
openharmony_ci
3feb4f26f3 !125 增强L0 低功耗可扩展性
Merge pull request !125 from zhushengle/sleep
2021-05-17 22:08:19 +08:00
openharmony_ci
5ef2efb347 !118 支持IAR工具的Cortex-m33 TrustZone
Merge pull request !118 from JerryH/master
2021-05-17 21:59:13 +08:00
openharmony_ci
517282d51c !121 新增M核文件系统vfs层,支持多种文件系统类型
Merge pull request !121 from JING/seren
2021-05-17 18:58:18 +08:00
chenjing
5479dd66d7 fix: add liteos_m vfs
Close #I3R493

Change-Id: Ic799182b46c6c04c879d1b2202bda6b1f2cf40df
2021-05-17 15:57:44 +08:00
openharmony_ci
e52008ba6e !123 m核编译存在libsec_kernel.a核libsec_static.a两份安全函数库,需要优化
Merge pull request !123 from zhangfanfan2/other
2021-05-15 14:46:16 +08:00
openharmony_ci
8ef21e0b41 !115 fix: correct spelling
Merge pull request !115 from rtos-lover/los_swtmr
2021-05-15 09:45:21 +08:00
openharmony_ci
62f6531539 !114 fix: correct typo
Merge pull request !114 from rtos-lover/los_task
2021-05-15 09:44:01 +08:00
openharmony_ci
439368edc1 !111 fix: correct typo in los_memory.c
Merge pull request !111 from rtos-lover/los_mem
2021-05-15 09:42:02 +08:00
openharmony_ci
0be2ecfdd0 !110 fix: corrent spelling
Merge pull request !110 from rtos-lover/los_debug
2021-05-15 09:41:16 +08:00
openharmony_ci
a47fc7beb3 !107 fix:enum misspell
Merge pull request !107 from Harylee/fix
2021-05-15 09:40:27 +08:00
zhushengle
43c04f6f5c fix:Low power expansion.
Close #I3RCHR

Change-Id: I8db9ae791b234b8237ce5a8e56d4d6581833b9ee
2021-05-14 17:08:47 +08:00
openharmony_ci
4166768998 !122 LOS_IntLock的返回类型实际为UINT32,不需要定义为UINTPTR,需要修改
Merge pull request !122 from zhangfanfan2/master
2021-05-14 16:11:11 +08:00
openharmony_ci
92c28e1fe7 !124 解决内存泄漏检测错误判断及删除冗余判断
Merge pull request !124 from JerryH/mem
2021-05-14 16:07:53 +08:00
YOUR_NAME
eac4a04153 Fix memory leak check and interity error check.
Delete redundant judgments.

Close #I3P10Y and #I3QNLT

Change-Id: I94ff34099bc39345ef5490f185f70c4b87bfd415
2021-05-14 14:49:17 +08:00
YOUR_NAME
bcc34e22ed fix: modify the return type of LOS_IntLock from UINTPTR to UINT32.
Change-Id: I6207e5cb7d612a154a88de4e9e274c67127361d8
2021-05-14 11:33:05 +08:00
zhangfanfan2
1144b75f3f fix: remove libsec_kernel 2021-05-13 20:46:46 +08:00
openharmony_ci
748a827560 !104 add: add environment setup and compilation into document
Merge pull request !104 from kenneth/master
2021-05-12 17:30:59 +08:00
openharmony_ci
e7a3659b33 !109 XX产品上,存在使用littlefs文件系统重复打开文件会新创建Fd,与预期不一致,改为返回失败
Merge pull request !109 from li_zan/master
2021-05-12 11:05:14 +08:00
openharmony_ci
658c340644 !109 XX产品上,存在使用littlefs文件系统重复打开文件会新创建Fd,与预期不一致,改为返回失败
Merge pull request !109 from li_zan/master
2021-05-12 11:05:13 +08:00
li_zan
7d9976cd90 Add already opened file logic 2021-05-11 20:30:31 +08:00
openharmony_ci
acf317a8cd !119 支持sleep函数
Merge pull request !119 from zhangfanfan2/master
2021-05-11 20:02:05 +08:00
zhangfanfan2
03be5e6e92 feature: Add sleep function 2021-05-11 16:48:35 +08:00
openharmony_ci
d38087fa2f !67 LiteOs-m内核posix接口修改和用例补充
Merge pull request !67 from babu_g/noEmployeeNum_ChangeID_13651229_guanzehui
2021-05-11 16:47:41 +08:00
YOUR_NAME
c70ef201f3 Add Cortex-m33 TrustZone about IAR
close #I3MX1F

Change-Id: I449b01ad7ac714412a26bb9f3a6b723a6c74ca3f
2021-05-11 10:45:52 +08:00
openharmony_ci
bb90e629cb !117 修正tm_gmtoff字段的含义
Merge pull request !117 from Caoruihong/gmtoff
2021-05-11 09:47:40 +08:00
li_zan
602c9f6dfa Add already opened file logic 2021-05-08 17:00:11 +08:00
li_zan
96d2f2910e Add already opened file logic 2021-05-08 15:18:01 +08:00
li_zan
3a4a8b0680 Add already opened file logic 2021-05-08 15:14:45 +08:00
openharmony_ci
7a72b0069a !113 fix: modify event API description
Merge pull request !113 from MGY917/master
2021-05-08 13:10:43 +08:00
li_zan
4aeaf030a2 Add already opened file logic 2021-05-08 11:31:27 +08:00
Caoruihong
9b498e651e fix tm_gmtoff
tm_gmtoff is opposite of timezone despite daylight saving.
timezone(global variable): seconds west of UTC, not adjusted for daylight saving.
tm_gmtoff(member of struct tm): seconds east of UTC, including adjustment for daylight saving.

Change-Id: If2e76b7da64989fb2df063ce4101d317474a7ab7
2021-05-08 11:17:02 +08:00
li_zan
49e9044529 Add already opened file logic 2021-05-08 11:14:33 +08:00
rtos-lover
dd5cefb0da fix: correct spelling
correct some typos in los_swtmr.c It_los_queue_head_019.c

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3PYLH
2021-05-08 10:30:25 +08:00
rtos-lover
3ceface13e fix: correct typo
correct typos in los_task.c

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3PYHW?from=project-issue
2021-05-08 10:23:02 +08:00
Guangyao Ma
9481f1d840 fix: modify event API description
Change-Id: I62a819f3407fb933e0bb2ff2e97eda6e643acafb
2021-05-08 10:17:11 +08:00
rtos-lover
f7d50d0fbf fix: fix function name
correct function name OsSchedSetIdleTaskSchedParam

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3PXEX
2021-05-08 10:12:52 +08:00
rtos-lover
e7ea50f131 fix: correct spelling
correct type in los_memory.c

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3PYC3
2021-05-08 10:06:01 +08:00
rtos-lover
02ac3ade30 fix:correct spelling
corrent those typos in log_debug.h los_exc.S

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3PVZV
2021-05-08 10:00:57 +08:00
kenneth
259fb54b3c fix: change to OpenHarmony LiteOS-M 2021-05-08 09:29:40 +08:00
kenneth
be57ece9ce fix: update macro to config item 2021-05-07 20:44:58 +08:00
kenneth
656fd1e422 fix:update according to review comments
the latest OpenHarmony code is needed.
2021-05-07 20:43:54 +08:00
li_zan
94c0727e1d Add already opened file logic 2021-05-07 15:25:42 +08:00
li_zan
cd292f8428 Add already opened file logic 2021-05-07 11:35:51 +08:00
li_zan
a99f817c23 Add already opened file logic 2021-05-07 11:35:08 +08:00
openharmony_ci
167b4d0c37 !87 合入某功能产品在M核上文件系统littlefs的适配代码
Merge pull request !87 from li_zan/master
2021-05-07 10:10:16 +08:00
openharmony_ci
9991911927 !98 fix:Scheduling optimization, test case adaptation modification
Merge pull request !98 from zhushengle/test
2021-05-06 21:19:06 +08:00
zhushengle
1a7a6b9ffe fix:Scheduling optimization, test case adaptation modification.
Close #I3OING

Change-Id: Ia131ebb46e92578081f2df93010eaf305dfbf977
2021-05-06 19:35:02 +08:00
openharmony_ci
4163a99123 !108 fix:delete redundant local variable
Merge pull request !108 from Harylee/delete
2021-05-06 19:28:22 +08:00
openharmony_ci
111f9476ea !106 fix: misspell
Merge pull request !106 from Harylee/update_osal
2021-05-06 19:25:26 +08:00
openharmony_ci
b57d33ba07 !105 L0 swtmr_align定时器在相同周期时,count计算错误,且相同响应时间时,后插入的节点应该位于已存在节点的后面
Merge pull request !105 from zhushengle/swtmr
2021-05-06 19:17:02 +08:00
kenneth
a38365ed09 fix: change description according to review 2021-05-06 19:04:59 +08:00
kenneth
4dc0d313d1 fix: update according to review comments 2021-05-06 17:05:22 +08:00
Haryslee
fcf7db5022 fix:delete redundant local variable
Change-Id: Ia3a01d91866a96f8b47c66a4af0042254e24f69f
2021-05-06 15:21:54 +08:00
Haryslee
26ed722cf0 fix:enum misspell
Change-Id: I0ae966a7738fe087e222dc1441c8409a1e1661e0
2021-05-06 15:07:15 +08:00
Haryslee
30578a6a68 fix: misspell
Change-Id: I29c6df3ea2e1c23529373de74aa634be0c3de114
2021-05-06 11:46:52 +08:00
zhushengle
5cda1e77cc fix:The SWTMR_ALIGN timer calculates the count error for the same period, and for the same response time, the later-inserted node should be behind the existing node.
Close #I3PS5B

Change-Id: I15317e64ea3376a4880e8eb0a3af3e3e8449ba08
2021-05-06 10:37:24 +08:00
kenneth
5c19fd4bec fix: update doc usage 2021-05-06 10:23:53 +08:00
kenneth
954c2fcfb5 fix: update document description 2021-05-06 10:20:47 +08:00
kenneth
85b18bdfce add: add introduction on project example 2021-05-06 10:11:04 +08:00
kenneth
d4c77b729b add: add ninja、gn compilation 2021-05-06 09:55:59 +08:00
li_zan
9bebc0fb82 add littlefs code 2021-04-30 17:02:42 +08:00
li_zan
2d21fca6e8 add littlefs code 2021-04-30 16:29:10 +08:00
li_zan
928827f62e add littlefs code 2021-04-30 15:16:34 +08:00
li_zan
580ef55f7e add littlefs code 2021-04-30 14:33:00 +08:00
openharmony_ci
58023d89c5 !91 fix LOS_MEMBOX_ALIGNED macro name
Merge pull request !91 from rtos-lover/master
2021-04-30 08:36:11 +08:00
openharmony_ci
6c83107292 !91 fix LOS_MEMBOX_ALIGNED macro name
Merge pull request !91 from rtos-lover/master
2021-04-30 08:36:10 +08:00
openharmony_ci
032f96e7d6 !102 fix: include file log_config.h in los_mpu.c
Merge pull request !102 from kenneth/master
2021-04-30 08:35:44 +08:00
openharmony_ci
b69ac58a97 !103 fix: modify type INLNIE
Merge pull request !103 from tel5021/master
2021-04-30 08:35:26 +08:00
openharmony_ci
0a65cfb651 !100 fix: L0 GN compilation problem
Merge pull request !100 from zhushengle/SIG
2021-04-29 16:37:19 +08:00
tel5021
294a6d246b fix: modify type INLNIE 2021-04-29 16:03:21 +08:00
kenneth
1932d714a5 fix: include file log_config.h in los_mpu.c
include log_config.h in kernel\arch\arm\cortex-m7\iar\los_mpu.c to solve compilation issue

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3OHY2
2021-04-29 15:23:44 +08:00
zhushengle
2f9bfcc6ee fix: L0 GN compilation problem
Close: #I3ORHS
Change-Id: Ia105084336f2ba66f91546226a9383646a0148ce
2021-04-29 10:38:54 +08:00
openharmony_ci
4f39369e13 !99 刷新submodule并将其URL改为使用相对路径
Merge pull request !99 from Caoruihong/relative_url
2021-04-29 09:17:16 +08:00
openharmony_ci
814e70270b !90 fix: remove targets project files
Merge pull request !90 from kenneth/master
2021-04-29 08:37:31 +08:00
Caoruihong
3ae790b065 use relative url for submodules
Change-Id: I3445dfb7b62888a2f6674fdebd364fb1727c61aa
2021-04-29 00:55:52 +08:00
openharmony_ci
1f725147f3 !96 fix:Fixed kernel error with header protector and header comment description.
Merge pull request !96 from zhushengle/others
2021-04-28 09:09:07 +08:00
openharmony_ci
f65e14bf3b !97 使内核使用正确的securec库
Merge pull request !97 from Caoruihong/securec_m
2021-04-27 21:11:06 +08:00
openharmony_ci
e638d1a41a !60 Add support for Nuclei RISC-V 32 bit processor in LiteOS-M of OpenHarmony
Merge pull request !60 from linzewenTin/dev_nuclei
2021-04-27 20:43:55 +08:00
Caoruihong
9cc5b79da1 use liteos_m specific securec build configuration
Change-Id: Id1ca03e0c7456724c1ba55fef4dbd07ba6213285
2021-04-27 16:54:32 +08:00
openharmony_ci
6c1ce1c1cc !84 style: align with first param line
Merge pull request !84 from MGY917/master
2021-04-27 11:40:12 +08:00
openharmony_ci
5b9eed0328 !95 fix:Scheduling module code to join GN compilation.
Merge pull request !95 from zhushengle/gn
2021-04-26 21:30:56 +08:00
openharmony_ci
4e568d1cbf !92 先使用顶层third_party, 后继再改用本仓库中的third_party
Merge pull request !92 from Caoruihong/top_third_party
2021-04-26 21:23:14 +08:00
openharmony_ci
667d0992f0 !94 恢复hos_cmsis_adp.h
Merge pull request !94 from Caoruihong/restore_hos_cmsis_adp_h
2021-04-26 21:23:04 +08:00
zhushengle
3907238b0f fix:Fixed kernel error with header protector and header comment description.
Close #I3O4SF

Change-Id: I544cde728fb8131d199a21be440ae02da2fe21fb
2021-04-26 21:13:55 +08:00
Caoruihong
19ccb7c76c restore hos_cmsis_adp.h
Change-Id: I9a37ebec3ea4e94652a723ae612691b9888705ed
2021-04-26 18:57:39 +08:00
zhushengle
8bf166b418 fix: Scheduling module code to join GN compilation.
Close #I3OA95

Change-Id: I19b25af29a078be048274ca98d970f3554491138
2021-04-26 18:57:33 +08:00
openharmony_ci
524317fa9f !89 fix:Fixed comment description for OS_TSK_GET_INDEX error
Merge pull request !89 from zhushengle/master
2021-04-26 18:53:19 +08:00
openharmony_ci
2659b02d2d !93 先保留CMSIS和SECUREC组件的旧的路径可用
Merge pull request !93 from Caoruihong/keep_old_path
2021-04-26 18:49:55 +08:00
Caoruihong
3db2a98360 keep old path available
Change-Id: I0b97d5f82386c6d642b94c390e24eede81cd7c54
2021-04-26 18:27:52 +08:00
Caoruihong
4d556fbe90 use top third_party
Change-Id: I382b10ef7a6adc328777349bce142e58895f7c8d
2021-04-26 17:11:56 +08:00
linzewen
70620b1cb6 Kernel: Remove unused function
Signed-off-by: linzewen <linzewen@nucleisys.com>
2021-04-25 20:58:53 -07:00
linzewen
4475439ca1 Kernel:Fix typo
Signed-off-by: linzewen <linzewen@nucleisys.com>
2021-04-25 20:08:41 -07:00
linzewen
dab3a81ac7 Kernel: Update task switch and delete some unused variables
Signed-off-by: linzewen <linzewen@nucleisys.com>
2021-04-25 19:55:37 -07:00
rtos-lover
fced8992cf fix: fix LOS_MEMBOX_ALIGNED macro name
change LOS_MEMBOX_ALLIGNED to fix LOS_MEMBOX_ALIGNED
2021-04-26 09:42:24 +08:00
kenneth
f39da5a6da fix: remove targets project files
remove cortex-m3_stm32f103_simulator_keil、cortex-m4_stm32f429ig_fire-challenger_iar、cortex-m7_nucleo_f767zi_gcc project files

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3NTW6?from=project-issue
2021-04-26 09:30:58 +08:00
li_zan
ac46317e0f add littlefs code 2021-04-25 20:42:35 +08:00
li_zan
10b416e74f add littlefs code 2021-04-25 17:41:42 +08:00
zhushengle
912bf69866 fix:Fixed comment description for OS_TSK_GET_INDEX error 2021-04-25 17:40:11 +08:00
openharmony_ci
b8cd812303 !83 fix:Provide a system CPU wait interface
Merge pull request !83 from zhushengle/master
2021-04-25 17:32:38 +08:00
linzewen
1639cf484d Target:Fix typo
Signed-off-by: linzewen <linzewen@nucleisys.com>
2021-04-25 02:25:13 -07:00
linzewen
2f3ea928df Target:Update demo soc config file and fix typo
Signed-off-by: linzewen <linzewen@nucleisys.com>
2021-04-25 02:19:24 -07:00
linzewen
24a847a111 Target: Update RV-STAR config file and fix some typo
Signed-off-by: linzewen <linzewen@nucleisys.com>
2021-04-25 02:19:24 -07:00
linzewen
6c60393567 kernel: update nuclei risc-v porting code
Signed-off-by: linzewen <linzewen@nucleisys.com>
2021-04-25 02:19:24 -07:00
linzewen
b4f5bc433c Update nuclei demo soc to latest version
Based on Nuclei SDK v0.3.1

Signed-off-by: linzewen <linzewen@nucleisys.com>
2021-04-25 02:19:24 -07:00
linzewen
4170e57f18 Fix some issues
Move some functions from head file to c file
Change interrupt function argument
The "hwiPrio" argument high 16 bit for level and low 16 bit for priority

Signed-off-by: linzewen <linzewen@nucleisys.com>
2021-04-25 02:19:24 -07:00
linzewen
2f3ded2a11 Add makefile based project for Nuclei RV_STAR board
Setup tools for compilment and entering GCC folder under riscv_nuclei_gd32vf103_soc_gcc
Using "make all" command to compile project
Using "make clean" command to clean project
Using "make debug" command to debug project
Using "make upload" command to upload project
OS configurations is under "OS_CONFIG" folder
Most information can be found in README.md

Signed-off-by: linzewen <linzewen@nucleisys.com>
2021-04-25 02:19:24 -07:00
linzewen
746d56b7b9 Add makefile based project for Nuclei ddr200T board
Setup tools for compilment and entering GCC folder under riscv_nuclei_demo_soc_gcc
Using "make all" command to compile project
Using "make clean" command to clean project
Using "make debug" command to debug project
Using "make upload" command to upload project
OS configurations is under "OS_CONFIG" folder
Most information can be found in README.md

Signed-off-by: linzewen <linzewen@nucleisys.com>
2021-04-25 02:19:24 -07:00
linzewen
6c8da43bc9 Add Nuclei RISC-V support
This kernel is setup for rv32 arch with gcc compiler.

Signed-off-by: linzewen <linzewen@nucleisys.com>
2021-04-25 02:19:24 -07:00
openharmony_ci
f96848e4ce !85 fix some typos
Merge pull request !85 from kenneth/master
2021-04-25 15:30:16 +08:00
li_zan
3ae9d36049 add littlefs code 2021-04-24 11:50:43 +08:00
li_zan
606bd9ca08 add littlefs code 2021-04-24 11:23:49 +08:00
openharmony_ci
8168885709 !82 加入FatFs同时修正BUILD.gn中third_party路径
Merge pull request !82 from Caoruihong/fix_thirdparty_path
2021-04-23 17:57:13 +08:00
zhushengle
adaf6cf7c5 fix:Change the interface to LOS_UDelay and change the input parameter to microsecond.
Close #I3NT3Y

Change-Id: Iae33e0aff59480342b07bb4fd2e66969a09affb3
2021-04-23 17:33:27 +08:00
kenneth
f6b8cab253 fix: fix some typo issues
change 'LOS_MOUDLE_ID' to 'LOS_MODULE_ID', change 'a interrupt' to 'an interrupt', change 'HalIsIntAcvive' to 'HalIsIntActive' and other typos.

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3NNOQ, https://gitee.com/openharmony/kernel_liteos_m/issues/I3NNR6, https://gitee.com/openharmony/kernel_liteos_m/issues/I3NNTL, https://gitee.com/openharmony/kernel_liteos_m/issues/I3NNQ1
2021-04-23 17:19:01 +08:00
Guangyao Ma
c6d36f5915 style: align with first param line
Change-Id: Ifc14322a05a624d5c24ef4dca25c1ad7299aeed1
2021-04-23 17:10:47 +08:00
zhushengle
9656d852ab fix:Add LOS_SysDelay declaration.
Close #I3NT3Y

Change-Id: I14a1edc3f9aa06cba28ad51a12f21f6fdcf14fd0
2021-04-23 15:38:11 +08:00
zhushengle
583d177de0 fix:Provide a CPU delay interface
Close #I3NT3Y

Change-Id: I30c984a95a77cbddabdae2900ab8fcf9d7eac1ac
2021-04-23 14:50:27 +08:00
openharmony_ci
3ca3a3e250 !80 fix: fix some misspell in comments
Merge pull request !80 from rtos-lover/master
2021-04-23 14:42:16 +08:00
Caoruihong
ad1e09ff77 add third_party FatFs and fix BUILD.gn
Change-Id: I456530ca5282d6c4b0904d04ae0a0a5ff155391a
2021-04-23 12:05:48 +08:00
openharmony_ci
18aa697589 !64 liteos_m 调度优化及低功耗设计
Merge pull request !64 from zhushengle/sched
2021-04-23 11:01:40 +08:00
zhushengle
afdda22821 fix:Solution of conflict
Change-Id: If2565e5942ca019865720d56dd8bda1617044e6d
2021-04-22 14:33:20 +08:00
openharmony_ci
23360db35c !81 posix模块编译中增加 pthread_cond.c
Merge pull request !81 from zhangfanfan2/master
2021-04-22 13:57:04 +08:00
openharmony_ci
77581810c3 !77 通过git submodule使用third_party组件
Merge pull request !77 from Caoruihong/third_party
2021-04-22 11:48:25 +08:00
zhangfanfan2
0a22391490 feature:add "pthread_cond.c" to compile in posix module 2021-04-22 11:46:37 +08:00
openharmony_ci
424f7ad6dc !79 将NORETURN声明放到函数前,KEIL不支持放在函数后
Merge pull request !79 from Caoruihong/fix_noreturn
2021-04-22 11:26:45 +08:00
openharmony_ci
8e3a4325e0 !36 Fixed mixed CH and En characters
Merge pull request !36 from davidinux/master
2021-04-21 22:18:01 +08:00
rtos-lover
457281427b fix: fix misspell in comments
change misspell __cpluscplus to __cplusplus

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3NG3P?from=project-issue
2021-04-21 18:29:53 +08:00
Caoruihong
14f0d7286a move noreturn attribute in front
Change-Id: I267fa3fcaa068fe9465231a5edac531b1b539eda
2021-04-21 17:19:07 +08:00
Caoruihong
b70f2c3e91 use third_party by git submodules
Change-Id: I1e2fe3e887c5ec528921534d4618d89d8cf90759
2021-04-21 16:53:49 +08:00
zhushengle
793d2139b2 fix:Solution of conflict.
Close #I3IK07

Change-Id: I6913691a28c90b54fbda233209d43b981884f10c
2021-04-20 14:56:26 +08:00
openharmony_ci
4474869a07 !75 删除无用的__cplusplus,移除不必要的文件x权限
Merge pull request !75 from Caoruihong/cplusplus
2021-04-20 09:01:48 +08:00
Caoruihong
3cea0e42b1 remove __cplusplus guards in .c files
Change-Id: Ie25b83a42d3ca35c3a6d624ef01f425a85957d7f
2021-04-19 18:19:28 +08:00
openharmony_ci
f278a00483 !73 修复LOS_MemInfoGet接口入参无清零的问题
Merge pull request !73 from JerryH/master
2021-04-19 14:19:20 +08:00
YOUR_NAME
d642d90a7d IssueNo:#I3IDB0
Description:Fix the problem that the interface does not reset the output parameter.
Sig:liteos_m
Feature or Bugfix:Bugfix
Binary Source:No

Change-Id: I9e6f7a6813c4eb70b22681fc6a4994eae44a1b64
2021-04-17 16:22:29 +08:00
zhushengle
bad8c3d53b IssueNo:#I3IK07
Description:LOS_SysCycleGet replace HalCpuCycleGet
Sig:kernel
Feature or Bugfix:Feature
Binary Source:No

Change-Id: Ife3a4d351818f718f58d3624b5ee6dd127113378
2021-04-17 16:07:51 +08:00
zhushengle
c5f517667a IssueNo:#I3IK07
Description:Resolve the conflict.
Feature or Bugfix:Feature
Binary Source:No

Change-Id: I882dcb9e523cab30e6ab4889099984fe0302f92e
2021-04-17 11:03:45 +08:00
zhushengle
3ae472f739 IssueNo:#I3IK07
Description:HalGetCpuCycle cancel the weak attribute
Sig:kernel
Feature or Bugfix:Feature
Binary Source:No

Change-Id: Ic88577e70626f760a8831ef98d7cda95b9dfaad4
2021-04-17 10:49:39 +08:00
openharmony_ci
d11a206619 !72 为LOS_Panic等函数添加noreturn属性
Merge pull request !72 from Caoruihong/noreturn
2021-04-17 09:24:12 +08:00
openharmony_ci
7fdbff3851 !66 优化HalSetRtcTime之类接口定义及说明
Merge pull request !66 from Caoruihong/RtcTime
2021-04-17 09:23:49 +08:00
Caoruihong
6bf6efdc7e add noreturn attribute for LOS_Panic LOS_Reboot and HalSysExit
Change-Id: I65bbdd3d60aa754a389f9371649a96483d2a6f8a
2021-04-16 19:32:01 +08:00
zhushengle
49be405820 Merge remote-tracking branch 'origin/master' into HEAD
Change-Id: I9a1458b1344f89ca04cab96c3599c9cfea757929
2021-04-16 19:22:07 +08:00
zhushengle
57f6e1f181 IssueNo:I3IK07
Description:liteos_m scheduling optimization and low power design.
Sig:kernel
Feature or Bugfix:Feature
Binary Source:No

Change-Id: I6ccbe267ec20f93f97032c5b006c3214eb099daa
2021-04-16 18:54:47 +08:00
openharmony_ci
530b738dec !71 【轻量级 PR】:fix osEventFlagsGet for #I3IP98
Merge pull request !71 from Caoruihong/N/A
2021-04-16 15:30:17 +08:00
Caoruihong
a5338840c0 fix osEventFlagsGet for #I3IP98 2021-04-16 14:48:32 +08:00
Caoruihong
1732679354 optimize Hal<Set/Get>Rtc<Time/Timezone> APIs
Change-Id: I2ba4b2d05c59f6c7532526fff0f2587b5b6719f0
2021-04-16 11:58:05 +08:00
openharmony_ci
a09d38a983 !70 lwip适配内核posix接口
Merge pull request !70 from 刘建东/master
2021-04-16 08:02:51 +08:00
openharmony_ci
e000ba3941 !69 新增hook适配层在其他平台上中断trace的支持
Merge pull request !69 from Zhaotianyu/0415hook
2021-04-16 07:55:30 +08:00
YOUR_NAME
92c4e63ae7 IssueNo:#I3IMWT
Description:use posix instead of lwip self
Feature or Bugfix:Bugfix
Binary Source:No
2021-04-15 20:00:41 +08:00
openharmony_ci
a03c2bb664 !68 支持osThreadNew函数attr为NULL时创建线程,同时修正线程优先级的转换
Merge pull request !68 from Caoruihong/osThreadNew
2021-04-15 18:35:44 +08:00
arvinzzz
84a9f65597 Description: The hook adaptation layer adds support for interrupts on other platforms.
Change-Id: I09636885b2edf893322ea5fb0eabef02266875a0
2021-04-15 15:53:30 +08:00
Caoruihong
2b88a46965 support osThreadNew with NULL attr parameter and fix priority issues
Change-Id: Ie26b6878f8742207545e55372f724872a932542a
2021-04-15 00:12:37 +08:00
zhushengle
628cdcbea0 IssueNo:#I3IK07
Description:liteos_m scheduling optimization and low power design.
Sig:kernel
Feature or Bugfix:Feature
Binary Source:No

Change-Id: I56bb190c73c8d7497ddbf2ad49ad522143008117
2021-04-14 17:27:42 +08:00
guanzehui
8b23ffca0d Description: opensource check,modify posix and unittest,add unit fuzz test case
Team: OTHERS
Feature or Bugfix:Feature
Binary Source:No
PrivateCode(Yes/No):No
Change-Id: Ia95966e595109db01440cffa062cf3aff4faa3b8
ChangeID:13651229
2021-04-14 14:34:48 +08:00
zhushengle
cd30e62998 IssueNo:#I3IK07
Description:liteos_m scheduling optimization and low power design.
Sig:kernel
Feature or Bugfix:Feature
Binary Source:No

Change-Id: I5b692a503ce6128626eec8f9a37742d7caa1fea9
2021-04-14 09:22:36 +08:00
zhushengle
f685eeb97d IssueNo:#I3IK07
Description:liteos_m scheduling optimization and low power design.
Sig:kernel
Feature or Bugfix:Feature
Binary Source:No

Change-Id: If913b673c9b69039b51ca416be0a77ebccf2773b
2021-04-13 21:48:04 +08:00
openharmony_ci
f6151020de !63 lwip适配内核posix接口
Merge pull request !63 from 刘建东/master
2021-04-13 14:22:18 +08:00
YOUR_NAME
788f9d2b4f IssueNo:#I3IBCL
Description:use posix instead of lwip self
Feature or Bugfix:Bugfix
Binary Source:No
2021-04-12 21:34:37 +08:00
YOUR_NAME
eca2fae28a IssueNo:#I3IBCL
Description:use posix instead of lwip self
Feature or Bugfix:Bugfix
Binary Source:No
2021-04-12 20:37:22 +08:00
YOUR_NAME
247959fcbc IssueNo:#I3IBCL
Description:use posix instead of lwip self
Feature or Bugfix:Bugfix
Binary Source:No
2021-04-12 10:57:50 +08:00
YOUR_NAME
80fe0c7d2a IssueNo:#I3IBCL
Description:use posix instead of lwip self
Feature or Bugfix:Bugfix
Binary Source:No
2021-04-12 10:26:02 +08:00
openharmony_ci
c6a520b7f8 !58 Add issue and PR template for master
Merge pull request !58 from 马明帅/add_issus_pr_template_for_master
2021-04-11 09:46:55 +08:00
openharmony_ci
45a8a3812c !52 heap初始化做address以及size的对齐检查
Merge pull request !52 from 金永生/los_heap
2021-04-10 09:03:51 +08:00
openharmony_ci
63d340305c !56 修复limits.h中部分宏定义
Merge pull request !56 from Zhaotianyu/0406limits
2021-04-09 17:17:57 +08:00
arvinzzz
caffe81339 IssueNo:#I3HGTM
Description: Fix some macro definitions of limits.h.
Feature or Bugfix: Bugfix
Binary Source:NA

Change-Id: I419c712f8605f8a0d2d6cb0b6c3831cea0e742e1
2021-04-09 10:05:57 +08:00
openharmony_ci
2c17c08c03 !61 mq_getattr & setattr interface add
Merge pull request !61 from give-me-five/master
2021-04-08 14:28:37 +08:00
openharmony_ci
1ffc972340 !62 Fix the issue that interrupt vector array alignment
Merge pull request !62 from Harylee/os
2021-04-08 14:27:12 +08:00
wuyunjie
d731b1aeb5 mqattr set get
Change-Id: I990a50335f6c2a9deaef87d445a970d4f398a0a5
2021-04-08 10:26:39 +08:00
Haryslee
6f92ee70bd Fix the issue that interrupt vector array alignment
Change-Id: I3200eff0e5b048135cd05ffa4e7559633088dc03
2021-04-07 20:02:13 +08:00
openharmony_ci
f2d61153c6 !57 L0 testsuit upload
Merge pull request !57 from give-me-five/master
2021-04-07 16:36:15 +08:00
mamingshuai
e367306278 add issue and pr template 2021-04-07 14:49:54 +08:00
x_xiny
449f27d5cb add l0 testsuits
Change-Id: I523269c97053f484d5cb0d94397269e41eaae86c
2021-04-07 11:19:43 +08:00
openharmony_ci
4fc4b8c9c1 !55 【轻量级 PR】:fix pthread_create timing bug
Merge pull request !55 from Caoruihong/N/A
2021-04-02 18:01:27 +08:00
Caoruihong
5b2c3f2c89 fix pthread_create timing bug 2021-04-02 16:18:19 +08:00
openharmony_ci
1d2ec9d05d !54 add hook framework
Merge pull request !54 from Zhaotianyu/master
2021-04-02 15:36:02 +08:00
arvinzzz
62caa74382 Description: add hook framework
Change-Id: I45c37c3c92e74e676818e713fa46b3a9fe970e68
2021-04-01 11:26:49 +08:00
金永生
9af0cd4891 modify:heapInit:check the heap addr and size for configured alignsize, if not, return err 2021-03-30 19:43:21 +08:00
openharmony_ci
9a9ffb0770 !49 使用01替换YES NO的依赖
Merge pull request !49 from 刘建东/master
2021-03-30 10:55:03 +08:00
YOUR_NAME
efc0c4455a IssueNo:#I3E5C3
Description:use 0 1 instead of YES NO
Sig:phone
Feature or Bugfix:Bugfix
Binary Source:No
2021-03-30 10:07:13 +08:00
openharmony_ci
dd02d2980c !46 添加基于MPU功能的任务栈保护机制
Merge pull request !46 from JerryH/master
2021-03-29 14:27:37 +08:00
openharmony_ci
024c18741b !47 L0 posix接口新增
Merge pull request !47 from give-me-five/noEmployeeNum_ChangeID_13439291_wuyunjie
2021-03-27 16:46:43 +08:00
wuyunjie
955b52e4b2 Description:l0 posix interface
Team: OTHERS
Feature or Bugfix:Feature
Binary Source:No
PrivateCode(Yes/No):No

Change-Id: I8bcb92a97a98c61077c55704dec03c997d1246da
ChangeID:13439291
2021-03-27 10:38:56 +08:00
YOUR_NAME
f5b7a2ed60 IssueNo:I3DGV9
Description:Add task stack protection by mpu.
Sig:liteos_m
Feature or Bugfix:Feature
Binary Source: No

Change-Id: I13e301379756f61677eeb44be41928cbf21e3eaa
2021-03-27 10:21:50 +08:00
openharmony_ci
3887b13564 !43 PendSv Fix for the cortex_m
Merge pull request !43 from 金永生/pendSV
2021-03-24 18:19:58 +08:00
金永生
bc31d46e42 fix:pendsv trigger for cortex-m SOC:some cpu will not enter pendsv when set the flag,and we need dsb and isb to fix this 2021-03-24 15:47:54 +08:00
openharmony_ci
5d8e3802b6 !39 修复liteos_m M3 keil工程编译失败的问题
Merge pull request !39 from zhushengle/origin/master
2021-03-23 17:15:14 +08:00
openharmony_ci
d070a997bc !41 Clean CodingStyle
Merge pull request !41 from JerryH/master
2021-03-23 16:57:32 +08:00
YOUR_NAME
70ebb57f28 Fix CodingStyle.
Change-Id: Ib76b61c7f22b8a978a4f36e398198f2e8ec0507b
2021-03-23 16:02:05 +08:00
openharmony_ci
1dca794c19 !34 解决time_t类型内核与业务可能存在的不匹配问题
Merge pull request !34 from JerryH/compiler
2021-03-23 10:59:01 +08:00
zhushengle
e84043e019 修复M3 keil工程编译失败问题
Change-Id: I7784f584c1a74cf5c5adbb9574ce1cc1db73ba06
2021-03-23 09:38:05 +08:00
openharmony_ci
2211321c56 !33 update readme
Merge pull request !33 from Harylee/master
2021-03-22 20:55:32 +08:00
davidinux
742f65d876 Interrupt typo fixed 2021-03-22 11:37:38 +01:00
davidinux
e8ae0fe38f Fixed mixed En ad Ch characters 2021-03-22 11:15:32 +01:00
YOUR_NAME
64895f8c3d Fix compiler error.
Change-Id: Iaa0ecd02e8c25ec1ebdd67a09e8b4ca961375318
2021-03-22 16:41:28 +08:00
YOUR_NAME
34c82ccd64 Add exc dump.
Change-Id: Ie3b925f89a01ade5f4a4fae6ff2eff94d97176da
2021-03-22 16:33:38 +08:00
lihao
9b803b0cd9 update readme
Change-Id: Ia6f88a48a49891df882f1876fd178518362461c8
2021-03-22 16:29:18 +08:00
openharmony_ci
d8fcb97fc6 !27 update ReadME.md
Merge pull request !27 from Harylee/noEmployeeNum_ChangeID_13291529_lihao
2021-03-17 09:38:25 +08:00
lihao
e4d8db9c22 Description:update ReadME.md
Team:OTHERS
Feature or Bugfix:Bugfix
Binary Source:NA
PrivateCode(Yes/No):Yes

Change-Id: Ida5ba9464d03d47068fb67cb5851b6dc0465ebca
ChangeID:13291529
2021-03-16 16:53:42 +08:00
mamingshuai
778c8b9930 update openharmony 1.0.1 2021-03-11 20:30:40 +08:00
openharmony_ci
c343c46b91 !21 添加cortex-m4的gcc 编译支持
Merge pull request !21 from 候鹏飞/master
2021-02-05 14:16:14 +08:00
openharmony_ci
71fb214c32 !24 liteos_m内核修改更新
Merge pull request !24 from JerryH/master
2021-02-01 08:43:52 +08:00
openharmony_ci
f035467ff3 !20 补充POSIX API头文件(来自musl)
Merge pull request !20 from Caoruihong/noEmployeeNum_caoruihong_12623753_20210122163214
2021-01-31 00:21:52 +08:00
huangjieliang
25b432927c Description: Sync liteos_m to OpenHarmony.
Reviewed-by: likailong
2021-01-30 18:05:13 +08:00
openharmony_ci
b030e0e8e2 !22 支持Cortex-M33
Merge pull request !22 from Caoruihong/master
2021-01-29 18:51:38 +08:00
c00546070
0df84c9ff1 Description: add cortex-m33 for rtl8720
Reviewed-by: shenwei
2021-01-29 17:28:45 +08:00
候鹏飞
867e7fb566 add cortex-m4 gcc 2021-01-28 16:10:21 +08:00
caoruihong
d3e54ea9aa Description: add posix api header files from musl
CommitID:70a1d0d4761c478b6b33c3eb29af254a445ada74
2021-01-22 16:32:15 +08:00
openharmony_ci
0e35ee9f73 !19 为liteos_m添加部分POSIX API
Merge pull request !19 from Caoruihong/master
2021-01-22 15:58:45 +08:00
Caoruihong
c3a34f1b79 Description: add posix api for liteos_m
Reviewed-by: likailong

Change-Id: I4f83c38d201ce6efe214509958c346aa9e542155
2021-01-21 23:47:21 +08:00
openharmony_ci
13355bb6a7 !18 【轻量级 PR】:修复CPUP编译失败问题
Merge pull request !18 from zhushengle/N/A
2021-01-20 14:13:30 +08:00
zhushengle
e12055cfcc 修复CPUP编译失败问题 2021-01-20 11:07:55 +08:00
openharmony_ci
5ee1803849 !16 支持riscv未对齐访问异常扩展
Merge pull request !16 from zhushengle/riscv
2021-01-16 15:31:53 +08:00
zhushengle
282f64c9eb Description:support for RISCV unaligned access to exception handling extensions.
Reviewed-by:likailong
2021-01-15 12:15:34 +08:00
openharmony_ci
0c14e12d34 !15 通过寄存器CPACR判断FPU是否使能
Merge pull request !15 from likailong/master
2021-01-11 22:06:35 +08:00
likailong
6d57e3cf30 Description: test FPU enabled or not by register
Reviewed-by: shenwei
2021-01-11 20:58:37 +08:00
likailong
a13512eefe Description: 2021-01-11 20:53:14 +08:00
openharmony_ci
a4c14e1614 !13 支持使用默认中断矢量寄存器地址
Merge pull request !13 from likailong/master
2021-01-11 18:43:34 +08:00
likailong
c766d49a4d Description: support original vector base address
Reviewed-by: shenwei
2021-01-11 11:04:40 +08:00
openharmony_ci
6474c37e79 !14 【轻量级 PR】:修复错误的中断控制位
Merge pull request !14 from zhushengle/N/A
2021-01-11 09:37:12 +08:00
zhushengle
6252cad79b update kernel/arch/risc-v/asm/soc_common.h. 2021-01-09 16:08:14 +08:00
likailong
5cee04fb0c Description: support original vector base address
Reviewed-by: shenwei
2021-01-08 19:04:35 +08:00
openharmony_ci
e38c8dfa0f !12 修复float-abi为soft时系统崩溃的问题
Merge pull request !12 from likailong/master
2021-01-08 11:02:27 +08:00
likailong
4c6ccb42f2 Merge branch 'master' of https://gitee.com/kkup180/kernel_liteos_m 2021-01-08 08:53:24 +08:00
likailong
992410db46 Description: fix float-abi=soft bug
Reviewed-by: shenwei
2021-01-08 08:50:29 +08:00
likailong
5f386b7e09 Description: fix float-abi=soft bug
Reviewed-by: shenwei
2021-01-07 21:45:24 +08:00
openharmony_ci
f5a0eef5d0 !11 为CORTEX-M7架构提供具体的开发板适配样例
Merge pull request !11 from Lixilun/lixilun_20210107150034
2021-01-07 16:21:51 +08:00
lixilun
f4d93476d6 Description: Port NUCLEO-F767ZI as an example.
Reviewed-by: likailong

Change-Id: I13482a4d1933de607c4782f71cf285c6602ee1db
2021-01-07 14:59:06 +08:00
openharmony_ci
8a22597afc !10 提升risc-v 中断处理架构兼容性
Merge pull request !10 from zhushengle/zhushengle_20201231163244
2020-12-31 21:31:36 +08:00
zhushengle
df9dc72e45 Description:The interrupt handling interface supports multiple architectures.
Reviewed-by:likailong

Change-Id: I9d6e40f6889ff6a8e3de2054b979b8dece3584a5
2020-12-31 16:24:40 +08:00
openharmony_ci
0e068d06a3 !9 提供Cortex-M7的支持
Merge pull request !9 from Lixilun/lixilun_20201223135923
2020-12-23 16:32:45 +08:00
lixilun@huawei.com
87dc04812d Description: Port Cortex-M7
Reviewed-by: Likailong

Change-Id: I10bd6fc60111c3059fcc5b4d0d36d13790e5b73d
2020-12-23 02:36:06 +00:00
openharmony_ci
77c55d835e !8 重构,方便移植第三方芯片
Merge pull request !8 from Caoruihong/caoruihong_20201216180422
2020-12-18 08:56:41 +08:00
Caoruihong
1405111aa9 Description: refactor
Reviewed-by: likailong
2020-12-16 17:30:08 +08:00
openharmony_ci
b295e8e28f !7 移动 riscv qemu 到/device/qemu
Merge pull request !7 from zhushengle/new
2020-12-11 09:44:57 +08:00
zhushengle
64c784bb46 move riscv32 qemu form liteos_m to /device/qemu 2020-12-10 17:48:32 +08:00
likailong
5d158d57a8 update arch_spec.md. 2020-12-03 16:48:08 +08:00
openharmony_ci
e46df54855 !6 修复IAR和Keil工程编译问题
Merge pull request !6 from likailong/master
2020-12-03 16:41:13 +08:00
likailong
547cbdb562 Description: IAR and Keil project remove los_misc.c and los_err.c, add utils/los_error.c
Reviewed-by: wangmihu
2020-12-03 15:45:27 +08:00
openharmony_ci
f4700a8dad !5 liteos-m重构
Merge pull request !5 from likailong/likailong_20201202194221
2020-12-03 15:34:44 +08:00
likailong
72c4acf01e Description: liteos-m refactoring
Reviewed-by: wangmihu, zhushengle
2020-12-02 19:40:34 +08:00
openharmony_ci
f7d1409762 !4 支持RISC-V架构
Merge pull request !4 from zhushengle/zhushengle_20201127151823
2020-11-27 17:38:44 +08:00
zhushengle
82082fc0e6 Description:Liteos_m Support risc-v
Reviewed-by:likailong, zhangfanfan
2020-11-27 15:20:02 +08:00
openharmony_ci
4b65155c4e !3 liteos-m refactoring
Merge pull request !3 from likailong/likailong_20201113180141
2020-11-16 14:52:20 +08:00
l00278955
07d25a8ae8 Description: liteos-m refactoring
Reviewed-by: liulei, shenwei

Change-Id: I7baba352c02b78aefc81fc5eca000d840d3b2fe3
2020-11-13 09:55:39 +08:00
Han
cd95966e18 !1 Delete unused comments
Merge pull request !1 from 五元/master
2020-09-10 20:12:39 +08:00
文峻_HW
1f97c05fc4 add LICENSE. 2020-09-10 18:14:45 +08:00
five-yuan
1efc35ba98 delete unused comment 2020-09-10 18:12:35 +08:00
panny
8ff7eb247b update readme.md. 2020-09-10 12:52:08 +08:00
1617 changed files with 229037 additions and 17247 deletions

6
.gitee/ISSUE_TEMPLATE.zh-CN.md Executable file → Normal file
View File

@@ -7,7 +7,5 @@
### 报错信息

14
.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md Executable file → Normal file
View File

@@ -10,6 +10,18 @@
### 测试用例(新增、改动、可能影响的功能)
### 是否涉及对外变更典型的如对外API规格变更、新增对外接口等等
必须选择一项在MarkDown模式下用[x]替换[ ]即可勾选对应选项):
- [ ] 是,涉及对外变更: 需要在commit message中按【[模板要求](https://gitee.com/openharmony/kernel_liteos_m/wikis/Commit%20message%E8%A7%84%E8%8C%83)】描述变更点
- [ ] 否,不涉及对外变更
### 是否需要同步至release3.0LTS ... )分支?
必须选择一项在MarkDown模式下用[x]替换[ ]即可勾选对应选项):
- [ ] 是,需要同步的分支:
- [ ]
理由:

20
.gitignore vendored Executable file → Normal file
View File

@@ -1 +1,21 @@
test
*.si4project
tags
cscope.*
*.swp
/**/*_iar/project/
!los_demo.eww
!los_demo.ewp
!los_demo.ewd
!los_demo.ewt
!los_demo.dep
!*.icf
targets/cortex-m7_nucleo_f767zi_gcc/build
*.o
*.d
*.su
# Menuconfig temp files
/config.h
/.config
/.config.old

267
BUILD.gn Executable file → Normal file
View File

@@ -1,42 +1,225 @@
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/subsystem/lite_subsystem.gni")
lite_subsystem("kernel") {
subsystem_components = [
"//kernel/liteos_m/arch",
"//kernel/liteos_m/components",
"//kernel/liteos_m/kernel",
]
if (LOSCFG_TEST) {
subsystem_components += [ "//kernel/liteos_m/test" ]
}
}
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/component/lite_component.gni")
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
import("liteos.gni")
if (defined(LOSCFG_COMPILER_ICCARM)) {
import("config_iccarm.gni")
} else {
import("config.gni")
cc = "$ohos_current_cc_command " + string_join(" ", liteos_arch_config_cflags)
if (ohos_build_compiler == "clang") {
cc += " --target=$target_triple"
}
}
declare_args() {
liteos_build_asm = true
}
config("arch_config") {
cflags = arch_config_cflags
asmflags = arch_config_asmflags
ldflags = arch_config_ldflags
}
config("stdinc_config") {
cflags = stdinc_config_cflags
asmflags = stdinc_config_asmflags
if (!defined(LOSCFG_COMPILER_ICCARM)) {
std_include = exec_script("//build/lite/run_shell_cmd.py",
[ "$cc -print-file-name=include" ],
"trim string")
cflags += [
"-isystem",
std_include,
]
}
}
config("ssp_config") {
cflags = ssp_config_cflags
asmflags = ssp_config_asmflags
}
config("optimize_config") {
cflags = optimize_config_cflags
asmflags = optimize_config_asmflags
}
config("kconfig_config") {
cflags = kconfig_config_cflags
asmflags = kconfig_config_asmflags
}
config("warn_config") {
cflags = warn_config_cflags
asmflags = warn_config_asmflags
}
config("dialect_config") {
cflags_c = dialect_config_cflags
cflags_cc = dialect_config_ccflags
asmflags = dialect_config_asmflags
}
config("misc_config") {
defines = []
if (!defined(LOSCFG_COMPILER_ICCARM)) {
defines += [ "__LITEOS__" ]
defines += [ "__LITEOS_M__" ]
}
if (!defined(LOSCFG_DEBUG_VERSION)) {
defines += [ "NDEBUG" ]
}
cflags = misc_config_cflags
asmflags = misc_config_asmflags
}
config("los_config") {
configs = [
#":arch_config",
":kconfig_config",
":stdinc_config",
":dialect_config",
":optimize_config",
":ssp_config",
#":warn_config",
":misc_config",
]
}
cmd = "if [ -f $device_path/BUILD.gn ]; then echo true; else echo false; fi"
HAVE_DEVICE_SDK = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
# If device_path points to vendor, use device_path directly,
# otherwise board is decoupled from soc, device_path should contain board
BOARD_SOC_FEATURE =
device_path == string_replace(device_path, "/vendor/", "") &&
device_path != string_replace(device_path, "/board/", "")
config("public") {
configs = [
"arch:public",
"kernel:public",
"kal:public",
"components:public",
"utils:public",
]
if (BOARD_SOC_FEATURE) {
configs += [ "$DEVICE_BOARD_DIR/$device_company:public" ]
configs += [ "$DEVICE_SOC_DIR/$LOSCFG_SOC_COMPANY:public" ]
} else {
if (HAVE_DEVICE_SDK) {
configs += [ "$device_path:public" ]
}
}
}
group("modules") {
deps = [
"arch",
"components",
"kal",
"kernel",
"testsuites",
"utils",
HDFTOPDIR,
]
if (BOARD_SOC_FEATURE) {
deps += [ "$DEVICE_BOARD_DIR/$device_company" ]
deps += [ "$DEVICE_SOC_DIR/$LOSCFG_SOC_COMPANY" ]
} else {
if (HAVE_DEVICE_SDK) {
deps += [ device_path ]
}
}
}
# when HAVE_DEVICE_SDK is not reached, gn raises an error. so we just use it as
# not needed
not_needed([ "HAVE_DEVICE_SDK" ])
static_library("libkernel") {
deps = [ ":modules" ]
if (defined(LOSCFG_COMPILER_ICCARM)) {
complete_static_lib = true
} else {
complete_static_lib = false
}
}
group("kernel") {
deps = [ ":libkernel" ]
}
group("liteos_m") {
}
executable("liteos") {
configs += [
":public",
":los_config",
]
ldflags = executable_config_ldflags
output_dir = target_out_dir
if (liteos_kernel_only) {
deps = [ ":kernel" ]
} else {
deps = [ "//build/lite:ohos" ]
}
}
copy("copy_liteos") {
deps = [ ":liteos" ]
sources = [ "$target_out_dir/unstripped/bin/liteos" ]
outputs = [ "$root_out_dir/$liteos_name" ]
}
build_ext_component("build_kernel_image") {
deps = [ ":copy_liteos" ]
exec_path = rebase_path(root_out_dir)
command = toochain_config_command
if (liteos_build_asm) {
command += toochain_asm_command
}
}

465
CHANGELOG.md Normal file
View File

@@ -0,0 +1,465 @@
# (2022-03-30)
### Bug Fixes
* c-sky等芯片架构的BUILD.gn优化 ([3311d73](https://gitee.com/openharmony/kernel_liteos_m/commits/3311d73406b68d289b6f715a099e90f62c86abd1)), closes [#I4D129](https://gitee.com/openharmony/kernel_liteos_m/issues/I4D129)
* change the sensitive words ([8e2248c](https://gitee.com/openharmony/kernel_liteos_m/commits/8e2248c062aaca2444cc1001873fe8e8d8cdd3c6)), closes [#I4K7LL](https://gitee.com/openharmony/kernel_liteos_m/issues/I4K7LL)
* cortex-m55栈优化 ([59e9c6e](https://gitee.com/openharmony/kernel_liteos_m/commits/59e9c6ed73caeeed56081a768198eccc7448df6c)), closes [#I4SQIQ](https://gitee.com/openharmony/kernel_liteos_m/issues/I4SQIQ)
* csky等新增模块的HalTickStart函数定义和实现不一致 ([07ab6a5](https://gitee.com/openharmony/kernel_liteos_m/commits/07ab6a5b77c6955f6093beeab976bdc1b32d1db9)), closes [#I4D1HY](https://gitee.com/openharmony/kernel_liteos_m/issues/I4D1HY)
* FD_SETSIZE compatible newlibc ([82c6d5f](https://gitee.com/openharmony/kernel_liteos_m/commits/82c6d5f17478fb47ea5977a32fb76d783ee3e815))
* fix compile warning saying dereference void * pointer ([29126a9](https://gitee.com/openharmony/kernel_liteos_m/commits/29126a98fe7a8f75695910bdf8fa1ccc6ff67288))
* gcc编译testsuite编译问题修复 ([f7d26b8](https://gitee.com/openharmony/kernel_liteos_m/commits/f7d26b8e12fb1ba4bebe6c0fc9ca9e392537419f)), closes [#I4DAOU](https://gitee.com/openharmony/kernel_liteos_m/issues/I4DAOU)
* Kconfig中打开littlefs选项默认关联打开LOSCFG_SUPPORT_LITTLEFS宏 ([b2bcab3](https://gitee.com/openharmony/kernel_liteos_m/commits/b2bcab3a5bd794c86dd4d93b1b5aeca2d097289b)), closes [#I4ENQ1](https://gitee.com/openharmony/kernel_liteos_m/issues/I4ENQ1)
* kernel接口融合添加/修改kernel函数 ([cee9714](https://gitee.com/openharmony/kernel_liteos_m/commits/cee9714a90f2660a0b4455f4f5a2fc42870a6aa5))
* L0 pthread_cond_timedwait接口实现存在的几个问题 ([2219c32](https://gitee.com/openharmony/kernel_liteos_m/commits/2219c32784071b6c37ea57185382e3228ed4b0a7)), closes [#I4N9P8](https://gitee.com/openharmony/kernel_liteos_m/issues/I4N9P8)
* liteos_kernel_only=true编译内核报错 ([adc2105](https://gitee.com/openharmony/kernel_liteos_m/commits/adc21052b2b9b55de9fc493cf74645f470edf9b5)), closes [#I4O204](https://gitee.com/openharmony/kernel_liteos_m/issues/I4O204)
* los_exc.S中_ExcInMsp主栈中异常处理函数中异常返回类型错误 ([c51df7a](https://gitee.com/openharmony/kernel_liteos_m/commits/c51df7a94c1f21803db25f46a73a7fb291588eda)), closes [#I4EJI4](https://gitee.com/openharmony/kernel_liteos_m/issues/I4EJI4)
* los_interrupt.c存在未使用的参数编译出错 ([5af4c2e](https://gitee.com/openharmony/kernel_liteos_m/commits/5af4c2e2139cabe49049283f7a4280460bbf353a)), closes [#I4SJPZ](https://gitee.com/openharmony/kernel_liteos_m/issues/I4SJPZ)
* LOS_Panic接口中增加需要增加LOS_BackTrace(),方便定位主动异常位置 ([f51d675](https://gitee.com/openharmony/kernel_liteos_m/commits/f51d675fee217e0ad519f2fa79f70b033f313dce)), closes [#I4IGGY](https://gitee.com/openharmony/kernel_liteos_m/issues/I4IGGY)
* los_trace.h接口注释错误修正 ([693468e](https://gitee.com/openharmony/kernel_liteos_m/commits/693468e5274af310721f5962602a915d701a7bf0)), closes #I4CYPZ
* m4核在任务中异常时backtrace使用的是MSP所在的栈而不是PSP所在的栈 ([3e8aea2](https://gitee.com/openharmony/kernel_liteos_m/commits/3e8aea224e481322efef9397e4aafc3450a09d28)), closes [#I4D7GE](https://gitee.com/openharmony/kernel_liteos_m/issues/I4D7GE)
* M核posix接口fs模块用例完善 ([ee380fb](https://gitee.com/openharmony/kernel_liteos_m/commits/ee380fb9be45ef033979ec3b8875d980b7f13198)), closes [#I4L7BF](https://gitee.com/openharmony/kernel_liteos_m/issues/I4L7BF)
* optimize default configuration ([b2e3849](https://gitee.com/openharmony/kernel_liteos_m/commits/b2e3849bfbd470981602b0dc02f47bffb38bfe11)), closes [#I4FSC9](https://gitee.com/openharmony/kernel_liteos_m/issues/I4FSC9)
* OsGetAllTskInfo调用和异常时无任务回调函数地址 ([1c605a3](https://gitee.com/openharmony/kernel_liteos_m/commits/1c605a338ad2317aeb464bdac85df5b9a79c99fd)), closes [#I4MG2T](https://gitee.com/openharmony/kernel_liteos_m/issues/I4MG2T)
* pm codex告警清零 ([9666380](https://gitee.com/openharmony/kernel_liteos_m/commits/96663805ecfd3248e33b4deb877c8d55cc4e8eec)), closes [#I4OWPE](https://gitee.com/openharmony/kernel_liteos_m/issues/I4OWPE)
* pm模块解冻线程时存在删除空链表且时间片频繁唤醒系统 ([9f185b5](https://gitee.com/openharmony/kernel_liteos_m/commits/9f185b5b52ed9506a4913f233c9ddfe45452ec05)), closes [#I4AKUS](https://gitee.com/openharmony/kernel_liteos_m/issues/I4AKUS)
* **posix unittest:** posix unittest 融合 ([ad6f249](https://gitee.com/openharmony/kernel_liteos_m/commits/ad6f249d1ea878f06864d79bdbed772b21eeac49))
* **posix:** posix兼容回退 ([207efc1](https://gitee.com/openharmony/kernel_liteos_m/commits/207efc15b859fe18d8b1dac2a3da9d7a5831aa6e))
* **posix:** posix接口融合接口规范兼容性修改 ([e0b1275](https://gitee.com/openharmony/kernel_liteos_m/commits/e0b12758da4a25e42110ba32da25b6d18ebed8ef))
* **posix接口融合:** posix接口融合接口规范兼容性修改 ([4b607fd](https://gitee.com/openharmony/kernel_liteos_m/commits/4b607fd0740a5379cd373890482235845d782b62))
* posix线程和LOS_TaskCreate任务不兼容补齐接口防护防止访问野指针 ([60805e1](https://gitee.com/openharmony/kernel_liteos_m/commits/60805e1a7c3736db86695ed86cd03cfaab70a427))
* pr模板补充说明 ([7b86f69](https://gitee.com/openharmony/kernel_liteos_m/commits/7b86f69cc0ccd5512b69fd3a1181b3440747ddb2))
* ReadMe中无对动态加载模块待加载的共享库的限制说明。 ([f86b971](https://gitee.com/openharmony/kernel_liteos_m/commits/f86b97180f97903bb2def271b7b11fc1ae1bf9bb)), closes [#I4ICK8](https://gitee.com/openharmony/kernel_liteos_m/issues/I4ICK8)
* shell 输入不识别命令时内存泄漏 ([0245b1a](https://gitee.com/openharmony/kernel_liteos_m/commits/0245b1a7b24fd36d23f9602d0755b274581a84ce)), closes [#I4UR9P](https://gitee.com/openharmony/kernel_liteos_m/issues/I4UR9P)
* **shell:** cat针对大文件无法工作 ([d518bad](https://gitee.com/openharmony/kernel_liteos_m/commits/d518bad0dc7dd9e3fbb45423a7db5cb8c1c922dc)), closes [#I4J4TK](https://gitee.com/openharmony/kernel_liteos_m/issues/I4J4TK)
* shell模块task命令踩内存问题修改 ([6ffd55d](https://gitee.com/openharmony/kernel_liteos_m/commits/6ffd55dcd07ce17b693a97bb678668f763480e4d)), closes [#I4A70V](https://gitee.com/openharmony/kernel_liteos_m/issues/I4A70V)
* switch inet_addr to a function ([b30e913](https://gitee.com/openharmony/kernel_liteos_m/commits/b30e9139d5502acab8c36ae9a56d4cd640786c44)), closes [#I4G4I4](https://gitee.com/openharmony/kernel_liteos_m/issues/I4G4I4)
* **testsuites:** cpup和测试套解耦 ([692651f](https://gitee.com/openharmony/kernel_liteos_m/commits/692651fe40f668f19b479186e52fea34d092b458))
* tick timer时钟频率赋值修改为运行时赋值 ([ae02afc](https://gitee.com/openharmony/kernel_liteos_m/commits/ae02afc8504f64ff6bc09828f55e9602bcbcae56)), closes [#I4PGUR](https://gitee.com/openharmony/kernel_liteos_m/issues/I4PGUR)
* tick中断处理时无挂起任务时应更新当前运行任务的时间片, 并触发一次调度 ([ea12d40](https://gitee.com/openharmony/kernel_liteos_m/commits/ea12d40caf1301b4a7b6d60a2c599ceff4746c90)), closes [#I4LRZG](https://gitee.com/openharmony/kernel_liteos_m/issues/I4LRZG)
* **time_func_test_01.c:** 修复testTimes测试单板配置LOSCFG_BASE_CORE_TICK_PER_SECOND = 1000的问题 ([5c982f1](https://gitee.com/openharmony/kernel_liteos_m/commits/5c982f1087f95174f2836c72648eab58adf37fd7))
* 中断向量表对齐大小支持可配置 ([cf9c838](https://gitee.com/openharmony/kernel_liteos_m/commits/cf9c8387e3785d994aacf948b7c1b61324a3dd63)), closes [#I4M20E](https://gitee.com/openharmony/kernel_liteos_m/issues/I4M20E)
* 优化trace buffer初始化删除swtmr 桩中的无效参数 ([afbc9a5](https://gitee.com/openharmony/kernel_liteos_m/commits/afbc9a593b61461072556cb5531d90b30ce2e394)), closes [#I4DPR7](https://gitee.com/openharmony/kernel_liteos_m/issues/I4DPR7)
* 优化低功耗流程 ([c6600d9](https://gitee.com/openharmony/kernel_liteos_m/commits/c6600d9dddb666f397ba659d47d64f334691af6b)), closes [#I46VXK](https://gitee.com/openharmony/kernel_liteos_m/issues/I46VXK)
* 修复arch目录调整影响到的target目录下的文件 ([d5725b2](https://gitee.com/openharmony/kernel_liteos_m/commits/d5725b22644da8ab3e719169230303e44c7d8750)), closes [#I4JM7Z](https://gitee.com/openharmony/kernel_liteos_m/issues/I4JM7Z)
* 修复cortex-m系列系统提供的timer在低频下时间不准的问题 ([3e569ba](https://gitee.com/openharmony/kernel_liteos_m/commits/3e569bac587d90dcd21aff7d8ec53216dfbb8f1c)), closes [#I4HBGR](https://gitee.com/openharmony/kernel_liteos_m/issues/I4HBGR)
* 修复hook层LOS_HOOK_TYPE_SEM_PEND的runningTask入参可能为空 ([3fd22ac](https://gitee.com/openharmony/kernel_liteos_m/commits/3fd22ac2b0b4c690669a659246aba099fd4311ec)), closes [#I4BU4P](https://gitee.com/openharmony/kernel_liteos_m/issues/I4BU4P)
* 修复irqNum = HwiNumGet()编译错误的问题 ([16e87d7](https://gitee.com/openharmony/kernel_liteos_m/commits/16e87d78d89bec7d85c076fc738ed4ad0614b865)), closes [#I4S81B](https://gitee.com/openharmony/kernel_liteos_m/issues/I4S81B)
* 修复Kconfig信息错误 ([bb04582](https://gitee.com/openharmony/kernel_liteos_m/commits/bb045829104211522cd12a7273d5853400c1ea26)), closes [#I4MZ1F](https://gitee.com/openharmony/kernel_liteos_m/issues/I4MZ1F)
* 修复L0_Emulator 门禁高概率失败的问题 ([7ad2f62](https://gitee.com/openharmony/kernel_liteos_m/commits/7ad2f62a03481a3919fef1f1e46e4c9677b1e65c)), closes [#I4NB0N](https://gitee.com/openharmony/kernel_liteos_m/issues/I4NB0N)
* 修复liteos-m在iar环境下的编译问题 ([4c4784e](https://gitee.com/openharmony/kernel_liteos_m/commits/4c4784e33d7944e7850009be192375aaa6e2b125)), closes [#I4Q5Q5](https://gitee.com/openharmony/kernel_liteos_m/issues/I4Q5Q5)
* 修复los_interrupt.c文件中HalHwiInit函数里未使能未对齐异常问题 ([d32e25f](https://gitee.com/openharmony/kernel_liteos_m/commits/d32e25f3ae8e8e5ec24effa98dc8f0b3ba94d0c1)), closes [#I4EJGR](https://gitee.com/openharmony/kernel_liteos_m/issues/I4EJGR)
* 修复newlib缺省PTHREAD_KEYS_MAX 问题 ([65f04bf](https://gitee.com/openharmony/kernel_liteos_m/commits/65f04bf093376a478e9585dadfc1238158cc3641)), closes [#I4OX47](https://gitee.com/openharmony/kernel_liteos_m/issues/I4OX47)
* 修复OsQueueMailFree提早释放内存的问题 ([ec88d16](https://gitee.com/openharmony/kernel_liteos_m/commits/ec88d1628937b3def6dd613246116f6bfa4141eb))
* 修复pm编译告警导致内核编译失败 ([18b0524](https://gitee.com/openharmony/kernel_liteos_m/commits/18b052458e1cea113df7a6bb4798a6d5e1eb751e)), closes [#I49MIN](https://gitee.com/openharmony/kernel_liteos_m/issues/I49MIN)
* 修复pthread 编译告警 ([cc57f81](https://gitee.com/openharmony/kernel_liteos_m/commits/cc57f81ab85a5eb9bb4be9bd7d2863978996bcf3)), closes [#I4U16U](https://gitee.com/openharmony/kernel_liteos_m/issues/I4U16U)
* 修复pthread_create相关问题 ([cd949dd](https://gitee.com/openharmony/kernel_liteos_m/commits/cd949ddae0aa4e7291b0b7f6ba83c2034cdf1301)), closes [#I4P78J](https://gitee.com/openharmony/kernel_liteos_m/issues/I4P78J)
* 修复pthread_create行为与posix不一致问题 ([2b1e5a7](https://gitee.com/openharmony/kernel_liteos_m/commits/2b1e5a7a130fbca1b86a787b54f474e183541d6d)), closes [#I49W9F](https://gitee.com/openharmony/kernel_liteos_m/issues/I49W9F)
* 修复readme中文档链接错误 ([8ee70a0](https://gitee.com/openharmony/kernel_liteos_m/commits/8ee70a0f8f856da29139a36ba6f8589201cdb109)), closes [#I4FD5G](https://gitee.com/openharmony/kernel_liteos_m/issues/I4FD5G)
* 修复risc-v异常时异常信息混乱且backtrace无法输出的问题 ([0fb49d4](https://gitee.com/openharmony/kernel_liteos_m/commits/0fb49d4422245e83c2435468eb7f2690f2e2c6e4)), closes #I4BPHX
* 修复shcmd.h需要用宏包起来的问题 ([a7a8a62](https://gitee.com/openharmony/kernel_liteos_m/commits/a7a8a62bcb7398b4194b37f62098da9cb1ce717e)), closes [#I45FU2](https://gitee.com/openharmony/kernel_liteos_m/issues/I45FU2)
* 修复shell 模块存在大量的编译告警及codeCheck。 ([e0d8b53](https://gitee.com/openharmony/kernel_liteos_m/commits/e0d8b5328f53dcef9427a34e8b0462250bb6a40f)), closes [#I48V2J](https://gitee.com/openharmony/kernel_liteos_m/issues/I48V2J)
* 修复任务栈对齐问题及补充posix和cmsis测试用例 ([ed863e9](https://gitee.com/openharmony/kernel_liteos_m/commits/ed863e90dd9aceb5d3b6d92b0a94703101b83f80))
* 修复公版gcc编译内核调用calloc崩溃 ([8d0ced2](https://gitee.com/openharmony/kernel_liteos_m/commits/8d0ced206951f35d5caab61969344b0ab259e5fb)), closes [#I4OFG6](https://gitee.com/openharmony/kernel_liteos_m/issues/I4OFG6)
* 修复未使用的参数和类型比较编译报错问题 ([21b46e8](https://gitee.com/openharmony/kernel_liteos_m/commits/21b46e82f31030703d052369701f4d6d736a4a86))
* 修复调度时间最大值不一致问题 ([9f393bc](https://gitee.com/openharmony/kernel_liteos_m/commits/9f393bcc6df592efb6940e9864ff93e932ae59ad))
* 修正liteos-m内核README不准确信息 ([0e067b2](https://gitee.com/openharmony/kernel_liteos_m/commits/0e067b239354c28e16b05489274b33051d002508)), closes [#I4PLWP](https://gitee.com/openharmony/kernel_liteos_m/issues/I4PLWP)
* 修正部分编码风格问题 ([91903a3](https://gitee.com/openharmony/kernel_liteos_m/commits/91903a37165ef364750916104be4f7dfd1d8f9a6)), closes [#I4K8M7](https://gitee.com/openharmony/kernel_liteos_m/issues/I4K8M7)
* 内核ERR打印线程信息不方便问题定位。 ([232fec2](https://gitee.com/openharmony/kernel_liteos_m/commits/232fec27ac8cd2f46b5a2f5cfbe4677d0e287314)), closes #I4DAKM
* 内源检视问题修复 ([c24363b](https://gitee.com/openharmony/kernel_liteos_m/commits/c24363bc50364b0be1fba3b993a83c6936fc3d08))
* 删除C文件中无用的__cplusplus ([7fe3aad](https://gitee.com/openharmony/kernel_liteos_m/commits/7fe3aaddf56b300ffcb2b186ae01ed64bef1c069)), closes [#I4D0YK](https://gitee.com/openharmony/kernel_liteos_m/issues/I4D0YK)
* 删除OsMemboxExcInfoGetSub内存调测方法中多余的赋值语句。 ([94db0fe](https://gitee.com/openharmony/kernel_liteos_m/commits/94db0fe7a30edaa10786101f1ef662987a27734a)), closes [#I4CFNX](https://gitee.com/openharmony/kernel_liteos_m/issues/I4CFNX)
* 去掉没有使用的入参consoleid。 ([a627953](https://gitee.com/openharmony/kernel_liteos_m/commits/a62795304da31e13021ea2c675d124afd2594102)), closes [#I43CVE](https://gitee.com/openharmony/kernel_liteos_m/issues/I43CVE)
* 去掉编译选项-fno-short-enums ([b542aab](https://gitee.com/openharmony/kernel_liteos_m/commits/b542aab09dd92397f8c1305ac656ef14a012b5f8)), closes [#I4JY32](https://gitee.com/openharmony/kernel_liteos_m/issues/I4JY32)
* 取消cpu进入低功耗前开中断操作 ([bd39e9e](https://gitee.com/openharmony/kernel_liteos_m/commits/bd39e9e6d67310222c363e132141bb7fee1213f1)), closes [#I4KDP8](https://gitee.com/openharmony/kernel_liteos_m/issues/I4KDP8)
* 告警修复 ([7d2fd01](https://gitee.com/openharmony/kernel_liteos_m/commits/7d2fd01c2d7d6d4c653a307a1419bc094f5332f0))
* 告警修复 ([2d7bf3b](https://gitee.com/openharmony/kernel_liteos_m/commits/2d7bf3b7d8ea84961e802c366899aca891f38377))
* 在头文件中补充LOSCFG_MEM_FREE_BY_TASKID函数的声明 ([ad18026](https://gitee.com/openharmony/kernel_liteos_m/commits/ad18026a59fc2853c9580e040f959f9f42082640)), closes [#I4JBOV](https://gitee.com/openharmony/kernel_liteos_m/issues/I4JBOV)
* 将curl依赖的函数新增至newlib库 ([bd04d9f](https://gitee.com/openharmony/kernel_liteos_m/commits/bd04d9f29a0b77445a71378f88b01ffdae24554f)), closes [#I4RG71](https://gitee.com/openharmony/kernel_liteos_m/issues/I4RG71)
* 将未定义小写"true""false"改为"TRUE""FALSE"。 ([9819eb5](https://gitee.com/openharmony/kernel_liteos_m/commits/9819eb567636adf1774de9fd6039d274bee8f69b)), closes [#I43D20](https://gitee.com/openharmony/kernel_liteos_m/issues/I43D20)
* 当前仓代码编译告警的问题 ([194ac58](https://gitee.com/openharmony/kernel_liteos_m/commits/194ac5898d1e2ffaa17f6dca405614b73da6f8bb)), closes #I4N50W
* 支持硬浮点编译 ([988fd85](https://gitee.com/openharmony/kernel_liteos_m/commits/988fd85fae454a0d9fe01ef1c921b4f3667d5ac8)), closes [#I48KJP](https://gitee.com/openharmony/kernel_liteos_m/issues/I48KJP)
* 测试用例任务栈的宏定义重复定义导致在osTest.h中修改不生效 ([ce6cf68](https://gitee.com/openharmony/kernel_liteos_m/commits/ce6cf6879f4564393765a24c4d65448e0fddc3eb))
* 添加L0 测试门禁 ([5c168fc](https://gitee.com/openharmony/kernel_liteos_m/commits/5c168fc3e0d08dd4a8924696e17a498eb444fa70)), closes #I4C5R4
* 添加newlib对ipv6的支持 ([f7400fb](https://gitee.com/openharmony/kernel_liteos_m/commits/f7400fbcb275cbb3b75f1aef2af1459b794432de)), closes [#I4M1DB](https://gitee.com/openharmony/kernel_liteos_m/issues/I4M1DB)
* 添加文件版权头等信息 ([cf4e017](https://gitee.com/openharmony/kernel_liteos_m/commits/cf4e017970f8a3113bc8b6028d75775f747512c6)), closes [#I4BXBH](https://gitee.com/openharmony/kernel_liteos_m/issues/I4BXBH)
* 清除因g_tm变量没有使用引入的编译告警 ([9689522](https://gitee.com/openharmony/kernel_liteos_m/commits/9689522a8e08b79244ad339dc24074843b99d33b)), closes [#I4LW3H](https://gitee.com/openharmony/kernel_liteos_m/issues/I4LW3H)
* 移除los_arch_interrupt.h文件中冗余声明的函数VOID OsExcInit(VOID) ([136952f](https://gitee.com/openharmony/kernel_liteos_m/commits/136952f193fe97cfd6a88932e71811e12edfa7a5)), closes [#I4D9OO](https://gitee.com/openharmony/kernel_liteos_m/issues/I4D9OO)
* 补充net相关头文件 ([93f616b](https://gitee.com/openharmony/kernel_liteos_m/commits/93f616b64e961013be5c5267e50d58a40b5cc6c9))
* 解决gmtime和localtime接口由于g_tm全局变量导致的竞态问题 ([1454b76](https://gitee.com/openharmony/kernel_liteos_m/commits/1454b76482d42e78c1904028de55d82261e5ecaa)), closes [#I4LW3H](https://gitee.com/openharmony/kernel_liteos_m/issues/I4LW3H)
* 解决los_pm.c:743:19: warning 编译告警 ([0c72c8b](https://gitee.com/openharmony/kernel_liteos_m/commits/0c72c8bf94b053ff90bbf2019006c52adf1eb8df)), closes [#I4D4L8](https://gitee.com/openharmony/kernel_liteos_m/issues/I4D4L8)
* 解决定时器超时但还在队列中无法删除的问题 ([ecce17e](https://gitee.com/openharmony/kernel_liteos_m/commits/ecce17ea4878c7bdf7d7de9a6848e6bf871563de)), closes [#I4LFVD](https://gitee.com/openharmony/kernel_liteos_m/issues/I4LFVD)
* 解除net对cmsis的依赖net属于内核模块不应该依赖内核对外接口 ([9982624](https://gitee.com/openharmony/kernel_liteos_m/commits/99826240d979c3aa820ab2aace62e3338978e6d1))
* 调度中将pm相关的部分用LOSCFG_KERNEL_PM包含 ([d7c0059](https://gitee.com/openharmony/kernel_liteos_m/commits/d7c0059dc4fcca3f85d2cad1012353892ce28021)), closes [#I4L00F](https://gitee.com/openharmony/kernel_liteos_m/issues/I4L00F)
* 调用LOS_TaskDetach操作已退出的joinable的任务时未正确回收该任务 ([49c93b3](https://gitee.com/openharmony/kernel_liteos_m/commits/49c93b37c5e215612bbeb4619e73c809f9eb1cac)), closes [#I4DZL7](https://gitee.com/openharmony/kernel_liteos_m/issues/I4DZL7)
* 针对pr是否同步至release分支增加原因说明规则 ([1ee543d](https://gitee.com/openharmony/kernel_liteos_m/commits/1ee543d5d31524d543ffb297b121224dedf8602f))
* 队列相关的API实现中,参数的校验不完全,导致程序异常 ([eef7c80](https://gitee.com/openharmony/kernel_liteos_m/commits/eef7c80a725d68af254ae55091bd36f978cf4284))
### Features
* adapt net ([8594ee4](https://gitee.com/openharmony/kernel_liteos_m/commits/8594ee469ad2d40a363e5d77f94f292ab3cb8c21))
* add option for ioctl ([5e8ac4b](https://gitee.com/openharmony/kernel_liteos_m/commits/5e8ac4b8883f64bbffa5bb3f063a601112058396)), closes [#I4I3W5](https://gitee.com/openharmony/kernel_liteos_m/issues/I4I3W5)
* add option SIOCGIFBRDADDR for ioctl ([33ee492](https://gitee.com/openharmony/kernel_liteos_m/commits/33ee49295329e3c394d1cc7b16f77a23ac2255a8)), closes [#I4EGNG](https://gitee.com/openharmony/kernel_liteos_m/issues/I4EGNG)
* added assembly atomic interface ([1513f50](https://gitee.com/openharmony/kernel_liteos_m/commits/1513f50a474d1227a83fb655ad18c19cd792f235))
* backtrace for arm9 ([03de7f3](https://gitee.com/openharmony/kernel_liteos_m/commits/03de7f37450a8821ea05e60e94a5d1dd359c4f99)), closes [#I4BMLG](https://gitee.com/openharmony/kernel_liteos_m/issues/I4BMLG)
* Board 和 SoC分离编译适配 ([3f1c04d](https://gitee.com/openharmony/kernel_liteos_m/commits/3f1c04dd57bca0379ce37162d9d824801e7d880f))
* **build:** add module_group and comment out arch_cflags ([e5636f7](https://gitee.com/openharmony/kernel_liteos_m/commits/e5636f7acaf7e8b7d14dc07930b2a16c86e63c85))
* **build:** support Kconfig ([7e67343](https://gitee.com/openharmony/kernel_liteos_m/commits/7e673430dc42c55b3a0a6d955ba8fea21d6d58ea))
* **cmsis:** support max_count for osSemaphoreNew ([d478152](https://gitee.com/openharmony/kernel_liteos_m/commits/d478152762013975551e1af154df42987596c9a6))
* cortex-m55支持psplimit ([db7d641](https://gitee.com/openharmony/kernel_liteos_m/commits/db7d641c223db8ab25501d79c2a6331f743d830b)), closes [#I4T7R3](https://gitee.com/openharmony/kernel_liteos_m/issues/I4T7R3)
* littlefs最大打开文件个数修改为可通过menuconfig配置 ([9bc9f3a](https://gitee.com/openharmony/kernel_liteos_m/commits/9bc9f3aa53be7bf392d3da09adcb184dec8e3da2))
* newlib支持pthread_equal ([ce5357e](https://gitee.com/openharmony/kernel_liteos_m/commits/ce5357eee1daf1c1b3a3aa7bdeaef0cc5a8901bf)), closes [#I4QERS](https://gitee.com/openharmony/kernel_liteos_m/issues/I4QERS)
* provide read write for socket by #define ([d044eda](https://gitee.com/openharmony/kernel_liteos_m/commits/d044eda3c3640ae135ef528739d0c9609f40c822)), closes [#I4H8TL](https://gitee.com/openharmony/kernel_liteos_m/issues/I4H8TL)
* synchronizing arch api ([04bf3a6](https://gitee.com/openharmony/kernel_liteos_m/commits/04bf3a682f149482d8ebdbb9ff96d6889edb487a)), closes [#I4N7XV](https://gitee.com/openharmony/kernel_liteos_m/issues/I4N7XV)
* synchronous los_hwicreate interface ([6c68ada](https://gitee.com/openharmony/kernel_liteos_m/commits/6c68adad4db7f6112990764eafe6a3bd5f8759a5))
* 低内存资源回收low memory killer ([ab886d8](https://gitee.com/openharmony/kernel_liteos_m/commits/ab886d848ab809942c11d0e408b8ff76c41b92b2)), closes [#I4ID0M](https://gitee.com/openharmony/kernel_liteos_m/issues/I4ID0M)
* 低功耗支持冻结线程等需求 ([9b5739a](https://gitee.com/openharmony/kernel_liteos_m/commits/9b5739ab11ae7a89d35ba6f54fc62137ddc6d897)), closes [#I49FJF](https://gitee.com/openharmony/kernel_liteos_m/issues/I49FJF)
* 内核提供Interrupt框架支持多架构多平台通用化 ([e8538d0](https://gitee.com/openharmony/kernel_liteos_m/commits/e8538d041a93817cea4ae3914afcfdc6182483e7))
* 内核提供tick timer框架支持多架构多平台通用化 ([f635450](https://gitee.com/openharmony/kernel_liteos_m/commits/f635450d7cf7f674de3803b5eb9d759b6e4d005b)), closes [#I4N7XV](https://gitee.com/openharmony/kernel_liteos_m/issues/I4N7XV)
* 同步调度部分优化至liteos_m ([fb11ab1](https://gitee.com/openharmony/kernel_liteos_m/commits/fb11ab181e69289f7a2edfd5857595b89f1d5d67))
* 支持cortex-m55 ([6e17805](https://gitee.com/openharmony/kernel_liteos_m/commits/6e1780546c173365262c7a50b81896f5b3c46389)), closes [#I4Q9OQ](https://gitee.com/openharmony/kernel_liteos_m/issues/I4Q9OQ)
* 支持Lms ([7b838e8](https://gitee.com/openharmony/kernel_liteos_m/commits/7b838e8a7b8e9f7fb34ca495e5cb46d70d12722b)), closes [#I4HYBG](https://gitee.com/openharmony/kernel_liteos_m/issues/I4HYBG)
* 支持posix 和 cmsis join能力 ([ecfdf7f](https://gitee.com/openharmony/kernel_liteos_m/commits/ecfdf7ff9bf1adf06835968dc6f06b7c45e04862)), closes [#I44V26](https://gitee.com/openharmony/kernel_liteos_m/issues/I44V26)
* 支持posix线程私有数据能力 ([a856303](https://gitee.com/openharmony/kernel_liteos_m/commits/a856303b9cdadcfade33de0d3a335db0332f5761)), closes [#I4ODEB](https://gitee.com/openharmony/kernel_liteos_m/issues/I4ODEB)
* 支持pthread_condattr_setclock ([68dad2c](https://gitee.com/openharmony/kernel_liteos_m/commits/68dad2ccc9856dc2c1ac112bc8f30a703c1af5d9)), closes [#I4ETLN](https://gitee.com/openharmony/kernel_liteos_m/issues/I4ETLN)
* 支持pthread_mutex属性相关接口 ([d2be4d7](https://gitee.com/openharmony/kernel_liteos_m/commits/d2be4d7a460365844a7732df8a3eb59e6bb64897)), closes [#I4G4RQ](https://gitee.com/openharmony/kernel_liteos_m/issues/I4G4RQ)
* 支持select.h的FD_SETSIZE宏配置 ([05642f0](https://gitee.com/openharmony/kernel_liteos_m/commits/05642f05ae6b220df977f4402bc31f396bf08603)), closes [#I4RYK4](https://gitee.com/openharmony/kernel_liteos_m/issues/I4RYK4)
* 支持任务栈可配置 ([96cc92d](https://gitee.com/openharmony/kernel_liteos_m/commits/96cc92d03561e1a9f1030c71916068584b349626))
* 调度、任务及pm解耦 ([cc8a794](https://gitee.com/openharmony/kernel_liteos_m/commits/cc8a794229f4236a1611183fd482740b3badbcd7)), closes [#I4JTN6](https://gitee.com/openharmony/kernel_liteos_m/issues/I4JTN6)
* 适配三方库FatFs升级至r0.14a版本 ([92ea355](https://gitee.com/openharmony/kernel_liteos_m/commits/92ea355756ebd92b8809ecb638ffb5355d89c5e9))
### BREAKING CHANGES
* pthread_create 支持任务栈设置
osThreadNew 支持任务栈设置
TSK_INIT_PARAM_S 结构体添加stackAddr 字段
* 涉及接口修改:
LOS_HwiCreate LOS_HwiDelete
改动内容:
中断处理函数参数类型由HWI_ARG_T统一改为HwiIrqParam封装原有arg参数及riscv部分实际使用变量pDevId, 这样一方面统一LiteOS接口也统一了中断处理函数的arg参数
同步LOS_HwiDelete接口入参新增HWI_IRQ_PARAM_S *irqParam参数为后续共享中断功能的添加预留
* 新增接口:
LOS_TaskResRecycle
LOS_CurrNanosec
LOS_MDelay
接口修改:
LOS_QueueCreate第一个入参添加const修饰并增加一种异常情况处理
los_memory.c中 OS_ERROR 修改为LOS_NOK重定义LOS_NOK为UINT32-1。
接口位置转移:
LOS_UDelay 由los_task.h/.c转移到los_tick.h/.c
宏修改:
LOS_ERRNO_MUX_PEND_INTERR 改名为 LOS_ERRNO_MUX_IN_INTERR
* **posix接口融合:**
接口修改:
calloc
pthread_mutex_init
mq_unlink
pthread_join
pthread_exit
pthread_attr_init
pthread_attr_destroy
pthread_condattr_destroy
pthread_cond_timedwait
pthread_mutexattr_init
pthread_mutexattr_settype
pthread_mutex_destroy
pthread_mutex_timedlock
pthread_mutex_trylockk
pthread_mutex_unlock
sem_getvalue
sem_timedwait
pthread_cond_timedwait
nanosleep
timer_create
timer_settime
timer_gettime
testStdlibStrtoull005
testStdlibStrtol011
testStdlibStrtoul007
testPthread004
新增接口:
CheckForCancel
pthread_setcancelstate
pthread_setcanceltype
pthread_once
pthread_setschedprio
pthread_attr_setstack
pthread_attr_getstack
pthread_condattr_getpshared
pthread_condattr_setpshared
pthread_condattr_getclock
pthread_mutexattr_gettype
CheckMutexAttr
OsMuxPreCheck
sem_trywait
MuxPendForPosix
MuxPostForPosix
增加overrun功能
接口变化:
mq_getsetattr 改为内部接口MqGetSetAttr
GetTickTimeFromNow->OsGetTickTimeFromNow
接口位置转移:
pthread_equal接口由newlib下转移到kal/posix/src/pthread.c中
* **posix:** 接口修改:
calloc
pthread_mutex_init
mq_unlink
pthread_join
pthread_exit
pthread_attr_init
pthread_attr_destroy
pthread_condattr_destroy
pthread_cond_timedwait
pthread_mutexattr_init
pthread_mutexattr_settype
pthread_mutex_destroy
pthread_mutex_timedlock
pthread_mutex_trylockk
pthread_mutex_unlock
sem_getvalue
新增接口:
CheckForCancel
pthread_setcancelstate
pthread_setcanceltype
pthread_once
pthread_setschedprio
pthread_attr_setstack
pthread_attr_getstack
pthread_condattr_getpshared
pthread_condattr_setpshared
pthread_condattr_getclock
pthread_mutexattr_gettype
CheckMutexAttr
OsMuxPreCheck
sem_trywait
接口变化:
mq_getsetattr 改为内部接口OsMqGetSetAttr
接口位置转移:
pthread_equal接口由newlib下转移到kal/posix/src/pthread.c中
* 新增接口:
LOS_HwiTrigger ArchIntTrigger
LOS_HwiEnable ArchIntEnable
LOS_HwiDisable ArchIntDisable
LOS_HwiClear ArchIntClear
LOS_HwiSetPriority ArchIntSetPriority
* Assembly implementation:
ArchAtomicRead
ArchAtomicSet
ArchAtomicAdd
ArchAtomicSub
ArchAtomicInc
ArchAtomicIncRet
ArchAtomicDec
ArchAtomicDecRet
* 原来版本中每个架构下提供的tick timer相关操作函数为弱函数
WEAK UINT32 HalTickStart(OS_TICK_HANDLER handler);
WEAK VOID HalSysTickReload(UINT64 nextResponseTime);
WEAK UINT64 HalGetTickCycle(UINT32 *period);
WEAK VOID HalTickLock(VOID);
WEAK VOID HalTickUnlock(VOID);
用户如果需要启用自己的tick timer需要自己实现相关接口(强属性),在 "内核初始化之前" 通过调用:
LOS_TickTimerRegister 接口替换系统默认提供的tick timer相关接口。
无论用户提供的tick timer 还是系统默认提供的,均在内核初始化时启动。
* int pthread_key_create(pthread_key_t *k, void (*dtor)(void *))
int pthread_key_delete(pthread_key_t k)
int pthread_setspecific(pthread_key_t k, const void *x)
void *pthread_getspecific(pthread_key_t k)
* 1.修改arch/include下接口以ArchXX命名函数
2.提取公共函数声明:ArchAtomicXchg32bits、ArchAtomicDecRet、ArchAtomicCmpXchg32bits
3.新增部分原子操作c内联实现
* 增加低内存资源回收注册相关接口LOS_LmkOpsNodeRegister、LOS_LmkOpsNodeUnregister和内存资源释放和任务恢复接口LOS_LmkTasksKill和LOS_LmkTasksRestore.
* SwtmrHandlerItem结构体新增swtmrID字段用于标识超时队列中软件定时器id
* 新增支持API:
LOS_LmsCheckPoolAdd使能检测指定内存池
LOS_LmsCheckPoolDel不检测指定内存池
LOS_LmsAddrProtect为指定内存段上锁不允许访问
LOS_LmsAddrDisableProtect去能指定内存段的访问保护
# (2021-09-30)
### Bug Fixes
* M核代码告警清零 ([cb5f862](https://gitee.com/openharmony/kernel_liteos_m/commits/cb5f862eafd91675bf53d0320616cc8f707a6e5a)), closes [#I4386N](https://gitee.com/openharmony/kernel_liteos_m/issues/I4386N)
* M核告警消除 ([5a9d53b](https://gitee.com/openharmony/kernel_liteos_m/commits/5a9d53b6444a3bbe084f575ef079f0da36c27c2a)), closes [#I46LHG](https://gitee.com/openharmony/kernel_liteos_m/issues/I46LHG)
* M核编译配置修改 ([deff7c9](https://gitee.com/openharmony/kernel_liteos_m/commits/deff7c921f606ed85663f91d21c12163c15aa7f8)), closes [#I46XEA](https://gitee.com/openharmony/kernel_liteos_m/issues/I46XEA)
* shell模块task命令踩内存问题修改 ([b5e84d5](https://gitee.com/openharmony/kernel_liteos_m/commits/b5e84d5516b599257151f88b5a830d6fe9e0e188)), closes #II4
* trustzone 中断适配 ([15a2c17](https://gitee.com/openharmony/kernel_liteos_m/commits/15a2c17f791b7d6703863718d92fa35402c41067)), closes [#I42TFV](https://gitee.com/openharmony/kernel_liteos_m/issues/I42TFV)
* add API LOS_HwiCreate and LOS_HwDelete ([eb668eb](https://gitee.com/openharmony/kernel_liteos_m/commits/eb668eb9e0021961230858f9bfa1599646da9a8f)), closes [#I3R75F](https://gitee.com/openharmony/kernel_liteos_m/issues/I3R75F)
* add liteos_m vfs ([5479dd6](https://gitee.com/openharmony/kernel_liteos_m/commits/5479dd66d7ec96d2206a9890586fe5f07d50fbb9)), closes [#I3R493](https://gitee.com/openharmony/kernel_liteos_m/issues/I3R493)
* backtrace代码段判断函数定义成弱函数如果有多个代码段那么可根据实际情况重定义 ([8692ed3](https://gitee.com/openharmony/kernel_liteos_m/commits/8692ed33a3b975bac7aa5b6ce3c40a84e281f6c5)), closes [#I420PQ](https://gitee.com/openharmony/kernel_liteos_m/issues/I420PQ)
* change cpup retval range ([d00a35b](https://gitee.com/openharmony/kernel_liteos_m/commits/d00a35ba9288047e9eaba06a8ed1d15806bfca40))
* change description according to review ([a38365e](https://gitee.com/openharmony/kernel_liteos_m/commits/a38365ed097fb398f922a5d1a72305933ae3e7b3))
* change queuePosion to queuePosition ([e772ccb](https://gitee.com/openharmony/kernel_liteos_m/commits/e772ccb3ccd3b31269066fa59a434a23af98ce51))
* change to OpenHarmony LiteOS-M ([259fb54](https://gitee.com/openharmony/kernel_liteos_m/commits/259fb54b3c1a208c5672f1f6551ba0424505e4b2))
* comment error ([a37b73d](https://gitee.com/openharmony/kernel_liteos_m/commits/a37b73d7599a62a728dbf564de9d9927f995ec1b))
* compile warning fix ([8dea15c](https://gitee.com/openharmony/kernel_liteos_m/commits/8dea15c4fcaff2957c60351781180f964c0a882d)), closes #I4330
* compile warnings ([75f6187](https://gitee.com/openharmony/kernel_liteos_m/commits/75f61870a002e238385bc9a7632d42b0b2488c9a)), closes [#I3Y57X](https://gitee.com/openharmony/kernel_liteos_m/issues/I3Y57X)
* correct ECB in comment ([e2aeb1f](https://gitee.com/openharmony/kernel_liteos_m/commits/e2aeb1ff1d4cd54a752c9f6ef976ee8e353da620))
* correct spelling ([dd5cefb](https://gitee.com/openharmony/kernel_liteos_m/commits/dd5cefb0dace4b7a7276c880e45d5520950e9844))
* correct spelling ([e7ea50f](https://gitee.com/openharmony/kernel_liteos_m/commits/e7ea50f13142e34a9860e75be051538fe91e234e))
* correct the counter of exception type ([bff6587](https://gitee.com/openharmony/kernel_liteos_m/commits/bff65877a281ac1cdcbefd325dcd3ad4933edac9))
* correct typo ([3ceface](https://gitee.com/openharmony/kernel_liteos_m/commits/3ceface13e1c15d107bc3c8460c17b9dd4c95e26))
* cpup funciton repair ([c842251](https://gitee.com/openharmony/kernel_liteos_m/commits/c842251bab7ea6365f2bee8ae880e6efb60f0c73))
* delete unused symbols for default config ([7ad3a22](https://gitee.com/openharmony/kernel_liteos_m/commits/7ad3a22b4d62c8b00876ff338c4ce8d1e3f3cbe2)), closes [#I45HN3](https://gitee.com/openharmony/kernel_liteos_m/issues/I45HN3)
* fix __cplusplus typo ([c3eb3e5](https://gitee.com/openharmony/kernel_liteos_m/commits/c3eb3e59e692371f67a4e21e4b38004195ce5e10))
* fix backtrace check issue ([b6664e6](https://gitee.com/openharmony/kernel_liteos_m/commits/b6664e66f14d432b02101c883a53cb333dc4c195))
* fix bad params def in HalTickStart ([4443b74](https://gitee.com/openharmony/kernel_liteos_m/commits/4443b74ea63d2e458af69723a7198bbbaeb856ea)), closes [#I48YWT](https://gitee.com/openharmony/kernel_liteos_m/issues/I48YWT)
* fix comment typo issue ([0c2a675](https://gitee.com/openharmony/kernel_liteos_m/commits/0c2a675e2d163eaf05aff7df226404888d78ca37))
* fix destroy typo ([4ba6259](https://gitee.com/openharmony/kernel_liteos_m/commits/4ba6259e94bd677764922b0470fddc2590f6efa5))
* fix function name ([f7d50d0](https://gitee.com/openharmony/kernel_liteos_m/commits/f7d50d0fbf53cdd352e94a387cf707083f1641bb))
* fix length typo ([98d6580](https://gitee.com/openharmony/kernel_liteos_m/commits/98d65801de9e37199b5df9c8734ebcb6ff5d853d))
* fix LOS_MEMBOX_ALIGNED macro name ([fced899](https://gitee.com/openharmony/kernel_liteos_m/commits/fced8992cf4fbc26c9722d528d642a7afe479170))
* fix LOS_TaskNameGet comment ([c70b28b](https://gitee.com/openharmony/kernel_liteos_m/commits/c70b28bf785da12fd60ecc92a5a63fb54e52c22a))
* fix macro typo ([1600360](https://gitee.com/openharmony/kernel_liteos_m/commits/16003604a948d081151ca4fcf0cfeea91c9e1960))
* fix misspell in comments ([4572814](https://gitee.com/openharmony/kernel_liteos_m/commits/457281427ba286e24386d7916c4bc81f112f1c60))
* fix NULL UNUSED redefined issue ([765bd55](https://gitee.com/openharmony/kernel_liteos_m/commits/765bd551990e906f457ec1145aea4f2bf5856547))
* fix OS_TASK_STACK_PROTECT_SIZE undeclared error ([2a5a515](https://gitee.com/openharmony/kernel_liteos_m/commits/2a5a515f50a0f344d416218046bf0880facfb97c)), closes [#I4C5RW](https://gitee.com/openharmony/kernel_liteos_m/issues/I4C5RW)
* fix print format compilation warning ([ef12c89](https://gitee.com/openharmony/kernel_liteos_m/commits/ef12c89c7a79791665125a0b7391f9e533a06a0f))
* fix readme link issue ([9e332c6](https://gitee.com/openharmony/kernel_liteos_m/commits/9e332c69a5813027575786424b78f0ae2f9a4c5a))
* fix some typo issues ([f6b8cab](https://gitee.com/openharmony/kernel_liteos_m/commits/f6b8cab2539e4d1ee9e47ab8e3eb12f1630f7393))
* fix typo in comment ([811d3fa](https://gitee.com/openharmony/kernel_liteos_m/commits/811d3fae8a39686a1c66dfd61c897b7fd3fac2ac))
* fix typos ([191644e](https://gitee.com/openharmony/kernel_liteos_m/commits/191644e4412fccb7142cfcd34316ad8e2d24fcdf))
* Fixed a spelling error in FS_LOCK_TIMEOUT_SEC. ([42dc308](https://gitee.com/openharmony/kernel_liteos_m/commits/42dc3083693be13c5fa8f2ad8213245465e28adf)), closes [#I3TL66](https://gitee.com/openharmony/kernel_liteos_m/issues/I3TL66)
* include file log_config.h in los_mpu.c ([1932d71](https://gitee.com/openharmony/kernel_liteos_m/commits/1932d714a589c9e87258d7c8ed647b6110bde543))
* L0 GN compilation problem ([2f9bfcc](https://gitee.com/openharmony/kernel_liteos_m/commits/2f9bfcc6ee436ee3568d0c8158a8e43c9ef02623)), closes [I3ORHS](https://gitee.com/openharmony/kernel_liteos_m/issues/I3ORHS)
* l0 shell adapt new master ([fd2227e](https://gitee.com/openharmony/kernel_liteos_m/commits/fd2227e5c858c840f63629c27e559580e1cbdf2f))
* littlefs inappropriate return value and errno ([452f364](https://gitee.com/openharmony/kernel_liteos_m/commits/452f36403dd4376572d8b52352d0d8129a4617e4)), closes [I3YIVT](https://gitee.com/openharmony/kernel_liteos_m/issues/I3YIVT)
* littlefs三方源码采用GN编译修改上库 ([bdb614b](https://gitee.com/openharmony/kernel_liteos_m/commits/bdb614bc2b82011d77c7c8ffb95e415d2640d19d))
* LOS_QueueInfoGet函数统计等待读写任务有误 ([215a1f6](https://gitee.com/openharmony/kernel_liteos_m/commits/215a1f6dc06cf2348c5875f7b05193b26ec17dde)), closes [#I4C6P2](https://gitee.com/openharmony/kernel_liteos_m/issues/I4C6P2)
* los_swtmr.h不满足自包含要求对los_config.h存在依赖但未包含los_config.h ([ad8e96a](https://gitee.com/openharmony/kernel_liteos_m/commits/ad8e96a00f2fcaebe57feae4e3f23f99d7f1d066)), closes [#I40DHM](https://gitee.com/openharmony/kernel_liteos_m/issues/I40DHM)
* **mbedtls:** mbedtls l0 support ([761b860](https://gitee.com/openharmony/kernel_liteos_m/commits/761b86096c3cf5642c95e556c11a45a3d5f413e4))
* misspell ([30578a6](https://gitee.com/openharmony/kernel_liteos_m/commits/30578a6a68a0d3a203b9a00e7bd1a946356d13d2))
* modify event API description ([9481f1d](https://gitee.com/openharmony/kernel_liteos_m/commits/9481f1d8406960b8b859cc5a84b3831eadaf040c))
* modify the return type of LOS_IntLock from UINTPTR to UINT32. ([bcc34e2](https://gitee.com/openharmony/kernel_liteos_m/commits/bcc34e22ede5aeccea63aba9f9ce3cb9aa92cbeb))
* modify type INLNIE ([294a6d2](https://gitee.com/openharmony/kernel_liteos_m/commits/294a6d246b6a1f7cba8ce1bc4eeb9ae11f17a003))
* Mutex锁释放后无任务持有的情况下owner未清空 ([c136cfd](https://gitee.com/openharmony/kernel_liteos_m/commits/c136cfdf973ae0068154606afa3a23858822c347)), closes [#I40OC8](https://gitee.com/openharmony/kernel_liteos_m/issues/I40OC8)
* M核littlefs当文件open失败时需要回收fd否则会有fd泄露 ([b458e12](https://gitee.com/openharmony/kernel_liteos_m/commits/b458e12ed54905db6667f9d5db1410f94a3d6c71)), closes [#I3XU6R](https://gitee.com/openharmony/kernel_liteos_m/issues/I3XU6R)
* m核上littlefs新增错误码功能 ([a062378](https://gitee.com/openharmony/kernel_liteos_m/commits/a06237863121816fa6421aed233446a3fa4e2665)), closes [#I3UVMQ](https://gitee.com/openharmony/kernel_liteos_m/issues/#I3UVMQ)
* net compile fix ([299813c](https://gitee.com/openharmony/kernel_liteos_m/commits/299813cdb43ae1e24200f0a6b006e04e4d4fcb05))
* open shell & fix qemu compile ([911a767](https://gitee.com/openharmony/kernel_liteos_m/commits/911a767992ee540a96ee9f67e0b87195656c3eab))
* ping cmd compile fail ([ae05de3](https://gitee.com/openharmony/kernel_liteos_m/commits/ae05de3ffda86d312d33b2e38f237dd76daf4949))
* protect from accssing NULL pointer, access g_handle after fslock ([bc7a914](https://gitee.com/openharmony/kernel_liteos_m/commits/bc7a914bce1b227a4f57265d5ecc3f82d78533e7)), closes [#I3UCX3](https://gitee.com/openharmony/kernel_liteos_m/issues/I3UCX3)
* remove changelog in README ([37ef8ca](https://gitee.com/openharmony/kernel_liteos_m/commits/37ef8ca7ae73bf78f56dfef36c48bcd790afb6ff)), closes [#I3ZECY](https://gitee.com/openharmony/kernel_liteos_m/issues/I3ZECY)
* remove libsec_kernel ([1144b75](https://gitee.com/openharmony/kernel_liteos_m/commits/1144b75f3ff9ce9e8fa114cf614d3deade8ac7c2))
* remove project files ([4ad01ce](https://gitee.com/openharmony/kernel_liteos_m/commits/4ad01ced93684e5c7ba144ca267f8fcc2fe03105))
* remove targets project files ([f39da5a](https://gitee.com/openharmony/kernel_liteos_m/commits/f39da5a6da59a3b1291c6b9ef7c50e6185df5ea1))
* risc-v 锁中断在调度后失效 ([70f3aa1](https://gitee.com/openharmony/kernel_liteos_m/commits/70f3aa1c112e949d9af8e0245af5879140adefba)), closes [#I42OLJ](https://gitee.com/openharmony/kernel_liteos_m/issues/I42OLJ)
* riscv_nuclei 编译失败 ([d3fb23c](https://gitee.com/openharmony/kernel_liteos_m/commits/d3fb23cca06580b6e447a9476a9c16643c4ea8fe)), closes [#I41PQJ](https://gitee.com/openharmony/kernel_liteos_m/issues/I41PQJ)
* rollback resources when opendir failed ([82fad6c](https://gitee.com/openharmony/kernel_liteos_m/commits/82fad6c36f183de93d936dd2007b899c2932bcee)), closes [#I3Y577](https://gitee.com/openharmony/kernel_liteos_m/issues/I3Y577)
* Scheduling module code to join GN compilation. ([8bf166b](https://gitee.com/openharmony/kernel_liteos_m/commits/8bf166b418ce1a6c027dc304d45fc9431923764c)), closes [#I3OA95](https://gitee.com/openharmony/kernel_liteos_m/issues/I3OA95)
* The hook module fails to compile under the c99 compilation standard. ([a078c30](https://gitee.com/openharmony/kernel_liteos_m/commits/a078c3086fa47e05e3ffdc4e94ca202284a1487b)), closes [#I3S4ME](https://gitee.com/openharmony/kernel_liteos_m/issues/I3S4ME)
* tick 动态化计算优化,减小中断执行时间对系统总体时间的影响,保证软件定时器的响应精度。 ([2118c84](https://gitee.com/openharmony/kernel_liteos_m/commits/2118c84616cce5b5d4569d5a82a4d5de02af1e1c)), closes [#I3YGP1](https://gitee.com/openharmony/kernel_liteos_m/issues/I3YGP1)
* timer qemu 头文件缺失 ([12fed74](https://gitee.com/openharmony/kernel_liteos_m/commits/12fed747226c377c656b8acb8346154627845b6f))
* update according to review comments ([4dc0d31](https://gitee.com/openharmony/kernel_liteos_m/commits/4dc0d313d1b4a39ebb62156d0bb6429ebb8b996d))
* update arch_spec.md ([cf43988](https://gitee.com/openharmony/kernel_liteos_m/commits/cf439885234e0955bab09834b3b876d627c81605))
* update doc usage ([5c19fd4](https://gitee.com/openharmony/kernel_liteos_m/commits/5c19fd4beca15a8b7faad847a13943a9abfe3c8c))
* update document description ([954c2fc](https://gitee.com/openharmony/kernel_liteos_m/commits/954c2fcfb531d0da1dcc6354a0c0b14335566ed7))
* update macro to config item ([be57ece](https://gitee.com/openharmony/kernel_liteos_m/commits/be57ece9ce6200c8868164bc0bb2f26e3062cd37))
* 以g_sysSchedStartTime是否为0判断时间轴是否生效存在极限场景导致调度时间不生效 ([509cf59](https://gitee.com/openharmony/kernel_liteos_m/commits/509cf59befb40839a376be31958d615f066c66fd)), closes [#I45HP5](https://gitee.com/openharmony/kernel_liteos_m/issues/I45HP5)
* 修复littlefs的多分区挂载时对pathname的处理逻辑异常 ([b55cfc1](https://gitee.com/openharmony/kernel_liteos_m/commits/b55cfc1ba7fc470b876c555ac7d3be0aa1d3d363)), closes [#I3WWFA](https://gitee.com/openharmony/kernel_liteos_m/issues/I3WWFA)
* 修复littlefs编译fs.c缺少头文件件依赖配置+若干musl库的缺失问题+多分区规格宏配置问题 ([7259289](https://gitee.com/openharmony/kernel_liteos_m/commits/7259289bd98a743f596060bc607f77ab8f149129)), closes [#I3VT11](https://gitee.com/openharmony/kernel_liteos_m/issues/I3VT11)
* 修复M核littlefs GN编译的若干错误 ([d77828e](https://gitee.com/openharmony/kernel_liteos_m/commits/d77828e206f3324424c3b1372332828a0afb84c2))
* 修复M核上musl库缺失strdup,c的问题 ([139f83a](https://gitee.com/openharmony/kernel_liteos_m/commits/139f83af391a4f5e64ab0fccbd783dd651b87e6a)), closes [#I3VZSI](https://gitee.com/openharmony/kernel_liteos_m/issues/I3VZSI)
* 修复QUEUE_INFO_S中waitReadTask无法保存大于32的任务编号 ([704cca9](https://gitee.com/openharmony/kernel_liteos_m/commits/704cca97b17972d1640fd33b1fa0b5917bb92b19)), closes [#I41N78](https://gitee.com/openharmony/kernel_liteos_m/issues/I41N78)
* 修复task命令格式错误增加copyright ([ad15bbd](https://gitee.com/openharmony/kernel_liteos_m/commits/ad15bbd6a4d298aabc05b26d7838de6425dbc5c5))
* 修复timer_settime只设置第一次到期时间时到期时间不准的缺陷 ([a5f4e37](https://gitee.com/openharmony/kernel_liteos_m/commits/a5f4e37e535bff39a333c469e2f1bf1817216fe8)), closes [#I3TCHA](https://gitee.com/openharmony/kernel_liteos_m/issues/I3TCHA)
* 修复timer_settime只设置第一次到期时间时到期时间不准的缺陷 ([e4b5d4e](https://gitee.com/openharmony/kernel_liteos_m/commits/e4b5d4ebe9677d49d490fe74e5ac33c4a29435a2)), closes [#I3TCHA](https://gitee.com/openharmony/kernel_liteos_m/issues/I3TCHA)
* 修复不规范的copyright ([2d9bbd2](https://gitee.com/openharmony/kernel_liteos_m/commits/2d9bbd2769e71e7b464bd22fc335999dd8000682)), closes [#I3SPJ1](https://gitee.com/openharmony/kernel_liteos_m/issues/I3SPJ1)
* 修复中断操作接口头文件位置变更,导致的编译错误 ([013a953](https://gitee.com/openharmony/kernel_liteos_m/commits/013a953926ca7cefd8a2f7c74d23c36c49765b59)), closes [#I4665Z](https://gitee.com/openharmony/kernel_liteos_m/issues/I4665Z)
* 修复文档链接失效问题 ([5d53c84](https://gitee.com/openharmony/kernel_liteos_m/commits/5d53c848124319a95f509b56ba001357c6dd8b05)), closes [#I4529I](https://gitee.com/openharmony/kernel_liteos_m/issues/I4529I)
* 内核模块编译增加-Werror编译选项且清除内核编译告警 ([3798091](https://gitee.com/openharmony/kernel_liteos_m/commits/3798091d87441ea445ec642de57e036dbbc8370e)), closes [#I46E6S](https://gitee.com/openharmony/kernel_liteos_m/issues/I46E6S)
* 删除MQ内冗余的重复宏定义 ([6d72916](https://gitee.com/openharmony/kernel_liteos_m/commits/6d7291660ad04682f05850876f81dfd0cba8ea6b)), closes [#I3U5QQ](https://gitee.com/openharmony/kernel_liteos_m/issues/I3U5QQ)
* 删除延时节点后,存在时间无法有效刷新的场景 ([0a87c04](https://gitee.com/openharmony/kernel_liteos_m/commits/0a87c04d58d11da2082470698de0760d72259533)), closes [#I45I9Y](https://gitee.com/openharmony/kernel_liteos_m/issues/I45I9Y)
* 在内核初始化前期启动tick timer ([b3841ed](https://gitee.com/openharmony/kernel_liteos_m/commits/b3841ed1ddbfb3359c7a0ceca04fc0f645d440c3)), closes [#I410F0](https://gitee.com/openharmony/kernel_liteos_m/issues/I410F0)
* 增加MPU功能的开关宏默认关闭 ([9709d29](https://gitee.com/openharmony/kernel_liteos_m/commits/9709d29b87a3888412ffda586e16eba86adccfe7)), closes [#I3WE0S](https://gitee.com/openharmony/kernel_liteos_m/issues/I3WE0S)
* 宏LOSCFG_SUPPORT_FATFS在fs.c中存在使用问题导致无fatfs的情况下编译出错 ([c1614ce](https://gitee.com/openharmony/kernel_liteos_m/commits/c1614ce2b4d4dfcda9532cbeeff25ad7a6558196)), closes [#I44XNR](https://gitee.com/openharmony/kernel_liteos_m/issues/I44XNR)
* 延时队列为NULL时返回的响应时间为64位最大值导致无法更新tick timer的响应周期 ([bcec32e](https://gitee.com/openharmony/kernel_liteos_m/commits/bcec32e389634097102a203ee7e937ed3193c984)), closes [#I3W1LF](https://gitee.com/openharmony/kernel_liteos_m/issues/I3W1LF)
* 支持smoke 测试用例 ([3ad5942](https://gitee.com/openharmony/kernel_liteos_m/commits/3ad5942301a1094a2c6b6ffee280cf09cfdb2a88)), closes [#I424RX](https://gitee.com/openharmony/kernel_liteos_m/issues/I424RX)
* 新增函数regcomp,regfree和regexec支持 ([86d5544](https://gitee.com/openharmony/kernel_liteos_m/commits/86d5544a3fd5f41f7f2abe3b143e9f1dc9b430f8)), closes [#I3U9LE](https://gitee.com/openharmony/kernel_liteos_m/issues/I3U9LE)
* 清理残留无效的trace代码 ([3c48951](https://gitee.com/openharmony/kernel_liteos_m/commits/3c489518576583ab6bf0d581810ef0a02b6ccd51)), closes [#I3ZMB4](https://gitee.com/openharmony/kernel_liteos_m/issues/I3ZMB4)
* 解决arm9编译冲突问题 ([c1a6245](https://gitee.com/openharmony/kernel_liteos_m/commits/c1a624536887fef44fed37134638bf40191b9aae)), closes [#I420PQ](https://gitee.com/openharmony/kernel_liteos_m/issues/I420PQ)
* 调度过程低概率触发OsSchedTaskEnQueue断言导致系统异常 ([e5e9289](https://gitee.com/openharmony/kernel_liteos_m/commits/e5e9289a08cf1db71c09647b71a864f5a1f8a4a2)), closes [#I3VX9Y](https://gitee.com/openharmony/kernel_liteos_m/issues/I3VX9Y)
* 调整hook类型和位置方便调试 ([369320d](https://gitee.com/openharmony/kernel_liteos_m/commits/369320de3710486f252c55c522e8c06e19541b77)), closes [#I3TGZS](https://gitee.com/openharmony/kernel_liteos_m/issues/I3TGZS)
### Features
* add cmsis ThreadFlags support ([cea551e](https://gitee.com/openharmony/kernel_liteos_m/commits/cea551e99ea0da8eefbaa826de2f68813252fb83))
* add deps to musl and securec ([bfa25fc](https://gitee.com/openharmony/kernel_liteos_m/commits/bfa25fcaa355c28a6139f683c4453f677e23abd7))
* add file type support for LfsStat ([ceaed2d](https://gitee.com/openharmony/kernel_liteos_m/commits/ceaed2dc86de2ed242aab4dd02c1f34e064583b3)), closes [#I3ZCDR](https://gitee.com/openharmony/kernel_liteos_m/issues/I3ZCDR)
* add interface of dhcp_is_bound ([84a180d](https://gitee.com/openharmony/kernel_liteos_m/commits/84a180d585686cda693bf8c6ed6b86f7c5dd5eee)), closes [#I46W08](https://gitee.com/openharmony/kernel_liteos_m/issues/I46W08)
* add L0 shell function ([97283b7](https://gitee.com/openharmony/kernel_liteos_m/commits/97283b7c5dd44b266e94fcf0f5d21e63ee1ec7e0))
* add LOS_ListHeadInsert function ([430b186](https://gitee.com/openharmony/kernel_liteos_m/commits/430b186be7ec1554a29a6d509188eb877d796a7e)), closes [#I3TAQA](https://gitee.com/openharmony/kernel_liteos_m/issues/I3TAQA)
* **kernel:** 补充获取最高、最低优先级接口 ([c24c38b](https://gitee.com/openharmony/kernel_liteos_m/commits/c24c38b084c13a2cdc5616f88bb5f63153600c28)), closes [#I42HM7](https://gitee.com/openharmony/kernel_liteos_m/issues/I42HM7)
* L0 armquem 剥离工具链 ([67d7455](https://gitee.com/openharmony/kernel_liteos_m/commits/67d74559d1bb3820bd51da2e2bf43e41e1224314))
* L0 支持Trace ([56c93a6](https://gitee.com/openharmony/kernel_liteos_m/commits/56c93a641b3c7a3d1ef9293ee3c95cccb559191f)), closes [#I41Y9Y](https://gitee.com/openharmony/kernel_liteos_m/issues/I41Y9Y)
* L0 支持低功耗框架 ([558ce14](https://gitee.com/openharmony/kernel_liteos_m/commits/558ce14becab05102497afca90a43d89abaf5531)), closes [#I3UDNV](https://gitee.com/openharmony/kernel_liteos_m/issues/I3UDNV)
* L0 测试用例支持risc-v qemu 编译运行 ([2dd6c08](https://gitee.com/openharmony/kernel_liteos_m/commits/2dd6c080daab52eaf61e5eefe7b581190670e8a7)), closes [#I3YILG](https://gitee.com/openharmony/kernel_liteos_m/issues/I3YILG)
* **liteos_m:** support backtrace for riscv ([ca1792a](https://gitee.com/openharmony/kernel_liteos_m/commits/ca1792aa4b5a85ca4ea6e41b265858c6b24a6897)), closes [#I3RVXY](https://gitee.com/openharmony/kernel_liteos_m/issues/I3RVXY)
* los_memory.c代码重复率处理 ([475db62](https://gitee.com/openharmony/kernel_liteos_m/commits/475db62db1ac285fc6cab91f09af618870269580)), closes [#I44WNU](https://gitee.com/openharmony/kernel_liteos_m/issues/I44WNU)
* M33平台支持GCC环境的Trustzone ([d469da2](https://gitee.com/openharmony/kernel_liteos_m/commits/d469da29c6d316640eaa7865f98ad8d6e2eb6d44)), closes [#I3Y85I](https://gitee.com/openharmony/kernel_liteos_m/issues/I3Y85I)
* provide getifaddrs for liteos_m ([948501a](https://gitee.com/openharmony/kernel_liteos_m/commits/948501ac73e7887f4585eca156ad760acc2a3b1f)), closes [#I400S5](https://gitee.com/openharmony/kernel_liteos_m/issues/I400S5)
* risc-v gn 编译框架添加汇编编译选项 ([76dc343](https://gitee.com/openharmony/kernel_liteos_m/commits/76dc343c888ec4e65eba43feb49921111b144640)), closes [#I3YS5Y](https://gitee.com/openharmony/kernel_liteos_m/issues/I3YS5Y)
* Support arm9 ([6d7c9df](https://gitee.com/openharmony/kernel_liteos_m/commits/6d7c9dfe597affb260e8bd74fa606b6d68c2b49a)), closes [#I3WLCN](https://gitee.com/openharmony/kernel_liteos_m/issues/I3WLCN)
* Support arm9 fiq swi mode and using system mode. ([97b5b08](https://gitee.com/openharmony/kernel_liteos_m/commits/97b5b0837be4b8df1381af29a6f650f243322840)), closes [#I3WLCN](https://gitee.com/openharmony/kernel_liteos_m/issues/I3WLCN)
* support non-continuous memory regions ([0facb0c](https://gitee.com/openharmony/kernel_liteos_m/commits/0facb0c0179f29a08b037655bbe691c98384dc84)), closes [#I43XOP](https://gitee.com/openharmony/kernel_liteos_m/issues/I43XOP)
* 完善m核qemu串口驱动支持shell输入 ([c4dc5ab](https://gitee.com/openharmony/kernel_liteos_m/commits/c4dc5ab0f8b5caae55efdbedf59ab07f5006f6c2)), closes [#I46N7F](https://gitee.com/openharmony/kernel_liteos_m/issues/I46N7F)
* 按任务统计已经alloc的内存大小 ([53117f9](https://gitee.com/openharmony/kernel_liteos_m/commits/53117f9f47a8dd3023e83dc0cc0de224eab9719f)), closes [#I44WNU](https://gitee.com/openharmony/kernel_liteos_m/issues/I44WNU)
* 支持native动态加载组件 ([d753834](https://gitee.com/openharmony/kernel_liteos_m/commits/d75383400efe5d9ca0ae4093e4f2e65fee03024b)), closes [#I418HJ](https://gitee.com/openharmony/kernel_liteos_m/issues/I418HJ)
* 新增LOSCFG_BASE_CORE_TSK_SWITCH_HOOK 宏定义配置 ([39efd6f](https://gitee.com/openharmony/kernel_liteos_m/commits/39efd6fb30ee7dc9159811f5d37dffcdfe81bae0)), closes [#I40Q9O](https://gitee.com/openharmony/kernel_liteos_m/issues/I40Q9O)
* 新增ROM/RAM分析工具 ([ee3403d](https://gitee.com/openharmony/kernel_liteos_m/commits/ee3403deaf24dc612b51354f31f795fb0b9a49b5))
* 补充fs相关函数用例 ([2a95af5](https://gitee.com/openharmony/kernel_liteos_m/commits/2a95af5bf1b412de27b4518d0abf7c335366d4d7)), closes [#I3UQ4F](https://gitee.com/openharmony/kernel_liteos_m/issues/I3UQ4F)
* 解决fclose等函数工具链重定义问题 ([b244ad4](https://gitee.com/openharmony/kernel_liteos_m/commits/b244ad4ad0da8d151b69071fdd6db808c91f85a5)), closes [#I3UG6O](https://gitee.com/openharmony/kernel_liteos_m/issues/I3UG6O)
### BREAKING CHANGES
* 新增4个对外接口声明在los_dynlink.h文件中分别为
(1) LOS_DynlinkInit: 动态加载模块初始化。
(2) LOS_SoLoad: 加载指定路径的共享库。
(3) LOS_FindSym: 根据共享库句柄查找指定符号。
(4) LOS_SoUnload: 卸载共享库。
* 1.新增一系列trace的对外API位于los_trace.h中.
LOS_TRACE_EASY简易插桩
LOS_TRACE标准插桩
LOS_TraceInit配置Trace缓冲区的地址和大小
LOS_TraceStart开启事件记录
LOS_TraceStop停止事件记录
LOS_TraceRecordDump输出Trace缓冲区数据
LOS_TraceRecordGet获取Trace缓冲区的首地址
LOS_TraceReset清除Trace缓冲区中的事件
LOS_TraceEventMaskSet设置事件掩码仅记录某些模块的事件
LOS_TraceHwiFilterHookReg注册过滤特定中断号事件的钩子函数
* 1.原调度中基于tick timer的低功耗扩展和当前的pm模块合并删除原对外接口LOS_SchedSleepInit,
 变为pm模块统一提供的LOS_PmRegistered接口.
2.原来在arch los_timer.h下提供的低功耗模式为枚举LOS_SysSleepEnum其中OS_SYS_NORMAL_SLEEP
和OS_SYS_DEEP_SLEEP不符合对外定义统一修改为LOS_SYS_NORMAL_SLEEP和LOS_SYS_DEEP_SLEEP,
并移至los_pm.h中.
3.VOID HalEnterSleep(LOS_SysSleepEnum sleep) 变更为UINT32 HalEnterSleep(VOID).

538
Kconfig Normal file
View File

@@ -0,0 +1,538 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mainmenu "Huawei LiteOS Configuration"
menu "Compiler"
choice
prompt "Compiler type"
default COMPILER_GCC
help
Choose compiler type.
config COMPILER_GCC
bool "GCC"
config COMPILER_CLANG_LLVM
bool "Clang"
config COMPILER_ICCARM
bool "ICCARM"
endchoice
config COMPILE_DEBUG
bool "Enable debug options"
default n
help
Answer Y to add -g option in compile command.
config COMPILE_OPTIMIZE
bool "Enable code optimization options"
default y
help
Answer Y to add optimization options for efficient code.
The final binary size will be smaller and execute faster.
But the debugging experience may be worst somehow.
config COMPILE_OPTIMIZE_SIZE
bool "Enable code size optimization options" if COMPILE_OPTIMIZE
default y
help
Answer Y to add optimization options for small code size.
The final binary size will be smaller.
But the compile time may be a bit longer.
config COMPILE_LTO
bool "Enable link time optimization (LTO)" if COMPILE_OPTIMIZE_SIZE
default y
help
Answer Y to add lto options for more smaller code size.
The final binary size will be smaller.
But the compile time may be much longer.
endmenu
menu "Platform"
######################### config options of bsp #####################
config PLATFORM
string
default "virt" if PLATFORM_QEMU_ARM_VIRT_CM7 || PLATFORM_QEMU_ARM_VIRT_CM4 || PLATFORM_QEMU_ARM_VIRT_CM55 || PRODUCT_QEMU_RISCV32_VIRT || PLATFORM_QEMU_CSKY_SMARTL || PLATFORM_QEMU_XTENSA_ESP32
config DEVICE_COMPANY
string
default "qemu" if PLATFORM_QEMU_ARM_VIRT_CM7 || PLATFORM_QEMU_ARM_VIRT_CM4 || PLATFORM_QEMU_ARM_VIRT_CM55 || PRODUCT_QEMU_RISCV32_VIRT || PLATFORM_QEMU_CSKY_SMARTL || PLATFORM_QEMU_XTENSA_ESP32
choice
prompt "Chip"
default PLATFORM_QEMU_ARM_VIRT_CM7
help
Qemu ARM Virt variants (based on different CPU types):
- qemu_arm_virt_cm7
- qemu_arm_virt_cm4
- qemu_riscv32_virt
- qemu_csky_smartl
- qemu_xtensa_esp32
config PLATFORM_QEMU_ARM_VIRT_CM7
bool "qemu_arm_virt_cm7"
select ARCH_CORTEX_M7
help
QEMU ARM Virtual Platform using Cortex-M7 CPU.
config PLATFORM_QEMU_ARM_VIRT_CM4
bool "qemu_arm_virt_cm4"
select ARCH_CORTEX_M4
help
QEMU ARM Virtual Platform using Cortex-M4 CPU.
config PLATFORM_QEMU_ARM_VIRT_CM55
bool "qemu_arm_virt_cm55"
select ARCH_CORTEX_M55
help
QEMU ARM Virtual Platform using Cortex-M55 CPU.
config PLATFORM_QEMU_RISCV32_VIRT
bool "qemu_riscv32_virt"
select ARCH_RISCV32
help
QEMU RISCV Virtual Platform using riscv32 CPU.
config PLATFORM_QEMU_CSKY_SMARTL
bool "qemu_csky_smartl"
select ARCH_CSKY
help
QEMU SmartL Virtual Platform using csky CPU.
config PLATFORM_QEMU_XTENSA_ESP32
bool "qemu_xtensa_esp32"
select ARCH_XTENSA
help
QEMU ESP32 Virtual Platform using xtensa CPU.
endchoice
choice
prompt "Product"
help
Select your target board.
config PRODUCT_QEMU_RISCV32_VIRT
bool "riscv32_virt" if PLATFORM_QEMU_RISCV32_VIRT
endchoice
######################### config options of cpu arch ################
source "arch/Kconfig"
# Device Kconfig import
osource "$(DEVICE_PATH)/Kconfig"
config SOC_COMPANY
string "SoC company name to locate soc build path"
help
This option specifies the SoC company name, used to locate the build path for soc. This option is set by the
SoC's Kconfig file, and should be exactly the same with SoC company path, and the user should generally avoid
modifying it via the menu configuration.
orsource "../../device/board/*/Kconfig.liteos_m.shields"
orsource "../../device/board/$(BOARD_COMPANY)/Kconfig.liteos_m.defconfig.boards"
choice
prompt "Board Selection"
orsource "../../device/board/$(BOARD_COMPANY)/Kconfig.liteos_m.boards"
endchoice
orsource "../../device/soc/*/Kconfig.liteos_m.defconfig"
choice
prompt "SoC Series Selection"
orsource "../../device/soc/*/Kconfig.liteos_m.series"
endchoice
orsource "../../device/soc/*/Kconfig.liteos_m.soc"
endmenu
######################### config options of kernel #####################
menu "Kernel"
######################### config options of extended #####################
config KERNEL_EXTKERNEL
bool "Enable Extend Kernel"
default y
help
This option will enable extend Kernel of LiteOS. Extend kernel include
cppsupport, cpup, etc. You can select one or some
of them.
config KERNEL_BACKTRACE
bool "Enable Backtrace"
default n
depends on KERNEL_EXTKERNEL
help
If you wish to build LiteOS with support for backtrace.
choice
prompt "Select Backtrace Type"
depends on KERNEL_BACKTRACE
config BACKTRACE_TYPE_1
bool "1: Call stack analysis for cortex-m series by scanning the stack"
depends on ARCH_ARM && !ARCH_ARM9
config BACKTRACE_TYPE_2
bool "2: Call stack analysis for risc-v by using frame pointer"
depends on ARCH_RISCV
config BACKTRACE_TYPE_3
bool "3: Call stack analysis for risc-v by scanning the stack"
depends on ARCH_RISCV
config BACKTRACE_TYPE_4
bool "4: Call stack analysis for xtensa by scanning the stack"
depends on ARCH_XTENSA
config BACKTRACE_TYPE_5
bool "5: Call stack analysis for c-sky by scanning the stack"
depends on ARCH_CSKY
config BACKTRACE_TYPE_6
bool "6: Call stack analysis for arm9 by scanning the stack"
depends on ARCH_ARM9
endchoice
config BACKTRACE_TYPE
int
default 0 if ! KERNEL_BACKTRACE
default 1 if BACKTRACE_TYPE_1
default 2 if BACKTRACE_TYPE_2
default 3 if BACKTRACE_TYPE_3
default 4 if BACKTRACE_TYPE_4
default 5 if BACKTRACE_TYPE_5
default 6 if BACKTRACE_TYPE_6
config BACKTRACE_DEPTH
int "Backtrace depth"
default 15
depends on KERNEL_BACKTRACE
config KERNEL_CPPSUPPORT
bool "Enable C++ Support"
default n
depends on KERNEL_EXTKERNEL
help
If you wish to build LiteOS with support for C++.
rsource "components/signal/Kconfig"
config BASE_CORE_CPUP
bool
default n
config KERNEL_CPUP
bool "Enable Cpup"
default n
depends on KERNEL_EXTKERNEL
select BASE_CORE_CPUP
help
If you wish to build LiteOS with support for cpup.
config CPUP_INCLUDE_IRQ
bool "Enable Cpup include irq"
default y
depends on KERNEL_CPUP
help
If you wish to include irq usage for cpup.
config KERNEL_DYNLINK
bool "Enable Dynamic Link Feature"
default n
depends on KERNEL_EXTKERNEL && ARCH_ARM
help
If you wish to build LiteOS with support for dynamic link.
config KERNEL_PM
bool "Enable Power Management"
default n
depends on KERNEL_EXTKERNEL
help
Configuration item for low power frame tailoring.
If you wish to build LiteOS with support for power management.
config KERNEL_PM_IDLE
bool "Enable Power Management Idle"
default n
depends on KERNEL_PM
help
Configuration item for low power frame tailoring.
If you wish to build LiteOS with support for power management idle.
config KERNEL_PM_DEBUG
bool "Power Management Debug"
default n
depends on KERNEL_PM
help
Configuration item for low power frame debug tailoring.
config PLATFORM_EXC
bool "Enable Platform Exc Hook"
default n
depends on KERNEL_EXTKERNEL
config KERNEL_LMK
bool "Enable Low Memory Killer"
default n
depends on KERNEL_EXTKERNEL
help
Configuration item for low memory killer tailoring.
If you wish to build LiteOS with support for low memory killer.
config KERNEL_LMK_DEBUG
bool "Low Memory Killer Debug"
default n
depends on KERNEL_LMK
help
Configuration item forlow memory killer debug tailoring.
######################### config options of trace #########################
source "components/trace/Kconfig"
######################### config options of lms #########################
source "components/lms/Kconfig"
endmenu
######################### config options of compatibility ##############
menu "Compat"
rsource "kal/Kconfig"
endmenu
######################## config options of filesystem ##################
menu "FileSystem"
rsource "components/fs/Kconfig"
endmenu
######################## config options of net ############################
menu "Net"
config NET_LWIP
bool "Enable Lwip"
default n
select NET_LWIP_SACK
help
Answer Y to enable LiteOS support lwip.
config NET_LWIP_SACK
bool
default n
endmenu
######################## config options of debug ########################
menu "Debug"
config THUMB
bool "Enable Thumb"
default n
depends on ARCH_ARM
help
Answer Y to build thumb version. This will make LiteOS smaller.
config DEBUG_VERSION
bool "Enable a Debug Version"
default y
help
If you do not select this option that means you enable a release version for LiteOS.
It also means you do not want to use debug modules, like shell,telnet,tftp,nfs and
memory check, etc.
If you select this option that means you enable a debug version for LiteOS.
That means you want a opposite behaviour compared to release version.
config DEBUG_KERNEL
bool "Enable Debug LiteOS Kernel Resource"
default n
depends on DEBUG_VERSION
help
If you select this option that means you enable debugging kernel resource.
It also means you want to get queue, mutex, semaphore, memory debug information.
That means you want a opposite behaviour compared to release version.
config MUTEX_CREATE_TRACE
bool "Enable Mutex Trace Debugging"
default n
depends on ARCH_ARM
depends on DEBUG_KERNEL
help
Answer Y to enable debug mutex trace.
config NET_LWIP_SACK_TFTP
bool "Enable Tftp"
default y
depends on SHELL && NET_LWIP_SACK && DEBUG_VERSION
help
Answer Y to enable LiteOS support tftp cmd and tftp tool.
config DEBUG_HOOK
bool "Enable Hook Framework"
default n
depends on DEBUG_VERSION
help
Enable the kernel hook framework to support customized trace information capture.
config SHELL_CMD_DEBUG
bool "Enable shell cmd Debug"
default n
depends on DEBUG_VERSION && SHELL
config DEBUG_TOOLS
bool "Enable DEBUG TOOLS"
default n
depends on DEBUG_VERSION
help
Answer Y to enable LiteOS debug tools, include stackdump, hwidump, tasktrack.
config MEM_DEBUG
bool "Enable MEM Debug"
default n
depends on DEBUG_VERSION
help
Answer Y to enable LiteOS support mem debug.
config MEM_LEAKCHECK
bool "Enable Function call stack of Mem operation recorded"
default n
depends on DEBUG_VERSION && MEM_DEBUG
select KERNEL_BACKTRACE
help
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the information of mem node.
config BASE_MEM_NODE_INTEGRITY_CHECK
bool "Enable integrity check or not"
default n
depends on DEBUG_VERSION && MEM_DEBUG
config MEM_WATERLINE
bool "Enable memory pool waterline or not"
default n
depends on DEBUG_VERSION && MEM_DEBUG
config TASK_MEM_USED
bool "Enable show task mem used or not"
default n
depends on DEBUG_VERSION && MEM_DEBUG
source "components/shell/Kconfig"
endmenu
######################## config options os drivers ########################
menu "Driver"
source "drivers/Kconfig"
endmenu
######################## config options os security #######################
menu "Security"
config SECURE_TRUSTZONE
bool "Enable ARM TrustZone"
default n
depends on ARCH_ARM
depends on ARCH_ARM_V8M
config SECURE_HEAP_SIZE
int "TrustZone Heap Size (bytes)"
default 2048
depends on SECURE_TRUSTZONE
config SECURE
bool "Enable Security"
default n
select MPU_ENABLE
config MPU_ENABLE
bool "Enable MPU"
default n
endmenu
menu "Test"
config TEST
bool
default n
config KERNEL_TEST
bool "Enable Kernel Test"
default n
select TEST
config KERNEL_TEST_FULL
bool "Full Kernel Test"
default n
depends on KERNEL_TEST
endmenu
menu "Stack Smashing Protector (SSP) Compiler Feature"
choice
prompt "Enable stack buffer overflow detection"
default CC_STACKPROTECTOR_STRONG
---help---
This option turns on the -fstack-protector GCC feature. This
feature puts, at the beginning of functions, a canary value on
the stack just before the return address, and validates
the value just before actually returning. Stack based buffer
overflows (that need to overwrite this return address) now also
overwrite the canary, which gets detected and the attack is then
neutralized via a kernel panic.
This feature requires gcc version 4.2 or above, or a distribution
gcc with the feature backported. Older versions are automatically
detected and for those versions, this configuration option is
ignored. (and a warning is printed during bootup)
config CC_NO_STACKPROTECTOR
bool "-fno-stack-protector"
config CC_STACKPROTECTOR
bool "-fstack-protector"
config CC_STACKPROTECTOR_STRONG
bool "-fstack-protector-strong"
config CC_STACKPROTECTOR_ALL
bool "-fstack-protector-all"
endchoice
endmenu

28
LICENSE Normal file
View File

@@ -0,0 +1,28 @@
Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

122
Makefile Normal file
View File

@@ -0,0 +1,122 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
LITEOSTOPDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
export LITEOSTOPDIR
LITEOS_TARGET = liteos
HIDE := @
KCONFIG_CMDS := $(notdir $(wildcard $(dir $(shell which menuconfig))*config))
ohos_kernel ?= liteos_m
$(foreach line,$(shell hb env | sed 's/\[OHOS INFO\]/ohos/g;s/ /_/g;s/:_/=/g' || true),$(eval $(line)))
ifneq ($(ohos_kernel),liteos_m)
$(error The selected product ($(ohos_product)) is not a liteos_m kernel type product)
endif
ifeq ($(PRODUCT_PATH),)
PRODUCT_PATH:=$(ohos_product_path)
endif
ifeq ($(DEVICE_PATH),)
DEVICE_PATH:=$(ohos_device_path)
endif
ifeq ($(BOARD_COMPANY),)
BOARD_COMPANY:=$(ohos_device_company)
endif
ifeq ($(TEE:1=y),y)
tee = _tee
endif
ifeq ($(RELEASE:1=y),y)
CONFIG ?= $(PRODUCT_PATH)/kernel_configs/release$(tee).config
else
CONFIG ?= $(PRODUCT_PATH)/kernel_configs/debug$(tee).config
endif
KCONFIG_CONFIG ?= $(CONFIG)
LITEOS_MENUCONFIG_H ?= $(LITEOSTOPDIR)/config.h
LITEOS_CONFIG_FILE ?= $(LITEOSTOPDIR)/.config
# export los_config.mk related environment variables
export LITEOS_MENUCONFIG_H
export LITEOS_CONFIG_FILE
export BOARD_COMPANY
export DEVICE_PATH
export PRODUCT_PATH
# export kconfig related environment variables
export CONFIG_=LOSCFG_
export srctree=$(LITEOSTOPDIR)
-include $(LITEOS_CONFIG_FILE)
define HELP =
Usage: make [TARGET]... [PARAMETER=VALUE]...
Targets:
help: display this help and exit
clean: clean compiled objects
cleanall: clean all build outputs
all: do build (Default target)
update_config: update product kernel config (use menuconfig)
xxconfig: invoke xxconfig command of kconfiglib (xxconfig is one of $(KCONFIG_CMDS))
Parameters:
TEE: boolean value(1 or y for true), enable tee
RELEASE: boolean value(1 or y for true), build release version
CONFIG: kernel config file to be use
args: arguments for xxconfig command
endef
export HELP
all:
$(HIDE)hb build -f --gn-args "liteos_kernel_only=true liteos_name=\"$(LITEOS_TARGET)\""
help:
$(HIDE)echo "$$HELP"
$(filter-out menuconfig,$(KCONFIG_CMDS)):
$(HIDE)$@ $(args)
$(LITEOS_CONFIG_FILE): $(KCONFIG_CONFIG)
$(HIDE)env KCONFIG_CONFIG=$< genconfig --config-out $@ --header-path $(LITEOS_MENUCONFIG_H)
update_config menuconfig:
$(HIDE)test -f "$(CONFIG)" && cp -v "$(CONFIG)" .config && menuconfig $(args) && savedefconfig --out "$(CONFIG)"
clean:
$(HIDE)hb clean
$(HIDE)echo "clean $(LOSCFG_PLATFORM) finish"
cleanall: clean
$(HIDE)echo "clean all done"
.PHONY: all clean cleanall help update_config $(KCONFIG_CMDS) $(KCONFIG_CONFIG)

8
NOTICE Normal file
View File

@@ -0,0 +1,8 @@
1、In kernel/liteos_m/targets/cortex-m4_stm32f429ig_fire-challenger_iar directory, the files including main.c,
target_config.h, dprintf.c, board/iar_stm32f429ig_fire-challenger.c and board/iar_stm32f429ig_fire-challenger.h,
are under the terms of the licence: kernel/liteos_m/LICENSE file,
and other files are under the terms of the licence: kernel/liteos_m/targets/cortex-m4_stm32f429ig_fire-challenger_iar/LICENSE.pdf file.
2、In kernel/liteos_m/targets/cortex-m7_nucleo_f767zi_gcc directory, the files including target_config.h,
Core/Inc/task_sample.h and Core/Src/task_sample.c, are under the terms of the licence: kernel/liteos_m/LICENSE file,
and other files are under the terms of the licence: kernel/liteos_m/targets/cortex-m7_nucleo_f767zi_gcc/LICENSE.pdf file.

90
OAT.xml Normal file
View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README.
-->
<configuration>
<oatconfig>
<licensefile></licensefile>
<policylist>
<policy name="projectPolicy" desc="">
<policyitem type="copyright" name="Huawei Technologies Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
<policyitem type="copyright" name="Hunan OpenValley Digital Industry Development Co., Ltd." path=".*" desc="Developed By OpenValley Digital Co., Ltd."/>
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
</policy>
</policylist>
<filefilterlist>
<filefilter name="defaultFilter" desc="文件属于FreeBSD仓库软连接本仓库屏蔽告警在FreeBSD仓库进行处理">
<filteritem type="filepath" name="arch/risc-v/nuclei/gcc/nmsis/Library/.*" desc="文件属于三方芯片的二进制代码,属于社区贡献,不用提供额外的说明"/>
<filteritem type="filepath" name="targets/riscv_nuclei_demo_soc_gcc/.*" desc="文件属于nuclei三方芯片的源代码文件头说明跟随liteos_m/LICENSE不用额外说明"/>
<filteritem type="filepath" name="targets/riscv_nuclei_gd32vf103_soc_gcc/.*" desc="文件属于nuclei三方芯片的源代码文件头说明跟随liteos_m/LICENSE不用额外说明"/>
<filteritem type="filepath" name="NOTICE" desc="NOTICE文件"/>
<filteritem type="filepath" name="arch/risc-v/nuclei" desc="该文件的license为apache 2.0符合"/>
</filefilter>
<filefilter name="defaultFilter" desc="Files not to check">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="defaultPolicyFilter" desc="Filters for compatibilitylicense header policies">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="copyrightPolicyFilter" desc="Filters for copyright header policies">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="licenseFileNamePolicyFilter" desc="Filters for LICENSE file policies">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="readmeFileNamePolicyFilter" desc="Filters for README file policies">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="readmeOpenSourcefileNamePolicyFilter" desc="Filters for README.OpenSource file policies">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
<filteritem type="filepath"
name="figures/architecture-of-openharmony-the-liteos-cortex-m-kernel.png" desc="architecture-of-openharmony-the-liteos-cortex-m-kernel"/>
<filteritem type="filepath" name="figures/OpenHarmony-LiteOS-M核内核架构图.png" desc="内核驱动架构"/>
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
</filefilterlist>
<licensematcherlist>
<!--licensematcher name="uvwxyz License" desc="If the scanning result is InvalidLicense, you can define matching rules here. Note that quotation marks must be escaped.">
<licensetext name="
uvwxyz license textA xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
" desc=""/>
<licensetext name="
uvwxyz license textB xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
" desc=""/>
</licensematcher-->
</licensematcherlist>
</oatconfig>
</configuration>

125
README.md Normal file
View File

@@ -0,0 +1,125 @@
# LiteOS-M Kernel<a name="EN-US_TOPIC_0000001096757661"></a>
- [Introduction](#section11660541593)
- [Directory Structure](#section161941989596)
- [Constraints](#section119744591305)
- [Usage](#section3732185231214)
- [Contribution](#section1371123476307)
- [Repositories Involved](#section1371113476307)
## Introduction<a name="section11660541593"></a>
OpenHarmony LiteOS-M is a lightweight operating system kernel designed for the Internet of Things (IoT) field. It features small footprint, low power consumption, and high performance. It has a simple code structure, including the minimum kernel function set, kernel abstraction layer, optional components, and project directory. The LiteOS-M kernel is divided into the hardware layer and hardware-irrelevant layers. The hardware layer provides a unified hardware abstraction layer (HAL) interface for easier hardware adaptation. A range of compilation toolchains can be used with different chip architectures to meet the expansion of diversified hardware and compilation toolchains in the Artificial Intelligence of Things (AIoT) field.
**Figure1** shows the architecture of the LiteOS-M kernel.
**Figure 1** Architecture of the OpenHarmony LiteOS-M kernel<a name="fig0865152210223"></a>
![](figures/architecture-of-openharmony-the-liteos-cortex-m-kernel.png "OpenHarmony-LiteOS-M Kernel Architecture")
## Directory Structure<a name="section161941989596"></a>
The directory structure is as follows. For more details, see [arch_spec.md](arch_spec.md).
```
/kernel/liteos_m
├── arch # Code of the kernel instruction architecture layer
│ ├── arm # Code of the ARM32 architecture
│ │ ├── arm9 # Code of the ARM9 architecture
│ │ ├── cortex-m3 # Code of the cortex-m3 architecture
│ │ ├── cortex-m33 # Code of the cortex-m33 architecture
│ │ ├── cortex-m4 # Code of the cortex-m4 architecture
│ │ ├── cortex-m7 # Code of the cortex-m7 architecture
│ │ └── include # Arm architecture public header file directory
│ ├── csky # Code of the csky architecture
│ │ └── v2 # Code of the csky v2 architecture
│ ├── include # APIs exposed externally
│ ├── risc-v # Code of the risc-v architecture
│ │ ├── nuclei # Code of the nuclei system technology risc-v architecture
│ │ └── riscv32 # Code of the risc-v official common architecture
│ └── xtensa # Code of the xtensa architecture
│ └── lx6 # Code of the lx6 xtensa architecture
├── components # Optional components
│ ├── backtrace # Backtrace support
│ ├── cppsupport # C++ support
│ ├── cpup # CPU percent (CPUP)
│ ├── dynlink # Dynamic loading and linking
│ ├── exchook # Exception hooks
│ ├── fs # File systems
│ ├── lmk # Low memory killer functions
│ ├── lms # Lite memory sanitizer functions
│ ├── net # Networking functions
│ ├── power # Power management
│ ├── shell # Shell function
│ ├── fs # File systems
│ └── trace # Trace tool
├── drivers # driver Kconfig
├── kal # Kernel abstraction layer
│ ├── cmsis # CMSIS API support
│ └── posix # POSIX API support
├── kernel # Minimum kernel function set
│ ├── include # APIs exposed externally
│ └── src # Source code of the minimum kernel function set
├── testsuites # Kernel testsuites
├── tools # Kernel tools
├── utils # Common directory
```
## Constraints<a name="section119744591305"></a>
OpenHarmony LiteOS-M supports only C and C++.
Applicable architecture: See the directory structure for the arch layer.
As for dynamic loading module, the shared library to be loaded needs signature verification or source restriction to ensure security.
## Usage<a name="section3732185231214"></a>
The OpenHarmony LiteOS-M kernel build system is a modular build system based on Generate Ninja (GN) and Ninja. It supports module-based configuration, tailoring, and assembling, and helps you build custom products. This document describes how to build a LiteOS-M project based on GN and Ninja. For details about the methods such as GCC+gn, IAR, and Keil MDK, visit the community websites.
### Setting Up the Environment
Before setting up the environment for a development board, you must set up the basic system environment for OpenHarmony first. The basic system environment includes the OpenHarmony build environment and development environment. For details, see [Setting Up Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/Readme-EN.md).
### Obtaining the OpenHarmony Source Code
For details about how to obtain the source code, see [Source Code Acquisition](https://gitee.com/openharmony/docs/blob/HEAD/en/device-dev/get-code/sourcecode-acquire.md). This document assumes that the clone directory is `~/openHarmony` after the complete OpenHarmony repository code is obtained.
### Example projects
Qemu simulator: `arm_mps2_an386、esp32、riscv32_virt、SmartL_E802`. For details about how to compile and run, see [qemu guide](https://gitee.com/openharmony/device_qemu).
Bestechnic: `bes2600`. For details about how to compile and run, see [Bestechnic developer guide](https://gitee.com/openharmony/device_soc_bestechnic).
### Community Porting Project Links
The LiteOS-M kernel porting projects for specific development boards are provided by community developers. The following provides the links to these projects. If you have porting projects for more development boards, you can provide your links to share your projects.
- Cortex-M3:
- STM32F103 https://gitee.com/rtos_lover/stm32f103_simulator_keil
This repository provides the Keil project code for building the OpenHarmony LiteOS-M kernel based on the STM32F103 chip architecture. This code supports build in Keil MDK mode.
- Cortex-M4:
- STM32F429IGTb https://gitee.com/harylee/stm32f429ig_firechallenger
This repository provides the project code for porting the OpenHarmony LiteOS-M kernel to support the STM32F429IGTb development board. The code supports build in Ninja, GCC, and IAR modes.
## Contribution<a name="section1371123476307"></a>
[How to involve](https://gitee.com/openharmony/docs/blob/master/en/contribute/how-to-contribute.md)
[Commit message spec](https://gitee.com/openharmony/kernel_liteos_m/wikis/Commit%20message%E8%A7%84%E8%8C%83)
[Liteos-M kernel coding style guide](https://gitee.com/openharmony/kernel_liteos_m/wikis/OpenHarmony%E8%BD%BB%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83)
How to contribute a chip based on Liteos-M kernel:
[Mini System SoC Porting Guide](https://gitee.com/openharmony/docs/blob/master/en/device-dev/porting/Readme-EN.md)
## Repositories Involved<a name="section1371113476307"></a>
[Kernel Subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/kernel.md)
[kernel\_liteos\_m](https://gitee.com/openharmony/kernel_liteos_m/blob/master/README.md)

125
README_zh.md Normal file
View File

@@ -0,0 +1,125 @@
# LiteOS-M内核<a name="ZH-CN_TOPIC_0000001096757661"></a>
- [简介](#section11660541593)
- [目录](#section161941989596)
- [约束](#section119744591305)
- [使用说明](#section3732185231214)
- [贡献](#section1371123476307)
- [相关仓](#section1371113476307)
## 简介<a name="section11660541593"></a>
OpenHarmony LiteOS-M内核是面向IoT领域构建的轻量级物联网操作系统内核具有小体积、低功耗、高性能的特点其代码结构简单主要包括内核最小功能集、内核抽象层、可选组件以及工程目录等分为硬件相关层以及硬件无关层硬件相关层提供统一的HALHardware Abstraction Layer接口提升硬件易适配性不同编译工具链和芯片架构的组合分类满足AIoT类型丰富的硬件和编译工具链的拓展。其架构图如图1所示
**图 1** OpenHarmony LiteOS-M核内核架构图<a name="fig0865152210223"></a>
![](figures/OpenHarmony-LiteOS-M核内核架构图.png "OpenHarmony-LiteOS-M核内核架构图")
## 目录<a name="section161941989596"></a>
目录结构如下,详细目录请参考[arch_spec_zh.md](arch_spec_zh.md)。
```
/kernel/liteos_m
├── arch # 内核指令架构层目录
│ ├── arm # arm 架构代码
│ │ ├── arm9 # arm9 架构代码
│ │ ├── cortex-m3 # cortex-m3架构代码
│ │ ├── cortex-m33 # cortex-m33架构代码
│ │ ├── cortex-m4 # cortex-m4架构代码
│ │ ├── cortex-m55 # cortex-m55架构代码
│ │ ├── cortex-m7 # cortex-m7架构代码
│ │ └── include # arm架构公共头文件目录
│ ├── csky # csky架构代码
│ │ └── v2 # csky v2架构代码
│ ├── include # 架构层对外接口存放目录
│ ├── risc-v # risc-v 架构
│ │ ├── nuclei # 芯来科技risc-v架构代码
│ │ └── riscv32 # risc-v官方通用架构代码
│ └── xtensa # xtensa 架构代码
│ └── lx6 # xtensa lx6架构代码
├── components # 可选组件
│ ├── backtrace # 栈回溯功能
│ ├── cppsupport # C++支持
│ ├── cpup # CPUP功能
│ ├── dynlink # 动态加载与链接
│ ├── exchook # 异常钩子
│ ├── fs # 文件系统
│ ├── lmk # Low memory killer 机制
│ ├── lms # Lite memory sanitizer 机制
│ ├── net # Network功能
│ ├── power # 低功耗管理
│ ├── shell # shell功能
│ └── trace # trace 工具
├── drivers # 驱动框架Kconfig
├── kal # 内核抽象层
│ ├── cmsis # cmsis标准接口支持
│ └── posix # posix标准接口支持
├── kernel # 内核最小功能集支持
│ ├── include # 对外接口存放目录
│ └── src # 内核最小功能集源码
├── testsuites # 内核测试用例
├── tools # 内核工具
├── utils # 通用公共目录
```
## 约束<a name="section119744591305"></a>
开发语言C/C++
适用架构详见目录结构arch层。
动态加载模块:待加载的共享库需要验签或者限制来源,确保安全性。
## 使用说明<a name="section3732185231214"></a>
OpenHarmony
LiteOS-M内核的编译构建系统是一个基于gn和ninja的组件化构建系统支持按组件配置、裁剪和拼装按需构建出定制化的产品。本文主要介绍如何基于gn和ninja编译LiteOS-M工程GCC+gn、IAR、Keil MDK等编译方式可以参考社区爱好者贡献的站点。
### 搭建系统基础环境
在搭建各个开发板环境前需要完成OpenHarmony系统基础环境搭建。系统基础环境主要是指OpenHarmony的编译环境和开发环境详细介绍请参考官方站点[开发环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Readme-CN.md)。开发者需要根据环境搭建文档完成环境搭建。
### 获取OpenHarmony源码
详细的源码获取方式,请见[源码获取](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/device-dev/get-code/sourcecode-acquire.md)。获取OpenHarmony完整仓代码后假设克隆目录为`~/openHarmony`
### 已支持的示例工程
Qemu模拟器: `arm_mps2_an386、esp32、riscv32_virt、SmartL_E802`, 编译运行详见: [Qemu指导](https://gitee.com/openharmony/device_qemu)
恒玄科技: `bes2600`, 编译运行详见: [恒玄开发指导](https://gitee.com/openharmony/device_soc_bestechnic)
### 社区移植工程链接
LiteOS-M内核移植的具体开发板的工程由社区开发者提供可以访问社区开发者代码仓获取。如果您移植支持了更多开发板可以提供链接给我们进行社区分享。
- cortex-m3
- STM32F103 https://gitee.com/rtos_lover/stm32f103_simulator_keil
该仓包含OpenHarmony LiteOS-M内核基于STM32F103芯片架构构建的Keil工程支持Keil MDK方式进行编译。
- cortex-m4
- 野火挑战者STM32F429IGTb https://gitee.com/harylee/stm32f429ig_firechallenger
该仓包含OpenHarmony LiteOS-M内核移植支持`野火挑战者STM32F429IGTb`开发板的工程代码支持Ninja、GCC、IAR等方式进行编译。
## 贡献<a name="section1371123476307"></a>
[如何贡献](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE.md)
[Commit message规范](https://gitee.com/openharmony/kernel_liteos_m/wikis/Commit%20message%E8%A7%84%E8%8C%83)
[Liteos-M 内核编码规范](https://gitee.com/openharmony/kernel_liteos_m/wikis/OpenHarmony%E8%BD%BB%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83)
如何基于Liteos-M内核贡献一款芯片:
[轻量系统芯片移植指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/porting/Readme-CN.md)
## 相关仓<a name="section1371113476307"></a>
[内核子系统](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/readme/%E5%86%85%E6%A0%B8%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
[kernel\_liteos\_m](https://gitee.com/openharmony/kernel_liteos_m/blob/master/README_zh.md)

103
arch/BUILD.gn Executable file → Normal file
View File

@@ -1,50 +1,53 @@
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/component/lite_component.gni")
source_set("m4") {
sources = [
"arm/cortex-m/cortex-m4/los_dispatch_gcc.S",
"arm/cortex-m/cortex-m4/los_hw_exc_gcc.S",
"arm/cortex-m/cortex-m4/los_hw_sr_gcc.s",
"arm/cortex-m/cortex-m4/los_exc.c",
"arm/cortex-m/src/los_hw.c",
"arm/cortex-m/src/los_hw_tick.c",
"arm/cortex-m/src/los_hwi.c",
]
}
lite_component("arch") {
features = [
":m4"
]
}
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_m/liteos.gni")
config("arch_config") {
include_dirs = [ "include" ]
}
module_group("arch") {
modules = []
if ("$board_cpu" == "arm9" || "$board_cpu" == "cortex-m3" ||
"$board_cpu" == "cortex-m4" || "$board_cpu" == "cortex-m7" ||
"$board_cpu" == "cortex-m33" || "$board_cpu" == "cortex-m55") {
modules += [ "arm" ]
} else if ("$board_cpu" == "ck802" || "$board_cpu" == "e802" ||
"$board_cpu" == "ck804ef") {
modules += [ "csky" ]
} else if ("$board_cpu" == "") {
if ("$board_arch" != string_replace("$board_arch", "rv32i", "")) {
modules += [ "risc-v" ]
} else if ("$board" == "esp32") {
modules += [ "xtensa" ]
}
}
configs = [ ":arch_config" ]
}

32
arch/Kconfig Normal file
View File

@@ -0,0 +1,32 @@
config ARCH_ARM
bool
rsource "arm/Kconfig"
config ARCH_CSKY
bool
config ARCH_RISCV
bool
config ARCH_RISCV32
bool
select ARCH_RISCV
config ARCH_XTENSA
bool
comment "Extra Configurations"
config ARCH_FPU_DISABLE
bool "Disable Floating Pointer Unit"
default n
help
This option will bypass floating procedure in system.
config ARCH_UNALIGNED_EXC
bool "Enable Unaligned Exception"
default y
depends on ARCH_ARM
help
This option will enable unaligned exception.

97
kernel/base/BUILD.gn → arch/arm/BUILD.gn Executable file → Normal file
View File

@@ -1,53 +1,44 @@
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
static_library("base") {
sources = [
"core/los_priqueue.c",
"core/los_swtmr.c",
"core/los_sys.c",
"core/los_task.c",
"core/los_tick.c",
"core/los_timeslice.c",
"ipc/los_event.c",
"ipc/los_mux.c",
"ipc/los_queue.c",
"ipc/los_sem.c",
"mem/bestfit/los_membox.c",
"mem/bestfit/los_memcheck.c",
"mem/bestfit/los_memory.c",
"mem/bestfit/los_memstat.c",
"mem/bestfit/los_multipledlinkhead.c",
"mem/common/los_slab.c",
"mem/common/los_slabmem.c",
"misc/los_misc.c",
"om/los_err.c",
]
}
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_m/liteos.gni")
config("arm_config") {
include_dirs = [ "include" ]
}
module_group("arm") {
modules = [ "common" ]
if (defined(LOSCFG_COMPILER_ICCARM)) {
modules += [ "$board_cpu/iar" ]
} else {
modules += [ "$board_cpu/gcc" ]
}
configs = [ ":arm_config" ]
}

135
arch/arm/Kconfig Normal file
View File

@@ -0,0 +1,135 @@
# ARM Architecture
#
# ARM has 32-bit(Aarch32) and 64-bit(Aarch64) implementations
#
config ARCH_ARM_AARCH32
bool
select ARCH_ARM
help
32-bit ARM architecture implementations, Except the M-profile.
It is not limited to ARMv7-A but also ARMv7-R, ARMv8-A 32-bit and etc.
#
# Architecture Versions
#
config ARCH_ARM_V7M
bool
config ARCH_ARM_V8M
bool
config ARCH_ARM_V5TE
bool
config ARCH_ARM_VER
string
default "armv7-m" if ARCH_ARM_V7M
default "armv8-m" if ARCH_ARM_V8M
default "armv5te" if ARCH_ARM_V5TE
#
# VFP Hardware
#
choice
prompt "Choose FPU type"
depends on !ARCH_FPU_DISABLE
choice
prompt "Choose FPU version"
default ARCH_FPU_VFP_V4
depends on !ARCH_FPU_DISABLE
help
Choose FPU version.
config ARCH_FPU_VFP_V3
bool "VFP_V3"
help
An optional extension to the Arm, Thumb, and ThumbEE instruction sets in the ARMv7-A and ARMv7-R profiles.
VFPv3U is a variant of VFPv3 that supports the trapping of floating-point exceptions to support code.
config ARCH_FPU_VFP_V4
bool "VFP_V4"
help
An optional extension to the Arm, Thumb, and ThumbEE instruction sets in the ARMv7-A and ARMv7-R profiles.
VFPv4U is a variant of VFPv4 that supports the trapping of floating-point exceptions to support code.
VFPv4 and VFPv4U add both the Half-precision Extension and the fused multiply-add instructions to the features of VFPv3.
endchoice
choice
prompt "Choose num of FPU doubleword registers"
default ARCH_FPU_VFP_D32
depends on !ARCH_FPU_DISABLE
help
Choose num of FPU doubleword registers.
config ARCH_FPU_VFP_D16
bool "FPU_VFP_D16"
depends on ARCH_ARM_AARCH32
help
VPU implemented with 16 doubleword registers (16 x 64-bit).
config ARCH_FPU_VFP_D32
bool "FPU_VFP_D32"
depends on ARCH_ARM_AARCH32
help
VPU implemented with 32 doubleword registers (32 x 64-bit).
endchoice
endchoice
config ARCH_FPU
string
default "vfpv3" if ARCH_FPU_VFP_V3 && ARCH_FPU_VFP_D32 && !COMPILER_ICCARM
default "vfpv3-d16" if ARCH_FPU_VFP_V3 && ARCH_FPU_VFP_D16 && !COMPILER_ICCARM
default "vfpv4" if ARCH_FPU_VFP_V4 && ARCH_FPU_VFP_D32 && !COMPILER_ICCARM
default "vfpv4-d16" if ARCH_FPU_VFP_V4 && ARCH_FPU_VFP_D16 && !COMPILER_ICCARM
default "VFPv3" if ARCH_FPU_VFP_V3 && ARCH_FPU_VFP_D32 && COMPILER_ICCARM
default "VFPv3_D16" if ARCH_FPU_VFP_V3 && ARCH_FPU_VFP_D16 && COMPILER_ICCARM
default "VFPv4" if ARCH_FPU_VFP_V4 && ARCH_FPU_VFP_D32 && COMPILER_ICCARM
default "VFPv4_D16" if ARCH_FPU_VFP_V4 && ARCH_FPU_VFP_D16 && COMPILER_ICCARM
#
# Supported Processor Cores
#
config ARCH_CORTEX_M3
bool
select ARCH_ARM_V7M
select ARCH_ARM_AARCH32
config ARCH_CORTEX_M4
bool
select ARCH_ARM_V7M
select ARCH_ARM_AARCH32
config ARCH_CORTEX_M7
bool
select ARCH_ARM_V7M
select ARCH_ARM_AARCH32
config ARCH_CORTEX_M33
bool
select ARCH_ARM_V8M
select ARCH_ARM_AARCH32
config ARCH_CORTEX_M55
bool
select ARCH_ARM_V8M
select ARCH_ARM_AARCH32
config ARCH_ARM9
bool
select ARCH_ARM_V5TE
select ARCH_ARM_AARCH32
config ARCH_CPU
string
default "cortex-m3" if ARCH_CORTEX_M3 && !COMPILER_ICCARM
default "cortex-m4" if ARCH_CORTEX_M4 && !COMPILER_ICCARM
default "cortex-m7" if ARCH_CORTEX_M7 && !COMPILER_ICCARM
default "cortex-m33" if ARCH_CORTEX_M33 && !COMPILER_ICCARM
default "cortex-m55" if ARCH_CORTEX_M55 && !COMPILER_ICCARM
default "Cortex-M3" if ARCH_CORTEX_M3 && COMPILER_ICCARM
default "Cortex-M4" if ARCH_CORTEX_M4 && COMPILER_ICCARM
default "Cortex-M7" if ARCH_CORTEX_M7 && COMPILER_ICCARM
default "Cortex-M33" if ARCH_CORTEX_M33 && COMPILER_ICCARM
default "Cortex-M55" if ARCH_CORTEX_M55 && COMPILER_ICCARM
default "arm9" if ARCH_ARM9

View File

@@ -0,0 +1,47 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_m/liteos.gni")
module_name = "arch"
kernel_module(module_name) {
sources = [
"los_context.c",
"los_dispatch.S",
"los_exc.S",
"los_interrupt.c",
"los_timer.c",
"reset_vector.S",
]
configs += [ "$LITEOSTOPDIR:warn_config" ]
}
config("public") {
include_dirs = [ "." ]
}

View File

@@ -0,0 +1,234 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_ATOMIC_H
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
STATIC INLINE INT32 ArchAtomicRead(const Atomic *v)
{
return *v;
}
STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
{
UINT32 intSave;
intSave = LOS_IntLock();
*v = setVal;
LOS_IntRestore(intSave);
}
STATIC INLINE INT32 ArchAtomicAdd(Atomic *v, INT32 addVal)
{
INT32 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v += addVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE INT32 ArchAtomicSub(Atomic *v, INT32 subVal)
{
INT32 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v -= subVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE VOID ArchAtomicInc(Atomic *v)
{
(VOID)ArchAtomicAdd(v, 1);
}
STATIC INLINE VOID ArchAtomicDec(Atomic *v)
{
(VOID)ArchAtomicSub(v, 1);
}
STATIC INLINE INT32 ArchAtomicIncRet(Atomic *v)
{
return ArchAtomicAdd(v, 1);
}
STATIC INLINE INT32 ArchAtomicDecRet(Atomic *v)
{
return ArchAtomicSub(v, 1);
}
STATIC INLINE INT32 ArchAtomicXchg32bits(Atomic *v, INT32 val)
{
INT32 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
*v = val;
LOS_IntRestore(intSave);
return prevVal;
}
STATIC INLINE BOOL ArchAtomicCmpXchg32bits(Atomic *v, INT32 val, INT32 oldVal)
{
INT32 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
if (prevVal == oldVal) {
*v = val;
}
LOS_IntRestore(intSave);
return prevVal != oldVal;
}
STATIC INLINE INT64 ArchAtomic64Read(const Atomic64 *v)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE VOID ArchAtomic64Set(Atomic64 *v, INT64 setVal)
{
UINT32 intSave;
intSave = LOS_IntLock();
*v = setVal;
LOS_IntRestore(intSave);
}
STATIC INLINE INT64 ArchAtomic64Add(Atomic64 *v, INT64 addVal)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v += addVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE INT64 ArchAtomic64Sub(Atomic64 *v, INT64 subVal)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v -= subVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE VOID ArchAtomic64Inc(Atomic64 *v)
{
(VOID)ArchAtomic64Add(v, 1);
}
STATIC INLINE INT64 ArchAtomic64IncRet(Atomic64 *v)
{
return ArchAtomic64Add(v, 1);
}
STATIC INLINE VOID ArchAtomic64Dec(Atomic64 *v)
{
(VOID)ArchAtomic64Sub(v, 1);
}
STATIC INLINE INT64 ArchAtomic64DecRet(Atomic64 *v)
{
return ArchAtomic64Sub(v, 1);
}
STATIC INLINE INT64 ArchAtomicXchg64bits(Atomic64 *v, INT64 val)
{
INT64 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
*v = val;
LOS_IntRestore(intSave);
return prevVal;
}
STATIC INLINE BOOL ArchAtomicCmpXchg64bits(Atomic64 *v, INT64 val, INT64 oldVal)
{
INT64 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
if (prevVal == oldVal) {
*v = val;
}
LOS_IntRestore(intSave);
return prevVal != oldVal;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_ATOMIC_H */

View File

@@ -0,0 +1,181 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_CONTEXT_H
#define _LOS_ARCH_CONTEXT_H
#include "los_config.h"
#include "los_compiler.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define PSR_T_ARM 0x00000000U
#define PSR_T_THUMB 0x00000020U
#define PSR_MODE_SVC 0x00000013U
#define PSR_MODE_SYS 0x0000001FU
#define PSR_MODE_SVC_THUMB (PSR_MODE_SVC | PSR_T_THUMB)
#define PSR_MODE_SVC_ARM (PSR_MODE_SVC | PSR_T_ARM)
#define PSR_MODE_SYS_THUMB (PSR_MODE_SYS | PSR_T_THUMB)
#define PSR_MODE_SYS_ARM (PSR_MODE_SYS | PSR_T_ARM)
VOID OsTaskEntryArm(VOID);
VOID OsTaskEntryThumb(VOID);
typedef struct TagTskContext {
UINT32 spsr;
UINT32 r0;
UINT32 r1;
UINT32 r2;
UINT32 r3;
UINT32 r4;
UINT32 r5;
UINT32 r6;
UINT32 r7;
UINT32 r8;
UINT32 r9;
UINT32 r10;
UINT32 r11;
UINT32 r12;
UINT32 sp;
UINT32 lr;
UINT32 pc;
} TaskContext;
/**
* @ingroup los_config
* @brief: Task start running function.
*
* @par Description:
* This API is used to start a task.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param: None.
*
* @retval None.
*
* @par Dependency:
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalStartToRun(VOID);
/**
* @ingroup los_arch_context
* @brief Wait for interrupt.
*
* @par Description:
* <ul>
* <li>This API is used to suspend execution until interrupt or a debug request occurs.</li>
* </ul>
* @attention None.
*
* @param None.
*
* @retval: None.
*
* @par Dependency:
* los_arch_context.h: the header file that contains the API declaration.
* @see None.
*/
extern VOID wfi(VOID);
/**
* @ingroup los_arch_context
* @brief: mem fence function.
*
* @par Description:
* This API is used to fence for memory.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param: None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_context.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID dmb(VOID);
/**
* @ingroup los_arch_context
* @brief: mem fence function.
*
* @par Description:
* This API is same as dmb, it just for adaptation.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param: None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_context.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID dsb(VOID);
/**
* @ingroup los_arch_context
* @brief: instruction fence function.
*
* @par Description:
* This API is used to fence for instruction.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param: None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_context.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID isb(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_CONTEXT_H */

View File

@@ -0,0 +1,280 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_INTERRUPT_H
#define _LOS_ARCH_INTERRUPT_H
#include "los_common_interrupt.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* *
* @ingroup los_arch_interrupt
* Highest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_HIGHEST
#define OS_HWI_PRIO_HIGHEST 0
#endif
/* *
* @ingroup los_arch_interrupt
* Lowest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_LOWEST
#define OS_HWI_PRIO_LOWEST 7
#endif
/* *
* @ingroup los_arch_interrupt
* Count of arm9 system interrupt vector.
*/
#define OS_SYS_VECTOR_CNT 0
/* *
* @ingroup los_arch_interrupt
* Count of arm9 interrupt vector.
*/
#define OS_VECTOR_CNT (OS_SYS_VECTOR_CNT + OS_HWI_MAX_NUM)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt number.
*
* Value: 0x02000900
*
* Solution: Ensure that the interrupt number is valid.
* The value range of the interrupt number applicable for a arm9 platform is [OS_USER_HWI_MIN,OS_USER_HWI_MAX].
*/
#define OS_ERRNO_HWI_NUM_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x00)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Null hardware interrupt handling function.
*
* Value: 0x02000901
*
* Solution: Pass in a valid non-null hardware interrupt handling function.
*/
#define OS_ERRNO_HWI_PROC_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x01)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Insufficient interrupt resources for hardware interrupt creation.
*
* Value: 0x02000902
*
* Solution: Increase the configured maximum number of supported hardware interrupts.
*/
#define OS_ERRNO_HWI_CB_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x02)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Insufficient memory for hardware interrupt initialization.
*
* Value: 0x02000903
*
* Solution: Expand the configured memory.
*/
#define OS_ERRNO_HWI_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x03)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: The interrupt has already been created.
*
* Value: 0x02000904
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x04)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt priority.
*
* Value: 0x02000905
*
* Solution: Ensure that the interrupt priority is valid.
* The value range of the interrupt priority applicable for a arm9 platform is [0,15].
*/
#define OS_ERRNO_HWI_PRIO_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x05)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Incorrect interrupt creation mode.
*
* Value: 0x02000906
*
* Solution: The interrupt creation mode can be only set to OS_HWI_MODE_COMM or
* OS_HWI_MODE_FAST of which the value can be 0 or 1.
*/
#define OS_ERRNO_HWI_MODE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x06)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: The interrupt has already been created as a fast interrupt.
*
* Value: 0x02000907
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_FASTMODE_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x07)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt operation function.
*
* Value: 0x0200090c
*
* Solution: Set a valid interrupt operation function
*/
#define OS_ERRNO_HWI_OPS_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x0c)
/* *
* @ingroup los_arch_interrupt
* @brief: Hardware interrupt entry function.
*
* @par Description:
* This API is used as all hardware interrupt handling function entry.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalInterrupt(VOID);
/**
* @ingroup los_exc
* the struct of register files
*
* description: the register files that saved when exception triggered
*
* notes:the following register with prefix 'uw' correspond to the registers in the cpu data sheet.
*/
typedef struct TagExcContext {
UINT32 spsr;
UINT32 r0;
UINT32 r1;
UINT32 r2;
UINT32 r3;
UINT32 r4;
UINT32 r5;
UINT32 r6;
UINT32 r7;
UINT32 r8;
UINT32 r9;
UINT32 r10;
UINT32 r11;
UINT32 r12;
UINT32 sp;
UINT32 lr;
UINT32 pc;
} EXC_CONTEXT_S;
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
VOID HalHwiInit(VOID);
/**
* @ingroup los_exc
* exception types: undefined instruction exception.
*/
#define OS_EXCEPT_UNDEF_INSTR 1
/**
* @ingroup los_exc
* exception types: software interrupt.
*/
#define OS_EXCEPT_SWI 2
/**
* @ingroup los_exc
* exception types: prefetch abort exception.
*/
#define OS_EXCEPT_PREFETCH_ABORT 3
/**
* @ingroup los_exc
* exception types: data abort exception.
*/
#define OS_EXCEPT_DATA_ABORT 4
/**
* @ingroup los_exc
* exception types: FIQ exception.
*/
#define OS_EXCEPT_FIQ 5
/**
* @ingroup los_exc
* Exception information structure
*
* Description: Exception information saved when an exception is triggered on the Cortex-M4 platform.
*
*/
typedef struct TagExcInfo {
/**< Exception occurrence phase: 0 means that an exception occurs in initialization,
* 1 means that an exception occurs in a task, and 2 means that an exception occurs in an interrupt */
UINT16 phase;
/**< Exception type. When exceptions occur, check the numbers 1 - 19 listed above */
UINT16 type;
/**< If the exact address access error indicates the wrong access address when the exception occurred */
UINT32 faultAddr;
/**< An exception occurs in an interrupt, indicating the interrupt number.
* An exception occurs in the task, indicating the task ID, or 0xFFFFFFFF if it occurs during initialization */
UINT32 thrdPid;
/**< Number of nested exceptions. Currently only registered hook functions are supported
* when an exception is entered for the first time */
UINT16 nestCnt;
/**< reserve */
UINT16 reserved;
/**< Hardware context at the time an exception to the automatic stack floating-point register occurs */
EXC_CONTEXT_S *context;
} ExcInfo;
extern ExcInfo g_excInfo;
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_INTERRUPT_H */

View File

@@ -0,0 +1,51 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_TIMER_H
#define _LOS_ARCH_TIMER_H
#include "los_config.h"
#include "los_compiler.h"
#include "los_timer.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_TIMER_H */

View File

@@ -0,0 +1,141 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_context.h"
#include "securec.h"
#include "los_arch_context.h"
#include "los_arch_interrupt.h"
#include "los_task.h"
#include "los_sched.h"
#include "los_interrupt.h"
#include "los_debug.h"
/* ****************************************************************************
Function : ArchInit
Description : arch init function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
{
HalHwiInit();
}
/* ****************************************************************************
Function : ArchSysExit
Description : Task exit function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
(VOID)LOS_IntLock();
while (1) {
}
}
/* ****************************************************************************
Function : ArchTskStackInit
Description : Task stack initialization function
Input : taskID --- TaskID
stackSize --- Total size of the stack
topStack --- Top of task's stack
Output : None
Return : Context pointer
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID *ArchTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
{
TaskContext *context = (TaskContext *)((UINTPTR)topStack + stackSize - sizeof(TaskContext));
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
context->r0 = taskID;
context->r1 = 0x01010101L;
context->r2 = 0x02020202L;
context->r3 = 0x03030303L;
context->r4 = 0x04040404L;
context->r5 = 0x05050505L;
context->r6 = 0x06060606L;
context->r7 = 0x07070707L;
context->r8 = 0x08080808L;
context->r9 = 0x09090909L;
context->r10 = 0x10101010L;
context->r11 = 0x11111111L;
context->r12 = 0x12121212L;
context->sp = (UINTPTR)topStack + stackSize;
context->lr = (UINTPTR)ArchSysExit;
if ((UINTPTR)taskCB->taskEntry & 0x01) {
context->pc = (UINTPTR)OsTaskEntryThumb;
context->spsr = PSR_MODE_SYS_THUMB; /* thumb mode */
} else {
context->pc = (UINTPTR)OsTaskEntryArm;
context->spsr = PSR_MODE_SYS_ARM; /* arm mode */
}
return (VOID *)context;
}
LITE_OS_SEC_TEXT_INIT UINT32 ArchStartSchedule(VOID)
{
(VOID)LOS_IntLock();
OsSchedStart();
HalStartToRun();
return LOS_OK; /* never return */
}
LITE_OS_SEC_TEXT_INIT VOID ArchTaskSchedule(VOID)
{
__asm__ __volatile__("swi 0");
}
LITE_OS_SEC_TEXT_INIT VOID dmb(VOID)
{
__asm__ __volatile__("" : : : "memory");
}
LITE_OS_SEC_TEXT_INIT VOID dsb(VOID)
{
__asm__ __volatile__("mcr p15, 0, %0, c7, c10, 4" : : "r"(0) : "memory");
}
LITE_OS_SEC_TEXT_INIT VOID isb(VOID)
{
__asm__ __volatile__("" : : : "memory");
}
LITE_OS_SEC_TEXT_INIT VOID wfi(VOID)
{
__asm__ __volatile__("mcr p15, 0, %0, c7, c0, 4" : : "r"(0) : "memory");
}

View File

@@ -0,0 +1,182 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.equ OS_PSR_THUMB, 0x20
.equ OS_PSR_INT_DIS, 0xC0
.equ OS_PSR_FIQ_DIS, 0x40
.equ OS_PSR_IRQ_DIS, 0x80
.equ OS_PSR_MODE_MASK, 0x1F
.equ OS_PSR_MODE_USR, 0x10
.equ OS_PSR_MODE_FIQ, 0x11
.equ OS_PSR_MODE_IRQ, 0x12
.equ OS_PSR_MODE_SVC, 0x13
.equ OS_PSR_MODE_ABT, 0x17
.equ OS_PSR_MODE_UND, 0x1B
.equ OS_PSR_MODE_SYS, 0x1F
.global HalStartToRun
.global OsTaskEntryArm
.global OsTaskEntryThumb
.global HalExceptSwiHdl
.global HalExceptFiqHdl
.global HalExceptIrqHdl
.extern OsTaskEntry
.extern OsSchedTaskSwitch
.extern HalInterrupt
.extern g_losTask
.code 32
.text
.macro SAVE_CONTEXT
STMFD SP!, {R0}
MRS R0, SPSR
AND R0, R0, #OS_PSR_MODE_SYS
CMP R0, #OS_PSR_MODE_SYS
BNE 1f
STMFD SP!, {SP}^
LDMFD SP!, {R0}
STMFD R0!, {LR}
MOV LR, R0
LDMFD SP!, {R0}
STMFD LR, {R0-R14}^
SUB LR, LR, #60
MRS R0, SPSR
STMFD LR!, {R0}
LDR R1, =g_losTask
LDR R1, [R1]
STR LR, [R1]
B 2f
1:
LDMFD SP!, {R0}
STMFD SP!, {R0-R12, LR}
MRS R0, SPSR
STMFD SP!, {R0}
2:
.endm
.macro RETSORE_CONTEXT
MRS R0, SPSR
AND R0, R0, #OS_PSR_MODE_SYS
CMP R0, #OS_PSR_MODE_SYS
BNE 3f
LDR R1, =g_losTask
LDR R1, [R1]
LDR LR, [R1]
LDMFD LR!, {R0}
MSR SPSR_cxsf, R0
LDMFD LR, {R0-R14}^
ADD LR, LR, #60
LDMFD LR!, {PC}^
3:
LDMFD SP!, {R0}
MSR SPSR_cxsf, R0
LDMFD SP!, {R0-R12, LR}
MOVS PC, LR
.endm
.macro TASK_SWITCH
MRS R0, CPSR
ORR R0, R0, #OS_PSR_INT_DIS
MSR CPSR, R0
BLX OsSchedTaskSwitch
CMP R0, #0
BEQ 4f
LDR R0, =g_losTask
LDR R1, [R0, #4]
STR R1, [R0]
4:
.endm
HalStartToRun:
LDR R1, =g_losTask
LDR R0, [R1, #4]
LDR LR, [R0]
LDMFD LR!, {R0}
MSR SPSR_cxsf, R0
LDMFD LR, {R0-R14}^
ADD LR, LR, #60
LDMFD LR!, {PC}^
HalExceptSwiHdl:
SAVE_CONTEXT
TASK_SWITCH
RETSORE_CONTEXT
HalExceptFiqHdl:
SUB LR, LR, #4
SAVE_CONTEXT
BLX HalInterrupt
RETSORE_CONTEXT
HalExceptIrqHdl:
SUB LR, LR, #4
SAVE_CONTEXT
BLX HalInterrupt
RETSORE_CONTEXT
OsTaskEntryArm:
STMFD SP!, {LR}
BL OsTaskEntry
LDMFD SP!, {LR}
BX LR
.code 16
.text
OsTaskEntryThumb:
PUSH {LR}
BL OsTaskEntry
POP {R0}
MOV LR, R0
BX LR

132
arch/arm/arm9/gcc/los_exc.S Normal file
View File

@@ -0,0 +1,132 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.equ OS_PSR_INT_DIS, 0xC0
.equ OS_PSR_FIQ_DIS, 0x40
.equ OS_PSR_IRQ_DIS, 0x80
.equ OS_PSR_MODE_MASK, 0x1F
.equ OS_PSR_MODE_USR, 0x10
.equ OS_PSR_MODE_FIQ, 0x11
.equ OS_PSR_MODE_IRQ, 0x12
.equ OS_PSR_MODE_SVC, 0x13
.equ OS_PSR_MODE_ABT, 0x17
.equ OS_PSR_MODE_UND, 0x1B
.equ OS_PSR_MODE_SYS, 0x1F
.equ OS_EXCEPT_RESET, 0x00
.equ OS_EXCEPT_UNDEF_INSTR, 0x01
.equ OS_EXCEPT_SWI, 0x02
.equ OS_EXCEPT_PREFETCH_ABORT, 0x03
.equ OS_EXCEPT_DATA_ABORT, 0x04
.equ OS_EXCEPT_FIQ, 0x05
.equ OS_EXCEPT_ADDR_ABORT, 0x06
.equ OS_EXCEPT_IRQ, 0x07
.global HalExceptAddrAbortHdl
.global HalExceptDataAbortHdl
.global HalExceptPrefetchAbortHdl
.global HalExceptUndefInstrHdl
.extern HalExcHandleEntry
.extern __exc_stack_top
.code 32
.text
HalExceptUndefInstrHdl:
STMFD SP!, {R0-R5}
MOV R0, #OS_EXCEPT_UNDEF_INSTR
B _osExceptDispatch
HalExceptPrefetchAbortHdl:
SUB LR, LR, #4
STMFD SP!, {R0-R5}
MOV R0, #OS_EXCEPT_PREFETCH_ABORT
B _osExceptDispatch
HalExceptDataAbortHdl:
SUB LR, LR, #4
STMFD SP!, {R0-R5}
MOV R0, #OS_EXCEPT_DATA_ABORT
B _osExceptDispatch
HalExceptAddrAbortHdl:
SUB LR, LR, #8
STMFD SP!, {R0-R5}
MOV R0, #OS_EXCEPT_ADDR_ABORT
B _osExceptDispatch
_osExceptDispatch:
MRS R1, SPSR
MOV R2, LR
MOV R4, SP
ADD SP, SP, #(6 * 4)
MSR CPSR_c, #(OS_PSR_INT_DIS | OS_PSR_MODE_SVC)
MOV R3, SP
LDR SP, =__exc_stack_top
STMFD SP!, {R2}
STMFD SP!, {LR}
STMFD SP!, {R3}
STMFD SP!, {R6-R12}
LDMFD R4!, {R6-R12}
STMFD SP!, {R6-R11}
STMFD SP!, {R1}
MOV R3, SP
_osExceptionGetSP:
STMFD SP!, {R1}
LDR R2, =HalExcHandleEntry
MOV LR, PC
BX R2
LDMFD SP!, {R1}
MOV SP, R1
LDMFD SP!, {R1}
MSR CPSR, R1
LDMFD SP!, {R0-R12}
ADD SP, SP, #(4 * 2)
LDMFD SP!, {LR}
SUB SP, SP, #(4 * 3)
LDMFD SP, {SP}
ADD LR, LR, #4
MOV PC, LR
.end

View File

@@ -0,0 +1,377 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdarg.h>
#include "securec.h"
#include "los_context.h"
#include "los_arch_interrupt.h"
#include "los_hook.h"
#include "los_task.h"
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
#define OS_INT_IRQ_ENABLE (1U << 0)
#define OS_INT_FIQ_ENABLE (1U << 1)
#define OS_INT_REG_BASE 0x00802040UL
#define OS_INT_GLOBAL_ENABLE_ADDR (OS_INT_REG_BASE + 4)
#define OS_INT_ENABLE_ADDR (OS_INT_REG_BASE)
#define OS_INT_STATUS_ADDR (OS_INT_REG_BASE + 12)
#define OS_INSTR_SET_MASK 0x01000020U
#define OS_ARM_INSTR_LEN 4
#define OS_THUMB_INSTR_LEN 2
ExcInfo g_excInfo = {0};
/* ****************************************************************************
Function : HwiNumGet
Description : Get an interrupt number
Input : None
Output : None
Return : Interrupt Indexes number
**************************************************************************** */
STATIC UINT32 HwiNumGet(VOID)
{
UINT32 status;
READ_UINT32(status, OS_INT_STATUS_ADDR);
return (31 - CLZ(status));
}
STATIC UINT32 HwiUnmask(HWI_HANDLE_T hwiNum)
{
*((volatile UINT32 *)OS_INT_ENABLE_ADDR) |= (1U << (hwiNum));
return LOS_OK;
}
STATIC UINT32 HwiMask(HWI_HANDLE_T hwiNum)
{
*((volatile UINT32 *)OS_INT_ENABLE_ADDR) &= ~(1U << (hwiNum));
return LOS_OK;
}
STATIC UINT32 HwiCreate(HWI_HANDLE_T hwiNum, HWI_PRIOR_T hwiPrio)
{
(VOID)hwiPrio;
HwiUnmask(hwiNum);
return LOS_OK;
}
STATIC HwiControllerOps g_archHwiOps = {
.enableIrq = HwiUnmask,
.disableIrq = HwiMask,
.getCurIrqNum = HwiNumGet,
.createIrq = HwiCreate,
};
HwiControllerOps *ArchIntOpsGet(VOID)
{
return &g_archHwiOps;
}
/* ****************************************************************************
Function : HalInterrupt
Description : Hardware interrupt entry function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
{
UINT32 intSave;
UINT32 hwiIndex;
intSave = LOS_IntLock();
g_intCount++;
LOS_IntRestore(intSave);
#if (LOSCFG_BASE_CORE_SCHED_SLEEP == 1)
OsSchedUpdateSleepTime();
#endif
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (g_hwiHandlerForm[hwiIndex].pfnHandler != 0) {
g_hwiHandlerForm[hwiIndex].pfnHandler((VOID *)g_hwiHandlerForm[hwiIndex].pParm);
}
#else
if (g_hwiHandlerForm[hwiIndex] != 0) {
g_hwiHandlerForm[hwiIndex]();
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
g_intCount--;
LOS_IntRestore(intSave);
}
#if (LOSCFG_KERNEL_PRINTF != 0)
STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
{
PRINTK("Current task info:\n");
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task SP = 0x%x\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
} else if (excInfo->phase == OS_EXC_IN_HWI) {
PRINTK("Exception occur in interrupt phase!\n");
} else {
PRINTK("Exception occur in system init phase!\n");
}
}
STATIC VOID OsExcRegInfo(const ExcInfo *excInfo)
{
PRINTK("Exception reg dump:\n");
PRINTK("PC = 0x%x\n", excInfo->context->pc);
PRINTK("LR = 0x%x\n", excInfo->context->lr);
PRINTK("R0 = 0x%x\n", excInfo->context->r0);
PRINTK("R1 = 0x%x\n", excInfo->context->r1);
PRINTK("R2 = 0x%x\n", excInfo->context->r2);
PRINTK("R3 = 0x%x\n", excInfo->context->r3);
PRINTK("R4 = 0x%x\n", excInfo->context->r4);
PRINTK("R5 = 0x%x\n", excInfo->context->r5);
PRINTK("R6 = 0x%x\n", excInfo->context->r6);
PRINTK("R7 = 0x%x\n", excInfo->context->r7);
PRINTK("R8 = 0x%x\n", excInfo->context->r8);
PRINTK("R9 = 0x%x\n", excInfo->context->r9);
PRINTK("R10 = 0x%x\n", excInfo->context->r10);
PRINTK("R11 = 0x%x\n", excInfo->context->r11);
PRINTK("R12 = 0x%x\n", excInfo->context->r12);
PRINTK("xPSR = 0x%x\n", excInfo->context->spsr);
}
#if (LOSCFG_KERNEL_BACKTRACE == 1)
STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
{
UINTPTR LR[LOSCFG_BACKTRACE_DEPTH] = {0};
UINT32 index;
OsBackTraceHookCall(LR, LOSCFG_BACKTRACE_DEPTH, 0, excInfo->context->sp);
PRINTK("----- backtrace start -----\n");
for (index = 0; index < LOSCFG_BACKTRACE_DEPTH; index++) {
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
#endif
STATIC VOID OsExcMemPoolCheckInfo(VOID)
{
PRINTK("\r\nmemory pools check:\n");
#if (LOSCFG_PLATFORM_EXC == 1)
MemInfoCB memExcInfo[OS_SYS_MEM_NUM];
UINT32 errCnt;
UINT32 i;
(VOID)memset_s(memExcInfo, sizeof(memExcInfo), 0, sizeof(memExcInfo));
errCnt = OsMemExcInfoGet(OS_SYS_MEM_NUM, memExcInfo);
if (errCnt < OS_SYS_MEM_NUM) {
errCnt += OsMemboxExcInfoGet(OS_SYS_MEM_NUM - errCnt, memExcInfo + errCnt);
}
if (errCnt == 0) {
PRINTK("all memory pool check passed!\n");
return;
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
if (ret == LOS_OK) {
PRINTK("system heap memcheck over, all passed!\n");
}
PRINTK("memory pool check end!\n");
}
#endif
STATIC VOID OsExcInfoDisplay(const ExcInfo *excInfo)
{
#if (LOSCFG_KERNEL_PRINTF != 0)
PRINTK("*************Exception Information**************\n");
OsExcTypeInfo(excInfo);
OsExcCurTaskInfo(excInfo);
OsExcRegInfo(excInfo);
#if (LOSCFG_KERNEL_BACKTRACE == 1)
OsExcBackTraceInfo(excInfo);
#endif
OsGetAllTskInfo();
OsExcMemPoolCheckInfo();
#endif
}
LITE_OS_SEC_TEXT_INIT VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr)
{
g_intCount++;
g_excInfo.nestCnt++;
g_excInfo.type = excType;
if ((excType == OS_EXCEPT_UNDEF_INSTR) || (excType == OS_EXCEPT_SWI)) {
if ((excBufAddr->spsr & OS_INSTR_SET_MASK) == 0) { /* Work status: ARM */
excBufAddr->pc -= OS_ARM_INSTR_LEN;
} else if ((excBufAddr->spsr & OS_INSTR_SET_MASK) == 0x20) { /* Work status: Thumb */
excBufAddr->pc -= OS_THUMB_INSTR_LEN;
}
}
g_excInfo.faultAddr = OS_EXC_IMPRECISE_ACCESS_ADDR;
if (g_losTask.runTask != NULL) {
g_excInfo.phase = OS_EXC_IN_TASK;
g_excInfo.thrdPid = g_losTask.runTask->taskID;
} else {
g_excInfo.phase = OS_EXC_IN_INIT;
g_excInfo.thrdPid = OS_NULL_INT;
}
g_excInfo.context = excBufAddr;
OsDoExcHook(EXC_INTERRUPT);
OsExcInfoDisplay(&g_excInfo);
ArchSysExit();
}
/* ****************************************************************************
Function : HalHwiInit
Description : initialization of the hardware interrupt
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
{
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 reg;
UINT32 val;
HWI_PROC_FUNC *hwiForm = (HWI_PROC_FUNC *)ArchGetHwiFrom();
for (val = OS_SYS_VECTOR_CNT; val < OS_VECTOR_CNT; val++) {
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
hwiForm[val].pfnHook = HalHwiDefaultHandler;
hwiForm[val].uwParam = 0;
#else
hwiForm[val] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
#endif
}
val = OS_INT_IRQ_ENABLE | OS_INT_FIQ_ENABLE;
READ_UINT32(reg, OS_INT_GLOBAL_ENABLE_ADDR);
reg |= val;
WRITE_UINT32(reg, OS_INT_GLOBAL_ENABLE_ADDR);
#endif
return;
}
UINT32 ArchIntLock(VOID)
{
UINT32 ret;
UINT32 temp;
__asm__ __volatile__("MRS %0, CPSR\n"
"ORR %1, %0, #0xC0\n"
"MSR CPSR_c, %1"
: "=r"(ret), "=r"(temp)
:
: "memory");
return ret;
}
VOID ArchIntRestore(UINT32 intSave)
{
__asm__ __volatile__("MSR CPSR_c, %0" : : "r"(intSave));
}
UINT32 ArchIntUnLock(VOID)
{
UINT32 intSave;
__asm__ __volatile__("MRS %0, CPSR\n"
"BIC %0, %0, #0xC0\n"
"MSR CPSR_c, %0"
: "=r"(intSave)
:
: "memory");
return intSave;
}

View File

@@ -0,0 +1,174 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_timer.h"
#include "los_config.h"
#include "los_arch_context.h"
#include "los_arch_interrupt.h"
#include "los_reg.h"
#define OS_TIMER_CLKDIV_POS 3
#define OS_TIMER_CLKDIV_MASK 7
#define OS_TIMER_INT_POS 7
#define OS_TIMER_INT_MASK 7
#define OS_TIMER_IRQ_NUM 8
#define OS_TIMER_ENABLE (1U << 0)
#define OS_TIMER_32K_CLK_BIT (1U << 21)
#define OS_TIMER_CNT_READ_BIT (1U << 0)
#define OS_TIMER_REG_BASE 0x00802A40UL
#define OS_TIMER_CLK_PWD_ADDR 0x00802008UL
#define OS_TIMER_PERIOD_REG_ADDR (OS_TIMER_REG_BASE)
#define OS_TIMER_CTL_REG_ADDR (OS_TIMER_REG_BASE + 12)
#define OS_TIMER_READ_CTL_ADDR (OS_TIMER_REG_BASE + 16)
#define OS_TIMER_READ_VAL_ADDR (OS_TIMER_REG_BASE + 20)
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
STATIC ArchTickTimer g_archTickTimer = {
.freq = 0,
.irqNum = OS_TIMER_IRQ_NUM,
.periodMax = LOSCFG_BASE_CORE_TICK_RESPONSE_MAX,
.init = SysTickStart,
.getCycle = SysTickCycleGet,
.reload = SysTickReload,
.lock = SysTickLock,
.unlock = SysTickUnlock,
.tickHandler = NULL,
};
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
{
UINT32 intSave = LOS_IntLock();
UINT32 value;
ArchTickTimer *tick = &g_archTickTimer;
tick->freq = OS_SYS_CLOCK;
READ_UINT32(value, OS_TIMER_CLK_PWD_ADDR);
value &= ~(OS_TIMER_32K_CLK_BIT);
WRITE_UINT32(value, OS_TIMER_CLK_PWD_ADDR);
value = LOSCFG_BASE_CORE_TICK_RESPONSE_MAX;
WRITE_UINT32(value, OS_TIMER_PERIOD_REG_ADDR);
READ_UINT32(value, OS_TIMER_CTL_REG_ADDR);
value &= ~(OS_TIMER_CLKDIV_MASK << OS_TIMER_CLKDIV_POS); // The default is 1, and the clock does not divide.
value &= ~(OS_TIMER_INT_MASK << OS_TIMER_INT_POS); // Clearing interruption.
value |= 0x1 << OS_TIMER_INT_POS;
value |= OS_TIMER_ENABLE; // Enable timer.
WRITE_UINT32(value, OS_TIMER_CTL_REG_ADDR);
(VOID)ArchHwiCreate(OS_TIMER_IRQ_NUM, 0, 0, (HWI_PROC_FUNC)handler, 0);
LOS_IntRestore(intSave);
return LOS_OK;
}
STATIC VOID SysTickClockIrqClear(VOID)
{
UINT32 mask = OS_TIMER_INT_MASK << OS_TIMER_INT_POS;
UINT32 status;
do {
WRITE_UINT32(mask, OS_TIMER_CTL_REG_ADDR);
READ_UINT32(status, OS_TIMER_CTL_REG_ADDR);
} while (status & mask);
}
STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
{
if (nextResponseTime > g_archTickTimer.periodMax) {
nextResponseTime = g_archTickTimer.periodMax;
}
SysTickLock();
WRITE_UINT32((UINT32)nextResponseTime, OS_TIMER_PERIOD_REG_ADDR);
SysTickClockIrqClear();
SysTickUnlock();
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)
{
UINT32 val;
READ_UINT32(*period, OS_TIMER_PERIOD_REG_ADDR);
WRITE_UINT32(OS_TIMER_CNT_READ_BIT, OS_TIMER_READ_CTL_ADDR);
do {
READ_UINT32(val, OS_TIMER_READ_CTL_ADDR);
} while (val & OS_TIMER_CNT_READ_BIT); // Wait for the setting to take effect.
READ_UINT32(val, OS_TIMER_READ_VAL_ADDR);
return (UINT64)val;
}
STATIC VOID SysTickLock(VOID)
{
UINT32 value;
READ_UINT32(value, OS_TIMER_CTL_REG_ADDR);
value &= ~OS_TIMER_ENABLE;
value &= ~(OS_TIMER_INT_MASK << OS_TIMER_INT_POS);
value |= 0x1 << OS_TIMER_INT_POS;
WRITE_UINT32(value, OS_TIMER_CTL_REG_ADDR);
}
STATIC VOID SysTickUnlock(VOID)
{
UINT32 value;
READ_UINT32(value, OS_TIMER_CTL_REG_ADDR);
value |= OS_TIMER_ENABLE;
value &= ~(OS_TIMER_INT_MASK << OS_TIMER_INT_POS);
value |= 0x1 << OS_TIMER_INT_POS;
WRITE_UINT32(value, OS_TIMER_CTL_REG_ADDR);
}
ArchTickTimer *ArchSysTickTimerGet(VOID)
{
return &g_archTickTimer;
}
UINT32 ArchEnterSleep(VOID)
{
dsb();
wfi();
isb();
return LOS_OK;
}

View File

@@ -0,0 +1,149 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.equ CPSR_IRQ_DISABLE, 0x80
.equ CPSR_FIQ_DISABLE, 0x40
.equ CPSR_THUMB_ENABLE, 0x20
.equ CPSR_USER_MODE, 0x10
.equ CPSR_FIQ_MODE, 0x11
.equ CPSR_IRQ_MODE, 0x12
.equ CPSR_SVC_MODE, 0x13
.equ CPSR_ABT_MODE, 0x17
.equ CPSR_UNDEF_MODE, 0x1B
.global __exc_stack_top
.global __irq_stack_top
.global __fiq_stack_top
.global __svc_stack_top
.global __abt_stack_top
.global __undef_stack_top
.global __exc_stack
.global __irq_stack
.global __fiq_stack
.global __svc_stack
.global __abt_stack
.global __undef_stack
.global main
.extern HalExceptFiqHdl
.extern HalExceptAddrAbortHdl
.extern HalExceptDataAbortHdl
.extern HalExceptPrefetchAbortHdl
.extern HalExceptSwiHdl
.extern HalExceptUndefInstrHdl
.extern HalExceptIrqHdl
.extern _bss_start
.extern _bss_end
.code 32
.text
.section ".vectors", "ax"
.global _vector_start
_vector_start:
B HalResetVector
B HalExceptUndefInstrHdl
B HalExceptSwiHdl
B HalExceptPrefetchAbortHdl
B HalExceptDataAbortHdl
B HalExceptAddrAbortHdl
B HalExceptIrqHdl
B HalExceptFiqHdl
.globl HalResetVector
.section ".boot", "ax"
HalResetVector:
MOV R0, #(CPSR_IRQ_DISABLE | CPSR_FIQ_DISABLE | CPSR_IRQ_MODE)
MSR CPSR, R0
LDR SP, =__irq_stack_top
MOV R0, #(CPSR_IRQ_DISABLE | CPSR_FIQ_DISABLE | CPSR_UNDEF_MODE)
MSR CPSR, R0
LDR SP, =__undef_stack_top
MOV R0, #(CPSR_IRQ_DISABLE | CPSR_FIQ_DISABLE | CPSR_ABT_MODE)
MSR CPSR, R0
LDR SP, =__abt_stack_top
MOV R0, #(CPSR_IRQ_DISABLE | CPSR_FIQ_DISABLE | CPSR_FIQ_MODE)
MSR CPSR, R0
LDR SP, =__fiq_stack_top
MOV R0, #(CPSR_IRQ_DISABLE | CPSR_FIQ_DISABLE | CPSR_SVC_MODE)
MSR CPSR, R0
MSR SPSR, R0
LDR SP, =__svc_stack_top
BL OsBssInit
B main
B .
OsBssInit:
LDR R0, =_bss_start
LDR R1, =_bss_end
MOV R3, R1
MOV R4, R0
MOV R2, #0
1: CMP R4, R3
STRLO R2, [R4], #4
BLO 1b
BX LR
.section ".bss", "wa", %nobits
.align 3
__undef_stack:
.space 32
__undef_stack_top:
__abt_stack:
.space 32
__abt_stack_top:
__irq_stack:
.space 1024
__irq_stack_top:
__fiq_stack:
.space 1024
__fiq_stack_top:
__svc_stack:
.space 1024
__svc_stack_top:
__exc_stack:
.space 512
__exc_stack_top:

79
kernel/extended/BUILD.gn → arch/arm/common/BUILD.gn Executable file → Normal file
View File

@@ -1,40 +1,39 @@
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
static_library("cpup") {
sources = [
"cpup/los_cpup.c",
"cppsupport/los_cppsupport.c"
]
include_dirs = [
"include"
]
}
# Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_m/liteos.gni")
module_name = "common"
kernel_module(module_name) {
sources = [ "los_common_interrupt.c" ]
configs += [ "$LITEOSTOPDIR:warn_config" ]
}
config("public") {
include_dirs = [ "." ]
}

View File

@@ -0,0 +1,324 @@
/*
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_arch_interrupt.h"
#include "los_debug.h"
#ifdef __ICCARM__
#pragma location = ".data.vector"
#pragma data_alignment = LOSCFG_ARCH_HWI_VECTOR_ALIGN
/* *
* @ingroup los_hwi
* Hardware interrupt form mapping handling function array.
*/
HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#elif defined(__CC_ARM) || defined(__GNUC__)
LITE_OS_SEC_VEC
/* *
* @ingroup los_hwi
* Hardware interrupt form mapping handling function array.
*/
HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0};
#endif
VOID *ArchGetHwiFrom(VOID)
{
return g_hwiForm;
}
UINT32 g_intCount = 0;
/* ****************************************************************************
Function : HalHwiDefaultHandler
Description : default handler of the hardware interrupt
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, ArchIntCurIrqNum());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsHwiIsCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
/* *
* @ingroup los_hwi
* Hardware interrupt handler form mapping handling function array.
*/
HWI_HANDLER_FUNC g_hwiHandlerForm[OS_VECTOR_CNT] = {{ (HWI_PROC_FUNC)0, (HWI_ARG_T)0 }};
/* *
* @ingroup los_hwi
* Set interrupt vector table.
*/
VOID OsSetVector(UINT32 num, HWI_PROC_FUNC vector, VOID *arg)
{
if ((num + OS_SYS_VECTOR_CNT) < OS_VECTOR_CNT) {
g_hwiForm[num + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalInterrupt;
g_hwiHandlerForm[num + OS_SYS_VECTOR_CNT].pfnHandler = vector;
g_hwiHandlerForm[num + OS_SYS_VECTOR_CNT].pParm = arg;
}
}
#else
/* *
* @ingroup los_hwi
* hardware interrupt handler form mapping handling function array.
*/
HWI_PROC_FUNC g_hwiHandlerForm[OS_VECTOR_CNT] = {0};
/* *
* @ingroup los_hwi
* Set interrupt vector table.
*/
VOID OsSetVector(UINT32 num, HWI_PROC_FUNC vector)
{
if ((num + OS_SYS_VECTOR_CNT) < OS_VECTOR_CNT) {
g_hwiForm[num + OS_SYS_VECTOR_CNT] = HalInterrupt;
g_hwiHandlerForm[num + OS_SYS_VECTOR_CNT] = vector;
}
}
#endif
UINT32 ArchIntTrigger(HWI_HANDLE_T hwiNum)
{
if (hwiNum >= OS_HWI_MAX_NUM) {
return OS_ERRNO_HWI_NUM_INVALID;
}
HwiControllerOps *hwiOps = ArchIntOpsGet();
if (hwiOps->triggerIrq == NULL) {
return OS_ERRNO_HWI_OPS_FUNC_NULL;
}
return hwiOps->triggerIrq(hwiNum);
}
UINT32 ArchIntEnable(HWI_HANDLE_T hwiNum)
{
if (hwiNum >= OS_HWI_MAX_NUM) {
return OS_ERRNO_HWI_NUM_INVALID;
}
HwiControllerOps *hwiOps = ArchIntOpsGet();
if (hwiOps->enableIrq == NULL) {
return OS_ERRNO_HWI_OPS_FUNC_NULL;
}
return hwiOps->enableIrq(hwiNum);
}
UINT32 ArchIntDisable(HWI_HANDLE_T hwiNum)
{
if (hwiNum >= OS_HWI_MAX_NUM) {
return OS_ERRNO_HWI_NUM_INVALID;
}
HwiControllerOps *hwiOps = ArchIntOpsGet();
if (hwiOps->disableIrq == NULL) {
return OS_ERRNO_HWI_OPS_FUNC_NULL;
}
return hwiOps->disableIrq(hwiNum);
}
UINT32 ArchIntClear(HWI_HANDLE_T hwiNum)
{
if (hwiNum >= OS_HWI_MAX_NUM) {
return OS_ERRNO_HWI_NUM_INVALID;
}
HwiControllerOps *hwiOps = ArchIntOpsGet();
if (hwiOps->clearIrq == NULL) {
return OS_ERRNO_HWI_OPS_FUNC_NULL;
}
return hwiOps->clearIrq(hwiNum);
}
UINT32 ArchIntSetPriority(HWI_HANDLE_T hwiNum, HWI_PRIOR_T priority)
{
if (hwiNum >= OS_HWI_MAX_NUM) {
return OS_ERRNO_HWI_NUM_INVALID;
}
if (priority > OS_HWI_PRIO_LOWEST) {
return OS_ERRNO_HWI_PRIO_INVALID;
}
HwiControllerOps *hwiOps = ArchIntOpsGet();
if (hwiOps->setIrqPriority == NULL) {
return OS_ERRNO_HWI_OPS_FUNC_NULL;
}
return hwiOps->setIrqPriority(hwiNum, priority);
}
UINT32 ArchIntCurIrqNum(VOID)
{
HwiControllerOps *hwiOps = ArchIntOpsGet();
return hwiOps->getCurIrqNum();
}
/* ****************************************************************************
Function : ArchHwiCreate
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode, HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
if (hwiNum >= OS_HWI_MAX_NUM) {
return OS_ERRNO_HWI_NUM_INVALID;
}
if (g_hwiForm[hwiNum + OS_SYS_VECTOR_CNT] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return OS_ERRNO_HWI_ALREADY_CREATED;
}
if (hwiPrio > OS_HWI_PRIO_LOWEST) {
return OS_ERRNO_HWI_PRIO_INVALID;
}
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiControllerOps *hwiOps = ArchIntOpsGet();
if (hwiOps->createIrq == NULL) {
LOS_IntRestore(intSave);
return OS_ERRNO_HWI_OPS_FUNC_NULL;
}
hwiOps->createIrq(hwiNum, hwiPrio);
LOS_IntRestore(intSave);
return LOS_OK;
}
/* ****************************************************************************
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {
return OS_ERRNO_HWI_NUM_INVALID;
}
ArchIntDisable((IRQn_Type)hwiNum);
intSave = LOS_IntLock();
g_hwiForm[hwiNum + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
LOS_IntRestore(intSave);
return LOS_OK;
}
INLINE UINT32 ArchIsIntActive(VOID)
{
return (g_intCount > 0);
}

View File

@@ -0,0 +1,123 @@
/*
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_COMMON_INTERRUPT_H
#define _LOS_COMMON_INTERRUPT_H
#include "los_config.h"
#include "los_compiler.h"
#include "los_interrupt.h"
#include "los_error.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* *
* @ingroup los_arch_interrupt
* Define the type of a hardware interrupt vector table function.
*/
typedef VOID (**HWI_VECTOR_FUNC)(VOID);
/* *
* @ingroup los_arch_interrupt
* Count of interrupts.
*/
extern UINT32 g_intCount;
/* *
* @ingroup los_arch_interrupt
* Maximum number of used hardware interrupts.
*/
#ifndef OS_HWI_MAX_NUM
#define OS_HWI_MAX_NUM LOSCFG_PLATFORM_HWI_LIMIT
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
HWI_PROC_FUNC pfnHandler;
VOID *pParm;
} HWI_HANDLER_FUNC;
/* *
* @ingroup los_arch_interrupt
* Set interrupt vector table.
*/
extern VOID OsSetVector(UINT32 num, HWI_PROC_FUNC vector, VOID *arg);
extern HWI_HANDLER_FUNC g_hwiHandlerForm[];
#else
/* *
* @ingroup los_arch_interrupt
* Set interrupt vector table.
*/
extern VOID OsSetVector(UINT32 num, HWI_PROC_FUNC vector);
extern HWI_PROC_FUNC g_hwiHandlerForm[];
#endif
#define OS_EXC_IN_INIT 0
#define OS_EXC_IN_TASK 1
#define OS_EXC_IN_HWI 2
#define OS_EXC_FLAG_FAULTADDR_VALID 0x01
#define OS_EXC_FLAG_IN_HWI 0x02
#define OS_EXC_IMPRECISE_ACCESS_ADDR 0xABABABAB
#define OS_EXC_EVENT 0x00000001
/* *
* @ingroup los_arch_interrupt
* @brief: Default vector handling function.
*
* @par Description:
* This API is used to configure interrupt for null function.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalHwiDefaultHandler(VOID);
VOID HalPreInterruptHandler(UINT32 arg);
VOID HalAftInterruptHandler(UINT32 arg);
VOID *ArchGetHwiFrom(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_COMMON_INTERRUPT_H */

View File

@@ -1,379 +0,0 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_exc_pri.h"
#include "los_memcheck_pri.h"
#ifdef LOSCFG_LIB_LIBC
#include "string.h"
#endif
#include "securec.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define EXC_INT_STATUS_LEN OS_NVIC_INT_ENABLE_SIZE + OS_NVIC_INT_PEND_SIZE + OS_NVIC_INT_ACT_SIZE + \
OS_NVIC_INT_PRI_SIZE + OS_NVIC_EXCPRI_SIZE + OS_NVIC_SHCSR_SIZE + OS_NVIC_INT_CTRL_SIZE
#define TASK_ARRAY_INIT_VALUE 0xff
#define FAULT_STATUS_REG_BIT 32
#define OS_NVIC_INT_CTRL_SIZE 4
#define OS_NVIC_SHCSR_SIZE 4
#define USGFAULT (1 << 18)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define CORE_TYPE_CORTEX_M4 2
#define HARDFAULT_IRQN (-13)
static VOID *g_excContent;
UINT32 g_curNestCount = 0;
ExcInfo g_excInfo;
__attribute__((noinline)) VOID LOS_Panic(const CHAR *fmt, ...)
{
va_list ap;
va_start(ap,fmt);
PRINT_ERR(fmt, ap);
va_end(ap);
asm volatile ("swi 0");
}
UINT8 g_uwExcTbl[FAULT_STATUS_REG_BIT] = {
0, 0, 0, 0, 0, 0, OS_EXC_UF_DIVBYZERO, OS_EXC_UF_UNALIGNED,
0, 0, 0, 0, OS_EXC_UF_NOCP, OS_EXC_UF_INVPC, OS_EXC_UF_INVSTATE, OS_EXC_UF_UNDEFINSTR,
0, 0, 0, OS_EXC_BF_STKERR, OS_EXC_BF_UNSTKERR, OS_EXC_BF_IMPRECISERR, OS_EXC_BF_PRECISERR, OS_EXC_BF_IBUSERR,
0, 0, 0, OS_EXC_MF_MSTKERR, OS_EXC_MF_MUNSTKERR, 0, OS_EXC_MF_DACCVIOL, OS_EXC_MF_IACCVIOL
};
UINT32 g_excArraySize = 0;
ExcInfoArray g_excArray[OS_EXC_TYPE_MAX - 1];
UINT32 g_LR_regs = 0;
UINT32 g_PC_regs = 0;
LITE_OS_SEC_TEXT_INIT VOID OsExcInfoDisplay(ExcInfo *exc)
{
PRINT_INFO("Phase = 0x%x\n", exc->phase);
PRINT_INFO("Type = 0x%x\n", exc->type);
PRINT_INFO("FaultAddr = 0x%x\n", exc->faultAddr);
PRINT_INFO("ThrdPid = 0x%x\n", exc->thrdPid);
PRINT_INFO("R0 = 0x%x\n", exc->context->uwR0);
PRINT_INFO("R1 = 0x%x\n", exc->context->uwR1);
PRINT_INFO("R2 = 0x%x\n", exc->context->uwR2);
PRINT_INFO("R3 = 0x%x\n", exc->context->uwR3);
PRINT_INFO("R4 = 0x%x\n", exc->context->uwR4);
PRINT_INFO("R5 = 0x%x\n", exc->context->uwR5);
PRINT_INFO("R6 = 0x%x\n", exc->context->uwR6);
PRINT_INFO("R7 = 0x%x\n", exc->context->uwR7);
PRINT_INFO("R8 = 0x%x\n", exc->context->uwR8);
PRINT_INFO("R9 = 0x%x\n", exc->context->uwR9);
PRINT_INFO("R10 = 0x%x\n", exc->context->uwR10);
PRINT_INFO("R11 = 0x%x\n", exc->context->uwR11);
PRINT_INFO("R12 = 0x%x\n", exc->context->uwR12);
PRINT_INFO("PriMask = 0x%x\n", exc->context->uwPriMask);
PRINT_INFO("SP = 0x%x\n", exc->context->uwSP);
PRINT_INFO("LR = 0x%x\n", exc->context->uwLR);
PRINT_INFO("PC = 0x%x\n", exc->context->uwPC);
PRINT_INFO("xPSR = 0x%x\n", exc->context->uwxPSR);
g_LR_regs = exc->context->uwLR;
g_PC_regs = exc->context->uwPC;
}
/* ****************************************************************************
Function : OsExcHandleEntry
Description : EXC模块的处理分发函数
Input : excType
: faultAddr
: pid
: excBufAddr --- EXC寄存器信息的首地址
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid,
EXC_CONTEXT_S *excBufAddr)
{
UINT16 tmpFlag = (excType >> 16) & OS_NULL_SHORT; // 为2在中断中为1 faultAddr有效
g_curNestCount++;
g_vuwIntCount++;
g_excInfo.nestCnt = g_curNestCount;
g_excInfo.type = excType & OS_NULL_SHORT;
g_excContent = (UINT32 *)g_aucTaskArray;
if (tmpFlag & OS_EXC_FLAG_FAULTADDR_VALID) {
g_excInfo.faultAddr = faultAddr;
} else {
g_excInfo.faultAddr = OS_EXC_IMPRECISE_ACCESS_ADDR;
}
if (g_losTask.runTask != NULL) {
if (tmpFlag & OS_EXC_FLAG_IN_HWI) {
g_excInfo.phase = OS_EXC_IN_HWI;
g_excInfo.thrdPid = pid;
} else {
g_excInfo.phase = OS_EXC_IN_TASK;
g_excInfo.thrdPid = g_losTask.runTask->taskID;
}
} else {
g_excInfo.phase = OS_EXC_IN_INIT;
g_excInfo.thrdPid = OS_NULL_INT;
}
if (excType & OS_EXC_FLAG_NO_FLOAT) {
g_excInfo.context = (EXC_CONTEXT_S *)((CHAR *)excBufAddr - LOS_OFF_SET_OF(EXC_CONTEXT_S, uwR4));
} else {
g_excInfo.context = excBufAddr;
}
OsExcSave2DDR();
OsExcInfoDisplay(&g_excInfo);
LOS_Reboot();
}
static VOID OsExcSaveIntStatus()
{
UINT32 ret;
UINT32 failCnt = 0;
*((UINT32 *)g_excContent) = OS_EXC_TYPE_NVIC;
g_excContent = (UINT8 *)g_excContent + sizeof(UINT32);
// = OS_NVIC_INT_ENABLE_SIZE + OS_NVIC_INT_PEND_SIZE + OS_NVIC_INT_ACT_SIZE + OS_NVIC_INT_PRI_SIZE + 12 + 4 + 4
*((UINT32 *)g_excContent) = EXC_INT_STATUS_LEN;
g_excContent = (UINT8 *)g_excContent + sizeof(UINT32);
/* 保存中断ENABLE寄存器组 */
ret = memcpy_s(g_excContent, MAX_EXC_MEM_SIZE, (const VOID *)OS_NVIC_SETENA_BASE, OS_NVIC_INT_ENABLE_SIZE);
g_excContent = (UINT8 *)g_excContent + OS_NVIC_INT_ENABLE_SIZE;
failCnt += (ret == EOK) ? 0 : 1;
/* 保存中断PEND寄存器组 */
ret = memcpy_s(g_excContent, MAX_EXC_MEM_SIZE, (const VOID *)OS_NVIC_SETPEND_BASE, OS_NVIC_INT_PEND_SIZE);
g_excContent = (UINT8 *)g_excContent + OS_NVIC_INT_PEND_SIZE;
failCnt += (ret == EOK) ? 0 : 1;
/* 保存中断ACTIVE寄存器组 */
ret = memcpy_s(g_excContent, MAX_EXC_MEM_SIZE, (const VOID *)OS_NVIC_INT_ACT_BASE, OS_NVIC_INT_ACT_SIZE);
g_excContent = (UINT8 *)g_excContent + OS_NVIC_INT_ACT_SIZE;
failCnt += (ret == EOK) ? 0 : 1;
/* 保存中断优先级寄存器组 */
ret = memcpy_s(g_excContent, MAX_EXC_MEM_SIZE, (const VOID *)OS_NVIC_PRI_BASE, OS_NVIC_INT_PRI_SIZE);
g_excContent = (UINT8 *)g_excContent + OS_NVIC_INT_PRI_SIZE;
failCnt += (ret == EOK) ? 0 : 1;
/* 系统异常优先级寄存器组 */
ret = memcpy_s(g_excContent, MAX_EXC_MEM_SIZE, (const VOID *)OS_NVIC_EXCPRI_BASE, OS_NVIC_EXCPRI_SIZE);
g_excContent = (UINT8 *)g_excContent + OS_NVIC_EXCPRI_SIZE;
failCnt += (ret == EOK) ? 0 : 1;
/* 保存系统Handler控制及状态寄存器SHCSR */
ret = memcpy_s(g_excContent, MAX_EXC_MEM_SIZE, (const VOID *)OS_NVIC_SHCSR, OS_NVIC_SHCSR_SIZE);
g_excContent = (UINT8 *)g_excContent + sizeof(UINT32);
failCnt += (ret == EOK) ? 0 : 1;
/* 保存中断控制及状态寄存器ICSR */
ret = memcpy_s(g_excContent, MAX_EXC_MEM_SIZE, (const VOID *)OS_NVIC_INT_CTRL, OS_NVIC_INT_CTRL_SIZE);
g_excContent = (UINT8 *)g_excContent + sizeof(UINT32);
failCnt += (ret == EOK) ? 0 : 1;
if (failCnt != 0) {
PRINT_ERR("OsExcSaveIntStatus copy register info failed, cnt:%d\n", failCnt);
}
return;
}
VOID OsExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg)
{
ExcInfoArray *excInfo = NULL;
if ((type == 0) || (type >= OS_EXC_TYPE_MAX) || (func == NULL)) {
PRINT_ERR("OsExcRegister ERROR!\n");
return;
}
excInfo = &(g_excArray[type - 1]);
excInfo->uwType = type;
excInfo->pFnExcInfoCb = func;
excInfo->pArg = arg;
excInfo->uwValid = TRUE;
}
static VOID OsExcSaveSysInfo(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, UINT32 loop, UINT32 length, UINT32 index)
{
UINT32 ret;
UINT32 buffer[OS_EXC_MAX_BUF_LEN];
*((UINT32 *)g_excContent) = type;
g_excContent = (UINT8 *)g_excContent + sizeof(UINT32);
*((UINT32 *)g_excContent) = length * (loop - index);
g_excContent = (UINT8 *)g_excContent + sizeof(UINT32);
for (; index < loop; index++) {
(VOID)memset_s(buffer, sizeof(UINT32) * OS_EXC_MAX_BUF_LEN, 0, sizeof(UINT32) * OS_EXC_MAX_BUF_LEN);
ret = func(index, (VOID *)buffer);
if (ret == LOS_OK) {
if (memcpy_s(g_excContent, MAX_EXC_MEM_SIZE, (VOID *)buffer, length) != EOK) {
PRINT_ERR("OsExcSaveSysInfo copy buffer failed\n");
return;
}
g_excContent = (UINT8 *)g_excContent + length;
} else {
g_excContent = (UINT8 *)g_excContent + length;
}
}
}
static VOID OsExcSaveInfo(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg)
{
UINT32 length;
UINT32 index;
UINT32 loop;
UINT32 taskSwitchCount = 0;
TaskSwitchInfo *taskSwitchInfo = NULL;
if (arg == NULL) {
return;
}
switch (type) {
case OS_EXC_TYPE_TSK: /* save task info */
length = sizeof(TSK_INFO_S);
loop = *(UINT32 *)arg;
index = 0;
break;
case OS_EXC_TYPE_QUE: /* save queue info */
length = sizeof(QUEUE_INFO_S);
loop = *(UINT32 *)arg + 1;
index = 1;
break;
case OS_EXC_TYPE_NVIC:
(VOID)func(0, 0);
goto END;
case OS_EXC_TYPE_TSK_SWITCH: /* save task switch info */
// not necessary, just for macro int library
taskSwitchInfo = arg;
taskSwitchCount = taskSwitchInfo->cntInfo.maxCnt;
length = sizeof(UINT32) + sizeof(CHAR) * LOS_TASK_NAMELEN;
if (taskSwitchInfo->cntInfo.isFull) {
index = taskSwitchInfo->idx;
loop = index + taskSwitchCount;
} else {
index = 0;
loop = taskSwitchInfo->idx;
}
break;
case OS_EXC_TYPE_MEM: /* save mem info */
length = sizeof(MEM_INFO_S);
loop = *(UINT32 *)arg;
index = 0;
break;
default:
goto END;
}
OsExcSaveSysInfo(type, (EXC_INFO_SAVE_CALLBACK)func, loop, length, index);
END:
return;
}
static VOID OsExcSave2DDR(VOID)
{
UINT32 index = 0;
UINT32 ret;
UINT32 failCnt = 0;
ret = memset_s(g_aucTaskArray, MAX_EXC_MEM_SIZE, TASK_ARRAY_INIT_VALUE, g_excArraySize);
if (ret != EOK) {
PRINT_ERR("memset failed\n");
return;
}
/* define core type */
*((UINT32 *)g_excContent) = CORE_TYPE_CORTEX_M4; // 1 is cortex-M3, 2 is cortex-M4
g_excContent = (UINT8 *)g_excContent + sizeof(UINT32);
/* save exception info */
*((UINT32 *)g_excContent) = OS_EXC_TYPE_CONTEXT;
g_excContent = (UINT8 *)g_excContent + sizeof(UINT32);
*((UINT32 *)g_excContent) = sizeof(ExcInfo) - sizeof(UINT32) + sizeof(EXC_CONTEXT_S);
g_excContent = (UINT8 *)g_excContent + sizeof(UINT32);
ret = memcpy_s((VOID *)g_excContent, MAX_EXC_MEM_SIZE, (VOID *)&g_excInfo, sizeof(ExcInfo) - sizeof(UINT32));
g_excContent = (UINT8 *)g_excContent + sizeof(ExcInfo) - sizeof(UINT32);
failCnt += (ret == EOK) ? 0 : 1;
ret = memcpy_s((VOID *)g_excContent, MAX_EXC_MEM_SIZE, g_excInfo.context, sizeof(EXC_CONTEXT_S));
g_excContent = (UINT8 *)g_excContent + sizeof(EXC_CONTEXT_S);
failCnt += (ret == EOK) ? 0 : 1;
if (failCnt != 0) {
PRINT_ERR("OsExcSave2DDR copy exc info failed, cnt:%d\n", failCnt);
}
for (index = 0; index < (OS_EXC_TYPE_MAX - 1); index++) {
if (g_excArray[index].uwValid == FALSE) {
continue;
}
OsExcSaveInfo(g_excArray[index].uwType, g_excArray[index].pFnExcInfoCb, g_excArray[index].pArg);
}
*((UINT32 *)g_excContent) = OS_EXC_TYPE_MAX;
g_excContent = (UINT8 *)g_excContent + sizeof(UINT32);
return;
}
LITE_OS_SEC_TEXT_INIT VOID OsExcInit(UINT32 arraySize)
{
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = OsExcHardFault;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = OsExcNMI;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = OsExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = OsExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = OsExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = OsExcSvcCall;
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */ // 因为文件系统存在非对齐操作,故此异常暂不接管
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
g_excArraySize = arraySize;
OsExcRegister(OS_EXC_TYPE_NVIC, (EXC_INFO_SAVE_CALLBACK)OsExcSaveIntStatus, NULL);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -1,98 +0,0 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_EXC_PRI_H
#define _LOS_EXC_PRI_H
#include "los_exc.h"
#include "los_sys_pri.h"
#ifdef LOSCFG_LIB_LIBC
#include "string.h"
#endif
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
typedef enum {
OS_EXC_TYPE_CONTEXT = 0,
OS_EXC_TYPE_TSK = 1,
OS_EXC_TYPE_QUE = 2,
OS_EXC_TYPE_NVIC = 3,
OS_EXC_TYPE_TSK_SWITCH = 4,
OS_EXC_TYPE_MEM = 5,
OS_EXC_TYPE_MAX = 6
} ExcInfoType;
typedef struct tagExcInfoCallBackArray {
ExcInfoType uwType;
UINT32 uwValid;
EXC_INFO_SAVE_CALLBACK pFnExcInfoCb;
VOID* pArg;
} ExcInfoArray;
#define MAX_SCENE_INFO_SIZE (8 + sizeof(ExcInfo) - 4 + sizeof(EXC_CONTEXT_S))
#define MAX_TSK_INFO_SIZE (8 + sizeof(TSK_INFO_S) * (LOSCFG_BASE_CORE_TSK_LIMIT + 1))
#define MAX_INT_INFO_SIZE (8 + 0x164)
#if (LOSCFG_BASE_IPC_QUEUE == YES)
#define MAX_QUEUE_INFO_SIZE (8 + sizeof(QUEUE_INFO_S) * LOSCFG_BASE_IPC_QUEUE_LIMIT)
#else
#define MAX_QUEUE_INFO_SIZE (0)
#endif
#if (LOSCFG_BASE_CORE_EXC_TSK_SWITCH == YES)
#define MAX_SWITCH_INFO_SIZE (8 + (sizeof(UINT32) + sizeof(CHAR) * LOS_TASK_NAMELEN) * OS_TASK_SWITCH_INFO_COUNT)
#else
#define MAX_SWITCH_INFO_SIZE (0)
#endif
#if (LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK == YES)
#define MAX_MEM_INFO_SIZE (8 + sizeof(MEM_INFO_S) * OS_SYS_MEM_NUM)
#else
#define MAX_MEM_INFO_SIZE (0)
#endif
#define MAX_EXC_MEM_SIZE ( 4 + MAX_SCENE_INFO_SIZE + MAX_TSK_INFO_SIZE + MAX_QUEUE_INFO_SIZE + MAX_INT_INFO_SIZE + MAX_SWITCH_INFO_SIZE + MAX_MEM_INFO_SIZE + 4)
VOID OsExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg);
VOID LOS_Reboot(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif

View File

@@ -1,131 +0,0 @@
;
; Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
; Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this list of
; conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice, this list
; of conditions and the following disclaimer in the documentation and/or other materials
; provided with the distribution.
;
; 3. Neither the name of the copyright holder nor the names of its contributors may be used
; to endorse or promote products derived from this software without specific prior written
; permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
; ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
.syntax unified
.arch armv7e-m
.thumb
.fpu vfpv4
.extern g_saveSRContext
.extern g_saveAR
.extern g_losTask
.global OsSRSaveRegister
.global OsSRRestoreRegister
.section .text
.thumb
.type OsSRSaveRegister, %function
.global OsSRSaveRegister
OsSRSaveRegister:
.fnstart
.cantunwind
PUSH {R2}
LDR R2, =g_saveAR
STR R0, [R2]
STR R1, [R2, #4]
POP {R2}
MRS R0, PSP
VSTMDB R0!, {D0-D7}
VMRS R1, FPSCR
STMFD R0!, {R1} //FPSCR
STMFD R0!, {R1} //NO_NAME
MRS R1, PSR
ORR R1, R1, #0x01000000
STMFD R0!, {R1}
MOV R1, LR
STMFD R0!, {R1} // ;PC
STMFD R0!, {R1} // ;LR
STMFD R0!, {R12}
MOV R12, R0
LDR R0, =g_saveAR
LDR R0, [R0]
LDR R1, =g_saveAR
LDR R1, [R1, #4]
STMFD R12!, {R0-R3}
STMFD R12!, {R4-R11}
VSTMDB R12!, {D8-D15}
MRS R0, CONTROL
STMFD R12!, {R0}
MRS R0, MSP
STMFD R12!, {R0}
LDR R1, =g_losTask
LDR R1, [R1]
STR R12, [R1]
MSR PSP, R12
BX LR
.fnend
.type OsSRSaveRegister, %function
.global OsSRSaveRegister
OsSRRestoreRegister:
.fnstart
.cantunwind
MRS R0, MSP
ADD R0, R0, #8
MSR MSP, R0
LDR R0, =g_losTask
LDR R0, [R0]
LDR R12, [R0]
LDR R0, =g_saveSRContext
ADD R0, R0, #120
MSR PSP, R0
LDMFD R12!,{R0}
MSR MSP, R0
LDMFD R12!,{R0}
MSR CONTROL, R0
VLDMIA R12!,{D8-D15}
LDMFD R12!,{R4-R11}
MSR PSP, R12
MOV LR, #0xFFFFFFED
BX LR
.fnend

View File

@@ -1,363 +0,0 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_EXC_H
#define _LOS_EXC_H
#include "los_hwi.h"
#include "los_task_pri.h"
#include "los_queue.h"
#include "los_memcheck.h"
#include "los_sys_pri.h"
#ifdef LOSCFG_LIB_LIBC
#include "string.h"
#endif
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#define OS_EXC_IN_INIT 0
#define OS_EXC_IN_TASK 1
#define OS_EXC_IN_HWI 2
#define OS_EXC_MAX_BUF_LEN 25
#define OS_EXC_MAX_NEST_DEPTH 1
#define OS_NVIC_SHCSR 0xE000ED24
#define OS_NVIC_CCR 0xE000ED14
#define OS_NVIC_INT_ENABLE_SIZE 0x20
#define OS_NVIC_INT_PRI_SIZE 0xF0
#define OS_NVIC_EXCPRI_SIZE 0xC
#define OS_NVIC_INT_PEND_SIZE OS_NVIC_INT_ACT_SIZE
#define OS_NVIC_INT_ACT_SIZE OS_NVIC_INT_ENABLE_SIZE
#define OS_EXC_FLAG_NO_FLOAT 0x10000000
#define OS_EXC_FLAG_FAULTADDR_VALID 0x01
#define OS_EXC_FLAG_IN_HWI 0x02
#define OS_EXC_IMPRECISE_ACCESS_ADDR 0xABABABAB
/**
*@ingroup los_exc
* the struct of register files
*
* description: the register files that saved when exception triggered
*
* notes:the following register with prefix 'uw' correspond to the registers in the cpu data sheet.
*/
typedef struct tagExcContext {
//handler save
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
UINT32 S16;
UINT32 S17;
UINT32 S18;
UINT32 S19;
UINT32 S20;
UINT32 S21;
UINT32 S22;
UINT32 S23;
UINT32 S24;
UINT32 S25;
UINT32 S26;
UINT32 S27;
UINT32 S28;
UINT32 S29;
UINT32 S30;
UINT32 S31;
#endif
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
//auto save
UINT32 uwSP;
UINT32 uwR0;
UINT32 uwR1;
UINT32 uwR2;
UINT32 uwR3;
UINT32 uwR12;
UINT32 uwLR;
UINT32 uwPC;
UINT32 uwxPSR;
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED) && (__FPU_USED== 1U)))
UINT32 S0;
UINT32 S1;
UINT32 S2;
UINT32 S3;
UINT32 S4;
UINT32 S5;
UINT32 S6;
UINT32 S7;
UINT32 S8;
UINT32 S9;
UINT32 S10;
UINT32 S11;
UINT32 S12;
UINT32 S13;
UINT32 S14;
UINT32 S15;
UINT32 FPSCR;
UINT32 NO_NAME;
#endif
}EXC_CONTEXT_S;
typedef UINT32 (*EXC_INFO_SAVE_CALLBACK)(UINT32, VOID*);
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
VOID OsExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
/**
* @ingroup los_hwi
* @brief: Exception initialization.
*
* @par Description:
* This API is used to configure the exception function vector table.
*
* @attention:
* <ul><li>None.</li></ul>
*
*@param uwArraySize [IN] Memory size of exception.
*
* @retval: None
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
VOID OsExcInit(UINT32 uwArraySize);
extern VOID OsExcNMI(VOID);
extern VOID OsExcHardFault(VOID);
extern VOID OsExcMemFault(VOID);
extern VOID OsExcBusFault(VOID);
extern VOID OsExcUsageFault(VOID);
extern VOID OsExcSvcCall(VOID);
extern VOID OsBackTrace(VOID);
extern UINT8 g_aucTaskArray[];
/**
*@ingroup los_exc
*@brief Kernel panic function.
*
*@par Description:
*Stack function that prints kernel panics.
*@attention After this function is called and stack information is printed, the system will fail to respond.
*@attention The input parameter can be NULL.
*@param fmt [IN] Type #char* : variadic argument.
*
*@retval #None.
*
*@par Dependency:
*los_exc.h: the header file that contains the API declaration.
*@see None.
*/
VOID LOS_Panic(const CHAR *fmt, ...);
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:总线状态寄存器入栈时发生错误
*/
#define OS_EXC_BF_STKERR 1
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:总线状态寄存器出栈时发生错误
*/
#define OS_EXC_BF_UNSTKERR 2
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:总线状态寄存器不精确的数据访问违例
*/
#define OS_EXC_BF_IMPRECISERR 3
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:总线状态寄存器精确的数据访问违例
*/
#define OS_EXC_BF_PRECISERR 4
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:总线状态寄存器取指时的访问违例
*/
#define OS_EXC_BF_IBUSERR 5
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:存储器管理状态寄存器入栈时发生错误
*/
#define OS_EXC_MF_MSTKERR 6
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:存储器管理状态寄存器出栈时发生错误
*/
#define OS_EXC_MF_MUNSTKERR 7
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:存储器管理状态寄存器数据访问违例
*/
#define OS_EXC_MF_DACCVIOL 8
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:存储器管理状态寄存器取指访问违例
*/
#define OS_EXC_MF_IACCVIOL 9
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:用法错误,表示除法运算时除数为零
*/
#define OS_EXC_UF_DIVBYZERO 10
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:用法错误,未对齐访问导致的错误
*/
#define OS_EXC_UF_UNALIGNED 11
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:用法错误,试图执行协处理器相关指令
*/
#define OS_EXC_UF_NOCP 12
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:用法错误在异常返回时试图非法地加载EXC_RETURN到PC
*/
#define OS_EXC_UF_INVPC 13
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:用法错误试图切入ARM状态
*/
#define OS_EXC_UF_INVSTATE 14
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:用法错误,执行的指令其编码是未定义的——解码不能
*/
#define OS_EXC_UF_UNDEFINSTR 15
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:NMI中断
*/
#define OS_EXC_CAUSE_NMI 16
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:硬fault
*/
#define OS_EXC_CAUSE_HARDFAULT 17
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:任务处理函数退出
*/
#define OS_EXC_CAUSE_TASK_EXIT 18
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:致命错误
*/
#define OS_EXC_CAUSE_FATAL_ERR 19
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:调试事件导致的硬fault
*/
#define OS_EXC_CAUSE_DEBUGEVT 20
/**
*@ingroup los_exc
*Cortex-M3异常具体类型:取向量时发生的硬fault
*/
#define OS_EXC_CAUSE_VECTBL 21
/**
*@ingroup los_exc
* 异常信息结构体
*
* 描述:M4平台下的异常触发时保存的异常信息
*
*/
typedef struct tagExcInfo {
/**< 异常发生阶段: 0表示异常发生在初始化中1表示异常发生在任务中2表示异常发生在中断中 */
UINT16 phase;
/**< 异常类型,出异常时对照上面列出的1-19号 */
UINT16 type;
/**< 若为精确地址访问错误表示异常发生时的错误访问地址 */
UINT32 faultAddr;
/**< 在中断中发生异常表示中断号。在任务中发生异常表示任务id如果发生在初始化中则为0xffffffff */
UINT32 thrdPid;
/**< 异常嵌套个数,目前仅支持第一次进入异常时执行注册的钩子函数 */
UINT16 nestCnt;
/**< 保留 */
UINT16 reserved;
/**< 自动压栈浮点寄存器的异常发生时刻的硬件上下文 */
EXC_CONTEXT_S * context;
} ExcInfo;
extern UINT32 g_curNestCount;
extern UINT32 g_vuwIntCount;
static VOID OsExcSave2DDR(VOID);
VOID OsExcInfoDisplay(ExcInfo *exc);
extern TaskSwitchInfo g_taskSwitchInfo;
extern UINT8 g_uwExcTbl[32];
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#endif /* _LOS_EXC_H */

View File

@@ -1,720 +0,0 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @defgroup los_hwi Hardware interrupt
* @ingroup kernel
*/
#ifndef _LOS_HWI_H
#define _LOS_HWI_H
#include "los_base.h"
#include "los_sys.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* *
* @ingroup los_hwi
* Maximum number of used hardware interrupts.
*/
#ifndef OS_HWI_MAX_NUM
#define OS_HWI_MAX_NUM LOSCFG_PLATFORM_HWI_LIMIT
#endif
/* *
* @ingroup los_hwi
* Highest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_HIGHEST
#define OS_HWI_PRIO_HIGHEST 0
#endif
/* *
* @ingroup los_hwi
* Lowest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_LOWEST
#define OS_HWI_PRIO_LOWEST 7
#endif
/* *
* @ingroup los_config
* Configuration item for interrupt with argument
*/
#ifndef OS_HWI_WITH_ARG
#define OS_HWI_WITH_ARG NO
#endif
/* *
* @ingroup los_hwi
* Define the type of a hardware interrupt number.
*/
typedef UINT32 HWI_HANDLE_T;
/* *
* @ingroup los_hwi
* Define the type of a hardware interrupt priority.
*/
typedef UINT16 HWI_PRIOR_T;
/* *
* @ingroup los_hwi
* Define the type of hardware interrupt mode configurations.
*/
typedef UINT16 HWI_MODE_T;
/* *
* @ingroup los_hwi
* Define the type of the parameter used for the hardware interrupt creation function. The function of this parameter varies among platforms.
*/
typedef UINT32 HWI_ARG_T;
/* *
* @ingroup los_hwi
* Define the type of a hardware interrupt handling function.
*/
#if (OS_HWI_WITH_ARG == YES)
typedef VOID (*HWI_PROC_FUNC)(VOID *parm);
typedef struct {
HWI_PROC_FUNC pfnHandler;
VOID *pParm;
} HWI_SLAVE_FUNC;
#else
typedef VOID (*HWI_PROC_FUNC)(void);
#endif
/* *
* @ingroup los_hwi
* Define the type of a hardware interrupt vector table function.
*/
typedef VOID (**HWI_VECTOR_FUNC)(void);
/* *
* @ingroup los_hwi
* Count of interrupts.
*/
extern UINT32 g_vuwIntCount;
/* *
* @ingroup los_hwi
* An interrupt is active.
*/
#define OS_INT_ACTIVE (g_vuwIntCount > 0)
/* *
* @ingroup los_hwi
* An interrupt is inactive.
*/
#define OS_INT_INACTIVE (!(OS_INT_ACTIVE))
/* *
* @ingroup los_hwi
* Count of M-Core system interrupt vector.
*/
#define OS_SYS_VECTOR_CNT 16
/* *
* @ingroup los_hwi
* Count of M-Core interrupt vector.
*/
#define OS_VECTOR_CNT (OS_SYS_VECTOR_CNT + OS_HWI_MAX_NUM)
/* *
* @ingroup los_hwi
* AIRCR register priority group parameter .
*/
#define OS_NVIC_AIRCR_PRIGROUP 7
/* *
* @ingroup los_hwi
* Boot interrupt vector table.
*/
extern UINT32 _BootVectors[];
/* *
* @ingroup los_hwi
* Hardware interrupt error code: Invalid interrupt number.
*
* Value: 0x02000900
*
* Solution: Ensure that the interrupt number is valid. The value range of the interrupt number applicable for a Cortex-A7 platform is [OS_USER_HWI_MIN,OS_USER_HWI_MAX].
*/
#define OS_ERRNO_HWI_NUM_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x00)
/* *
* @ingroup los_hwi
* Hardware interrupt error code: Null hardware interrupt handling function.
*
* Value: 0x02000901
*
* Solution: Pass in a valid non-null hardware interrupt handling function.
*/
#define OS_ERRNO_HWI_PROC_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x01)
/* *
* @ingroup los_hwi
* Hardware interrupt error code: Insufficient interrupt resources for hardware interrupt creation.
*
* Value: 0x02000902
*
* Solution: Increase the configured maximum number of supported hardware interrupts.
*/
#define OS_ERRNO_HWI_CB_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x02)
/* *
* @ingroup los_hwi
* Hardware interrupt error code: Insufficient memory for hardware interrupt initialization.
*
* Value: 0x02000903
*
* Solution: Expand the configured memory.
*/
#define OS_ERRNO_HWI_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x03)
/* *
* @ingroup los_hwi
* Hardware interrupt error code: The interrupt has already been created.
*
* Value: 0x02000904
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x04)
/* *
* @ingroup los_hwi
* Hardware interrupt error code: Invalid interrupt priority.
*
* Value: 0x02000905
*
* Solution: Ensure that the interrupt priority is valid. The value range of the interrupt priority applicable for a Cortex-A7 platform is [0,15].
*/
#define OS_ERRNO_HWI_PRIO_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x05)
/* *
* @ingroup los_hwi
* Hardware interrupt error code: Incorrect interrupt creation mode.
*
* Value: 0x02000906
*
* Solution: The interrupt creation mode can be only set to OS_HWI_MODE_COMM or OS_HWI_MODE_FAST of which the value can be 0 or 1.
*/
#define OS_ERRNO_HWI_MODE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x06)
/* *
* @ingroup los_hwi
* Hardware interrupt error code: The interrupt has already been created as a fast interrupt.
*
* Value: 0x02000907
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_FASTMODE_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x07)
/* *
* @ingroup los_hwi
* SysTick control and status register.
*/
#define OS_SYSTICK_CONTROL_REG 0xE000E010
/* *
* @ingroup los_hw
* SysTick current value register.
*/
#define OS_SYSTICK_CURRENT_REG 0xE000E018
/* *
* @ingroup los_hwi
* Interrupt Priority-Level Registers.
*/
#define OS_NVIC_PRI_BASE 0xE000E400
/* *
* @ingroup los_hwi
* Interrupt enable register for 0-31.
*/
#define OS_NVIC_SETENA_BASE 0xE000E100
/* *
* @ingroup los_hwi
* interrupt pending register.
*/
#define OS_NVIC_SETPEND_BASE 0xE000E200
/* *
* @ingroup los_hwi
* Interrupt active register.
*/
#define OS_NVIC_INT_ACT_BASE 0xE000E300
/* *
* @ingroup los_hwi
* Interrupt disable register for 0-31.
*/
#define OS_NVIC_CLRENA_BASE 0xE000E180
/* *
* @ingroup los_hwi
* Interrupt control and status register.
*/
#define OS_NVIC_INT_CTRL 0xE000ED04
/* *
* @ingroup los_hwi
* Vector table offset register.
*/
#define OS_NVIC_VTOR 0xE000ED08
/* *
* @ingroup los_hwi
* Application interrupt and reset control register
*/
#define OS_NVIC_AIRCR 0xE000ED0C
/* *
* @ingroup los_hwi
* System exception priority register.
*/
#define OS_NVIC_EXCPRI_BASE 0xE000ED18
/* *
* @ingroup los_hwi
* Interrupt No. 1 :reset.
*/
#define OS_EXC_RESET 1
/* *
* @ingroup los_hwi
* Interrupt No. 2 :Non-Maskable Interrupt.
*/
#define OS_EXC_NMI 2
/* *
* @ingroup los_hwi
* Interrupt No. 3 :(hard)fault.
*/
#define OS_EXC_HARD_FAULT 3
/* *
* @ingroup los_hwi
* Interrupt No. 4 :MemManage fault.
*/
#define OS_EXC_MPU_FAULT 4
/* *
* @ingroup los_hwi
* Interrupt No. 5 :Bus fault.
*/
#define OS_EXC_BUS_FAULT 5
/* *
* @ingroup los_hwi
* Interrupt No. 6 :Usage fault.
*/
#define OS_EXC_USAGE_FAULT 6
/* *
* @ingroup los_hwi
* Interrupt No. 11 :SVCall.
*/
#define OS_EXC_SVC_CALL 11
/* *
* @ingroup los_hwi
* Interrupt No. 12 :Debug monitor.
*/
#define OS_EXC_DBG_MONITOR 12
/* *
* @ingroup los_hwi
* Interrupt No. 14 :PendSV.
*/
#define OS_EXC_PEND_SV 14
/* *
* @ingroup los_hwi
* Interrupt No. 15 :SysTick.
*/
#define OS_EXC_SYS_TICK 15
/* *
* @ingroup los_hwi
* hardware interrupt form mapping handling function array.
*/
extern HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT];
#if (OS_HWI_WITH_ARG == YES)
/* *
* @ingroup los_hwi
* hardware interrupt Slave form mapping handling function array.
*/
extern HWI_SLAVE_FUNC g_hwiSlaveForm[OS_VECTOR_CNT];
/* *
* @ingroup los_hwi
* Set interrupt vector table.
*/
#define OsSetVectonr(num, vector, arg) \
do { \
g_hwiForm[num + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)OsInterrupt; \
g_hwiSlaveForm[num + OS_SYS_VECTOR_CNT].pfnHandler = vector; \
g_hwiSlaveForm[num + OS_SYS_VECTOR_CNT].pParm = (VOID *)arg; \
} while(0)
#else
/* *
* @ingroup los_hwi
* hardware interrupt Slave form mapping handling function array.
*/
extern HWI_PROC_FUNC g_hwiSlaveForm[OS_VECTOR_CNT];
/* *
* @ingroup los_hwi
* Set interrupt vector table.
*/
#define OsSetVector(num, vector) \
do { \
g_hwiForm[num + OS_SYS_VECTOR_CNT] = OsInterrupt; \
g_hwiSlaveForm[num + OS_SYS_VECTOR_CNT] = vector; \
} while(0)
#endif
/* *
* @ingroup los_hwi
* @brief Create a hardware interrupt.
*
* @par Description:
* This API is used to configure a hardware interrupt and register a hardware interrupt handling function.
*
* @attention
* <ul>
* <li>The hardware interrupt module is usable only when the configuration item for hardware interrupt tailoring is enabled.</li>
* <li>Hardware interrupt number value range: [OS_USER_HWI_MIN,OS_USER_HWI_MAX]. The value range applicable for a Cortex-A7 platform is [32,95].</li>
* <li>OS_HWI_MAX_NUM specifies the maximum number of interrupts that can be created.</li>
* <li>Before executing an interrupt on a platform, refer to the chip manual of the platform.</li>
* </ul>
*
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a Cortex-A7 platform is [32,95].
* @param hwiPrio [IN] Type#HWI_PRIOR_T: hardware interrupt priority. Ignore this parameter temporarily.
* @param mode [IN] Type#HWI_MODE_T: hardware interrupt mode. Ignore this parameter temporarily.
* @param handler [IN] Type#HWI_PROC_FUNC: interrupt handler used when a hardware interrupt is triggered.
* @param arg [IN] Type#HWI_ARG_T: input parameter of the interrupt handler used when a hardware interrupt is triggered.
*
* @retval #OS_ERRNO_HWI_PROC_FUNC_NULL 0x02000901: Null hardware interrupt handling function.
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
* @retval #OS_ERRNO_HWI_NO_MEMORY 0x02000903: Insufficient memory for hardware interrupt creation.
* @retval #OS_ERRNO_HWI_ALREADY_CREATED 0x02000904: The interrupt handler being created has already been created.
* @retval #LOS_OK 0 : The interrupt is successfully created.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg);
/* *
* @ingroup los_hwi
* @brief: Hardware interrupt entry function.
*
* @par Description:
* This API is used as all hardware interrupt handling function entry.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID OsInterrupt(VOID);
/* *
* @ingroup los_hwi
* @brief: Get a interrupt number.
*
* @par Description:
* This API is used to get the current interrupt number.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param: None.
*
* @retval: Interrupt Indexes number.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern UINT32 OsIntNumGet(VOID);
/* *
* @ingroup los_hwi
* @brief: Default vector handling function.
*
* @par Description:
* This API is used to configure interrupt for null function.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li
></ul>
* @see None.
*/
extern VOID OsHwiDefaultHandler(VOID);
/* *
* @ingroup los_hwi
* @brief: Reset the vector table.
*
* @par Description:
* This API is used to reset the vector table.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID Reset_Handler(VOID);
/* *
* @ingroup los_hwi
* @brief: Pended System Call.
*
* @par Description:
* PendSV can be pended and is useful for an OS to pend an exception
* so that an action can be performed after other important tasks are completed.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID osPendSV(VOID);
/* *
* @ingroup los_hwi
* @brief Enable all interrupts.
*
* @par Description:
* <ul>
* <li>This API is used to enable all IRQ and FIQ interrupts in the CPSR.</li>
* </ul>
* @attention
* <ul>
* <li>None.</li>
* </ul>
*
* @param None.
*
* @retval CPSR value obtained after all interrupts are enabled.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see LOS_IntRestore
*/
extern UINTPTR LOS_IntUnLock(VOID);
/* *
* @ingroup los_hwi
* @brief Disable all interrupts.
*
* @par Description:
* <ul>
* <li>This API is used to disable all IRQ and FIQ interrupts in the CPSR.</li>
* </ul>
* @attention
* <ul>
* <li>None.</li>
* </ul>
*
* @param None.
*
* @retval CPSR value obtained before all interrupts are disabled.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see LOS_IntRestore
*/
extern UINTPTR LOS_IntLock(VOID);
/* *
* @ingroup los_hwi
* @brief Restore interrupts.
*
* @par Description:
* <ul>
* <li>This API is used to restore the CPSR value obtained before all interrupts are disabled.</li>
* </ul>
* @attention
* <ul>
* <li>This API can be called only after all interrupts are disabled, and the input parameter value should be the value returned by calling the all interrupt disabling API.</li>
* </ul>
*
* @param intSave [IN] CPSR value obtained before all interrupts are disabled.
*
* @retval None.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see LOS_IntLock
*/
extern VOID LOS_IntRestore(UINTPTR intSave);
/* *
* @ingroup los_hwi
* @brief Get value from xPSR register.
*
* @par Description:
* <ul>
* <li>This API is used to Get value from xPSR register.</li>
* </ul>
* @attention
* <ul>
* <li>None.</li>
* </ul>
*
* @param cntHi [IN] CpuTick High 4 byte
* @param cntLo [IN] CpuTick Low 4 byte
*
* @retval None.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see LOS_IntRestore
*/
extern VOID LOS_GetCpuCycle(UINT32 *cntHi, UINT32 *cntLo);
#if (LOSCFG_KERNEL_TICKLESS == YES)
/**
* @ingroup los_hwi
* @brief reconfig systick, and clear SysTick_IRQn.
*
* @par Description:
* <ul>
* <li>This API is used to reconfig systick, and clear SysTick_IRQn.</li>
* </ul>
* @attention
* <ul>
* <li>None.</li>
* </ul>
*
* @param cyclesPerTick [IN] Cycles Per Tick
*
* @retval None.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see LOS_IntRestore
*/
extern VOID LOS_SysTickReload(UINT32 cyclesPerTick);
#endif
/**
* @ingroup los_hwi
* @brief Get System cycle count.
*
* @par Description:
* <ul>
* <li>This API is used to Get System cycle count.</li>
* </ul>
* @attention
* <ul>
* <li>None.</li>
* </ul>
*
* @param None.
*
* @retval: The value of the system cycle count.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see LOS_IntRestore
*/
extern VOID LOS_GetCpuCycle(UINT32 *puwCntHi, UINT32 *puwCntLo);
extern VOID LOS_GetSystickCycle(UINT32 *puwCntHi, UINT32 *puwCntLo);
extern UINT32 LOS_SysTickCurrCycleGet(VOID);
/* *
* @ingroup los_hwi
* @brief Delete hardware interrupt.
*
* @par Description:
* This API is used to delete hardware interrupt.
*
* @attention
* <ul>
* <li>The hardware interrupt module is usable only when the configuration item for hardware interrupt tailoring is enabled.</li>
* <li>Hardware interrupt number value range: [OS_USER_HWI_MIN,OS_USER_HWI_MAX]. The value range applicable for a Cortex-A7 platform is [32,95].</li>
* <li>OS_HWI_MAX_NUM specifies the maximum number of interrupts that can be created.</li>
* <li>Before executing an interrupt on a platform, refer to the chip manual of the platform.</li>
* </ul>
*
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a Cortex-A7 platform is [32,95].
*
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
* @retval #LOS_OK 0 : The interrupt is successfully delete.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_HWI_H */

View File

@@ -1,210 +0,0 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_tick_pri.h"
#include "los_base.h"
#include "los_task_pri.h"
#include "los_swtmr.h"
#include "los_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#define TICK_CHECK 0x4000000
#define CYCLE_CHECK 0xFFFFFFFFU
#define SHIFT_32_BIT 32
/* ****************************************************************************
Function : OsTickStart
Description : Configure Tick Interrupt Start
Input : none
output : none
return : LOS_OK - Success , or LOS_ERRNO_TICK_CFG_INVALID - failed
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 OsTickStart(VOID)
{
UINT32 ret;
if ((OS_SYS_CLOCK == 0) ||
(LOSCFG_BASE_CORE_TICK_PER_SECOND == 0) ||
(LOSCFG_BASE_CORE_TICK_PER_SECOND > OS_SYS_CLOCK)) {
return LOS_ERRNO_TICK_CFG_INVALID;
}
#if (OS_HWI_WITH_ARG == YES)
OsSetVector(SysTick_IRQn, (HWI_PROC_FUNC)OsTickHandler, NULL);
#else
OsSetVector(SysTick_IRQn, OsTickHandler);
#endif
g_cyclesPerTick = OS_SYS_CLOCK / LOSCFG_BASE_CORE_TICK_PER_SECOND;
g_ullTickCount = 0;
ret = SysTick_Config(g_cyclesPerTick);
if (ret == 1) {
return LOS_ERRNO_TICK_PER_SEC_TOO_SMALL;
}
return LOS_OK;
}
#if (LOSCFG_KERNEL_TICKLESS == YES)
/* ****************************************************************************
Function : LOS_SysTickReload
Description : reconfig systick, and clear SysTick_IRQn
Input : cyclesPerTick --- cycles Per Tick
output : none
return : none
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID LOS_SysTickReload(UINT32 cyclesPerTick)
{
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
NVIC_ClearPendingIRQ(SysTick_IRQn);
SysTick->LOAD = (UINT32)(cyclesPerTick - 1UL); /* set reload register */
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
}
#endif
/* ****************************************************************************
Function : LOS_SysTickCurrCycleGet
Description : Get System cycle count
Input : none
output : none
return : hwCycle --- the system cycle count
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_SysTickCurrCycleGet(VOID)
{
UINT32 hwCycle;
UINTPTR intSave;
intSave = LOS_IntLock();
hwCycle = SysTick->VAL;
/* tick has come, but may interrupt environment, not counting the Tick interrupt response, to do +1 */
if ((SCB->ICSR & TICK_CHECK) != 0) {
hwCycle = SysTick->VAL;
hwCycle += g_cyclesPerTick;
}
LOS_IntRestore(intSave);
return hwCycle;
}
/* ****************************************************************************
Function : LOS_GetCpuCycle
Description : Get System cycle count
Input : none
output : cntHi --- CpuTick High 4 byte
cntLo --- CpuTick Low 4 byte
return : none
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID LOS_GetCpuCycle(UINT32 *cntHi, UINT32 *cntLo)
{
UINT64 swTick;
UINT64 cycle;
UINT32 hwCycle;
UINTPTR intSave;
intSave = LOS_IntLock();
swTick = g_ullTickCount;
hwCycle = SysTick->VAL;
/* tick has come, but may interrupt environment, not counting the Tick interrupt response, to do +1 */
if ((SCB->ICSR & TICK_CHECK) != 0) {
hwCycle = SysTick->VAL;
swTick++;
}
cycle = (((swTick) * g_cyclesPerTick) + (g_cyclesPerTick - hwCycle));
*cntHi = cycle >> SHIFT_32_BIT;
*cntLo = cycle & CYCLE_CHECK;
LOS_IntRestore(intSave);
return;
}
/* ****************************************************************************
Function : LOS_GetSystickCycle
Description : Get Sys tick cycle count
Input : none
output : cntHi --- SysTick count High 4 byte
cntLo --- SysTick count Low 4 byte
return : none
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID LOS_GetSystickCycle(UINT32 *cntHi, UINT32 *cntLo)
{
UINT64 swTick;
UINT64 cycle;
UINT32 hwCycle;
UINTPTR intSave;
UINT32 systickLoad;
UINT32 systickCur;
intSave = LOS_IntLock();
swTick = g_ullTickCount;
systickLoad = SysTick->LOAD;
systickCur = SysTick->VAL;
if (systickLoad < systickCur) {
LOS_IntRestore(intSave);
return;
}
hwCycle = systickLoad - systickCur;
/* tick has come, but may interrupt environment, not counting the Tick interrupt response, to do +1 */
if ((SCB->ICSR & TICK_CHECK) != 0) {
hwCycle = systickLoad - systickCur;
swTick++;
}
cycle = hwCycle + swTick * systickLoad;
*cntHi = cycle >> SHIFT_32_BIT;
*cntLo = cycle & CYCLE_CHECK;
LOS_IntRestore(intSave);
return;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */

View File

@@ -1,254 +0,0 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_hwi.h"
#include "los_sr.h"
#if (LOSCFG_KERNEL_TICKLESS == YES)
#include "los_tickless_pri.h"
#endif
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/*lint -save -e40 -e522 -e533*/
__weak VOID SysTickHandler(VOID)
{
return;
}
UINT32 g_vuwIntCount = 0;
/*lint -restore*/
#ifdef __ICCARM__
#pragma location = ".data.vector"
#elif defined(__CC_ARM) || defined(__GNUC__)
LITE_OS_SEC_VEC
#endif
HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {
(HWI_PROC_FUNC)0, // [0] Top of Stack
(HWI_PROC_FUNC)Reset_Handler, // [1] reset
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [2] NMI Handler
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [3] Hard Fault Handler
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [4] MPU Fault Handler
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [5] Bus Fault Handler
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [6] Usage Fault Handler
(HWI_PROC_FUNC)0, // [7] Reserved
(HWI_PROC_FUNC)0, // [8] Reserved
(HWI_PROC_FUNC)0, // [9] Reserved
(HWI_PROC_FUNC)0, // [10] Reserved
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [11] SVCall Handler
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [12] Debug Monitor Handler
(HWI_PROC_FUNC)0, // [13] Reserved
(HWI_PROC_FUNC)osPendSV, // [14] PendSV Handler
(HWI_PROC_FUNC)SysTickHandler, // [15] SysTick Handler
};
#if (OS_HWI_WITH_ARG == YES)
HWI_SLAVE_FUNC g_hwiSlaveForm[OS_VECTOR_CNT] = {{ (HWI_PROC_FUNC)0, (HWI_ARG_T)0 }};
#else
HWI_PROC_FUNC g_hwiSlaveForm[OS_VECTOR_CNT] = {0};
#endif
/* ****************************************************************************
Function : OsIntNumGet
Description : Get a interrupt number
Input : None
Output : None
Return : Interrupt Indexes number
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR UINT32 OsIntNumGet(VOID)
{
return __get_IPSR();
}
/* ****************************************************************************
Function : OsHwiDefaultHandler
Description : default handler of the hardware interrupt
Input : None
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID OsHwiDefaultHandler(VOID)
{
UINT32 irqNum = OsIntNumGet();
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
while (1) {}
}
/* ****************************************************************************
Function : OsInterrupt
Description : Hardware interrupt entry function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT VOID OsInterrupt(VOID)
{
UINT32 hwiIndex;
UINT32 intSave;
#if (LOSCFG_KERNEL_RUNSTOP == YES)
SCB->SCR &= (UINT32) ~((UINT32)SCB_SCR_SLEEPDEEP_Msk);
#endif
intSave = LOS_IntLock();
g_vuwIntCount++;
LOS_IntRestore(intSave);
hwiIndex = OsIntNumGet();
#if (LOSCFG_KERNEL_TICKLESS == YES)
osUpdateKernelTickCount(hwiIndex);
#endif
#if (OS_HWI_WITH_ARG == YES)
if (g_hwiSlaveForm[hwiIndex].pfnHandler != 0) {
g_hwiSlaveForm[hwiIndex].pfnHandler((VOID *)g_hwiSlaveForm[hwiIndex].pParm);
}
#else
if (g_hwiSlaveForm[hwiIndex] != 0) {
g_hwiSlaveForm[hwiIndex]();
}
#endif
intSave = LOS_IntLock();
g_vuwIntCount--;
LOS_IntRestore(intSave);
}
/* ****************************************************************************
Function : OsHwiInit
Description : initialization of the hardware interrupt
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID OsHwiInit()
{
UINT32 index;
for (index = OS_SYS_VECTOR_CNT; index < OS_VECTOR_CNT; index++) {
g_hwiForm[index] = (HWI_PROC_FUNC)OsHwiDefaultHandler;
}
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;
#if (__CORTEX_M >= 0x03U) /* only for Cortex-M3 and above */
NVIC_SetPriorityGrouping(OS_NVIC_AIRCR_PRIGROUP);
#endif
return;
}
/* ****************************************************************************
Function : LOS_HwiCreate
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
UINTPTR intSave;
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
if (hwiNum >= OS_HWI_MAX_NUM) {
return OS_ERRNO_HWI_NUM_INVALID;
}
if (g_hwiForm[hwiNum + OS_SYS_VECTOR_CNT] != (HWI_PROC_FUNC)OsHwiDefaultHandler) {
return OS_ERRNO_HWI_ALREADY_CREATED;
}
if (hwiPrio > OS_HWI_PRIO_LOWEST) {
return OS_ERRNO_HWI_PRIO_INVALID;
}
intSave = LOS_IntLock();
#if (OS_HWI_WITH_ARG == YES)
OsSetVector(hwiNum, handler, arg);
#else
OsSetVector(hwiNum, handler);
#endif
NVIC_EnableIRQ((IRQn_Type)hwiNum);
NVIC_SetPriority((IRQn_Type)hwiNum, hwiPrio);
LOS_IntRestore(intSave);
return LOS_OK;
}
/* ****************************************************************************
Function : LOS_HwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum)
{
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {
return OS_ERRNO_HWI_NUM_INVALID;
}
NVIC_DisableIRQ((IRQn_Type)hwiNum);
intSave = LOS_IntLock();
g_hwiForm[hwiNum + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)OsHwiDefaultHandler;
LOS_IntRestore(intSave);
return LOS_OK;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -0,0 +1,153 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_ATOMIC_H
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
STATIC INLINE VOID ArchAtomicInc(Atomic *v)
{
(VOID)ArchAtomicAdd(v, 1);
}
STATIC INLINE VOID ArchAtomicDec(Atomic *v)
{
(VOID)ArchAtomicSub(v, 1);
}
STATIC INLINE INT32 ArchAtomicIncRet(Atomic *v)
{
return ArchAtomicAdd(v, 1);
}
STATIC INLINE INT32 ArchAtomicDecRet(Atomic *v)
{
return ArchAtomicSub(v, 1);
}
STATIC INLINE VOID ArchAtomic64Set(Atomic64 *v, INT64 setVal)
{
UINT32 intSave;
intSave = LOS_IntLock();
*v = setVal;
LOS_IntRestore(intSave);
}
STATIC INLINE INT64 ArchAtomic64Add(Atomic64 *v, INT64 addVal)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v += addVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE INT64 ArchAtomic64Sub(Atomic64 *v, INT64 subVal)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v -= subVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE VOID ArchAtomic64Inc(Atomic64 *v)
{
(VOID)ArchAtomic64Add(v, 1);
}
STATIC INLINE INT64 ArchAtomic64IncRet(Atomic64 *v)
{
return ArchAtomic64Add(v, 1);
}
STATIC INLINE VOID ArchAtomic64Dec(Atomic64 *v)
{
(VOID)ArchAtomic64Sub(v, 1);
}
STATIC INLINE INT64 ArchAtomic64DecRet(Atomic64 *v)
{
return ArchAtomic64Sub(v, 1);
}
STATIC INLINE INT64 ArchAtomicXchg64bits(Atomic64 *v, INT64 val)
{
INT64 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
*v = val;
LOS_IntRestore(intSave);
return prevVal;
}
STATIC INLINE BOOL ArchAtomicCmpXchg64bits(Atomic64 *v, INT64 val, INT64 oldVal)
{
INT64 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
if (prevVal == oldVal) {
*v = val;
}
LOS_IntRestore(intSave);
return prevVal != oldVal;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_ATOMIC_H */

View File

@@ -0,0 +1,130 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_CONTEXT_H
#define _LOS_ARCH_CONTEXT_H
#include "los_config.h"
#include "los_compiler.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
typedef struct TagTskContext {
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
UINT32 S16;
UINT32 S17;
UINT32 S18;
UINT32 S19;
UINT32 S20;
UINT32 S21;
UINT32 S22;
UINT32 S23;
UINT32 S24;
UINT32 S25;
UINT32 S26;
UINT32 S27;
UINT32 S28;
UINT32 S29;
UINT32 S30;
UINT32 S31;
#endif
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
UINT32 uwR0;
UINT32 uwR1;
UINT32 uwR2;
UINT32 uwR3;
UINT32 uwR12;
UINT32 uwLR;
UINT32 uwPC;
UINT32 uwxPSR;
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
UINT32 S0;
UINT32 S1;
UINT32 S2;
UINT32 S3;
UINT32 S4;
UINT32 S5;
UINT32 S6;
UINT32 S7;
UINT32 S8;
UINT32 S9;
UINT32 S10;
UINT32 S11;
UINT32 S12;
UINT32 S13;
UINT32 S14;
UINT32 S15;
UINT32 FPSCR;
UINT32 NO_NAME;
#endif
} TaskContext;
/**
* @ingroup los_config
* @brief: Task start running function.
*
* @par Description:
* This API is used to start a task.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param: None.
*
* @retval None.
*
* @par Dependency:
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalStartToRun(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_CONTEXT_H */

View File

@@ -0,0 +1,624 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_INTERRUPT_H
#define _LOS_ARCH_INTERRUPT_H
#include "los_config.h"
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* *
* @ingroup los_arch_interrupt
* Highest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_HIGHEST
#define OS_HWI_PRIO_HIGHEST 0
#endif
/* *
* @ingroup los_arch_interrupt
* Lowest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_LOWEST
#define OS_HWI_PRIO_LOWEST 7
#endif
/* *
* @ingroup los_arch_interrupt
* Count of M-Core system interrupt vector.
*/
#define OS_SYS_VECTOR_CNT 16
/* *
* @ingroup los_arch_interrupt
* Count of M-Core interrupt vector.
*/
#define OS_VECTOR_CNT (OS_SYS_VECTOR_CNT + OS_HWI_MAX_NUM)
/* *
* @ingroup los_arch_interrupt
* AIRCR register priority group parameter .
*/
#define OS_NVIC_AIRCR_PRIGROUP 7
/* *
* @ingroup los_arch_interrupt
* Boot interrupt vector table.
*/
extern UINT32 _BootVectors[];
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt number.
*
* Value: 0x02000900
*
* Solution: Ensure that the interrupt number is valid.
* The value range of the interrupt number applicable for a Cortex-M3 platform is [OS_USER_HWI_MIN,OS_USER_HWI_MAX].
*/
#define OS_ERRNO_HWI_NUM_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x00)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Null hardware interrupt handling function.
*
* Value: 0x02000901
*
* Solution: Pass in a valid non-null hardware interrupt handling function.
*/
#define OS_ERRNO_HWI_PROC_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x01)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Insufficient interrupt resources for hardware interrupt creation.
*
* Value: 0x02000902
*
* Solution: Increase the configured maximum number of supported hardware interrupts.
*/
#define OS_ERRNO_HWI_CB_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x02)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Insufficient memory for hardware interrupt initialization.
*
* Value: 0x02000903
*
* Solution: Expand the configured memory.
*/
#define OS_ERRNO_HWI_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x03)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: The interrupt has already been created.
*
* Value: 0x02000904
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x04)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt priority.
*
* Value: 0x02000905
*
* Solution: Ensure that the interrupt priority is valid.
* The value range of the interrupt priority applicable for a Cortex-M3 platform is [0,15].
*/
#define OS_ERRNO_HWI_PRIO_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x05)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Incorrect interrupt creation mode.
*
* Value: 0x02000906
*
* Solution: The interrupt creation mode can be only set to OS_HWI_MODE_COMM or
* OS_HWI_MODE_FAST of which the value can be 0 or 1.
*/
#define OS_ERRNO_HWI_MODE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x06)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: The interrupt has already been created as a fast interrupt.
*
* Value: 0x02000907
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_FASTMODE_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x07)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt operation function.
*
* Value: 0x0200090c
*
* Solution: Set a valid interrupt operation function
*/
#define OS_ERRNO_HWI_OPS_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x0c)
/* *
* @ingroup los_arch_interrupt
* SysTick control and status register.
*/
#define OS_SYSTICK_CONTROL_REG 0xE000E010
/* *
* @ingroup los_hw
* SysTick current value register.
*/
#define OS_SYSTICK_CURRENT_REG 0xE000E018
/* *
* @ingroup los_arch_interrupt
* Interrupt Priority-Level Registers.
*/
#define OS_NVIC_PRI_BASE 0xE000E400
/* *
* @ingroup los_arch_interrupt
* Interrupt enable register for 0-31.
*/
#define OS_NVIC_SETENA_BASE 0xE000E100
/* *
* @ingroup los_arch_interrupt
* interrupt pending register.
*/
#define OS_NVIC_SETPEND_BASE 0xE000E200
/* *
* @ingroup los_arch_interrupt
* Interrupt active register.
*/
#define OS_NVIC_INT_ACT_BASE 0xE000E300
/* *
* @ingroup los_arch_interrupt
* Interrupt disable register for 0-31.
*/
#define OS_NVIC_CLRENA_BASE 0xE000E180
/* *
* @ingroup los_arch_interrupt
* Interrupt control and status register.
*/
#define OS_NVIC_INT_CTRL 0xE000ED04
/* *
* @ingroup los_arch_interrupt
* Vector table offset register.
*/
#define OS_NVIC_VTOR 0xE000ED08
/* *
* @ingroup los_arch_interrupt
* Application interrupt and reset control register
*/
#define OS_NVIC_AIRCR 0xE000ED0C
/* *
* @ingroup los_arch_interrupt
* System exception priority register.
*/
#define OS_NVIC_EXCPRI_BASE 0xE000ED18
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 1 :reset.
*/
#define OS_EXC_RESET 1
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 2 :Non-Maskable Interrupt.
*/
#define OS_EXC_NMI 2
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 3 :(hard)fault.
*/
#define OS_EXC_HARD_FAULT 3
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 4 :MemManage fault.
*/
#define OS_EXC_MPU_FAULT 4
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 5 :Bus fault.
*/
#define OS_EXC_BUS_FAULT 5
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 6 :Usage fault.
*/
#define OS_EXC_USAGE_FAULT 6
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 11 :SVCall.
*/
#define OS_EXC_SVC_CALL 11
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 12 :Debug monitor.
*/
#define OS_EXC_DBG_MONITOR 12
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 14 :PendSV.
*/
#define OS_EXC_PEND_SV 14
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 15 :SysTick.
*/
#define OS_EXC_SYS_TICK 15
/* *
* @ingroup los_arch_interrupt
* @brief: Hardware interrupt entry function.
*
* @par Description:
* This API is used as all hardware interrupt handling function entry.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalInterrupt(VOID);
/* *
* @ingroup los_arch_interrupt
* @brief: Reset the vector table.
*
* @par Description:
* This API is used to reset the vector table.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID Reset_Handler(VOID);
/* *
* @ingroup los_arch_interrupt
* @brief: Pended System Call.
*
* @par Description:
* PendSV can be pended and is useful for an OS to pend an exception
* so that an action can be performed after other important tasks are completed.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalPendSV(VOID);
#define OS_EXC_MAX_BUF_LEN 25
#define OS_EXC_MAX_NEST_DEPTH 1
#define OS_EXC_FLAG_NO_FLOAT 0x10000000
#define OS_NVIC_SHCSR 0xE000ED24
#define OS_NVIC_CCR 0xE000ED14
#define OS_NVIC_INT_ENABLE_SIZE 0x20
#define OS_NVIC_INT_PRI_SIZE 0xF0
#define OS_NVIC_EXCPRI_SIZE 0xC
#define OS_NVIC_INT_CTRL_SIZE 4
#define OS_NVIC_SHCSR_SIZE 4
#define OS_NVIC_INT_PEND_SIZE OS_NVIC_INT_ACT_SIZE
#define OS_NVIC_INT_ACT_SIZE OS_NVIC_INT_ENABLE_SIZE
/**
* @ingroup los_exc
* the struct of register files
*
* description: the register files that saved when exception triggered
*
* notes:the following register with prefix 'uw' correspond to the registers in the cpu data sheet.
*/
typedef struct TagExcContext {
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
UINT32 S16;
UINT32 S17;
UINT32 S18;
UINT32 S19;
UINT32 S20;
UINT32 S21;
UINT32 S22;
UINT32 S23;
UINT32 S24;
UINT32 S25;
UINT32 S26;
UINT32 S27;
UINT32 S28;
UINT32 S29;
UINT32 S30;
UINT32 S31;
#endif
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
/* auto save */
UINT32 uwSP;
UINT32 uwR0;
UINT32 uwR1;
UINT32 uwR2;
UINT32 uwR3;
UINT32 uwR12;
UINT32 uwLR;
UINT32 uwPC;
UINT32 uwxPSR;
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED) && (__FPU_USED== 1U)))
UINT32 S0;
UINT32 S1;
UINT32 S2;
UINT32 S3;
UINT32 S4;
UINT32 S5;
UINT32 S6;
UINT32 S7;
UINT32 S8;
UINT32 S9;
UINT32 S10;
UINT32 S11;
UINT32 S12;
UINT32 S13;
UINT32 S14;
UINT32 S15;
UINT32 FPSCR;
UINT32 NO_NAME;
#endif
} EXC_CONTEXT_S;
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
VOID HalExcNMI(VOID);
VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID);
VOID HalExcSvcCall(VOID);
VOID HalHwiInit(VOID);
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the bus status register was being pushed.
*/
#define OS_EXC_BF_STKERR 1
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the bus status register was out of the stack.
*/
#define OS_EXC_BF_UNSTKERR 2
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register imprecise data access violation.
*/
#define OS_EXC_BF_IMPRECISERR 3
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register exact data access violation.
*/
#define OS_EXC_BF_PRECISERR 4
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register access violation while pointing.
*/
#define OS_EXC_BF_IBUSERR 5
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the memory management status register was being pushed.
*/
#define OS_EXC_MF_MSTKERR 6
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the memory management status register was out of the stack.
*/
#define OS_EXC_MF_MUNSTKERR 7
/**
* @ingroup los_exc
* Cortex-M exception types: Memory management status register data access violation.
*/
#define OS_EXC_MF_DACCVIOL 8
/**
* @ingroup los_exc
* Cortex-M exception types: Memory management status register access violation.
*/
#define OS_EXC_MF_IACCVIOL 9
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage indicating that the divisor is zero during the division operation.
*/
#define OS_EXC_UF_DIVBYZERO 10
/**
* @ingroup los_exc
* Cortex-M exception types: Usage error, error caused by unaligned access.
*/
#define OS_EXC_UF_UNALIGNED 11
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage attempting to execute coprocessor related instruction.
*/
#define OS_EXC_UF_NOCP 12
/**
* @ingroup los_exc
* Cortex-M exception types: Usage error attempting to load EXC_RETURN to PC illegally on exception return.
*/
#define OS_EXC_UF_INVPC 13
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage, attempting to cut to ARM state.
*/
#define OS_EXC_UF_INVSTATE 14
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage. Executed instruction whose code is undefined.
*/
#define OS_EXC_UF_UNDEFINSTR 15
/**
* @ingroup los_exc
* Cortex-M exception types: NMI
*/
#define OS_EXC_CAUSE_NMI 16
/**
* @ingroup los_exc
* Cortex-M exception types: hard fault
*/
#define OS_EXC_CAUSE_HARDFAULT 17
/**
* @ingroup los_exc
* Cortex-M exception types: The task handler exits.
*/
#define OS_EXC_CAUSE_TASK_EXIT 18
/**
* @ingroup los_exc
* Cortex-M exception types: A fatal error.
*/
#define OS_EXC_CAUSE_FATAL_ERR 19
/**
* @ingroup los_exc
* Cortex-M exception types: Hard Fault caused by a debug event.
*/
#define OS_EXC_CAUSE_DEBUGEVT 20
/**
* @ingroup los_exc
* Cortex-M exception types: A hard fault that occurs when a quantity is oriented.
*/
#define OS_EXC_CAUSE_VECTBL 21
/**
* @ingroup los_exc
* Exception information structure
*
* Description: Exception information saved when an exception is triggered on the Cortex-M3 platform.
*
*/
typedef struct TagExcInfo {
/**< Exception occurrence phase: 0 means that an exception occurs in initialization,
* 1 means that an exception occurs in a task, and 2 means that an exception occurs in an interrupt */
UINT16 phase;
/**< Exception type. When exceptions occur, check the numbers 1 - 21 listed above */
UINT16 type;
/**< If the exact address access error indicates the wrong access address when the exception occurred */
UINT32 faultAddr;
/**< An exception occurs in an interrupt, indicating the interrupt number.
* An exception occurs in the task, indicating the task ID, or 0xFFFFFFFF if it occurs during initialization */
UINT32 thrdPid;
/**< Number of nested exceptions. Currently only registered hook functions are supported
* when an exception is entered for the first time */
UINT16 nestCnt;
/**< reserve */
UINT16 reserved;
/**< Hardware context at the time an exception to the automatic stack floating-point register occurs */
EXC_CONTEXT_S *context;
} ExcInfo;
extern UINT32 g_curNestCount;
extern UINT8 g_uwExcTbl[32];
extern ExcInfo g_excInfo;
#define MAX_INT_INFO_SIZE (8 + 0x164)
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_INTERRUPT_H */

View File

@@ -0,0 +1,51 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_TIMER_H
#define _LOS_ARCH_TIMER_H
#include "los_config.h"
#include "los_compiler.h"
#include "los_timer.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_TIMER_H */

View File

@@ -0,0 +1,98 @@
;
; Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this list of
; conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice, this list
; of conditions and the following disclaimer in the documentation and/or other materials
; provided with the distribution.
;
; 3. Neither the name of the copyright holder nor the names of its contributors may be used
; to endorse or promote products derived from this software without specific prior written
; permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
; ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
EXPORT ArchAtomicRead
EXPORT ArchAtomicSet
EXPORT ArchAtomicAdd
EXPORT ArchAtomicSub
EXPORT ArchAtomicXchg32bits
EXPORT ArchAtomicCmpXchg32bits
PRESERVE8
AREA |.text|, CODE, READONLY
THUMB
EXPORT ArchAtomicRead
EXPORT ArchAtomicSet
EXPORT ArchAtomicAdd
EXPORT ArchAtomicSub
EXPORT ArchAtomicXchg32bits
EXPORT ArchAtomicCmpXchg32bits
PRESERVE8
AREA |.text|, CODE, READONLY
THUMB
ArchAtomicRead
ldrex r1, [r0]
mov r0, r1
bx lr
ArchAtomicSet
ldrex r2, [r0]
strex r3, r1, [r0]
teq r3, #0
bne ArchAtomicSet
bx lr
ArchAtomicAdd
ldrex r2, [r0]
add r2, r2, r1
strex r3, r2, [r0]
teq r3, #0
bne ArchAtomicAdd
mov r0, r2
bx lr
ArchAtomicSub
ldrex r2, [r0]
sub r2, r2, r1
strex r3, r2, [r0]
teq r3, #0
bne ArchAtomicSub
mov r0, r2
bx lr
ArchAtomicXchg32bits
ldrex r2, [r0]
strex r3, r1, [r0]
teq r3, #0
bne ArchAtomicXchg32bits
mov r0, r2
ArchAtomicCmpXchg32bits
ldrex r3, [r0]
cmp r3, r2
bne end
strex r4, r1, [r0]
teq r4, #0
bne ArchAtomicCmpXchg32bits
end

View File

@@ -0,0 +1,146 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_context.h"
#include "securec.h"
#include "ARMCM3.h"
#include "los_arch_context.h"
#include "los_arch_interrupt.h"
#include "los_task.h"
#include "los_sched.h"
#include "los_interrupt.h"
#include "los_debug.h"
/* ****************************************************************************
Function : ArchInit
Description : arch init function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
{
HalHwiInit();
}
/* ****************************************************************************
Function : ArchSysExit
Description : Task exit function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
(VOID)LOS_IntLock();
while (1) {
}
}
/* ****************************************************************************
Function : ArchTskStackInit
Description : Task stack initialization function
Input : taskID --- TaskID
stackSize --- Total size of the stack
topStack --- Top of task's stack
Output : None
Return : Context pointer
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID *ArchTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
{
TaskContext *context = (TaskContext *)((UINTPTR)topStack + stackSize - sizeof(TaskContext));
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
context->S16 = 0xAA000010;
context->S17 = 0xAA000011;
context->S18 = 0xAA000012;
context->S19 = 0xAA000013;
context->S20 = 0xAA000014;
context->S21 = 0xAA000015;
context->S22 = 0xAA000016;
context->S23 = 0xAA000017;
context->S24 = 0xAA000018;
context->S25 = 0xAA000019;
context->S26 = 0xAA00001A;
context->S27 = 0xAA00001B;
context->S28 = 0xAA00001C;
context->S29 = 0xAA00001D;
context->S30 = 0xAA00001E;
context->S31 = 0xAA00001F;
context->S0 = 0xAA000000;
context->S1 = 0xAA000001;
context->S2 = 0xAA000002;
context->S3 = 0xAA000003;
context->S4 = 0xAA000004;
context->S5 = 0xAA000005;
context->S6 = 0xAA000006;
context->S7 = 0xAA000007;
context->S8 = 0xAA000008;
context->S9 = 0xAA000009;
context->S10 = 0xAA00000A;
context->S11 = 0xAA00000B;
context->S12 = 0xAA00000C;
context->S13 = 0xAA00000D;
context->S14 = 0xAA00000E;
context->S15 = 0xAA00000F;
context->FPSCR = 0x00000000;
context->NO_NAME = 0xAA000011;
#endif
context->uwR4 = 0x04040404L;
context->uwR5 = 0x05050505L;
context->uwR6 = 0x06060606L;
context->uwR7 = 0x07070707L;
context->uwR8 = 0x08080808L;
context->uwR9 = 0x09090909L;
context->uwR10 = 0x10101010L;
context->uwR11 = 0x11111111L;
context->uwPriMask = 0;
context->uwR0 = taskID;
context->uwR1 = 0x01010101L;
context->uwR2 = 0x02020202L;
context->uwR3 = 0x03030303L;
context->uwR12 = 0x12121212L;
context->uwLR = (UINT32)(UINTPTR)ArchSysExit;
context->uwPC = (UINT32)(UINTPTR)OsTaskEntry;
context->uwxPSR = 0x01000000L;
return (VOID *)context;
}
LITE_OS_SEC_TEXT_INIT UINT32 ArchStartSchedule(VOID)
{
(VOID)LOS_IntLock();
OsSchedStart();
HalStartToRun();
return LOS_OK; /* never return */
}

View File

@@ -1,162 +1,138 @@
;
; Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
; Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this list of
; conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice, this list
; of conditions and the following disclaimer in the documentation and/or other materials
; provided with the distribution.
;
; 3. Neither the name of the copyright holder nor the names of its contributors may be used
; to endorse or promote products derived from this software without specific prior written
; permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
; ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
PRESERVE8
EXPORT LOS_IntLock
EXPORT LOS_IntUnLock
EXPORT LOS_IntRestore
EXPORT LOS_StartToRun
EXPORT osTaskSchedule
EXPORT osPendSV
IMPORT g_losTask
IMPORT g_taskSwitchHook
IMPORT g_taskScheduled
OS_NVIC_INT_CTRL EQU 0xE000ED04
OS_NVIC_SYSPRI2 EQU 0xE000ED20
OS_NVIC_PENDSV_PRI EQU 0xF0F00000
OS_NVIC_PENDSVSET EQU 0x10000000
OS_TASK_STATUS_RUNNING EQU 0x0010
SECTION .text:CODE(2)
THUMB
REQUIRE8
LOS_StartToRun
LDR R4, =OS_NVIC_SYSPRI2
LDR R5, =OS_NVIC_PENDSV_PRI
STR R5, [R4]
LDR R0, =g_taskScheduled
MOV R1, #1
STR R1, [R0]
MOV R0, #2
MSR CONTROL, R0
LDR R0, =g_losTask
LDR R2, [R0, #4]
LDR R0, =g_losTask
STR R2, [R0]
LDR R3, =g_losTask
LDR R0, [R3]
LDRH R7, [R0 , #4]
MOV R8, #OS_TASK_STATUS_RUNNING
ORR R7, R7, R8
STRH R7, [R0 , #4]
LDR R12, [R0]
ADD R12, R12, #100
LDMFD R12!, {R0-R7}
ADD R12, R12, #72
MSR PSP, R12
VPUSH S0;
VPOP S0;
MOV LR, R5
;MSR xPSR, R7
CPSIE I
BX R6
LOS_IntLock
MRS R0, PRIMASK
CPSID I
BX LR
LOS_IntUnLock
MRS R0, PRIMASK
CPSIE I
BX LR
LOS_IntRestore
MSR PRIMASK, R0
BX LR
osTaskSchedule
LDR R0, =OS_NVIC_INT_CTRL
LDR R1, =OS_NVIC_PENDSVSET
STR R1, [R0]
BX LR
osPendSV
MRS R12, PRIMASK
CPSID I
LDR R2, =g_taskSwitchHook
LDR R2, [R2]
CBZ R2, TaskSwitch
PUSH {R12, LR}
BLX R2
POP {R12, LR}
TaskSwitch
MRS R0, PSP
STMFD R0!, {R4-R12}
VSTMDB R0!, {D8-D15}
LDR R5, =g_losTask
LDR R6, [R5]
STR R0, [R6]
LDRH R7, [R6 , #4]
MOV R8,#OS_TASK_STATUS_RUNNING
BIC R7, R7, R8
STRH R7, [R6 , #4]
LDR R0, =g_losTask
LDR R0, [R0, #4]
STR R0, [R5]
LDRH R7, [R0 , #4]
MOV R8, #OS_TASK_STATUS_RUNNING
ORR R7, R7, R8
STRH R7, [R0 , #4]
LDR R1, [R0]
VLDMIA R1!, {D8-D15}
LDMFD R1!, {R4-R12}
MSR PSP, R1
MSR PRIMASK, R12
BX LR
END
;
; Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
; Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this list of
; conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice, this list
; of conditions and the following disclaimer in the documentation and/or other materials
; provided with the distribution.
;
; 3. Neither the name of the copyright holder nor the names of its contributors may be used
; to endorse or promote products derived from this software without specific prior written
; permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
; ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
PRESERVE8
EXPORT ArchIntLock
EXPORT ArchIntUnLock
EXPORT ArchIntRestore
EXPORT HalStartToRun
EXPORT ArchTaskSchedule
EXPORT HalPendSV
IMPORT OsSchedTaskSwitch
IMPORT g_losTask
OS_NVIC_INT_CTRL EQU 0xE000ED04
OS_NVIC_SYSPRI2 EQU 0xE000ED20
OS_NVIC_PENDSV_PRI EQU 0xF0F00000
OS_NVIC_PENDSVSET EQU 0x10000000
OS_TASK_STATUS_RUNNING EQU 0x0010
AREA |.text|, CODE, READONLY
THUMB
REQUIRE8
HalStartToRun
LDR R4, =OS_NVIC_SYSPRI2
LDR R5, =OS_NVIC_PENDSV_PRI
STR R5, [R4]
MOV R0, #2
MSR CONTROL, R0
LDR R1, =g_losTask
LDR R0, [R1, #4]
LDR R12, [R0]
;ADD R12, R12, #100
ADD R12, R12, #36
LDMFD R12!, {R0-R7}
;ADD R12, R12, #72
MSR PSP, R12
;VPUSH S0;
;VPOP S0;
MOV LR, R5
;MSR xPSR, R7
CPSIE I
BX R6
ArchIntLock
MRS R0, PRIMASK
CPSID I
BX LR
ArchIntUnLock
MRS R0, PRIMASK
CPSIE I
BX LR
ArchIntRestore
MSR PRIMASK, R0
BX LR
ArchTaskSchedule
LDR R0, =OS_NVIC_INT_CTRL
LDR R1, =OS_NVIC_PENDSVSET
STR R1, [R0]
DSB
ISB
BX LR
HalPendSV
MRS R12, PRIMASK
CPSID I
HalTaskSwitch
PUSH {R12, LR}
BL OsSchedTaskSwitch
POP {R12, LR}
CMP R0, #0
MOV R0, LR
BNE TaskContextSwitch
MSR PRIMASK, R12
BX LR
TaskContextSwitch
MOV LR, R0
MRS R0, PSP
STMFD R0!, {R4-R12}
;VSTMDB R0!, {D8-D15}
LDR R5, =g_losTask
LDR R6, [R5]
STR R0, [R6]
LDR R0, [R5, #4]
STR R0, [R5]
LDR R1, [R0]
;VLDMIA R1!, {D8-D15}
LDMFD R1!, {R4-R12}
MSR PSP, R1
MSR PRIMASK, R12
BX LR
END

View File

@@ -0,0 +1,285 @@
;
; Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
; Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this list of
; conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice, this list
; of conditions and the following disclaimer in the documentation and/or other materials
; provided with the distribution.
;
; 3. Neither the name of the copyright holder nor the names of its contributors may be used
; to endorse or promote products derived from this software without specific prior written
; permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
; ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
PRESERVE8
AREA |.text|, CODE, READONLY
THUMB
EXPORT HalExcNMI
EXPORT HalExcHardFault
EXPORT HalExcMemFault
EXPORT HalExcBusFault
EXPORT HalExcUsageFault
EXPORT HalExcSvcCall
IMPORT HalExcHandleEntry
IMPORT g_uwExcTbl
IMPORT g_taskScheduled
OS_FLG_BGD_ACTIVE EQU 0x0002
OS_EXC_CAUSE_NMI EQU 16
OS_EXC_CAUSE_HARDFAULT EQU 17
HF_DEBUGEVT EQU 20
HF_VECTBL EQU 21
FLAG_ADDR_VALID EQU 0x10000
FLAG_HWI_ACTIVE EQU 0x20000
FLAG_NO_FLOAT EQU 0x10000000
OS_NVIC_FSR EQU 0xE000ED28 ;include BusFault/MemFault/UsageFault State Register
OS_NVIC_HFSR EQU 0xE000ED2C ;HardFault State Register
OS_NVIC_BFAR EQU 0xE000ED38
OS_NVIC_MMAR EQU 0xE000ED34
OS_NVIC_ACT_BASE EQU 0xE000E300
OS_NVIC_SHCSRS EQU 0xE000ED24
OS_NVIC_SHCSR_MASK EQU 0xC00
HalExcNMI
MOV R0, #OS_EXC_CAUSE_NMI
MOV R1, #0
B osExcDispatch
HalExcHardFault
MOV R0, #OS_EXC_CAUSE_HARDFAULT
LDR R2, =OS_NVIC_HFSR
LDR R2, [R2]
MOV R1, #HF_DEBUGEVT
ORR R0, R0, R1, LSL #0x8
TST R2, #0x80000000
BNE osExcDispatch ; DEBUGEVT
AND R0, R0 , #0x000000FF
MOV R1, #HF_VECTBL
ORR R0, R0, R1, LSL #0x8
TST R2, #0x00000002
BNE osExcDispatch ; VECTBL
;if not DEBUGEVT and VECTBL then is FORCED
AND R0, R0, #0x000000FF
LDR R2, =OS_NVIC_FSR
LDR R2, [R2]
TST R2, #0x8000 ; BFARVALID
BNE _HFBusFault ; BusFault
TST R2, #0x80 ; MMARVALID
BNE _HFMemFault ; MemFault
MOV R12,#0
B osHFExcCommonBMU
_HFBusFault
LDR R1, =OS_NVIC_BFAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
B osHFExcCommonBMU
_HFMemFault
LDR R1, =OS_NVIC_MMAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
osHFExcCommonBMU
CLZ R2, R2
LDR R3, =g_uwExcTbl
ADD R3, R3, R2
LDRB R2, [R3]
ORR R0, R0, R2, LSL #0x8
ORR R0, R0 ,R12
B osExcDispatch
HalExcSvcCall
TST LR, #0x4
ITE EQ
MRSEQ R0, MSP
MRSNE R0, PSP
LDR R1, [R0,#24]
LDRB R0, [R1,#-2]
MOV R1, #0
B osExcDispatch
HalExcBusFault
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
TST R0, #0x8000 ; BFARVALID
BEQ _ExcBusNoADDR
LDR R1, =OS_NVIC_BFAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
AND R0, R0, #0x1F00
B osExcCommonBMU
_ExcBusNoADDR
MOV R12,#0
B osExcCommonBMU
HalExcMemFault
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
TST R0, #0x80 ; MMARVALID
BEQ _ExcMemNoADDR
LDR R1, =OS_NVIC_MMAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
AND R0, R0, #0x1B
B osExcCommonBMU
_ExcMemNoADDR
MOV R12,#0
B osExcCommonBMU
HalExcUsageFault
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
MOV R1, #0x030F
LSL R1, R1, #16
AND R0, R0, R1
MOV R12, #0
osExcCommonBMU
CLZ R0, R0
LDR R3, =g_uwExcTbl
ADD R3, R3, R0
LDRB R0, [R3]
ORR R0, R0, R12
; R0 -- EXCCAUSE(bit 16 is 1 if EXCADDR valid), R1 -- EXCADDR
osExcDispatch
LDR R2, =OS_NVIC_ACT_BASE
MOV R12, #8 ; R12 is hwi check loop counter
_hwiActiveCheck
LDR R3, [R2] ; R3 store active hwi register when exc
CMP R3, #0
BEQ _hwiActiveCheckNext
; exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
AND R12, R12, #1
ADD R2, R2, R12, LSL #5 ; calculate R2 (hwi number) as pid
_ExcInMSP
CMP LR, #0xFFFFFFE9
BNE _NoFloatInMsp
ADD R3, R13, #104
PUSH {R3}
MRS R12, PRIMASK ; store message-->exc: disable int?
PUSH {R4-R12} ; store message-->exc: {R4-R12}
;VPUSH {D8-D15}
B _handleEntry
_NoFloatInMsp
ADD R3, R13, #32
PUSH {R3} ; save IRQ SP ; store message-->exc: MSP(R13)
MRS R12, PRIMASK ; store message-->exc: disable int?
PUSH {R4-R12} ; store message-->exc: {R4-R12}
ORR R0, R0, #FLAG_NO_FLOAT
B _handleEntry
_hwiActiveCheckNext
ADD R2, R2, #4 ; next NVIC ACT ADDR
SUBS R12, R12, #1
BNE _hwiActiveCheck
;/*NMI interrupt excption*/
LDR R2, =OS_NVIC_SHCSRS
LDRH R2,[R2]
LDR R3,=OS_NVIC_SHCSR_MASK
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
; exc occurred in Task or Init or exc
; reserved for register info from task stack
LDR R2, =g_taskScheduled
LDR R2, [R2]
TST R2, #1 ; OS_FLG_BGD_ACTIVE
BEQ _ExcInMSP ; if exc occurred in Init then branch
CMP LR, #0xFFFFFFED ;auto push floating registers
BNE _NoFloatInPsp
; exc occurred in Task
MOV R2, R13
SUB R13, #96 ; add 8 Bytes reg(for STMFD)
MRS R3, PSP
ADD R12, R3, #104
PUSH {R12} ; save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
;VPUSH {D8-D15}
; copy auto saved task register
LDMFD R3!, {R4-R11} ; R4-R11 store PSP reg(auto push when exc in task)
;VLDMIA R3!, {D8-D15}
;VSTMDB R2!, {D8-D15}
STMFD R2!, {R4-R11}
B _handleEntry
_NoFloatInPsp
MOV R2, R13 ;no auto push floating registers
SUB R13, #32 ; add 8 Bytes reg(for STMFD)
MRS R3, PSP
ADD R12, R3, #32
PUSH {R12} ; save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
LDMFD R3, {R4-R11} ; R4-R11 store PSP reg(auto push when exc in task)
STMFD R2!, {R4-R11}
ORR R0, R0, #FLAG_NO_FLOAT
_handleEntry
MOV R3, R13 ; R13:the 4th param
CPSID I
CPSID F
B HalExcHandleEntry
NOP
END

View File

@@ -0,0 +1,436 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdarg.h>
#include "securec.h"
#include "los_context.h"
#include "los_arch_interrupt.h"
#include "los_hook.h"
#include "los_task.h"
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
/* ****************************************************************************
Function : HwiNumGet
Description : Get an interrupt number
Input : None
Output : None
Return : Interrupt Indexes number
**************************************************************************** */
STATIC UINT32 HwiNumGet(VOID)
{
return __get_IPSR();
}
STATIC UINT32 HwiUnmask(HWI_HANDLE_T hwiNum)
{
NVIC_EnableIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiMask(HWI_HANDLE_T hwiNum)
{
NVIC_DisableIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiSetPriority(HWI_HANDLE_T hwiNum, UINT8 priority)
{
NVIC_SetPriority((IRQn_Type)hwiNum, priority);
return LOS_OK;
}
STATIC UINT32 HwiPending(HWI_HANDLE_T hwiNum)
{
NVIC_SetPendingIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiClear(HWI_HANDLE_T hwiNum)
{
NVIC_ClearPendingIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiCreate(HWI_HANDLE_T hwiNum, HWI_PRIOR_T hwiPrio)
{
HwiSetPriority(hwiNum, hwiPrio);
HwiUnmask(hwiNum);
return LOS_OK;
}
STATIC HwiControllerOps g_archHwiOps = {
.enableIrq = HwiUnmask,
.disableIrq = HwiMask,
.setIrqPriority = HwiSetPriority,
.getCurIrqNum = HwiNumGet,
.triggerIrq = HwiPending,
.clearIrq = HwiClear,
.createIrq = HwiCreate,
};
HwiControllerOps *ArchIntOpsGet(VOID)
{
return &g_archHwiOps;
}
/* ****************************************************************************
Function : HalInterrupt
Description : Hardware interrupt entry function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
{
UINT32 hwiIndex;
UINT32 intSave;
#if (LOSCFG_KERNEL_RUNSTOP == 1)
SCB->SCR &= (UINT32) ~((UINT32)SCB_SCR_SLEEPDEEP_Msk);
#endif
intSave = LOS_IntLock();
g_intCount++;
LOS_IntRestore(intSave);
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (g_hwiHandlerForm[hwiIndex].pfnHandler != 0) {
g_hwiHandlerForm[hwiIndex].pfnHandler((VOID *)g_hwiHandlerForm[hwiIndex].pParm);
}
#else
if (g_hwiHandlerForm[hwiIndex] != 0) {
g_hwiHandlerForm[hwiIndex]();
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
g_intCount--;
LOS_IntRestore(intSave);
}
#define FAULT_STATUS_REG_BIT 32
#define USGFAULT (1 << 18)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define UNALIGNFAULT (1 << 3)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
UINT8 g_uwExcTbl[FAULT_STATUS_REG_BIT] = {
0, 0, 0, 0, 0, 0, OS_EXC_UF_DIVBYZERO, OS_EXC_UF_UNALIGNED,
0, 0, 0, 0, OS_EXC_UF_NOCP, OS_EXC_UF_INVPC, OS_EXC_UF_INVSTATE, OS_EXC_UF_UNDEFINSTR,
0, 0, 0, OS_EXC_BF_STKERR, OS_EXC_BF_UNSTKERR, OS_EXC_BF_IMPRECISERR, OS_EXC_BF_PRECISERR, OS_EXC_BF_IBUSERR,
0, 0, 0, OS_EXC_MF_MSTKERR, OS_EXC_MF_MUNSTKERR, 0, OS_EXC_MF_DACCVIOL, OS_EXC_MF_IACCVIOL
};
#if (LOSCFG_KERNEL_PRINTF != 0)
STATIC VOID OsExcNvicDump(VOID)
{
#define OS_NR_NVIC_EXC_DUMP_TYPES 7
UINT32 *base = NULL;
UINT32 len, i, j;
UINT32 rgNvicBases[OS_NR_NVIC_EXC_DUMP_TYPES] = {
OS_NVIC_SETENA_BASE, OS_NVIC_SETPEND_BASE, OS_NVIC_INT_ACT_BASE,
OS_NVIC_PRI_BASE, OS_NVIC_EXCPRI_BASE, OS_NVIC_SHCSR, OS_NVIC_INT_CTRL
};
UINT32 rgNvicLens[OS_NR_NVIC_EXC_DUMP_TYPES] = {
OS_NVIC_INT_ENABLE_SIZE, OS_NVIC_INT_PEND_SIZE, OS_NVIC_INT_ACT_SIZE,
OS_NVIC_INT_PRI_SIZE, OS_NVIC_EXCPRI_SIZE, OS_NVIC_SHCSR_SIZE,
OS_NVIC_INT_CTRL_SIZE
};
CHAR strRgEnable[] = "enable";
CHAR strRgPending[] = "pending";
CHAR strRgActive[] = "active";
CHAR strRgPriority[] = "priority";
CHAR strRgException[] = "exception";
CHAR strRgShcsr[] = "shcsr";
CHAR strRgIntCtrl[] = "control";
CHAR *strRgs[] = {
strRgEnable, strRgPending, strRgActive, strRgPriority,
strRgException, strRgShcsr, strRgIntCtrl
};
PRINTK("\r\nOS exception NVIC dump:\n");
for (i = 0; i < OS_NR_NVIC_EXC_DUMP_TYPES; i++) {
base = (UINT32 *)rgNvicBases[i];
len = rgNvicLens[i];
PRINTK("interrupt %s register, base address: %p, size: 0x%x\n", strRgs[i], base, len);
len = (len >> 2); /* 2: Gets the next register offset */
for (j = 0; j < len; j++) {
PRINTK("0x%x ", *(base + j));
if ((j != 0) && ((j % 16) == 0)) { /* 16: print wrap line */
PRINTK("\n");
}
}
PRINTK("\n");
}
}
STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
{
PRINTK("Current task info:\n");
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
} else if (excInfo->phase == OS_EXC_IN_HWI) {
PRINTK("Exception occur in interrupt phase!\n");
} else {
PRINTK("Exception occur in system init phase!\n");
}
}
STATIC VOID OsExcRegInfo(const ExcInfo *excInfo)
{
PRINTK("Exception reg dump:\n");
PRINTK("PC = 0x%x\n", excInfo->context->uwPC);
PRINTK("LR = 0x%x\n", excInfo->context->uwLR);
PRINTK("SP = 0x%x\n", excInfo->context->uwSP);
PRINTK("R0 = 0x%x\n", excInfo->context->uwR0);
PRINTK("R1 = 0x%x\n", excInfo->context->uwR1);
PRINTK("R2 = 0x%x\n", excInfo->context->uwR2);
PRINTK("R3 = 0x%x\n", excInfo->context->uwR3);
PRINTK("R4 = 0x%x\n", excInfo->context->uwR4);
PRINTK("R5 = 0x%x\n", excInfo->context->uwR5);
PRINTK("R6 = 0x%x\n", excInfo->context->uwR6);
PRINTK("R7 = 0x%x\n", excInfo->context->uwR7);
PRINTK("R8 = 0x%x\n", excInfo->context->uwR8);
PRINTK("R9 = 0x%x\n", excInfo->context->uwR9);
PRINTK("R10 = 0x%x\n", excInfo->context->uwR10);
PRINTK("R11 = 0x%x\n", excInfo->context->uwR11);
PRINTK("R12 = 0x%x\n", excInfo->context->uwR12);
PRINTK("PriMask = 0x%x\n", excInfo->context->uwPriMask);
PRINTK("xPSR = 0x%x\n", excInfo->context->uwxPSR);
}
#if (LOSCFG_KERNEL_BACKTRACE == 1)
STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
{
UINTPTR LR[LOSCFG_BACKTRACE_DEPTH] = {0};
UINT32 index;
OsBackTraceHookCall(LR, LOSCFG_BACKTRACE_DEPTH, 0, excInfo->context->uwSP);
PRINTK("----- backtrace start -----\n");
for (index = 0; index < LOSCFG_BACKTRACE_DEPTH; index++) {
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
#endif
STATIC VOID OsExcMemPoolCheckInfo(VOID)
{
PRINTK("\r\nmemory pools check:\n");
#if (LOSCFG_PLATFORM_EXC == 1)
MemInfoCB memExcInfo[OS_SYS_MEM_NUM];
UINT32 errCnt;
UINT32 i;
(VOID)memset_s(memExcInfo, sizeof(memExcInfo), 0, sizeof(memExcInfo));
errCnt = OsMemExcInfoGet(OS_SYS_MEM_NUM, memExcInfo);
if (errCnt < OS_SYS_MEM_NUM) {
errCnt += OsMemboxExcInfoGet(OS_SYS_MEM_NUM - errCnt, memExcInfo + errCnt);
}
if (errCnt == 0) {
PRINTK("all memory pool check passed!\n");
return;
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
if (ret == LOS_OK) {
PRINTK("system heap memcheck over, all passed!\n");
}
PRINTK("memory pool check end!\n");
}
#endif
STATIC VOID OsExcInfoDisplay(const ExcInfo *excInfo)
{
#if (LOSCFG_KERNEL_PRINTF != 0)
PRINTK("*************Exception Information**************\n");
OsExcTypeInfo(excInfo);
OsExcCurTaskInfo(excInfo);
OsExcRegInfo(excInfo);
#if (LOSCFG_KERNEL_BACKTRACE == 1)
OsExcBackTraceInfo(excInfo);
#endif
OsGetAllTskInfo();
OsExcNvicDump();
OsExcMemPoolCheckInfo();
#endif
}
LITE_OS_SEC_TEXT_INIT VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr)
{
UINT16 tmpFlag = (excType >> 16) & OS_NULL_SHORT; /* 16: Get Exception Type */
g_intCount++;
g_excInfo.nestCnt++;
g_excInfo.type = excType & OS_NULL_SHORT;
if (tmpFlag & OS_EXC_FLAG_FAULTADDR_VALID) {
g_excInfo.faultAddr = faultAddr;
} else {
g_excInfo.faultAddr = OS_EXC_IMPRECISE_ACCESS_ADDR;
}
if (g_losTask.runTask != NULL) {
if (tmpFlag & OS_EXC_FLAG_IN_HWI) {
g_excInfo.phase = OS_EXC_IN_HWI;
g_excInfo.thrdPid = pid;
} else {
g_excInfo.phase = OS_EXC_IN_TASK;
g_excInfo.thrdPid = g_losTask.runTask->taskID;
}
} else {
g_excInfo.phase = OS_EXC_IN_INIT;
g_excInfo.thrdPid = OS_NULL_INT;
}
if (excType & OS_EXC_FLAG_NO_FLOAT) {
g_excInfo.context = (EXC_CONTEXT_S *)((CHAR *)excBufAddr - LOS_OFF_SET_OF(EXC_CONTEXT_S, uwR4));
} else {
g_excInfo.context = excBufAddr;
}
OsDoExcHook(EXC_INTERRUPT);
OsExcInfoDisplay(&g_excInfo);
ArchSysExit();
}
WEAK VOID SysTick_Handler(VOID)
{
return;
}
/* ****************************************************************************
Function : HalHwiInit
Description : initialization of the hardware interrupt
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
{
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
HWI_PROC_FUNC *hwiForm = (HWI_PROC_FUNC *)ArchGetHwiFrom();
hwiForm[0] = 0; /* [0] Top of Stack */
hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcSvcCall;
hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)hwiForm;
#endif
#if (__CORTEX_M >= 0x03U) /* only for Cortex-M3 and above */
NVIC_SetPriorityGrouping(OS_NVIC_AIRCR_PRIGROUP);
#endif
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
#ifdef LOSCFG_ARCH_UNALIGNED_EXC
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);
#else
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT);
#endif
return;
}

View File

@@ -1,62 +1,66 @@
;
; Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
; Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this list of
; conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice, this list
; of conditions and the following disclaimer in the documentation and/or other materials
; provided with the distribution.
;
; 3. Neither the name of the copyright holder nor the names of its contributors may be used
; to endorse or promote products derived from this software without specific prior written
; permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
; ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
PRESERVE8
AREA RESET, CODE, READONLY
THUMB
IMPORT ||Image$$ARM_LIB_STACKHEAP$$ZI$$Limit||
IMPORT PendSV_Handler
EXPORT _BootVectors
EXPORT osResetVector
_BootVectors
DCD ||Image$$ARM_LIB_STACKHEAP$$ZI$$Limit||
DCD osResetVector
osResetVector
CPSID I
IMPORT LOS_HardBootInit
LDR R0, =LOS_HardBootInit
BLX R0
IMPORT __main
LDR R0, =__main
BX R0
ALIGN
END
;
; Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
; Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this list of
; conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice, this list
; of conditions and the following disclaimer in the documentation and/or other materials
; provided with the distribution.
;
; 3. Neither the name of the copyright holder nor the names of its contributors may be used
; to endorse or promote products derived from this software without specific prior written
; permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
; ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
;*----------------------------------------------------------------------------
;* Name: LOS_VENDOR.S
;* Purpose: Thread scheduler
;* Rev.: V1.0.0
;*----------------------------------------------------------------------------
PRESERVE8
AREA RESET, CODE, READONLY
THUMB
IMPORT ||Image$$ARM_LIB_STACKHEAP$$ZI$$Limit||
IMPORT HalHwiDefaultHandler
EXPORT _BootVectors
EXPORT Reset_Handler
_BootVectors
DCD ||Image$$ARM_LIB_STACKHEAP$$ZI$$Limit||
DCD Reset_Handler
DCD HalHwiDefaultHandler
DCD HalHwiDefaultHandler
Reset_Handler
CPSID I
IMPORT LOS_HardBootInit
BL LOS_HardBootInit
IMPORT __main
LDR R0, =__main
BX R0
ALIGN
END

View File

@@ -0,0 +1,130 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_timer.h"
#include "los_config.h"
#include "ARMCM3.h"
#include "los_tick.h"
#include "los_arch_interrupt.h"
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
STATIC ArchTickTimer g_archTickTimer = {
.freq = 0,
.irqNum = SysTick_IRQn,
.periodMax = LOSCFG_BASE_CORE_TICK_RESPONSE_MAX,
.init = SysTickStart,
.getCycle = SysTickCycleGet,
.reload = SysTickReload,
.lock = SysTickLock,
.unlock = SysTickUnlock,
.tickHandler = NULL,
};
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
{
UINT32 ret;
ArchTickTimer *tick = &g_archTickTimer;
tick->freq = OS_SYS_CLOCK;
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(tick->irqNum, handler, NULL);
#else
OsSetVector(tick->irqNum, handler);
#endif
#endif
ret = SysTick_Config(LOSCFG_BASE_CORE_TICK_RESPONSE_MAX);
if (ret == 1) {
return LOS_ERRNO_TICK_PER_SEC_TOO_SMALL;
}
return LOS_OK;
}
STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
{
if (nextResponseTime > g_archTickTimer.periodMax) {
nextResponseTime = g_archTickTimer.periodMax;
}
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)
{
UINT32 hwCycle = 0;
UINT32 intSave = LOS_IntLock();
UINT32 val = SysTick->VAL;
*period = SysTick->LOAD;
if (val != 0) {
hwCycle = *period - val;
}
LOS_IntRestore(intSave);
return (UINT64)hwCycle;
}
STATIC VOID SysTickLock(VOID)
{
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
}
STATIC VOID SysTickUnlock(VOID)
{
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
}
ArchTickTimer *ArchSysTickTimerGet(VOID)
{
return &g_archTickTimer;
}
UINT32 ArchEnterSleep(VOID)
{
__DSB();
__WFI();
__ISB();
return LOS_OK;
}

View File

@@ -0,0 +1,38 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_m/liteos.gni")
module_group("gcc") {
if (defined(LOSCFG_SECURE_TRUSTZONE)) {
modules = [ "TZ" ]
} else {
modules = [ "NTZ" ]
}
}

View File

@@ -0,0 +1,46 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_m/liteos.gni")
module_name = "arch"
kernel_module(module_name) {
sources = [
"los_context.c",
"los_dispatch.S",
"los_exc.S",
"los_interrupt.c",
"los_timer.c",
]
configs += [ "$LITEOSTOPDIR:warn_config" ]
}
config("public") {
include_dirs = [ "." ]
}

View File

@@ -0,0 +1,297 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_ATOMIC_H
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
STATIC INLINE INT32 ArchAtomicRead(const Atomic *v)
{
INT32 val;
__asm__ __volatile__("ldrex %0, [%1]\n"
: "=&r"(val)
: "r"(v)
: "cc");
return val;
}
STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
{
UINT32 status;
do {
__asm__ __volatile__("ldrex %0, [%1]\n"
"strex %0, %2, [%1]\n"
: "=&r"(status)
: "r"(v), "r"(setVal)
: "cc");
} while (__builtin_expect(status != 0, 0));
}
STATIC INLINE INT32 ArchAtomicAdd(Atomic *v, INT32 addVal)
{
INT32 val;
UINT32 status;
do {
__asm__ __volatile__("ldrex %1, [%2]\n"
"add %1, %1, %3\n"
"strex %0, %1, [%2]"
: "=&r"(status), "=&r"(val)
: "r"(v), "r"(addVal)
: "cc");
} while (__builtin_expect(status != 0, 0));
return val;
}
STATIC INLINE INT32 ArchAtomicSub(Atomic *v, INT32 subVal)
{
INT32 val;
UINT32 status;
do {
__asm__ __volatile__("ldrex %1, [%2]\n"
"sub %1, %1, %3\n"
"strex %0, %1, [%2]"
: "=&r"(status), "=&r"(val)
: "r"(v), "r"(subVal)
: "cc");
} while (__builtin_expect(status != 0, 0));
return val;
}
STATIC INLINE VOID ArchAtomicInc(Atomic *v)
{
(VOID)ArchAtomicAdd(v, 1);
}
STATIC INLINE VOID ArchAtomicDec(Atomic *v)
{
(VOID)ArchAtomicSub(v, 1);
}
STATIC INLINE INT32 ArchAtomicIncRet(Atomic *v)
{
return ArchAtomicAdd(v, 1);
}
STATIC INLINE INT32 ArchAtomicDecRet(Atomic *v)
{
return ArchAtomicSub(v, 1);
}
/**
* @ingroup los_arch_atomic
* @brief Atomic exchange for 32-bit variable.
*
* @par Description:
* This API is used to implement the atomic exchange for 32-bit variable
* and return the previous value of the atomic variable.
* @attention
* <ul>The pointer v must not be NULL.</ul>
*
* @param v [IN] The variable pointer.
* @param val [IN] The exchange value.
*
* @retval #INT32 The previous value of the atomic variable
* @par Dependency:
* <ul><li>los_arch_atomic.h: the header file that contains the API declaration.</li></ul>
* @see
*/
STATIC INLINE INT32 ArchAtomicXchg32bits(volatile INT32 *v, INT32 val)
{
INT32 prevVal = 0;
UINT32 status = 0;
do {
__asm__ __volatile__("ldrex %0, [%3]\n"
"strex %1, %4, [%3]"
: "=&r"(prevVal), "=&r"(status), "+m"(*v)
: "r"(v), "r"(val)
: "cc");
} while (__builtin_expect(status != 0, 0));
return prevVal;
}
/**
* @ingroup los_arch_atomic
* @brief Atomic exchange for 32-bit variable with compare.
*
* @par Description:
* This API is used to implement the atomic exchange for 32-bit variable, if the value of variable is equal to oldVal.
* @attention
* <ul>The pointer v must not be NULL.</ul>
*
* @param v [IN] The variable pointer.
* @param val [IN] The new value.
* @param oldVal [IN] The old value.
*
* @retval TRUE The previous value of the atomic variable is not equal to oldVal.
* @retval FALSE The previous value of the atomic variable is equal to oldVal.
* @par Dependency:
* <ul><li>los_arch_atomic.h: the header file that contains the API declaration.</li></ul>
* @see
*/
STATIC INLINE BOOL ArchAtomicCmpXchg32bits(volatile INT32 *v, INT32 val, INT32 oldVal)
{
INT32 prevVal = 0;
UINT32 status = 0;
do {
__asm__ __volatile__("ldrex %0, %2\n"
"mov %1, #0\n"
"cmp %0, %3\n"
"bne 1f\n"
"strex %1, %4, %2\n"
"1:"
: "=&r"(prevVal), "=&r"(status), "+Q"(*v)
: "r"(oldVal), "r"(val)
: "cc");
} while (__builtin_expect(status != 0, 0));
return prevVal != oldVal;
}
STATIC INLINE INT64 ArchAtomic64Read(const Atomic64 *v)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE VOID ArchAtomic64Set(Atomic64 *v, INT64 setVal)
{
UINT32 intSave;
intSave = LOS_IntLock();
*v = setVal;
LOS_IntRestore(intSave);
}
STATIC INLINE INT64 ArchAtomic64Add(Atomic64 *v, INT64 addVal)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v += addVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE INT64 ArchAtomic64Sub(Atomic64 *v, INT64 subVal)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v -= subVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE VOID ArchAtomic64Inc(Atomic64 *v)
{
(VOID)ArchAtomic64Add(v, 1);
}
STATIC INLINE INT64 ArchAtomic64IncRet(Atomic64 *v)
{
return ArchAtomic64Add(v, 1);
}
STATIC INLINE VOID ArchAtomic64Dec(Atomic64 *v)
{
(VOID)ArchAtomic64Sub(v, 1);
}
STATIC INLINE INT64 ArchAtomic64DecRet(Atomic64 *v)
{
return ArchAtomic64Sub(v, 1);
}
STATIC INLINE INT64 ArchAtomicXchg64bits(Atomic64 *v, INT64 val)
{
INT64 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
*v = val;
LOS_IntRestore(intSave);
return prevVal;
}
STATIC INLINE BOOL ArchAtomicCmpXchg64bits(Atomic64 *v, INT64 val, INT64 oldVal)
{
INT64 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
if (prevVal == oldVal) {
*v = val;
}
LOS_IntRestore(intSave);
return prevVal != oldVal;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_ATOMIC_H */

View File

@@ -0,0 +1,130 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_CONTEXT_H
#define _LOS_ARCH_CONTEXT_H
#include "los_config.h"
#include "los_compiler.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
typedef struct TagTskContext {
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
UINT32 S16;
UINT32 S17;
UINT32 S18;
UINT32 S19;
UINT32 S20;
UINT32 S21;
UINT32 S22;
UINT32 S23;
UINT32 S24;
UINT32 S25;
UINT32 S26;
UINT32 S27;
UINT32 S28;
UINT32 S29;
UINT32 S30;
UINT32 S31;
#endif
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
UINT32 uwR0;
UINT32 uwR1;
UINT32 uwR2;
UINT32 uwR3;
UINT32 uwR12;
UINT32 uwLR;
UINT32 uwPC;
UINT32 uwxPSR;
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
UINT32 S0;
UINT32 S1;
UINT32 S2;
UINT32 S3;
UINT32 S4;
UINT32 S5;
UINT32 S6;
UINT32 S7;
UINT32 S8;
UINT32 S9;
UINT32 S10;
UINT32 S11;
UINT32 S12;
UINT32 S13;
UINT32 S14;
UINT32 S15;
UINT32 FPSCR;
UINT32 NO_NAME;
#endif
} TaskContext;
/**
* @ingroup los_config
* @brief: Task start running function.
*
* @par Description:
* This API is used to start a task.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param: None.
*
* @retval None.
*
* @par Dependency:
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalStartToRun(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_CONTEXT_H */

View File

@@ -0,0 +1,621 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_INTERRUPT_H
#define _LOS_ARCH_INTERRUPT_H
#include "los_common_interrupt.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* *
* @ingroup los_arch_interrupt
* Highest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_HIGHEST
#define OS_HWI_PRIO_HIGHEST 0
#endif
/* *
* @ingroup los_arch_interrupt
* Lowest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_LOWEST
#define OS_HWI_PRIO_LOWEST 7
#endif
/* *
* @ingroup los_arch_interrupt
* AIRCR register priority group parameter .
*/
#define OS_NVIC_AIRCR_PRIGROUP 7
/* *
* @ingroup los_arch_interrupt
* Boot interrupt vector table.
*/
extern UINT32 _BootVectors[];
/* *
* @ingroup los_arch_interrupt
* Count of M-Core system interrupt vector.
*/
#define OS_SYS_VECTOR_CNT 16
/* *
* @ingroup los_arch_interrupt
* Count of M-Core interrupt vector.
*/
#define OS_VECTOR_CNT (OS_SYS_VECTOR_CNT + OS_HWI_MAX_NUM)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt number.
*
* Value: 0x02000900
*
* Solution: Ensure that the interrupt number is valid.
* The value range of the interrupt number applicable for a Cortex-M33 platform is [OS_USER_HWI_MIN,OS_USER_HWI_MAX].
*/
#define OS_ERRNO_HWI_NUM_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x00)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Null hardware interrupt handling function.
*
* Value: 0x02000901
*
* Solution: Pass in a valid non-null hardware interrupt handling function.
*/
#define OS_ERRNO_HWI_PROC_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x01)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Insufficient interrupt resources for hardware interrupt creation.
*
* Value: 0x02000902
*
* Solution: Increase the configured maximum number of supported hardware interrupts.
*/
#define OS_ERRNO_HWI_CB_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x02)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Insufficient memory for hardware interrupt initialization.
*
* Value: 0x02000903
*
* Solution: Expand the configured memory.
*/
#define OS_ERRNO_HWI_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x03)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: The interrupt has already been created.
*
* Value: 0x02000904
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x04)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt priority.
*
* Value: 0x02000905
*
* Solution: Ensure that the interrupt priority is valid.
* The value range of the interrupt priority applicable for a Cortex-M33 platform is [0,15].
*/
#define OS_ERRNO_HWI_PRIO_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x05)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Incorrect interrupt creation mode.
*
* Value: 0x02000906
*
* Solution: The interrupt creation mode can be only set to OS_HWI_MODE_COMM or
* OS_HWI_MODE_FAST of which the value can be 0 or 1.
*/
#define OS_ERRNO_HWI_MODE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x06)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: The interrupt has already been created as a fast interrupt.
*
* Value: 0x02000907
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_FASTMODE_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x07)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt operation function.
*
* Value: 0x0200090c
*
* Solution: Set a valid interrupt operation function
*/
#define OS_ERRNO_HWI_OPS_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x0c)
/* *
* @ingroup los_arch_interrupt
* SysTick control and status register.
*/
#define OS_SYSTICK_CONTROL_REG 0xE000E010
/* *
* @ingroup los_hw
* SysTick current value register.
*/
#define OS_SYSTICK_CURRENT_REG 0xE000E018
/* *
* @ingroup los_arch_interrupt
* Interrupt Priority-Level Registers.
*/
#define OS_NVIC_PRI_BASE 0xE000E400
/* *
* @ingroup los_arch_interrupt
* Interrupt enable register for 0-31.
*/
#define OS_NVIC_SETENA_BASE 0xE000E100
/* *
* @ingroup los_arch_interrupt
* interrupt pending register.
*/
#define OS_NVIC_SETPEND_BASE 0xE000E200
/* *
* @ingroup los_arch_interrupt
* Interrupt active register.
*/
#define OS_NVIC_INT_ACT_BASE 0xE000E300
/* *
* @ingroup los_arch_interrupt
* Interrupt disable register for 0-31.
*/
#define OS_NVIC_CLRENA_BASE 0xE000E180
/* *
* @ingroup los_arch_interrupt
* Interrupt control and status register.
*/
#define OS_NVIC_INT_CTRL 0xE000ED04
/* *
* @ingroup los_arch_interrupt
* Vector table offset register.
*/
#define OS_NVIC_VTOR 0xE000ED08
/* *
* @ingroup los_arch_interrupt
* Application interrupt and reset control register
*/
#define OS_NVIC_AIRCR 0xE000ED0C
/* *
* @ingroup los_arch_interrupt
* System exception priority register.
*/
#define OS_NVIC_EXCPRI_BASE 0xE000ED18
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 1 :reset.
*/
#define OS_EXC_RESET 1
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 2 :Non-Maskable Interrupt.
*/
#define OS_EXC_NMI 2
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 3 :(hard)fault.
*/
#define OS_EXC_HARD_FAULT 3
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 4 :MemManage fault.
*/
#define OS_EXC_MPU_FAULT 4
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 5 :Bus fault.
*/
#define OS_EXC_BUS_FAULT 5
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 6 :Usage fault.
*/
#define OS_EXC_USAGE_FAULT 6
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 11 :SVCall.
*/
#define OS_EXC_SVC_CALL 11
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 12 :Debug monitor.
*/
#define OS_EXC_DBG_MONITOR 12
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 14 :PendSV.
*/
#define OS_EXC_PEND_SV 14
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 15 :SysTick.
*/
#define OS_EXC_SYS_TICK 15
/* *
* @ingroup los_arch_interrupt
* @brief: Hardware interrupt entry function.
*
* @par Description:
* This API is used as all hardware interrupt handling function entry.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalInterrupt(VOID);
/* *
* @ingroup los_arch_interrupt
* @brief: Reset the vector table.
*
* @par Description:
* This API is used to reset the vector table.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID Reset_Handler(VOID);
/* *
* @ingroup los_arch_interrupt
* @brief: Pended System Call.
*
* @par Description:
* PendSV can be pended and is useful for an OS to pend an exception
* so that an action can be performed after other important tasks are completed.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalPendSV(VOID);
#define OS_EXC_MAX_BUF_LEN 25
#define OS_EXC_MAX_NEST_DEPTH 1
#define OS_EXC_FLAG_NO_FLOAT 0x10000000
#define OS_NVIC_SHCSR 0xE000ED24
#define OS_NVIC_CCR 0xE000ED14
#define OS_NVIC_INT_ENABLE_SIZE 0x20
#define OS_NVIC_INT_PRI_SIZE 0xF0
#define OS_NVIC_EXCPRI_SIZE 0xC
#define OS_NVIC_INT_CTRL_SIZE 4
#define OS_NVIC_SHCSR_SIZE 4
#define OS_NVIC_INT_PEND_SIZE OS_NVIC_INT_ACT_SIZE
#define OS_NVIC_INT_ACT_SIZE OS_NVIC_INT_ENABLE_SIZE
/**
* @ingroup los_exc
* the struct of register files
*
* description: the register files that saved when exception triggered
*
* notes:the following register with prefix 'uw' correspond to the registers in the cpu data sheet.
*/
typedef struct TagExcContext {
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
UINT32 S16;
UINT32 S17;
UINT32 S18;
UINT32 S19;
UINT32 S20;
UINT32 S21;
UINT32 S22;
UINT32 S23;
UINT32 S24;
UINT32 S25;
UINT32 S26;
UINT32 S27;
UINT32 S28;
UINT32 S29;
UINT32 S30;
UINT32 S31;
#endif
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
/* auto save */
UINT32 uwSP;
UINT32 uwR0;
UINT32 uwR1;
UINT32 uwR2;
UINT32 uwR3;
UINT32 uwR12;
UINT32 uwLR;
UINT32 uwPC;
UINT32 uwxPSR;
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED) && (__FPU_USED== 1U)))
UINT32 S0;
UINT32 S1;
UINT32 S2;
UINT32 S3;
UINT32 S4;
UINT32 S5;
UINT32 S6;
UINT32 S7;
UINT32 S8;
UINT32 S9;
UINT32 S10;
UINT32 S11;
UINT32 S12;
UINT32 S13;
UINT32 S14;
UINT32 S15;
UINT32 FPSCR;
UINT32 NO_NAME;
#endif
} EXC_CONTEXT_S;
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
VOID HalExcNMI(VOID);
VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID);
VOID HalSVCHandler(VOID);
VOID HalHwiInit(VOID);
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the bus status register was being pushed.
*/
#define OS_EXC_BF_STKERR 1
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the bus status register was out of the stack.
*/
#define OS_EXC_BF_UNSTKERR 2
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register imprecise data access violation.
*/
#define OS_EXC_BF_IMPRECISERR 3
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register exact data access violation.
*/
#define OS_EXC_BF_PRECISERR 4
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register access violation while pointing.
*/
#define OS_EXC_BF_IBUSERR 5
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the memory management status register was being pushed.
*/
#define OS_EXC_MF_MSTKERR 6
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the memory management status register was out of the stack.
*/
#define OS_EXC_MF_MUNSTKERR 7
/**
* @ingroup los_exc
* Cortex-M exception types: Memory management status register data access violation.
*/
#define OS_EXC_MF_DACCVIOL 8
/**
* @ingroup los_exc
* Cortex-M exception types: Memory management status register access violation.
*/
#define OS_EXC_MF_IACCVIOL 9
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage indicating that the divisor is zero during the division operation.
*/
#define OS_EXC_UF_DIVBYZERO 10
/**
* @ingroup los_exc
* Cortex-M exception types: Usage error, error caused by unaligned access.
*/
#define OS_EXC_UF_UNALIGNED 11
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage attempting to execute coprocessor related instruction.
*/
#define OS_EXC_UF_NOCP 12
/**
* @ingroup los_exc
* Cortex-M exception types: Usage error attempting to load EXC_RETURN to PC illegally on exception return.
*/
#define OS_EXC_UF_INVPC 13
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage, attempting to cut to ARM state.
*/
#define OS_EXC_UF_INVSTATE 14
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage. Executed instruction whose code is undefined.
*/
#define OS_EXC_UF_UNDEFINSTR 15
/**
* @ingroup los_exc
* Cortex-M exception types: NMI
*/
#define OS_EXC_CAUSE_NMI 16
/**
* @ingroup los_exc
* Cortex-M exception types: hard fault
*/
#define OS_EXC_CAUSE_HARDFAULT 17
/**
* @ingroup los_exc
* Cortex-M exception types: The task handler exits.
*/
#define OS_EXC_CAUSE_TASK_EXIT 18
/**
* @ingroup los_exc
* Cortex-M exception types: A fatal error.
*/
#define OS_EXC_CAUSE_FATAL_ERR 19
/**
* @ingroup los_exc
* Cortex-M exception types: Hard Fault caused by a debug event.
*/
#define OS_EXC_CAUSE_DEBUGEVT 20
/**
* @ingroup los_exc
* Cortex-M exception types: A hard fault that occurs when a quantity is oriented.
*/
#define OS_EXC_CAUSE_VECTBL 21
/**
* @ingroup los_exc
* Exception information structure
*
* Description: Exception information saved when an exception is triggered on the Cortex-M33 platform.
*
*/
typedef struct TagExcInfo {
/**< Exception occurrence phase: 0 means that an exception occurs in initialization,
* 1 means that an exception occurs in a task, and 2 means that an exception occurs in an interrupt */
UINT16 phase;
/**< Exception type. When exceptions occur, check the numbers 1 - 21 listed above */
UINT16 type;
/**< If the exact address access error indicates the wrong access address when the exception occurred */
UINT32 faultAddr;
/**< An exception occurs in an interrupt, indicating the interrupt number.
* An exception occurs in the task, indicating the task ID, or 0xFFFFFFFF if it occurs during initialization */
UINT32 thrdPid;
/**< Number of nested exceptions. Currently only registered hook functions are supported
* when an exception is entered for the first time */
UINT16 nestCnt;
/**< reserve */
UINT16 reserved;
/**< Hardware context at the time an exception to the automatic stack floating-point register occurs */
EXC_CONTEXT_S *context;
} ExcInfo;
extern ExcInfo g_excInfo;
extern UINT32 g_curNestCount;
extern UINT8 g_uwExcTbl[32];
#define MAX_INT_INFO_SIZE (8 + 0x164)
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_INTERRUPT_H */

View File

@@ -0,0 +1,51 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_TIMER_H
#define _LOS_ARCH_TIMER_H
#include "los_config.h"
#include "los_compiler.h"
#include "los_timer.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_TIMER_H */

View File

@@ -0,0 +1,160 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_context.h"
#include "securec.h"
#include "los_arch_context.h"
#include "los_arch_interrupt.h"
#include "los_task.h"
#include "los_sched.h"
#include "los_interrupt.h"
#include "los_debug.h"
/* ****************************************************************************
Function : ArchInit
Description : arch init function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
{
HalHwiInit();
}
/* ****************************************************************************
Function : ArchSysExit
Description : Task exit function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
(VOID)LOS_IntLock();
while (1) {
}
}
/* ****************************************************************************
Function : ArchTskStackInit
Description : Task stack initialization function
Input : taskID --- TaskID
stackSize --- Total size of the stack
topStack --- Top of task's stack
Output : None
Return : Context pointer
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID *ArchTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
{
TaskContext *context = (TaskContext *)((UINTPTR)topStack + stackSize - sizeof(TaskContext));
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
context->S16 = 0xAA000010;
context->S17 = 0xAA000011;
context->S18 = 0xAA000012;
context->S19 = 0xAA000013;
context->S20 = 0xAA000014;
context->S21 = 0xAA000015;
context->S22 = 0xAA000016;
context->S23 = 0xAA000017;
context->S24 = 0xAA000018;
context->S25 = 0xAA000019;
context->S26 = 0xAA00001A;
context->S27 = 0xAA00001B;
context->S28 = 0xAA00001C;
context->S29 = 0xAA00001D;
context->S30 = 0xAA00001E;
context->S31 = 0xAA00001F;
context->S0 = 0xAA000000;
context->S1 = 0xAA000001;
context->S2 = 0xAA000002;
context->S3 = 0xAA000003;
context->S4 = 0xAA000004;
context->S5 = 0xAA000005;
context->S6 = 0xAA000006;
context->S7 = 0xAA000007;
context->S8 = 0xAA000008;
context->S9 = 0xAA000009;
context->S10 = 0xAA00000A;
context->S11 = 0xAA00000B;
context->S12 = 0xAA00000C;
context->S13 = 0xAA00000D;
context->S14 = 0xAA00000E;
context->S15 = 0xAA00000F;
context->FPSCR = 0x00000000;
context->NO_NAME = 0xAA000011;
#endif
context->uwR4 = 0x04040404L;
context->uwR5 = 0x05050505L;
context->uwR6 = 0x06060606L;
context->uwR7 = 0x07070707L;
context->uwR8 = 0x08080808L;
context->uwR9 = 0x09090909L;
context->uwR10 = 0x10101010L;
context->uwR11 = 0x11111111L;
context->uwPriMask = 0;
context->uwR0 = taskID;
context->uwR1 = 0x01010101L;
context->uwR2 = 0x02020202L;
context->uwR3 = 0x03030303L;
context->uwR12 = 0x12121212L;
context->uwLR = (UINT32)(UINTPTR)ArchSysExit;
context->uwPC = (UINT32)(UINTPTR)OsTaskEntry;
context->uwxPSR = 0x01000000L;
return (VOID *)context;
}
#if (LOSCFG_KERNEL_SIGNAL == 1)
VOID *ArchSignalContextInit(VOID *stackPointer, VOID *stackTop, UINTPTR sigHandler, UINT32 param)
{
UNUSED(stackTop);
TaskContext *context = (TaskContext *)((UINTPTR)stackPointer - sizeof(TaskContext));
(VOID)memset_s((VOID *)context, sizeof(TaskContext), 0, sizeof(TaskContext));
context->uwR0 = param;
context->uwPC = sigHandler;
context->uwxPSR = 0x01000000L; /* Thumb flag, always set 1 */
return (VOID *)context;
}
#endif
LITE_OS_SEC_TEXT_INIT UINT32 ArchStartSchedule(VOID)
{
(VOID)LOS_IntLock();
OsSchedStart();
HalStartToRun();
return LOS_OK; /* never return */
}

View File

@@ -0,0 +1,207 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.syntax unified
.arch armv7e-m
.thumb
.fpu fpv5-d16
//;.arch_extension sec
.equ OS_FPU_CPACR, 0xE000ED88
.equ OS_FPU_CPACR_ENABLE, 0x00F00000
.equ OS_NVIC_INT_CTRL, 0xE000ED04
.equ OS_NVIC_SYSPRI2, 0xE000ED20
.equ OS_NVIC_PENDSV_PRI, 0xF0F00000
.equ OS_NVIC_PENDSVSET, 0x10000000
.equ OS_TASK_STATUS_RUNNING, 0x0010
.section .text
.thumb
.macro SIGNAL_CONTEXT_RESTORE
push {r12, lr}
blx OsSignalTaskContextRestore
pop {r12, lr}
cmp r0, #0
mov r1, r0
bne SignalContextRestore
.endm
.type HalStartToRun, %function
.global HalStartToRun
HalStartToRun:
.fnstart
.cantunwind
ldr r4, =OS_NVIC_SYSPRI2
ldr r5, =OS_NVIC_PENDSV_PRI
str r5, [r4]
mov r0, #2
msr CONTROL, r0
ldr r1, =g_losTask
ldr r0, [r1, #4]
ldr r12, [r0]
ldr.w r1, =OS_FPU_CPACR
ldr r1, [r1]
and r1, r1, #OS_FPU_CPACR_ENABLE
cmp r1, #OS_FPU_CPACR_ENABLE
bne __DisabledFPU
add r12, r12, #100
ldmfd r12!, {r0-r7}
add r12, r12, #72
msr psp, r12
vpush {S0}
vpop {S0}
mov lr, r5
cpsie I
bx r6
__DisabledFPU:
ADD r12, r12, #36
LDMFD r12!, {r0-r7}
MSR psp, r12
MOV lr, r5
cpsie I
BX r6
.fnend
.type ArchIntLock, %function
.global ArchIntLock
ArchIntLock:
.fnstart
.cantunwind
MRS R0, PRIMASK
CPSID I
BX LR
.fnend
.type ArchIntUnLock, %function
.global ArchIntUnLock
ArchIntUnLock:
.fnstart
.cantunwind
MRS R0, PRIMASK
CPSIE I
BX LR
.fnend
.type ArchIntRestore, %function
.global ArchIntRestore
ArchIntRestore:
.fnstart
.cantunwind
MSR PRIMASK, R0
BX LR
.fnend
.type ArchTaskSchedule, %function
.global ArchTaskSchedule
ArchTaskSchedule:
.fnstart
.cantunwind
ldr r0, =OS_NVIC_INT_CTRL
ldr r1, =OS_NVIC_PENDSVSET
str r1, [r0]
dsb
isb
bx lr
.fnend
.type HalPendSV, %function
.global HalPendSV
HalPendSV:
.fnstart
.cantunwind
mrs r12, PRIMASK
cpsid I
HalTaskSwitch:
SIGNAL_CONTEXT_RESTORE
push {r12, lr}
blx OsSchedTaskSwitch
pop {r12, lr}
cmp r0, #0
mov r0, lr
bne TaskContextSwitch
msr PRIMASK, r12
bx lr
TaskContextSwitch:
mov lr, r0
mrs r0, psp
stmfd r0!, {r4-r12}
ldr.w r3, =OS_FPU_CPACR
ldr r3, [r3]
and r3, r3, #OS_FPU_CPACR_ENABLE
cmp r3, #OS_FPU_CPACR_ENABLE
bne __DisabledFPU1
vstmdb r0!, {d8-d15}
__DisabledFPU1:
ldr r5, =g_losTask
ldr r6, [r5]
str r0, [r6]
ldr r0, [r5, #4]
str r0, [r5]
ldr r1, [r0]
SignalContextRestore:
ldr.w r3, =OS_FPU_CPACR
ldr r3, [r3]
and r3, r3, #OS_FPU_CPACR_ENABLE
cmp r3, #OS_FPU_CPACR_ENABLE
bne __DisabledFPU2
VLDMIA r1!, {d8-d15}
__DisabledFPU2:
ldmfd r1!, {r4-r12}
msr psp, r1
msr PRIMASK, r12
bx lr
.fnend

View File

@@ -1,384 +1,384 @@
;
; Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
; Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this list of
; conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice, this list
; of conditions and the following disclaimer in the documentation and/or other materials
; provided with the distribution.
;
; 3. Neither the name of the copyright holder nor the names of its contributors may be used
; to endorse or promote products derived from this software without specific prior written
; permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
; ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
.syntax unified
.arch armv7e-m
.thumb
.fpu vfpv4
.section .text
.global OsExcNMI
.global OsExcHardFault
.global OsExcMemFault
.global OsExcBusFault
.global OsExcUsageFault
.global OsExcSvcCall
.extern OsExcHandleEntry
.extern g_vuwLosFlag
.extern g_uwCurNestCount
.extern g_uwExcTbl
.extern g_taskScheduled
.equ OS_FLG_BGD_ACTIVE, 0x0002
.equ OS_EXC_CAUSE_NMI, 16
.equ OS_EXC_CAUSE_HARDFAULT, 17
.equ HF_DEBUGEVT, 20
.equ HF_VECTBL, 21
.equ FLAG_ADDR_VALID, 0x10000
.equ FLAG_HWI_ACTIVE, 0x20000
.equ FLAG_NO_FLOAT, 0x10000000
.equ OS_NVIC_FSR , 0xE000ED28 //include BusFault/MemFault/UsageFault State Regeister
.equ OS_NVIC_HFSR , 0xE000ED2C //HardFault State Regeister
.equ OS_NVIC_BFAR , 0xE000ED38
.equ OS_NVIC_MMAR , 0xE000ED34
.equ OS_NVIC_ACT_BASE , 0xE000E300
.equ OS_NVIC_SHCSRS , 0xE000ED24
.equ OS_NVIC_SHCSR_MASK , 0xC00
.type OsExcNMI, %function
.global OsExcNMI
OsExcNMI:
.fnstart
.cantunwind
MOV R0, #OS_EXC_CAUSE_NMI
MOV R1, #0
B osExcDispatch
.fnend
.type OsExcHardFault, %function
.global OsExcHardFault
OsExcHardFault:
.fnstart
.cantunwind
MOV R0, #OS_EXC_CAUSE_HARDFAULT
LDR R2, =OS_NVIC_HFSR
LDR R2, [R2]
MOV R1, #HF_DEBUGEVT
ORR R0, R0, R1, LSL #0x8
TST R2, #0x80000000
BNE osExcDispatch // DEBUGEVT
AND R0, #0x000000FF
MOV R1, #HF_VECTBL
ORR R0, R0, R1, LSL #0x8
TST R2, #0x00000002
BNE osExcDispatch // VECTBL
//if not DEBUGEVT and VECTBL then is FORCED
AND R0, #0x000000FF
LDR R2, =OS_NVIC_FSR
LDR R2, [R2]
TST R2, #0x8000 // BFARVALID
BNE _HFBusFault // BusFault
TST R2, #0x80 // MMARVALID
BNE _HFMemFault // MemFault
MOV R12,#0
B osHFExcCommonBMU
.fnend
.type _HFBusFault, %function
_HFBusFault:
.fnstart
.cantunwind
LDR R1, =OS_NVIC_BFAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
B osHFExcCommonBMU
.fnend
.type _HFMemFault, %function
_HFMemFault:
.fnstart
.cantunwind
LDR R1, =OS_NVIC_MMAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
.fnend
.type osHFExcCommonBMU, %function
.global osHFExcCommonBMU
osHFExcCommonBMU:
.fnstart
.cantunwind
CLZ R2, R2
LDR R3, =g_uwExcTbl
ADD R3, R3, R2
LDRB R2, [R3]
ORR R0, R0, R2, LSL #0x8
ORR R0, R12
B osExcDispatch
.fnend
.type OsExcSvcCall, %function
.global OsExcSvcCall
OsExcSvcCall:
.fnstart
.cantunwind
TST LR, #0x4
ITE EQ
MRSEQ R0, MSP
MRSNE R0, PSP
LDR R1, [R0,#24]
LDRB R0, [R1,#-2]
MOV R1, #0
B osExcDispatch
.fnend
.type OsExcBusFault, %function
.global OsExcBusFault
OsExcBusFault:
.fnstart
.cantunwind
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
TST R0, #0x8000 // BFARVALID
BEQ _ExcBusNoADDR
LDR R1, =OS_NVIC_BFAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
AND R0, #0x1F00
B osExcCommonBMU
.fnend
.type _ExcBusNoADDR, %function
.global _ExcBusNoADDR
_ExcBusNoADDR:
.fnstart
.cantunwind
MOV R12,#0
B osExcCommonBMU
.fnend
.type OsExcMemFault, %function
.global OsExcMemFault
OsExcMemFault:
.fnstart
.cantunwind
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
TST R0, #0x80 // MMARVALID
BEQ _ExcMemNoADDR
LDR R1, =OS_NVIC_MMAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
AND R0, #0x1B
B osExcCommonBMU
.fnend
.type _ExcMemNoADDR, %function
.global _ExcMemNoADDR
_ExcMemNoADDR:
.fnstart
.cantunwind
MOV R12,#0
B osExcCommonBMU
.fnend
.type OsExcUsageFault, %function
.global OsExcUsageFault
OsExcUsageFault:
.fnstart
.cantunwind
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
LDR R1, =#0x030F
LSL R1, #16
AND R0, R1
MOV R12, #0
.fnend
.type osExcCommonBMU, %function
.global osExcCommonBMU
osExcCommonBMU:
.fnstart
.cantunwind
CLZ R0, R0
LDR R3, =g_uwExcTbl
ADD R3, R3, R0
LDRB R0, [R3]
ORR R0, R0, R12
.fnend
// R0 -- EXCCAUSE(bit 16 is 1 if EXCADDR valid), R1 -- EXCADDR
.type osExcDispatch, %function
.global osExcDispatch
osExcDispatch:
.fnstart
.cantunwind
LDR R2, =OS_NVIC_ACT_BASE
MOV R12, #8 // R12 is hwi check loop counter
.fnend
.type _hwiActiveCheck, %function
.global _hwiActiveCheck
_hwiActiveCheck:
.fnstart
.cantunwind
LDR R3, [R2] // R3 store active hwi register when exc
CMP R3, #0
BEQ _hwiActiveCheckNext
// exc occured in IRQ
ORR R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
AND R12, #1
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as uwPid
.fnend
.type _ExcInMSP, %function
.global _ExcInMSP
_ExcInMSP:
.fnstart
.cantunwind
CMP LR, #0XFFFFFFED
BNE _NoFloatInMsp
ADD R3, R13, #104
PUSH {R3}
MRS R12, PRIMASK // store message-->exc: disable int?
PUSH {R4-R12} // store message-->exc: {R4-R12}
VPUSH {D8-D15}
B _handleEntry
.fnend
.type _NoFloatInMsp, %function
.global _NoFloatInMsp
_NoFloatInMsp:
.fnstart
.cantunwind
ADD R3, R13, #32
PUSH {R3} // save IRQ SP // store message-->exc: MSP(R13)
MRS R12, PRIMASK // store message-->exc: disable int?
PUSH {R4-R12} // store message-->exc: {R4-R12}
ORR R0, R0, #FLAG_NO_FLOAT
B _handleEntry
.fnend
.type _hwiActiveCheckNext, %function
.global _hwiActiveCheckNext
_hwiActiveCheckNext:
.fnstart
.cantunwind
ADD R2, #4 // next NVIC ACT ADDR
SUBS R12, #1
BNE _hwiActiveCheck
/*NMI interrupt excption*/
LDR R2, =OS_NVIC_SHCSRS
LDRH R2,[R2]
LDR R3,=OS_NVIC_SHCSR_MASK
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
// exc occured in Task or Init or exc
// reserved for register info from task stack
LDR R2, =g_taskScheduled
LDR R2, [R2]
TST R2, #1 // OS_FLG_BGD_ACTIVE
BEQ _ExcInMSP // if exc occured in Init then branch
CMP LR, #0xFFFFFFED //auto push floating registers
BNE _NoFloatInPsp
// exc occured in Task
MOV R2, R13
SUB R13, #96 // add 8 Bytes reg(for STMFD)
MRS R3, PSP
ADD R12, R3, #104
PUSH {R12} // save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
VPUSH {D8-D15}
// copy auto saved task register
LDMFD R3!, {R4-R11} // R4-R11 store PSP reg(auto push when exc in task)
VLDMIA R3!, {D8-D15}
VSTMDB R2!, {D8-D15}
STMFD R2!, {R4-R11}
B _handleEntry
.fnend
.type _NoFloatInPsp, %function
.global _NoFloatInPsp
_NoFloatInPsp:
.fnstart
.cantunwind
MOV R2, R13 //no auto push floating registers
SUB R13, #32 // add 8 Bytes reg(for STMFD)
MRS R3, PSP
ADD R12, R3, #32
PUSH {R12} // save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
LDMFD R3, {R4-R11} // R4-R11 store PSP reg(auto push when exc in task)
STMFD R2!, {R4-R11}
ORR R0, R0, #FLAG_NO_FLOAT
.fnend
.type _handleEntry, %function
.global _handleEntry
_handleEntry:
.fnstart
.cantunwind
MOV R3, R13 // R13:the 4th param
CPSID I
CPSID F
B OsExcHandleEntry
NOP
.fnend
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.syntax unified
.arch armv7e-m
.thumb
.fpu fpv5-d16
.section .text
.global HalExcNMI
.global HalExcHardFault
.global HalExcMemFault
.global HalExcBusFault
.global HalExcUsageFault
.global HalSVCHandler
.extern HalExcHandleEntry
.extern g_uwExcTbl
.extern g_taskScheduled
.equ OS_FLG_BGD_ACTIVE, 0x0002
.equ OS_EXC_CAUSE_NMI, 16
.equ OS_EXC_CAUSE_HARDFAULT, 17
.equ HF_DEBUGEVT, 20
.equ HF_VECTBL, 21
.equ FLAG_ADDR_VALID, 0x10000
.equ FLAG_HWI_ACTIVE, 0x20000
.equ FLAG_NO_FLOAT, 0x10000000
.equ OS_NVIC_FSR , 0xE000ED28 //include BusFault/MemFault/UsageFault State Register
.equ OS_NVIC_HFSR , 0xE000ED2C //HardFault State Register
.equ OS_NVIC_BFAR , 0xE000ED38
.equ OS_NVIC_MMAR , 0xE000ED34
.equ OS_NVIC_ACT_BASE , 0xE000E300
.equ OS_NVIC_SHCSRS , 0xE000ED24
.equ OS_NVIC_SHCSR_MASK , 0xC00
.type HalExcNMI, %function
.global HalExcNMI
HalExcNMI:
.fnstart
.cantunwind
MOV R0, #OS_EXC_CAUSE_NMI
MOV R1, #0
B osExcDispatch
.fnend
.type HalExcHardFault, %function
.global HalExcHardFault
HalExcHardFault:
.fnstart
.cantunwind
MOV R0, #OS_EXC_CAUSE_HARDFAULT
LDR R2, =OS_NVIC_HFSR
LDR R2, [R2]
MOV R1, #HF_DEBUGEVT
ORR R0, R0, R1, LSL #0x8
TST R2, #0x80000000
BNE osExcDispatch // DEBUGEVT
AND R0, R0 , #0x000000FF
MOV R1, #HF_VECTBL
ORR R0, R0, R1, LSL #0x8
TST R2, #0x00000002
BNE osExcDispatch // VECTBL
//if not DEBUGEVT and VECTBL then is FORCED
AND R0, R0, #0x000000FF
LDR R2, =OS_NVIC_FSR
LDR R2, [R2]
TST R2, #0x8000 // BFARVALID
BNE _HFBusFault // BusFault
TST R2, #0x80 // MMARVALID
BNE _HFMemFault // MemFault
MOV R12,#0
B osHFExcCommonBMU
.fnend
.type _HFBusFault, %function
_HFBusFault:
.fnstart
.cantunwind
LDR R1, =OS_NVIC_BFAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
B osHFExcCommonBMU
.fnend
.type _HFMemFault, %function
_HFMemFault:
.fnstart
.cantunwind
LDR R1, =OS_NVIC_MMAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
.fnend
.type osHFExcCommonBMU, %function
.global osHFExcCommonBMU
osHFExcCommonBMU:
.fnstart
.cantunwind
CLZ R2, R2
LDR R3, =g_uwExcTbl
ADD R3, R3, R2
LDRB R2, [R3]
ORR R0, R0, R2, LSL #0x8
ORR R0, R0 ,R12
B osExcDispatch
.fnend
.type HalSVCHandler, %function
.global HalSVCHandler
HalSVCHandler:
.fnstart
.cantunwind
TST LR, #0x4
ITE EQ
MRSEQ R0, MSP
MRSNE R0, PSP
LDR R1, [R0,#24]
LDRB R0, [R1,#-2]
MOV R1, #0
B osExcDispatch
.fnend
.type HalExcBusFault, %function
.global HalExcBusFault
HalExcBusFault:
.fnstart
.cantunwind
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
TST R0, #0x8000 // BFARVALID
BEQ _ExcBusNoADDR
LDR R1, =OS_NVIC_BFAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
AND R0, R0, #0x1F00
B osExcCommonBMU
.fnend
.type _ExcBusNoADDR, %function
.global _ExcBusNoADDR
_ExcBusNoADDR:
.fnstart
.cantunwind
MOV R12,#0
B osExcCommonBMU
.fnend
.type HalExcMemFault, %function
.global HalExcMemFault
HalExcMemFault:
.fnstart
.cantunwind
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
TST R0, #0x80 // MMARVALID
BEQ _ExcMemNoADDR
LDR R1, =OS_NVIC_MMAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
AND R0, R0, #0x1B
B osExcCommonBMU
.fnend
.type _ExcMemNoADDR, %function
.global _ExcMemNoADDR
_ExcMemNoADDR:
.fnstart
.cantunwind
MOV R12,#0
B osExcCommonBMU
.fnend
.type HalExcUsageFault, %function
.global HalExcUsageFault
HalExcUsageFault:
.fnstart
.cantunwind
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
MOVW R1, #0x030F
LSL R1, R1, #16
AND R0, R0, R1
MOV R12, #0
.fnend
.type osExcCommonBMU, %function
.global osExcCommonBMU
osExcCommonBMU:
.fnstart
.cantunwind
CLZ R0, R0
LDR R3, =g_uwExcTbl
ADD R3, R3, R0
LDRB R0, [R3]
ORR R0, R0, R12
.fnend
// R0 -- EXCCAUSE(bit 16 is 1 if EXCADDR valid), R1 -- EXCADDR
.type osExcDispatch, %function
.global osExcDispatch
osExcDispatch:
.fnstart
.cantunwind
LDR R2, =OS_NVIC_ACT_BASE
MOV R12, #8 // R12 is hwi check loop counter
.fnend
.type _hwiActiveCheck, %function
.global _hwiActiveCheck
_hwiActiveCheck:
.fnstart
.cantunwind
LDR R3, [R2] // R3 store active hwi register when exc
CMP R3, #0
BEQ _hwiActiveCheckNext
// exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
AND R12, R12, #1
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as pid
.fnend
.type _ExcInMSP, %function
.global _ExcInMSP
_ExcInMSP:
.fnstart
.cantunwind
CMP LR, #0xFFFFFFE9
BNE _NoFloatInMsp
ADD R3, R13, #104
PUSH {R3}
MRS R12, PRIMASK // store message-->exc: disable int?
PUSH {R4-R12} // store message-->exc: {R4-R12}
VPUSH {D8-D15}
B _handleEntry
.fnend
.type _NoFloatInMsp, %function
.global _NoFloatInMsp
_NoFloatInMsp:
.fnstart
.cantunwind
ADD R3, R13, #32
PUSH {R3} // save IRQ SP // store message-->exc: MSP(R13)
MRS R12, PRIMASK // store message-->exc: disable int?
PUSH {R4-R12} // store message-->exc: {R4-R12}
ORR R0, R0, #FLAG_NO_FLOAT
B _handleEntry
.fnend
.type _hwiActiveCheckNext, %function
.global _hwiActiveCheckNext
_hwiActiveCheckNext:
.fnstart
.cantunwind
ADD R2, R2, #4 // next NVIC ACT ADDR
SUBS R12, R12, #1
BNE _hwiActiveCheck
/*NMI interrupt excption*/
LDR R2, =OS_NVIC_SHCSRS
LDRH R2,[R2]
LDR R3,=OS_NVIC_SHCSR_MASK
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
// exc occurred in Task or Init or exc
// reserved for register info from task stack
LDR R2, =g_taskScheduled
LDR R2, [R2]
TST R2, #1 // OS_FLG_BGD_ACTIVE
BEQ _ExcInMSP // if exc occurred in Init then branch
CMP LR, #0xFFFFFFED //auto push floating registers
BNE _NoFloatInPsp
// exc occurred in Task
MOV R2, R13
SUB R13, #96 // add 8 Bytes reg(for STMFD)
MRS R3, PSP
ADD R12, R3, #104
PUSH {R12} // save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
VPUSH {D8-D15}
// copy auto saved task register
LDMFD R3!, {R4-R11} // R4-R11 store PSP reg(auto push when exc in task)
VLDMIA R3!, {D8-D15}
VSTMDB R2!, {D8-D15}
STMFD R2!, {R4-R11}
B _handleEntry
.fnend
.type _NoFloatInPsp, %function
.global _NoFloatInPsp
_NoFloatInPsp:
.fnstart
.cantunwind
MOV R2, R13 // no auto push floating registers
SUB R13, #32 // add 8 Bytes reg(for STMFD)
MRS R3, PSP
ADD R12, R3, #32
PUSH {R12} // save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
LDMFD R3, {R4-R11} // R4-R11 store PSP reg(auto push when exc in task)
STMFD R2!, {R4-R11}
ORR R0, R0, #FLAG_NO_FLOAT
.fnend
.type _handleEntry, %function
.global _handleEntry
_handleEntry:
.fnstart
.cantunwind
MOV R3, R13 // R13:the 4th param
CPSID I
CPSID F
B HalExcHandleEntry
NOP
.fnend

View File

@@ -0,0 +1,433 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdarg.h>
#include "securec.h"
#include "los_context.h"
#include "los_arch_interrupt.h"
#include "los_hook.h"
#include "los_task.h"
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
#define DEF_HANDLER_START_INDEX 2
/* ****************************************************************************
Function : HwiNumGet
Description : Get an interrupt number
Input : None
Output : None
Return : Interrupt Indexes number
**************************************************************************** */
STATIC UINT32 HwiNumGet(VOID)
{
return __get_IPSR();
}
STATIC UINT32 HwiUnmask(HWI_HANDLE_T hwiNum)
{
NVIC_EnableIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiMask(HWI_HANDLE_T hwiNum)
{
NVIC_DisableIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiSetPriority(HWI_HANDLE_T hwiNum, UINT8 priority)
{
NVIC_SetPriority((IRQn_Type)hwiNum, priority);
return LOS_OK;
}
STATIC UINT32 HwiPending(HWI_HANDLE_T hwiNum)
{
NVIC_SetPendingIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiClear(HWI_HANDLE_T hwiNum)
{
NVIC_ClearPendingIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiCreate(HWI_HANDLE_T hwiNum, HWI_PRIOR_T hwiPrio)
{
HwiSetPriority(hwiNum, hwiPrio);
HwiUnmask(hwiNum);
return LOS_OK;
}
STATIC HwiControllerOps g_archHwiOps = {
.enableIrq = HwiUnmask,
.disableIrq = HwiMask,
.setIrqPriority = HwiSetPriority,
.getCurIrqNum = HwiNumGet,
.triggerIrq = HwiPending,
.clearIrq = HwiClear,
.createIrq = HwiCreate,
};
HwiControllerOps *ArchIntOpsGet(VOID)
{
return &g_archHwiOps;
}
/* ****************************************************************************
Function : HalInterrupt
Description : Hardware interrupt entry function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
{
UINT32 hwiIndex;
UINT32 intSave;
#if (LOSCFG_KERNEL_RUNSTOP == 1)
SCB->SCR &= (UINT32) ~((UINT32)SCB_SCR_SLEEPDEEP_Msk);
#endif
intSave = LOS_IntLock();
g_intCount++;
LOS_IntRestore(intSave);
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (g_hwiHandlerForm[hwiIndex].pfnHandler != 0) {
g_hwiHandlerForm[hwiIndex].pfnHandler((VOID *)g_hwiHandlerForm[hwiIndex].pParm);
}
#else
if (g_hwiHandlerForm[hwiIndex] != 0) {
g_hwiHandlerForm[hwiIndex]();
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
g_intCount--;
LOS_IntRestore(intSave);
}
#define FAULT_STATUS_REG_BIT 32
#define USGFAULT (1 << 18)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define UNALIGNFAULT (1 << 3)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
UINT8 g_uwExcTbl[FAULT_STATUS_REG_BIT] = {
0, 0, 0, 0, 0, 0, OS_EXC_UF_DIVBYZERO, OS_EXC_UF_UNALIGNED,
0, 0, 0, 0, OS_EXC_UF_NOCP, OS_EXC_UF_INVPC, OS_EXC_UF_INVSTATE, OS_EXC_UF_UNDEFINSTR,
0, 0, 0, OS_EXC_BF_STKERR, OS_EXC_BF_UNSTKERR, OS_EXC_BF_IMPRECISERR, OS_EXC_BF_PRECISERR, OS_EXC_BF_IBUSERR,
0, 0, 0, OS_EXC_MF_MSTKERR, OS_EXC_MF_MUNSTKERR, 0, OS_EXC_MF_DACCVIOL, OS_EXC_MF_IACCVIOL
};
#if (LOSCFG_KERNEL_PRINTF != 0)
STATIC VOID OsExcNvicDump(VOID)
{
#define OS_NR_NVIC_EXC_DUMP_TYPES 7
UINT32 *base = NULL;
UINT32 len, i, j;
UINT32 rgNvicBases[OS_NR_NVIC_EXC_DUMP_TYPES] = {
OS_NVIC_SETENA_BASE, OS_NVIC_SETPEND_BASE, OS_NVIC_INT_ACT_BASE,
OS_NVIC_PRI_BASE, OS_NVIC_EXCPRI_BASE, OS_NVIC_SHCSR, OS_NVIC_INT_CTRL
};
UINT32 rgNvicLens[OS_NR_NVIC_EXC_DUMP_TYPES] = {
OS_NVIC_INT_ENABLE_SIZE, OS_NVIC_INT_PEND_SIZE, OS_NVIC_INT_ACT_SIZE,
OS_NVIC_INT_PRI_SIZE, OS_NVIC_EXCPRI_SIZE, OS_NVIC_SHCSR_SIZE,
OS_NVIC_INT_CTRL_SIZE
};
CHAR strRgEnable[] = "enable";
CHAR strRgPending[] = "pending";
CHAR strRgActive[] = "active";
CHAR strRgPriority[] = "priority";
CHAR strRgException[] = "exception";
CHAR strRgShcsr[] = "shcsr";
CHAR strRgIntCtrl[] = "control";
CHAR *strRgs[] = {
strRgEnable, strRgPending, strRgActive, strRgPriority,
strRgException, strRgShcsr, strRgIntCtrl
};
PRINTK("\r\nOS exception NVIC dump:\n");
for (i = 0; i < OS_NR_NVIC_EXC_DUMP_TYPES; i++) {
base = (UINT32 *)rgNvicBases[i];
len = rgNvicLens[i];
PRINTK("interrupt %s register, base address: %p, size: 0x%x\n", strRgs[i], base, len);
len = (len >> 2); /* 2: Gets the next register offset */
for (j = 0; j < len; j++) {
PRINTK("0x%x ", *(base + j));
if ((j != 0) && ((j % 16) == 0)) { /* 16: print wrap line */
PRINTK("\n");
}
}
PRINTK("\n");
}
}
STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
{
PRINTK("Current task info:\n");
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
} else if (excInfo->phase == OS_EXC_IN_HWI) {
PRINTK("Exception occur in interrupt phase!\n");
} else {
PRINTK("Exception occur in system init phase!\n");
}
}
STATIC VOID OsExcRegInfo(const ExcInfo *excInfo)
{
PRINTK("Exception reg dump:\n");
PRINTK("PC = 0x%x\n", excInfo->context->uwPC);
PRINTK("LR = 0x%x\n", excInfo->context->uwLR);
PRINTK("SP = 0x%x\n", excInfo->context->uwSP);
PRINTK("R0 = 0x%x\n", excInfo->context->uwR0);
PRINTK("R1 = 0x%x\n", excInfo->context->uwR1);
PRINTK("R2 = 0x%x\n", excInfo->context->uwR2);
PRINTK("R3 = 0x%x\n", excInfo->context->uwR3);
PRINTK("R4 = 0x%x\n", excInfo->context->uwR4);
PRINTK("R5 = 0x%x\n", excInfo->context->uwR5);
PRINTK("R6 = 0x%x\n", excInfo->context->uwR6);
PRINTK("R7 = 0x%x\n", excInfo->context->uwR7);
PRINTK("R8 = 0x%x\n", excInfo->context->uwR8);
PRINTK("R9 = 0x%x\n", excInfo->context->uwR9);
PRINTK("R10 = 0x%x\n", excInfo->context->uwR10);
PRINTK("R11 = 0x%x\n", excInfo->context->uwR11);
PRINTK("R12 = 0x%x\n", excInfo->context->uwR12);
PRINTK("PriMask = 0x%x\n", excInfo->context->uwPriMask);
PRINTK("xPSR = 0x%x\n", excInfo->context->uwxPSR);
}
#if (LOSCFG_KERNEL_BACKTRACE == 1)
STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
{
UINTPTR LR[LOSCFG_BACKTRACE_DEPTH] = {0};
UINT32 index;
OsBackTraceHookCall(LR, LOSCFG_BACKTRACE_DEPTH, 0, excInfo->context->uwSP);
PRINTK("----- backtrace start -----\n");
for (index = 0; index < LOSCFG_BACKTRACE_DEPTH; index++) {
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
#endif
STATIC VOID OsExcMemPoolCheckInfo(VOID)
{
PRINTK("\r\nmemory pools check:\n");
#if (LOSCFG_PLATFORM_EXC == 1)
MemInfoCB memExcInfo[OS_SYS_MEM_NUM];
UINT32 errCnt;
UINT32 i;
(VOID)memset_s(memExcInfo, sizeof(memExcInfo), 0, sizeof(memExcInfo));
errCnt = OsMemExcInfoGet(OS_SYS_MEM_NUM, memExcInfo);
if (errCnt < OS_SYS_MEM_NUM) {
errCnt += OsMemboxExcInfoGet(OS_SYS_MEM_NUM - errCnt, memExcInfo + errCnt);
}
if (errCnt == 0) {
PRINTK("all memory pool check passed!\n");
return;
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
if (ret == LOS_OK) {
PRINTK("system heap memcheck over, all passed!\n");
}
PRINTK("memory pool check end!\n");
}
#endif
STATIC VOID OsExcInfoDisplay(const ExcInfo *excInfo)
{
#if (LOSCFG_KERNEL_PRINTF != 0)
PRINTK("*************Exception Information**************\n");
OsExcTypeInfo(excInfo);
OsExcCurTaskInfo(excInfo);
OsExcRegInfo(excInfo);
#if (LOSCFG_KERNEL_BACKTRACE == 1)
OsExcBackTraceInfo(excInfo);
#endif
OsGetAllTskInfo();
OsExcNvicDump();
OsExcMemPoolCheckInfo();
#endif
}
LITE_OS_SEC_TEXT_INIT VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr)
{
UINT16 tmpFlag = (excType >> 16) & OS_NULL_SHORT; /* 16: Get Exception Type */
g_intCount++;
g_excInfo.nestCnt++;
g_excInfo.type = excType & OS_NULL_SHORT;
if (tmpFlag & OS_EXC_FLAG_FAULTADDR_VALID) {
g_excInfo.faultAddr = faultAddr;
} else {
g_excInfo.faultAddr = OS_EXC_IMPRECISE_ACCESS_ADDR;
}
if (g_losTask.runTask != NULL) {
if (tmpFlag & OS_EXC_FLAG_IN_HWI) {
g_excInfo.phase = OS_EXC_IN_HWI;
g_excInfo.thrdPid = pid;
} else {
g_excInfo.phase = OS_EXC_IN_TASK;
g_excInfo.thrdPid = g_losTask.runTask->taskID;
}
} else {
g_excInfo.phase = OS_EXC_IN_INIT;
g_excInfo.thrdPid = OS_NULL_INT;
}
if (excType & OS_EXC_FLAG_NO_FLOAT) {
g_excInfo.context = (EXC_CONTEXT_S *)((CHAR *)excBufAddr - LOS_OFF_SET_OF(EXC_CONTEXT_S, uwR4));
} else {
g_excInfo.context = excBufAddr;
}
OsDoExcHook(EXC_INTERRUPT);
OsExcInfoDisplay(&g_excInfo);
ArchSysExit();
}
/* ****************************************************************************
Function : HalHwiInit
Description : initialization of the hardware interrupt
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
{
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
HWI_PROC_FUNC *hwiForm = (HWI_PROC_FUNC *)ArchGetHwiFrom();
hwiForm[0] = 0; /* [0] Top of Stack */
hwiForm[1] = 0; /* [1] reset */
for (index = DEF_HANDLER_START_INDEX; index < OS_VECTOR_CNT; index++) {
hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)OsTickHandler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)hwiForm;
#endif
#if (__CORTEX_M >= 0x03U) /* only for Cortex-M3 and above */
NVIC_SetPriorityGrouping(OS_NVIC_AIRCR_PRIGROUP);
#endif
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
#ifdef LOSCFG_ARCH_UNALIGNED_EXC
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);
#else
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT);
#endif
return;
}

View File

@@ -0,0 +1,128 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_timer.h"
#include "los_config.h"
#include "los_tick.h"
#include "los_arch_interrupt.h"
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
STATIC ArchTickTimer g_archTickTimer = {
.freq = 0,
.irqNum = SysTick_IRQn,
.periodMax = LOSCFG_BASE_CORE_TICK_RESPONSE_MAX,
.init = SysTickStart,
.getCycle = SysTickCycleGet,
.reload = SysTickReload,
.lock = SysTickLock,
.unlock = SysTickUnlock,
.tickHandler = NULL,
};
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
{
UINT32 ret;
ArchTickTimer *tick = &g_archTickTimer;
tick->freq = OS_SYS_CLOCK;
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(tick->irqNum, handler, NULL);
#else
OsSetVector(tick->irqNum, handler);
#endif
#endif
ret = SysTick_Config(LOSCFG_BASE_CORE_TICK_RESPONSE_MAX);
if (ret == 1) {
return LOS_ERRNO_TICK_PER_SEC_TOO_SMALL;
}
return LOS_OK;
}
STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
{
if (nextResponseTime > g_archTickTimer.periodMax) {
nextResponseTime = g_archTickTimer.periodMax;
}
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)
{
UINT32 hwCycle = 0;
UINT32 intSave = LOS_IntLock();
UINT32 val = SysTick->VAL;
*period = SysTick->LOAD;
if (val != 0) {
hwCycle = *period - val;
}
LOS_IntRestore(intSave);
return (UINT64)hwCycle;
}
STATIC VOID SysTickLock(VOID)
{
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
}
STATIC VOID SysTickUnlock(VOID)
{
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
}
ArchTickTimer *ArchSysTickTimerGet(VOID)
{
return &g_archTickTimer;
}
UINT32 ArchEnterSleep(VOID)
{
__DSB();
__WFI();
__ISB();
return LOS_OK;
}

View File

@@ -0,0 +1,52 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_m/liteos.gni")
module_name = "arch"
kernel_module(module_name) {
sources = [
"non_secure/los_context.c",
"non_secure/los_dispatch.S",
"non_secure/los_exc.S",
"non_secure/los_interrupt.c",
"non_secure/los_timer.c",
"non_secure/los_trustzone.c",
]
configs += [ "$LITEOSTOPDIR:warn_config" ]
include_dirs = [
"non_secure",
"secure",
]
}
config("public") {
include_dirs = [ "non_secure" ]
}

View File

@@ -0,0 +1,297 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_ATOMIC_H
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
STATIC INLINE INT32 ArchAtomicRead(const Atomic *v)
{
INT32 val;
__asm__ __volatile__("ldrex %0, [%1]\n"
: "=&r"(val)
: "r"(v)
: "cc");
return val;
}
STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
{
UINT32 status;
do {
__asm__ __volatile__("ldrex %0, [%1]\n"
"strex %0, %2, [%1]\n"
: "=&r"(status)
: "r"(v), "r"(setVal)
: "cc");
} while (__builtin_expect(status != 0, 0));
}
STATIC INLINE INT32 ArchAtomicAdd(Atomic *v, INT32 addVal)
{
INT32 val;
UINT32 status;
do {
__asm__ __volatile__("ldrex %1, [%2]\n"
"add %1, %1, %3\n"
"strex %0, %1, [%2]"
: "=&r"(status), "=&r"(val)
: "r"(v), "r"(addVal)
: "cc");
} while (__builtin_expect(status != 0, 0));
return val;
}
STATIC INLINE INT32 ArchAtomicSub(Atomic *v, INT32 subVal)
{
INT32 val;
UINT32 status;
do {
__asm__ __volatile__("ldrex %1, [%2]\n"
"sub %1, %1, %3\n"
"strex %0, %1, [%2]"
: "=&r"(status), "=&r"(val)
: "r"(v), "r"(subVal)
: "cc");
} while (__builtin_expect(status != 0, 0));
return val;
}
STATIC INLINE VOID ArchAtomicInc(Atomic *v)
{
(VOID)ArchAtomicAdd(v, 1);
}
STATIC INLINE VOID ArchAtomicDec(Atomic *v)
{
(VOID)ArchAtomicSub(v, 1);
}
STATIC INLINE INT32 ArchAtomicIncRet(Atomic *v)
{
return ArchAtomicAdd(v, 1);
}
STATIC INLINE INT32 ArchAtomicDecRet(Atomic *v)
{
return ArchAtomicSub(v, 1);
}
/**
* @ingroup los_arch_atomic
* @brief Atomic exchange for 32-bit variable.
*
* @par Description:
* This API is used to implement the atomic exchange for 32-bit variable
* and return the previous value of the atomic variable.
* @attention
* <ul>The pointer v must not be NULL.</ul>
*
* @param v [IN] The variable pointer.
* @param val [IN] The exchange value.
*
* @retval #INT32 The previous value of the atomic variable
* @par Dependency:
* <ul><li>los_arch_atomic.h: the header file that contains the API declaration.</li></ul>
* @see
*/
STATIC INLINE INT32 ArchAtomicXchg32bits(volatile INT32 *v, INT32 val)
{
INT32 prevVal = 0;
UINT32 status = 0;
do {
__asm__ __volatile__("ldrex %0, [%3]\n"
"strex %1, %4, [%3]"
: "=&r"(prevVal), "=&r"(status), "+m"(*v)
: "r"(v), "r"(val)
: "cc");
} while (__builtin_expect(status != 0, 0));
return prevVal;
}
/**
* @ingroup los_arch_atomic
* @brief Atomic exchange for 32-bit variable with compare.
*
* @par Description:
* This API is used to implement the atomic exchange for 32-bit variable, if the value of variable is equal to oldVal.
* @attention
* <ul>The pointer v must not be NULL.</ul>
*
* @param v [IN] The variable pointer.
* @param val [IN] The new value.
* @param oldVal [IN] The old value.
*
* @retval TRUE The previous value of the atomic variable is not equal to oldVal.
* @retval FALSE The previous value of the atomic variable is equal to oldVal.
* @par Dependency:
* <ul><li>los_arch_atomic.h: the header file that contains the API declaration.</li></ul>
* @see
*/
STATIC INLINE BOOL ArchAtomicCmpXchg32bits(volatile INT32 *v, INT32 val, INT32 oldVal)
{
INT32 prevVal = 0;
UINT32 status = 0;
do {
__asm__ __volatile__("ldrex %0, %2\n"
"mov %1, #0\n"
"cmp %0, %3\n"
"bne 1f\n"
"strex %1, %4, %2\n"
"1:"
: "=&r"(prevVal), "=&r"(status), "+Q"(*v)
: "r"(oldVal), "r"(val)
: "cc");
} while (__builtin_expect(status != 0, 0));
return prevVal != oldVal;
}
STATIC INLINE INT64 ArchAtomic64Read(const Atomic64 *v)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE VOID ArchAtomic64Set(Atomic64 *v, INT64 setVal)
{
UINT32 intSave;
intSave = LOS_IntLock();
*v = setVal;
LOS_IntRestore(intSave);
}
STATIC INLINE INT64 ArchAtomic64Add(Atomic64 *v, INT64 addVal)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v += addVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE INT64 ArchAtomic64Sub(Atomic64 *v, INT64 subVal)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v -= subVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE VOID ArchAtomic64Inc(Atomic64 *v)
{
(VOID)ArchAtomic64Add(v, 1);
}
STATIC INLINE INT64 ArchAtomic64IncRet(Atomic64 *v)
{
return ArchAtomic64Add(v, 1);
}
STATIC INLINE VOID ArchAtomic64Dec(Atomic64 *v)
{
(VOID)ArchAtomic64Sub(v, 1);
}
STATIC INLINE INT64 ArchAtomic64DecRet(Atomic64 *v)
{
return ArchAtomic64Sub(v, 1);
}
STATIC INLINE INT64 ArchAtomicXchg64bits(Atomic64 *v, INT64 val)
{
INT64 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
*v = val;
LOS_IntRestore(intSave);
return prevVal;
}
STATIC INLINE BOOL ArchAtomicCmpXchg64bits(Atomic64 *v, INT64 val, INT64 oldVal)
{
INT64 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
if (prevVal == oldVal) {
*v = val;
}
LOS_IntRestore(intSave);
return prevVal != oldVal;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_ATOMIC_H */

View File

@@ -0,0 +1,133 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_CONTEXT_H
#define _LOS_ARCH_CONTEXT_H
#include "los_config.h"
#include "los_compiler.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
typedef struct TagTskContext {
UINT32 secureContext;
UINT32 stackLimit;
UINT32 excReturn;
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
UINT32 S16;
UINT32 S17;
UINT32 S18;
UINT32 S19;
UINT32 S20;
UINT32 S21;
UINT32 S22;
UINT32 S23;
UINT32 S24;
UINT32 S25;
UINT32 S26;
UINT32 S27;
UINT32 S28;
UINT32 S29;
UINT32 S30;
UINT32 S31;
#endif
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
UINT32 uwR0;
UINT32 uwR1;
UINT32 uwR2;
UINT32 uwR3;
UINT32 uwR12;
UINT32 uwLR;
UINT32 uwPC;
UINT32 uwxPSR;
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
UINT32 S0;
UINT32 S1;
UINT32 S2;
UINT32 S3;
UINT32 S4;
UINT32 S5;
UINT32 S6;
UINT32 S7;
UINT32 S8;
UINT32 S9;
UINT32 S10;
UINT32 S11;
UINT32 S12;
UINT32 S13;
UINT32 S14;
UINT32 S15;
UINT32 FPSCR;
UINT32 NO_NAME;
#endif
} TaskContext;
/**
* @ingroup los_config
* @brief: Task start running function.
*
* @par Description:
* This API is used to start a task.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param: None.
*
* @retval None.
*
* @par Dependency:
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalStartToRun(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_CONTEXT_H */

View File

@@ -0,0 +1,621 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_INTERRUPT_H
#define _LOS_ARCH_INTERRUPT_H
#include "los_common_interrupt.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* *
* @ingroup los_arch_interrupt
* Highest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_HIGHEST
#define OS_HWI_PRIO_HIGHEST 0
#endif
/* *
* @ingroup los_arch_interrupt
* Lowest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_LOWEST
#define OS_HWI_PRIO_LOWEST 7
#endif
/* *
* @ingroup los_arch_interrupt
* AIRCR register priority group parameter .
*/
#define OS_NVIC_AIRCR_PRIGROUP 7
/* *
* @ingroup los_arch_interrupt
* Boot interrupt vector table.
*/
extern UINT32 _BootVectors[];
/* *
* @ingroup los_arch_interrupt
* Count of M-Core system interrupt vector.
*/
#define OS_SYS_VECTOR_CNT 16
/* *
* @ingroup los_arch_interrupt
* Count of M-Core interrupt vector.
*/
#define OS_VECTOR_CNT (OS_SYS_VECTOR_CNT + OS_HWI_MAX_NUM)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt number.
*
* Value: 0x02000900
*
* Solution: Ensure that the interrupt number is valid.
* The value range of the interrupt number applicable for a Cortex-M33 platform is [OS_USER_HWI_MIN,OS_USER_HWI_MAX].
*/
#define OS_ERRNO_HWI_NUM_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x00)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Null hardware interrupt handling function.
*
* Value: 0x02000901
*
* Solution: Pass in a valid non-null hardware interrupt handling function.
*/
#define OS_ERRNO_HWI_PROC_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x01)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Insufficient interrupt resources for hardware interrupt creation.
*
* Value: 0x02000902
*
* Solution: Increase the configured maximum number of supported hardware interrupts.
*/
#define OS_ERRNO_HWI_CB_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x02)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Insufficient memory for hardware interrupt initialization.
*
* Value: 0x02000903
*
* Solution: Expand the configured memory.
*/
#define OS_ERRNO_HWI_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x03)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: The interrupt has already been created.
*
* Value: 0x02000904
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x04)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt priority.
*
* Value: 0x02000905
*
* Solution: Ensure that the interrupt priority is valid.
* The value range of the interrupt priority applicable for a Cortex-M33 platform is [0,15].
*/
#define OS_ERRNO_HWI_PRIO_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x05)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Incorrect interrupt creation mode.
*
* Value: 0x02000906
*
* Solution: The interrupt creation mode can be only set to OS_HWI_MODE_COMM or
* OS_HWI_MODE_FAST of which the value can be 0 or 1.
*/
#define OS_ERRNO_HWI_MODE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x06)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: The interrupt has already been created as a fast interrupt.
*
* Value: 0x02000907
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_FASTMODE_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x07)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt operation function.
*
* Value: 0x0200090c
*
* Solution: Set a valid interrupt operation function
*/
#define OS_ERRNO_HWI_OPS_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x0c)
/* *
* @ingroup los_arch_interrupt
* SysTick control and status register.
*/
#define OS_SYSTICK_CONTROL_REG 0xE000E010
/* *
* @ingroup los_hw
* SysTick current value register.
*/
#define OS_SYSTICK_CURRENT_REG 0xE000E018
/* *
* @ingroup los_arch_interrupt
* Interrupt Priority-Level Registers.
*/
#define OS_NVIC_PRI_BASE 0xE000E400
/* *
* @ingroup los_arch_interrupt
* Interrupt enable register for 0-31.
*/
#define OS_NVIC_SETENA_BASE 0xE000E100
/* *
* @ingroup los_arch_interrupt
* interrupt pending register.
*/
#define OS_NVIC_SETPEND_BASE 0xE000E200
/* *
* @ingroup los_arch_interrupt
* Interrupt active register.
*/
#define OS_NVIC_INT_ACT_BASE 0xE000E300
/* *
* @ingroup los_arch_interrupt
* Interrupt disable register for 0-31.
*/
#define OS_NVIC_CLRENA_BASE 0xE000E180
/* *
* @ingroup los_arch_interrupt
* Interrupt control and status register.
*/
#define OS_NVIC_INT_CTRL 0xE000ED04
/* *
* @ingroup los_arch_interrupt
* Vector table offset register.
*/
#define OS_NVIC_VTOR 0xE000ED08
/* *
* @ingroup los_arch_interrupt
* Application interrupt and reset control register
*/
#define OS_NVIC_AIRCR 0xE000ED0C
/* *
* @ingroup los_arch_interrupt
* System exception priority register.
*/
#define OS_NVIC_EXCPRI_BASE 0xE000ED18
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 1 :reset.
*/
#define OS_EXC_RESET 1
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 2 :Non-Maskable Interrupt.
*/
#define OS_EXC_NMI 2
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 3 :(hard)fault.
*/
#define OS_EXC_HARD_FAULT 3
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 4 :MemManage fault.
*/
#define OS_EXC_MPU_FAULT 4
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 5 :Bus fault.
*/
#define OS_EXC_BUS_FAULT 5
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 6 :Usage fault.
*/
#define OS_EXC_USAGE_FAULT 6
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 11 :SVCall.
*/
#define OS_EXC_SVC_CALL 11
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 12 :Debug monitor.
*/
#define OS_EXC_DBG_MONITOR 12
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 14 :PendSV.
*/
#define OS_EXC_PEND_SV 14
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 15 :SysTick.
*/
#define OS_EXC_SYS_TICK 15
/* *
* @ingroup los_arch_interrupt
* @brief: Hardware interrupt entry function.
*
* @par Description:
* This API is used as all hardware interrupt handling function entry.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalInterrupt(VOID);
/* *
* @ingroup los_arch_interrupt
* @brief: Reset the vector table.
*
* @par Description:
* This API is used to reset the vector table.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID Reset_Handler(VOID);
/* *
* @ingroup los_arch_interrupt
* @brief: Pended System Call.
*
* @par Description:
* PendSV can be pended and is useful for an OS to pend an exception
* so that an action can be performed after other important tasks are completed.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalPendSV(VOID);
#define OS_EXC_MAX_BUF_LEN 25
#define OS_EXC_MAX_NEST_DEPTH 1
#define OS_EXC_FLAG_NO_FLOAT 0x10000000
#define OS_NVIC_SHCSR 0xE000ED24
#define OS_NVIC_CCR 0xE000ED14
#define OS_NVIC_INT_ENABLE_SIZE 0x20
#define OS_NVIC_INT_PRI_SIZE 0xF0
#define OS_NVIC_EXCPRI_SIZE 0xC
#define OS_NVIC_INT_CTRL_SIZE 4
#define OS_NVIC_SHCSR_SIZE 4
#define OS_NVIC_INT_PEND_SIZE OS_NVIC_INT_ACT_SIZE
#define OS_NVIC_INT_ACT_SIZE OS_NVIC_INT_ENABLE_SIZE
/**
* @ingroup los_exc
* the struct of register files
*
* description: the register files that saved when exception triggered
*
* notes:the following register with prefix 'uw' correspond to the registers in the cpu data sheet.
*/
typedef struct TagExcContext {
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
UINT32 S16;
UINT32 S17;
UINT32 S18;
UINT32 S19;
UINT32 S20;
UINT32 S21;
UINT32 S22;
UINT32 S23;
UINT32 S24;
UINT32 S25;
UINT32 S26;
UINT32 S27;
UINT32 S28;
UINT32 S29;
UINT32 S30;
UINT32 S31;
#endif
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
/* auto save */
UINT32 uwSP;
UINT32 uwR0;
UINT32 uwR1;
UINT32 uwR2;
UINT32 uwR3;
UINT32 uwR12;
UINT32 uwLR;
UINT32 uwPC;
UINT32 uwxPSR;
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED) && (__FPU_USED== 1U)))
UINT32 S0;
UINT32 S1;
UINT32 S2;
UINT32 S3;
UINT32 S4;
UINT32 S5;
UINT32 S6;
UINT32 S7;
UINT32 S8;
UINT32 S9;
UINT32 S10;
UINT32 S11;
UINT32 S12;
UINT32 S13;
UINT32 S14;
UINT32 S15;
UINT32 FPSCR;
UINT32 NO_NAME;
#endif
} EXC_CONTEXT_S;
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
VOID HalExcNMI(VOID);
VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID);
VOID HalSVCHandler(VOID);
VOID HalHwiInit(VOID);
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the bus status register was being pushed.
*/
#define OS_EXC_BF_STKERR 1
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the bus status register was out of the stack.
*/
#define OS_EXC_BF_UNSTKERR 2
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register imprecise data access violation.
*/
#define OS_EXC_BF_IMPRECISERR 3
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register exact data access violation.
*/
#define OS_EXC_BF_PRECISERR 4
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register access violation while pointing.
*/
#define OS_EXC_BF_IBUSERR 5
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the memory management status register was being pushed.
*/
#define OS_EXC_MF_MSTKERR 6
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the memory management status register was out of the stack.
*/
#define OS_EXC_MF_MUNSTKERR 7
/**
* @ingroup los_exc
* Cortex-M exception types: Memory management status register data access violation.
*/
#define OS_EXC_MF_DACCVIOL 8
/**
* @ingroup los_exc
* Cortex-M exception types: Memory management status register access violation.
*/
#define OS_EXC_MF_IACCVIOL 9
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage indicating that the divisor is zero during the division operation.
*/
#define OS_EXC_UF_DIVBYZERO 10
/**
* @ingroup los_exc
* Cortex-M exception types: Usage error, error caused by unaligned access.
*/
#define OS_EXC_UF_UNALIGNED 11
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage attempting to execute coprocessor related instruction.
*/
#define OS_EXC_UF_NOCP 12
/**
* @ingroup los_exc
* Cortex-M exception types: Usage error attempting to load EXC_RETURN to PC illegally on exception return.
*/
#define OS_EXC_UF_INVPC 13
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage, attempting to cut to ARM state.
*/
#define OS_EXC_UF_INVSTATE 14
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage. Executed instruction whose code is undefined.
*/
#define OS_EXC_UF_UNDEFINSTR 15
/**
* @ingroup los_exc
* Cortex-M exception types: NMI
*/
#define OS_EXC_CAUSE_NMI 16
/**
* @ingroup los_exc
* Cortex-M exception types: hard fault
*/
#define OS_EXC_CAUSE_HARDFAULT 17
/**
* @ingroup los_exc
* Cortex-M exception types: The task handler exits.
*/
#define OS_EXC_CAUSE_TASK_EXIT 18
/**
* @ingroup los_exc
* Cortex-M exception types: A fatal error.
*/
#define OS_EXC_CAUSE_FATAL_ERR 19
/**
* @ingroup los_exc
* Cortex-M exception types: Hard Fault caused by a debug event.
*/
#define OS_EXC_CAUSE_DEBUGEVT 20
/**
* @ingroup los_exc
* Cortex-M exception types: A hard fault that occurs when a quantity is oriented.
*/
#define OS_EXC_CAUSE_VECTBL 21
/**
* @ingroup los_exc
* Exception information structure
*
* Description: Exception information saved when an exception is triggered on the Cortex-M33 platform.
*
*/
typedef struct TagExcInfo {
/**< Exception occurrence phase: 0 means that an exception occurs in initialization,
* 1 means that an exception occurs in a task, and 2 means that an exception occurs in an interrupt */
UINT16 phase;
/**< Exception type. When exceptions occur, check the numbers 1 - 21 listed above */
UINT16 type;
/**< If the exact address access error indicates the wrong access address when the exception occurred */
UINT32 faultAddr;
/**< An exception occurs in an interrupt, indicating the interrupt number.
* An exception occurs in the task, indicating the task ID, or 0xFFFFFFFF if it occurs during initialization */
UINT32 thrdPid;
/**< Number of nested exceptions. Currently only registered hook functions are supported
* when an exception is entered for the first time */
UINT16 nestCnt;
/**< reserve */
UINT16 reserved;
/**< Hardware context at the time an exception to the automatic stack floating-point register occurs */
EXC_CONTEXT_S *context;
} ExcInfo;
extern ExcInfo g_excInfo;
extern UINT32 g_curNestCount;
extern UINT8 g_uwExcTbl[32];
#define MAX_INT_INFO_SIZE (8 + 0x164)
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_INTERRUPT_H */

View File

@@ -0,0 +1,51 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_TIMER_H
#define _LOS_ARCH_TIMER_H
#include "los_config.h"
#include "los_compiler.h"
#include "los_timer.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_TIMER_H */

View File

@@ -0,0 +1,163 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_context.h"
#include "securec.h"
#include "los_arch_context.h"
#include "los_arch_interrupt.h"
#include "los_task.h"
#include "los_sched.h"
#include "los_interrupt.h"
#include "los_debug.h"
/* ****************************************************************************
Function : ArchInit
Description : arch init function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
{
HalHwiInit();
}
/* ****************************************************************************
Function : ArchSysExit
Description : Task exit function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
(VOID)LOS_IntLock();
while (1) {
}
}
/* ****************************************************************************
Function : ArchTskStackInit
Description : Task stack initialization function
Input : taskID --- TaskID
stackSize --- Total size of the stack
topStack --- Top of task's stack
Output : None
Return : Context pointer
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID *ArchTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
{
TaskContext *context = (TaskContext *)((UINTPTR)topStack + stackSize - sizeof(TaskContext));
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
context->S16 = 0xAA000010;
context->S17 = 0xAA000011;
context->S18 = 0xAA000012;
context->S19 = 0xAA000013;
context->S20 = 0xAA000014;
context->S21 = 0xAA000015;
context->S22 = 0xAA000016;
context->S23 = 0xAA000017;
context->S24 = 0xAA000018;
context->S25 = 0xAA000019;
context->S26 = 0xAA00001A;
context->S27 = 0xAA00001B;
context->S28 = 0xAA00001C;
context->S29 = 0xAA00001D;
context->S30 = 0xAA00001E;
context->S31 = 0xAA00001F;
context->S0 = 0xAA000000;
context->S1 = 0xAA000001;
context->S2 = 0xAA000002;
context->S3 = 0xAA000003;
context->S4 = 0xAA000004;
context->S5 = 0xAA000005;
context->S6 = 0xAA000006;
context->S7 = 0xAA000007;
context->S8 = 0xAA000008;
context->S9 = 0xAA000009;
context->S10 = 0xAA00000A;
context->S11 = 0xAA00000B;
context->S12 = 0xAA00000C;
context->S13 = 0xAA00000D;
context->S14 = 0xAA00000E;
context->S15 = 0xAA00000F;
context->FPSCR = 0x00000000;
context->NO_NAME = 0xAA000011;
#endif
context->secureContext = 0UL;
context->stackLimit = (UINT32)topStack;
context->excReturn = 0xFFFFFFBC;
context->uwR4 = 0x04040404L;
context->uwR5 = 0x05050505L;
context->uwR6 = 0x06060606L;
context->uwR7 = 0x07070707L;
context->uwR8 = 0x08080808L;
context->uwR9 = 0x09090909L;
context->uwR10 = 0x10101010L;
context->uwR11 = 0x11111111L;
context->uwPriMask = 0;
context->uwR0 = taskID;
context->uwR1 = 0x01010101L;
context->uwR2 = 0x02020202L;
context->uwR3 = 0x03030303L;
context->uwR12 = 0x12121212L;
context->uwLR = (UINT32)(UINTPTR)ArchSysExit;
context->uwPC = (UINT32)(UINTPTR)OsTaskEntry;
context->uwxPSR = 0x01000000L;
return (VOID *)context;
}
VOID *ArchSignalContextInit(VOID *stackPointer, VOID *stackTop, UINTPTR sigHandler, UINT32 param)
{
TaskContext *context = (TaskContext *)((UINTPTR)stackPointer - sizeof(TaskContext));
(VOID)memset_s((VOID *)context, sizeof(TaskContext), 0, sizeof(TaskContext));
context->uwR0 = param;
context->uwPC = sigHandler;
context->stackLimit = (UINT32)stackTop;
context->excReturn = 0xFFFFFFBC;
context->uwxPSR = 0x01000000L; /* Thumb flag, always set 1 */
return (VOID *)context;
}
LITE_OS_SEC_TEXT_INIT UINT32 ArchStartSchedule(VOID)
{
(VOID)LOS_IntLock();
OsSchedStart();
HalStartToRun();
return LOS_OK; /* never return */
}

View File

@@ -0,0 +1,270 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.syntax unified
.arch armv7e-m
.thumb
.fpu fpv5-d16
.equ OS_FPU_CPACR, 0xE000ED88
.equ OS_FPU_CPACR_ENABLE, 0x00F00000
.equ OS_NVIC_INT_CTRL, 0xE000ED04
.equ OS_NVIC_SYSPRI2, 0xE000ED20
.equ OS_NVIC_PENDSV_PRI, 0xF0F00000
.equ OS_NVIC_PENDSVSET, 0x10000000
.equ OS_TASK_STATUS_RUNNING, 0x0010
.section .text
.thumb
.macro SIGNAL_CONTEXT_RESTORE
PUSH {R12, LR}
BLX OsSignalTaskContextRestore
POP {R12, LR}
CMP R0, #0
MOV R1, R0
BNE SignalContextRestore
.endm
.type HalStartFirstTask, %function
.global HalStartFirstTask
HalStartFirstTask:
MOV R0, #2
MSR CONTROL, R0
LDR R1, =g_losTask
LDR R0, [R1, #4]
LDR R12, [R0] /* Get the stack pointer of the current task. */
LDMFD R12!, {R1-R3} /* Read from stack: R1 = secureContext, R2 = stackLmit and R3 = excReturn.*/
LDR R4, =g_secureContext
STR R1, [R4] /* Set the secureContext to g_secureContext handler. */
MSR PSPLIM, R2 /* Set the stackLmit for the PSPLIM about current task. */
ISB
LDR.W R1, =OS_FPU_CPACR
LDR R1, [R1]
AND R1, R1, #OS_FPU_CPACR_ENABLE
CMP R1, #OS_FPU_CPACR_ENABLE
BNE __DisabledFPU1
ADD R12, R12, #64
VPUSH {S0}
VPOP {S0}
__DisabledFPU1:
ADD R12, R12, #36
MSR PSP, R12
CPSIE I
BX R3
.type ArchIntLock, %function
.global ArchIntLock
ArchIntLock:
.fnstart
.cantunwind
MRS R0, PRIMASK
CPSID I
BX LR
.fnend
.type ArchIntUnLock, %function
.global ArchIntUnLock
ArchIntUnLock:
.fnstart
.cantunwind
MRS R0, PRIMASK
CPSIE I
BX LR
.fnend
.type ArchIntRestore, %function
.global ArchIntRestore
ArchIntRestore:
.fnstart
.cantunwind
MSR PRIMASK, R0
BX LR
.fnend
.type ArchTaskSchedule, %function
.global ArchTaskSchedule
ArchTaskSchedule:
.fnstart
.cantunwind
ldr r0, =OS_NVIC_INT_CTRL
ldr r1, =OS_NVIC_PENDSVSET
str r1, [r0]
dsb
isb
bx lr
.fnend
.type HalPendSV, %function
.global HalPendSV
HalPendSV:
.fnstart
.cantunwind
mrs r12, PRIMASK
cpsid I
HalTaskSwitch:
SIGNAL_CONTEXT_RESTORE
push {r12, lr}
blx OsSchedTaskSwitch
pop {r12, lr}
cmp r0, #0
mov r0, lr
bne TaskContextSwitch
msr PRIMASK, r12
bx lr
TaskContextSwitch:
mov lr, r0
mrs r0, psp
LDR R2, =g_secureContext
LDR R1, [R2]
CBZ R1, __SaveNSContext /* If the g_secureContext is NULL, so no secure context to save. */
PUSH {R0-R1, R12, R14} /* Store registers, include LR, PRIMASK. */
BL HalSecureContextSave /* Store the secure context to g_secureContext->curStackPointer. */
POP {R0-R3}
MOV LR, R3
MOV R12, R2 /* R2 = PRIMASK. */
__SaveNSContext:
STMFD R0!, {R4-R12}
LDR.W R3, =OS_FPU_CPACR
LDR R3, [R3]
AND R3, R3, #OS_FPU_CPACR_ENABLE
CMP R3, #OS_FPU_CPACR_ENABLE
BNE __DisabledFPU2
VSTMDB R0!, {D8-D15}
__DisabledFPU2:
LDR R5, =g_losTask
LDR R6, [R5] /* Get the stackPointer handler of the current task. */
SUBS R0, R0, #12
STR R0, [R6] /* Save the new top of stack in TCB. */
MRS R2, PSPLIM
MOV R3, LR
STMIA R0!, {R1, R2-R3} /* Store g_secureContext, PSPLIM and LR on the stack of current task. */
LDR R0, [R5, #4]
STR R0, [R5]
LDR R1, [R0]
SignalContextRestore:
LDMIA R1!, {R0, R2-R3} /* Restore secureContext, PSPLIM and LR from the current task stack. */
MSR PSPLIM, R2
MOV LR, R3
LDR R2, =g_secureContext
STR R0, [R2] /* Set the secureContext of the new task to g_secureContext. */
CBZ R0, __RestoreNSContext /* If there is no secure context for the new task, so restore from the non-secure context. */
PUSH {R1, R3}
BL HalSecureContextLoad /* Restore the secure context. */
POP {R1, R3}
MOV LR, R3
__RestoreNSContext:
LDR.W R3, =OS_FPU_CPACR
LDR R3, [R3]
AND R3, R3, #OS_FPU_CPACR_ENABLE
CMP R3, #OS_FPU_CPACR_ENABLE
BNE __DisabledFPU3
VLDMIA R1!, {D8-D15}
__DisabledFPU3:
LDMFD R1!, {R4-R12}
MSR PSP, R1
MSR PRIMASK, R12
BX LR
.fnend
.type HalSVCStartSchedule, %function
.global HalSVCStartSchedule
HalSVCStartSchedule:
.fnstart
.cantunwind
LDR R4, =OS_NVIC_SYSPRI2
LDR R5, =OS_NVIC_PENDSV_PRI
STR R5, [R4]
CPSIE I
DSB
ISB
SVC 2
.fnend
.type HalSVCSecureContextAlloc, %function
.global HalSVCSecureContextAlloc
HalSVCSecureContextAlloc:
.fnstart
.cantunwind
SVC 0
BX LR
.fnend
.type HalSVCSecureContextFree, %function
.global HalSVCSecureContextFree
HalSVCSecureContextFree:
.fnstart
.cantunwind
SVC 1
BX LR
.fnend
.type HalSVCHandler, %function
.global HalSVCHandler
HalSVCHandler:
.fnstart
.cantunwind
TST LR, #0x04
ITE EQ
MRSEQ R1, MSP
MRSNE R1, PSP
LDR R0, [R1, #24]
LDRB R0, [R0, #-2] /* Get the SVC number. */
PUSH {LR}
MOV R2, R1 /* Get the stack for R2. */
LDMFD R2!, {R1} /* Get the input arg for HalSecureSVCHandler. */
STMFD R2!, {R1}
BL HalSecureSVCHandler
POP {LR}
BX LR
.fnend

View File

@@ -0,0 +1,368 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.syntax unified
.arch armv7e-m
.thumb
.fpu fpv5-d16
.section .text
.global HalExcNMI
.global HalExcHardFault
.global HalExcMemFault
.global HalExcBusFault
.global HalExcUsageFault
.extern HalExcHandleEntry
.extern g_uwExcTbl
.extern g_taskScheduled
.equ OS_FLG_BGD_ACTIVE, 0x0002
.equ OS_EXC_CAUSE_NMI, 16
.equ OS_EXC_CAUSE_HARDFAULT, 17
.equ HF_DEBUGEVT, 20
.equ HF_VECTBL, 21
.equ FLAG_ADDR_VALID, 0x10000
.equ FLAG_HWI_ACTIVE, 0x20000
.equ FLAG_NO_FLOAT, 0x10000000
.equ OS_NVIC_FSR , 0xE000ED28 //include BusFault/MemFault/UsageFault State Register
.equ OS_NVIC_HFSR , 0xE000ED2C //HardFault State Register
.equ OS_NVIC_BFAR , 0xE000ED38
.equ OS_NVIC_MMAR , 0xE000ED34
.equ OS_NVIC_ACT_BASE , 0xE000E300
.equ OS_NVIC_SHCSRS , 0xE000ED24
.equ OS_NVIC_SHCSR_MASK , 0xC00
.type HalExcNMI, %function
.global HalExcNMI
HalExcNMI:
.fnstart
.cantunwind
MOV R0, #OS_EXC_CAUSE_NMI
MOV R1, #0
B osExcDispatch
.fnend
.type HalExcHardFault, %function
.global HalExcHardFault
HalExcHardFault:
.fnstart
.cantunwind
MOV R0, #OS_EXC_CAUSE_HARDFAULT
LDR R2, =OS_NVIC_HFSR
LDR R2, [R2]
MOV R1, #HF_DEBUGEVT
ORR R0, R0, R1, LSL #0x8
TST R2, #0x80000000
BNE osExcDispatch // DEBUGEVT
AND R0, R0 , #0x000000FF
MOV R1, #HF_VECTBL
ORR R0, R0, R1, LSL #0x8
TST R2, #0x00000002
BNE osExcDispatch // VECTBL
//if not DEBUGEVT and VECTBL then is FORCED
AND R0, R0, #0x000000FF
LDR R2, =OS_NVIC_FSR
LDR R2, [R2]
TST R2, #0x8000 // BFARVALID
BNE _HFBusFault // BusFault
TST R2, #0x80 // MMARVALID
BNE _HFMemFault // MemFault
MOV R12,#0
B osHFExcCommonBMU
.fnend
.type _HFBusFault, %function
_HFBusFault:
.fnstart
.cantunwind
LDR R1, =OS_NVIC_BFAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
B osHFExcCommonBMU
.fnend
.type _HFMemFault, %function
_HFMemFault:
.fnstart
.cantunwind
LDR R1, =OS_NVIC_MMAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
.fnend
.type osHFExcCommonBMU, %function
.global osHFExcCommonBMU
osHFExcCommonBMU:
.fnstart
.cantunwind
CLZ R2, R2
LDR R3, =g_uwExcTbl
ADD R3, R3, R2
LDRB R2, [R3]
ORR R0, R0, R2, LSL #0x8
ORR R0, R0 ,R12
B osExcDispatch
.fnend
.type HalExcBusFault, %function
.global HalExcBusFault
HalExcBusFault:
.fnstart
.cantunwind
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
TST R0, #0x8000 // BFARVALID
BEQ _ExcBusNoADDR
LDR R1, =OS_NVIC_BFAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
AND R0, R0, #0x1F00
B osExcCommonBMU
.fnend
.type _ExcBusNoADDR, %function
.global _ExcBusNoADDR
_ExcBusNoADDR:
.fnstart
.cantunwind
MOV R12,#0
B osExcCommonBMU
.fnend
.type HalExcMemFault, %function
.global HalExcMemFault
HalExcMemFault:
.fnstart
.cantunwind
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
TST R0, #0x80 // MMARVALID
BEQ _ExcMemNoADDR
LDR R1, =OS_NVIC_MMAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
AND R0, R0, #0x1B
B osExcCommonBMU
.fnend
.type _ExcMemNoADDR, %function
.global _ExcMemNoADDR
_ExcMemNoADDR:
.fnstart
.cantunwind
MOV R12,#0
B osExcCommonBMU
.fnend
.type HalExcUsageFault, %function
.global HalExcUsageFault
HalExcUsageFault:
.fnstart
.cantunwind
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
MOVW R1, #0x030F
LSL R1, R1, #16
AND R0, R0, R1
MOV R12, #0
.fnend
.type osExcCommonBMU, %function
.global osExcCommonBMU
osExcCommonBMU:
.fnstart
.cantunwind
CLZ R0, R0
LDR R3, =g_uwExcTbl
ADD R3, R3, R0
LDRB R0, [R3]
ORR R0, R0, R12
.fnend
// R0 -- EXCCAUSE(bit 16 is 1 if EXCADDR valid), R1 -- EXCADDR
.type osExcDispatch, %function
.global osExcDispatch
osExcDispatch:
.fnstart
.cantunwind
LDR R2, =OS_NVIC_ACT_BASE
MOV R12, #8 // R12 is hwi check loop counter
.fnend
.type _hwiActiveCheck, %function
.global _hwiActiveCheck
_hwiActiveCheck:
.fnstart
.cantunwind
LDR R3, [R2] // R3 store active hwi register when exc
CMP R3, #0
BEQ _hwiActiveCheckNext
// exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
AND R12, R12, #1
ADD R2, R2, R12, LSL #5 // calculate R2 (hwi number) as pid
.fnend
.type _ExcInMSP, %function
.global _ExcInMSP
_ExcInMSP:
.fnstart
.cantunwind
CMP LR, #0xFFFFFFE9
BNE _NoFloatInMsp
ADD R3, R13, #104
PUSH {R3}
MRS R12, PRIMASK // store message-->exc: disable int?
PUSH {R4-R12} // store message-->exc: {R4-R12}
VPUSH {D8-D15}
B _handleEntry
.fnend
.type _NoFloatInMsp, %function
.global _NoFloatInMsp
_NoFloatInMsp:
.fnstart
.cantunwind
ADD R3, R13, #32
PUSH {R3} // save IRQ SP // store message-->exc: MSP(R13)
MRS R12, PRIMASK // store message-->exc: disable int?
PUSH {R4-R12} // store message-->exc: {R4-R12}
ORR R0, R0, #FLAG_NO_FLOAT
B _handleEntry
.fnend
.type _hwiActiveCheckNext, %function
.global _hwiActiveCheckNext
_hwiActiveCheckNext:
.fnstart
.cantunwind
ADD R2, R2, #4 // next NVIC ACT ADDR
SUBS R12, R12, #1
BNE _hwiActiveCheck
/*NMI interrupt excption*/
LDR R2, =OS_NVIC_SHCSRS
LDRH R2,[R2]
LDR R3,=OS_NVIC_SHCSR_MASK
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
// exc occurred in Task or Init or exc
// reserved for register info from task stack
LDR R2, =g_taskScheduled
LDR R2, [R2]
TST R2, #1 // OS_FLG_BGD_ACTIVE
BEQ _ExcInMSP // if exc occurred in Init then branch
CMP LR, #0xFFFFFFED //auto push floating registers
BNE _NoFloatInPsp
// exc occurred in Task
MOV R2, R13
SUB R13, #96 // add 8 Bytes reg(for STMFD)
MRS R3, PSP
ADD R12, R3, #104
PUSH {R12} // save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
VPUSH {D8-D15}
// copy auto saved task register
LDMFD R3!, {R4-R11} // R4-R11 store PSP reg(auto push when exc in task)
VLDMIA R3!, {D8-D15}
VSTMDB R2!, {D8-D15}
STMFD R2!, {R4-R11}
B _handleEntry
.fnend
.type _NoFloatInPsp, %function
.global _NoFloatInPsp
_NoFloatInPsp:
.fnstart
.cantunwind
MOV R2, R13 // no auto push floating registers
SUB R13, #32 // add 8 Bytes reg(for STMFD)
MRS R3, PSP
ADD R12, R3, #32
PUSH {R12} // save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
LDMFD R3, {R4-R11} // R4-R11 store PSP reg(auto push when exc in task)
STMFD R2!, {R4-R11}
ORR R0, R0, #FLAG_NO_FLOAT
.fnend
.type _handleEntry, %function
.global _handleEntry
_handleEntry:
.fnstart
.cantunwind
MOV R3, R13 // R13:the 4th param
CPSID I
CPSID F
B HalExcHandleEntry
NOP
.fnend

View File

@@ -0,0 +1,433 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdarg.h>
#include "securec.h"
#include "los_context.h"
#include "los_arch_interrupt.h"
#include "los_hook.h"
#include "los_task.h"
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
#define DEF_HANDLER_START_INDEX 2
/* ****************************************************************************
Function : HwiNumGet
Description : Get an interrupt number
Input : None
Output : None
Return : Interrupt Indexes number
**************************************************************************** */
STATIC UINT32 HwiNumGet(VOID)
{
return __get_IPSR();
}
STATIC UINT32 HwiUnmask(HWI_HANDLE_T hwiNum)
{
NVIC_EnableIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiMask(HWI_HANDLE_T hwiNum)
{
NVIC_DisableIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiSetPriority(HWI_HANDLE_T hwiNum, UINT8 priority)
{
NVIC_SetPriority((IRQn_Type)hwiNum, priority);
return LOS_OK;
}
STATIC UINT32 HwiPending(HWI_HANDLE_T hwiNum)
{
NVIC_SetPendingIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiClear(HWI_HANDLE_T hwiNum)
{
NVIC_ClearPendingIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiCreate(HWI_HANDLE_T hwiNum, HWI_PRIOR_T hwiPrio)
{
HwiSetPriority(hwiNum, hwiPrio);
HwiUnmask(hwiNum);
return LOS_OK;
}
STATIC HwiControllerOps g_archHwiOps = {
.enableIrq = HwiUnmask,
.disableIrq = HwiMask,
.setIrqPriority = HwiSetPriority,
.getCurIrqNum = HwiNumGet,
.triggerIrq = HwiPending,
.clearIrq = HwiClear,
.createIrq = HwiCreate,
};
HwiControllerOps *ArchIntOpsGet(VOID)
{
return &g_archHwiOps;
}
/* ****************************************************************************
Function : HalInterrupt
Description : Hardware interrupt entry function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
{
UINT32 hwiIndex;
UINT32 intSave;
#if (LOSCFG_KERNEL_RUNSTOP == 1)
SCB->SCR &= (UINT32) ~((UINT32)SCB_SCR_SLEEPDEEP_Msk);
#endif
intSave = LOS_IntLock();
g_intCount++;
LOS_IntRestore(intSave);
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (g_hwiHandlerForm[hwiIndex].pfnHandler != 0) {
g_hwiHandlerForm[hwiIndex].pfnHandler((VOID *)g_hwiHandlerForm[hwiIndex].pParm);
}
#else
if (g_hwiHandlerForm[hwiIndex] != 0) {
g_hwiHandlerForm[hwiIndex]();
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
g_intCount--;
LOS_IntRestore(intSave);
}
#define FAULT_STATUS_REG_BIT 32
#define USGFAULT (1 << 18)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define UNALIGNFAULT (1 << 3)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
UINT8 g_uwExcTbl[FAULT_STATUS_REG_BIT] = {
0, 0, 0, 0, 0, 0, OS_EXC_UF_DIVBYZERO, OS_EXC_UF_UNALIGNED,
0, 0, 0, 0, OS_EXC_UF_NOCP, OS_EXC_UF_INVPC, OS_EXC_UF_INVSTATE, OS_EXC_UF_UNDEFINSTR,
0, 0, 0, OS_EXC_BF_STKERR, OS_EXC_BF_UNSTKERR, OS_EXC_BF_IMPRECISERR, OS_EXC_BF_PRECISERR, OS_EXC_BF_IBUSERR,
0, 0, 0, OS_EXC_MF_MSTKERR, OS_EXC_MF_MUNSTKERR, 0, OS_EXC_MF_DACCVIOL, OS_EXC_MF_IACCVIOL
};
#if (LOSCFG_KERNEL_PRINTF != 0)
STATIC VOID OsExcNvicDump(VOID)
{
#define OS_NR_NVIC_EXC_DUMP_TYPES 7
UINT32 *base = NULL;
UINT32 len, i, j;
UINT32 rgNvicBases[OS_NR_NVIC_EXC_DUMP_TYPES] = {
OS_NVIC_SETENA_BASE, OS_NVIC_SETPEND_BASE, OS_NVIC_INT_ACT_BASE,
OS_NVIC_PRI_BASE, OS_NVIC_EXCPRI_BASE, OS_NVIC_SHCSR, OS_NVIC_INT_CTRL
};
UINT32 rgNvicLens[OS_NR_NVIC_EXC_DUMP_TYPES] = {
OS_NVIC_INT_ENABLE_SIZE, OS_NVIC_INT_PEND_SIZE, OS_NVIC_INT_ACT_SIZE,
OS_NVIC_INT_PRI_SIZE, OS_NVIC_EXCPRI_SIZE, OS_NVIC_SHCSR_SIZE,
OS_NVIC_INT_CTRL_SIZE
};
CHAR strRgEnable[] = "enable";
CHAR strRgPending[] = "pending";
CHAR strRgActive[] = "active";
CHAR strRgPriority[] = "priority";
CHAR strRgException[] = "exception";
CHAR strRgShcsr[] = "shcsr";
CHAR strRgIntCtrl[] = "control";
CHAR *strRgs[] = {
strRgEnable, strRgPending, strRgActive, strRgPriority,
strRgException, strRgShcsr, strRgIntCtrl
};
PRINTK("\r\nOS exception NVIC dump:\n");
for (i = 0; i < OS_NR_NVIC_EXC_DUMP_TYPES; i++) {
base = (UINT32 *)rgNvicBases[i];
len = rgNvicLens[i];
PRINTK("interrupt %s register, base address: %p, size: 0x%x\n", strRgs[i], base, len);
len = (len >> 2); /* 2: Gets the next register offset */
for (j = 0; j < len; j++) {
PRINTK("0x%x ", *(base + j));
if ((j != 0) && ((j % 16) == 0)) { /* 16: print wrap line */
PRINTK("\n");
}
}
PRINTK("\n");
}
}
STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
{
PRINTK("Current task info:\n");
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
} else if (excInfo->phase == OS_EXC_IN_HWI) {
PRINTK("Exception occur in interrupt phase!\n");
} else {
PRINTK("Exception occur in system init phase!\n");
}
}
STATIC VOID OsExcRegInfo(const ExcInfo *excInfo)
{
PRINTK("Exception reg dump:\n");
PRINTK("PC = 0x%x\n", excInfo->context->uwPC);
PRINTK("LR = 0x%x\n", excInfo->context->uwLR);
PRINTK("SP = 0x%x\n", excInfo->context->uwSP);
PRINTK("R0 = 0x%x\n", excInfo->context->uwR0);
PRINTK("R1 = 0x%x\n", excInfo->context->uwR1);
PRINTK("R2 = 0x%x\n", excInfo->context->uwR2);
PRINTK("R3 = 0x%x\n", excInfo->context->uwR3);
PRINTK("R4 = 0x%x\n", excInfo->context->uwR4);
PRINTK("R5 = 0x%x\n", excInfo->context->uwR5);
PRINTK("R6 = 0x%x\n", excInfo->context->uwR6);
PRINTK("R7 = 0x%x\n", excInfo->context->uwR7);
PRINTK("R8 = 0x%x\n", excInfo->context->uwR8);
PRINTK("R9 = 0x%x\n", excInfo->context->uwR9);
PRINTK("R10 = 0x%x\n", excInfo->context->uwR10);
PRINTK("R11 = 0x%x\n", excInfo->context->uwR11);
PRINTK("R12 = 0x%x\n", excInfo->context->uwR12);
PRINTK("PriMask = 0x%x\n", excInfo->context->uwPriMask);
PRINTK("xPSR = 0x%x\n", excInfo->context->uwxPSR);
}
#if (LOSCFG_KERNEL_BACKTRACE == 1)
STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
{
UINTPTR LR[LOSCFG_BACKTRACE_DEPTH] = {0};
UINT32 index;
OsBackTraceHookCall(LR, LOSCFG_BACKTRACE_DEPTH, 0, excInfo->context->uwSP);
PRINTK("----- backtrace start -----\n");
for (index = 0; index < LOSCFG_BACKTRACE_DEPTH; index++) {
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
#endif
STATIC VOID OsExcMemPoolCheckInfo(VOID)
{
PRINTK("\r\nmemory pools check:\n");
#if (LOSCFG_PLATFORM_EXC == 1)
MemInfoCB memExcInfo[OS_SYS_MEM_NUM];
UINT32 errCnt;
UINT32 i;
(VOID)memset_s(memExcInfo, sizeof(memExcInfo), 0, sizeof(memExcInfo));
errCnt = OsMemExcInfoGet(OS_SYS_MEM_NUM, memExcInfo);
if (errCnt < OS_SYS_MEM_NUM) {
errCnt += OsMemboxExcInfoGet(OS_SYS_MEM_NUM - errCnt, memExcInfo + errCnt);
}
if (errCnt == 0) {
PRINTK("all memory pool check passed!\n");
return;
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
if (ret == LOS_OK) {
PRINTK("system heap memcheck over, all passed!\n");
}
PRINTK("memory pool check end!\n");
}
#endif
STATIC VOID OsExcInfoDisplay(const ExcInfo *excInfo)
{
#if (LOSCFG_KERNEL_PRINTF != 0)
PRINTK("*************Exception Information**************\n");
OsExcTypeInfo(excInfo);
OsExcCurTaskInfo(excInfo);
OsExcRegInfo(excInfo);
#if (LOSCFG_KERNEL_BACKTRACE == 1)
OsExcBackTraceInfo(excInfo);
#endif
OsGetAllTskInfo();
OsExcNvicDump();
OsExcMemPoolCheckInfo();
#endif
}
LITE_OS_SEC_TEXT_INIT VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr)
{
UINT16 tmpFlag = (excType >> 16) & OS_NULL_SHORT; /* 16: Get Exception Type */
g_intCount++;
g_excInfo.nestCnt++;
g_excInfo.type = excType & OS_NULL_SHORT;
if (tmpFlag & OS_EXC_FLAG_FAULTADDR_VALID) {
g_excInfo.faultAddr = faultAddr;
} else {
g_excInfo.faultAddr = OS_EXC_IMPRECISE_ACCESS_ADDR;
}
if (g_losTask.runTask != NULL) {
if (tmpFlag & OS_EXC_FLAG_IN_HWI) {
g_excInfo.phase = OS_EXC_IN_HWI;
g_excInfo.thrdPid = pid;
} else {
g_excInfo.phase = OS_EXC_IN_TASK;
g_excInfo.thrdPid = g_losTask.runTask->taskID;
}
} else {
g_excInfo.phase = OS_EXC_IN_INIT;
g_excInfo.thrdPid = OS_NULL_INT;
}
if (excType & OS_EXC_FLAG_NO_FLOAT) {
g_excInfo.context = (EXC_CONTEXT_S *)((CHAR *)excBufAddr - LOS_OFF_SET_OF(EXC_CONTEXT_S, uwR4));
} else {
g_excInfo.context = excBufAddr;
}
OsDoExcHook(EXC_INTERRUPT);
OsExcInfoDisplay(&g_excInfo);
ArchSysExit();
}
/* ****************************************************************************
Function : HalHwiInit
Description : initialization of the hardware interrupt
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
{
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
HWI_PROC_FUNC *hwiForm = (HWI_PROC_FUNC *)ArchGetHwiFrom();
hwiForm[0] = 0; /* [0] Top of Stack */
hwiForm[1] = 0; /* [1] reset */
for (index = DEF_HANDLER_START_INDEX; index < OS_VECTOR_CNT; index++) {
hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)OsTickHandler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)hwiForm;
#endif
#if (__CORTEX_M >= 0x03U) /* only for Cortex-M3 and above */
NVIC_SetPriorityGrouping(OS_NVIC_AIRCR_PRIGROUP);
#endif
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
#ifdef LOSCFG_ARCH_UNALIGNED_EXC
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);
#else
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT);
#endif
return;
}

View File

@@ -0,0 +1,127 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_timer.h"
#include "los_config.h"
#include "los_tick.h"
#include "los_arch_interrupt.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
STATIC ArchTickTimer g_archTickTimer = {
.freq = 0,
.irqNum = SysTick_IRQn,
.periodMax = LOSCFG_BASE_CORE_TICK_RESPONSE_MAX,
.init = SysTickStart,
.getCycle = SysTickCycleGet,
.reload = SysTickReload,
.lock = SysTickLock,
.unlock = SysTickUnlock,
.tickHandler = NULL,
};
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
{
UINT32 ret;
ArchTickTimer *tick = &g_archTickTimer;
tick->freq = OS_SYS_CLOCK;
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(tick->irqNum, handler, NULL);
#else
OsSetVector(tick->irqNum, handler);
#endif
#endif
ret = SysTick_Config(g_cyclesPerTick);
if (ret == 1) {
return LOS_ERRNO_TICK_PER_SEC_TOO_SMALL;
}
return LOS_OK;
}
STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
{
if (nextResponseTime > g_archTickTimer.periodMax) {
nextResponseTime = g_archTickTimer.periodMax;
}
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)
{
UINT32 hwCycle = 0;
UINT32 intSave = LOS_IntLock();
UINT32 val = SysTick->VAL;
*period = SysTick->LOAD;
if (val != 0) {
hwCycle = *period - val;
}
LOS_IntRestore(intSave);
return (UINT64)hwCycle;
}
STATIC VOID SysTickLock(VOID)
{
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
}
STATIC VOID SysTickUnlock(VOID)
{
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
}
ArchTickTimer *ArchSysTickTimerGet(VOID)
{
return &g_archTickTimer;
}
UINT32 ArchEnterSleep(VOID)
{
__DSB();
__WFI();
__ISB();
return LOS_OK;
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_trustzone.h"
#include "los_secure_macros.h"
#include "los_secure_context.h"
#include "los_debug.h"
#include "los_arch_context.h"
#include "los_interrupt.h"
OsSecureContext *g_secureContext = NULL;
VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
{
switch (svcID) {
case OS_SVC_START_SCHEDULE:
HalSecureContextInit();
HalStartFirstTask();
break;
case OS_SVC_ALLOCATE_SECURE_CONTEXT:
g_secureContext = HalSecureContextAlloc(arg);
LOS_ASSERT(g_secureContext != NULL);
HalSecureContextLoad(g_secureContext);
break;
case OS_SVC_FREE_SECURE_CONTEXT:
LOS_ASSERT(g_secureContext != NULL);
HalSecureContextFree(g_secureContext);
break;
default:
PRINT_ERR("Incorrect svc id = %u\n", svcID);
break;
}
}
VOID HalStartToRun(VOID)
{
HalSVCStartSchedule();
}
VOID LOS_SecureContextAlloc(UINT32 secureStackSize)
{
if (secureStackSize == 0) {
return;
}
LOS_ASSERT((__get_IPSR() == 0) && (__get_PRIMASK() == 0));
secureStackSize = LOS_Align(secureStackSize, sizeof(UINTPTR));
HalSVCSecureContextAlloc(secureStackSize);
}
VOID LOS_SecureContextFree(VOID)
{
HalSVCSecureContextFree();
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_TRUSTZONE_H
#define _LOS_TRUSTZONE_H
#include "los_config.h"
#include "los_task.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
extern VOID LOS_SecureContextAlloc(UINT32 secureStackSize);
extern VOID LOS_SecureContextFree(VOID);
extern VOID HalStartFirstTask(VOID);
extern VOID HalSVCStartSchedule(VOID);
extern VOID HalSVCSecureContextAlloc(UINT32 secureStackSize);
extern VOID HalSVCSecureContextFree(VOID);
extern VOID HalSVCHandler(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif

View File

@@ -0,0 +1,98 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_secure_context.h"
#include "los_secure_macros.h"
#include "los_secure_heap.h"
OS_CMSE_NS_ENTRY VOID HalSecureContextInit(VOID)
{
UINT32 ipsr;
OS_IPSR_READ(ipsr);
if (!ipsr) {
return;
}
HalSecureContextInitAsm();
}
OS_CMSE_NS_ENTRY OsSecureContext *HalSecureContextAlloc(UINT32 size)
{
OsSecureContext *secureContext = NULL;
UINT32 ipsr;
OS_IPSR_READ(ipsr);
if (!ipsr) {
return NULL;
}
secureContext = HalSecureMalloc(sizeof(OsSecureContext));
if (secureContext == NULL) {
return NULL;
}
secureContext->stackLimit = HalSecureMalloc(size);
if (secureContext->stackLimit == NULL) {
HalSecureFree(secureContext);
return NULL;
}
secureContext->stackStart = secureContext->stackLimit + size;
secureContext->curStackPointer = secureContext->stackStart;
return secureContext;
}
OS_CMSE_NS_ENTRY VOID HalSecureContextFree(OsSecureContext *secureContext)
{
UINT32 ipsr;
OS_IPSR_READ(ipsr);
if (!ipsr) {
return;
}
HalSecureFree(secureContext->stackLimit);
secureContext->stackLimit = NULL;
HalSecureFree(secureContext);
}
OS_CMSE_NS_ENTRY VOID HalSecureContextLoad(OsSecureContext *secureContext)
{
HalSecureContextLoadAsm(secureContext);
}
OS_CMSE_NS_ENTRY VOID HalSecureContextSave(OsSecureContext *secureContext)
{
HalSecureContextSaveAsm(secureContext);
}

View File

@@ -0,0 +1,65 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_SECURE_CONTEXT_H
#define _LOS_SECURE_CONTEXT_H
#include "los_config.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
typedef struct {
UINT8 *curStackPointer;
UINT8 *stackLimit;
UINT8 *stackStart;
} OsSecureContext;
extern VOID HalSecureContextInit(VOID);
extern OsSecureContext *HalSecureContextAlloc(UINT32 size);
extern VOID HalSecureContextFree(OsSecureContext *secureContext);
extern VOID HalSecureContextLoad(OsSecureContext *secureContext);
extern VOID HalSecureContextSave(OsSecureContext *secureContext);
extern VOID HalSecureContextInitAsm(VOID);
extern VOID HalSecureContextLoadAsm(OsSecureContext *secureContext);
extern VOID HalSecureContextSaveAsm(OsSecureContext *secureContext);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif

View File

@@ -0,0 +1,100 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.syntax unified
.arch armv7e-m
.thumb
.fpu fpv5-d16
.equ OS_SECURE_SCB_AIRCR, 0xE000ED0C
.section .text
.thumb
.type HalSecureContextInitAsm, %function
.global HalSecureContextInitAsm
HalSecureContextInitAsm:
.fnstart
.cantunwind
LDR R0, =OS_SECURE_SCB_AIRCR
LDR R1, [R0]
MOV R2, #0xFFFF
LSL R2, R2, #16
BIC R1, R1, R2
MOV R2, #0x05FA
LSL R2, R2, #16
ORR R1, R1, R2
BIC R1, R1, #0x4000
MOV R2, #0x4000
ORR R1, R1, R2
STR R1, [R0]
MOV R0, #0
MSR PSPLIM, R0
MSR PSP, R0
MOV R0, #2
MSR CONTROL, R0
BX LR
.fnend
.type HalSecureContextLoadAsm, %function
.global HalSecureContextLoadAsm
HalSecureContextLoadAsm:
.fnstart
.cantunwind
MRS R1, IPSR
CBZ R1, __ThreadMode
LDMIA R0!, {R1, R2} /* R1 = g_secureContext->curStackPointer, R2 = g_secureContext->stackLimit. */
MSR PSPLIM, R2 /* Restore PSPLIM. */
MSR PSP, R1 /* Restore PSP. */
BX LR
.fnend
.type HalSecureContextSaveAsm, %function
.global HalSecureContextSaveAsm
HalSecureContextSaveAsm:
.fnstart
.cantunwind
MRS R0, IPSR
CBZ R0, __ThreadMode
MRS R0, PSP
STR R0, [R1] /* g_secureContext->curStackPointer = R0. */
MOV R0, #0
MSR PSPLIM, R0 /* No PSPLIM for the current task. */
MSR PSP, R0 /* No secure stack for the current task. */
.fnend
__ThreadMode:
BX LR

View File

@@ -0,0 +1,229 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_secure_heap.h"
#include "los_secure_macros.h"
#include "los_config.h"
#include "los_list.h"
STATIC UINT8 __attribute__((aligned(0x4)))g_secureHeap[LOSCFG_SECURE_HEAP_SIZE] = {0};
STATIC LOS_DL_LIST g_secureHeapFreeList = {NULL, NULL};
struct OsSecureHeapNode {
LOS_DL_LIST freeNode;
struct OsSecureHeapNode *preNode;
UINT32 size : 24;
UINT32 used : 8;
};
#define OS_SECURE_HEAP_NODE_HEAD_SIZE sizeof(struct OsSecureHeapNode)
#define OS_SECURE_HEAP_ALIGN_SIZE sizeof(UINTPTR)
#define OS_SECURE_HEAP_NODE_USED 1
#define OS_SECURE_HEAP_NODE_FREE 0
#define OS_SECURE_HEAP_FIRST_NODE ((struct OsSecureHeapNode *)g_secureHeap)
#define OS_SECURE_HEAP_NEXT_NODE(node) \
((struct OsSecureHeapNode *)((UINT8 *)(node) + (node)->size))
#define OS_SECURE_HEAP_END_NODE \
((struct OsSecureHeapNode *)((UINT8 *)g_secureHeap + LOSCFG_SECURE_HEAP_SIZE - OS_SECURE_HEAP_NODE_HEAD_SIZE))
STATIC INLINE VOID OsSecureHeapListInit(LOS_DL_LIST *head)
{
head->pstPrev = head;
head->pstNext = head;
}
STATIC INLINE VOID OsSecureHeapListDelete(LOS_DL_LIST *node)
{
node->pstNext->pstPrev = node->pstPrev;
node->pstPrev->pstNext = node->pstNext;
node->pstNext = NULL;
node->pstPrev = NULL;
}
STATIC INLINE VOID OsSecureHeapListAdd(LOS_DL_LIST *listNode, LOS_DL_LIST *node)
{
node->pstNext = listNode->pstNext;
node->pstPrev = listNode;
listNode->pstNext->pstPrev = node;
listNode->pstNext = node;
}
STATIC struct OsSecureHeapNode *OsSecureHeapFindSuitableFreeBlock(UINT32 allocSize)
{
LOS_DL_LIST *listNodeHead = &g_secureHeapFreeList;
struct OsSecureHeapNode *tmpNode = NULL;
LOS_DL_LIST_FOR_EACH_ENTRY(tmpNode, listNodeHead, struct OsSecureHeapNode, freeNode) {
if (tmpNode->size >= allocSize) {
return tmpNode;
}
}
return NULL;
}
STATIC INLINE VOID OsSecureHeapClearNode(struct OsSecureHeapNode *node)
{
node->preNode = NULL;
node->size = 0;
node->used = 0;
node->freeNode.pstPrev = NULL;
node->freeNode.pstNext = NULL;
}
STATIC INLINE VOID OsSecureHeapMergeNode(struct OsSecureHeapNode *node)
{
struct OsSecureHeapNode *nextNode = NULL;
node->preNode->size += node->size;
nextNode = (struct OsSecureHeapNode *)((UINTPTR)node + node->size);
nextNode->preNode = node->preNode;
OsSecureHeapClearNode(node);
}
STATIC INLINE VOID OsSecureHeapSplitNode(struct OsSecureHeapNode *allocNode, UINT32 allocSize)
{
struct OsSecureHeapNode *newFreeNode = NULL;
struct OsSecureHeapNode *nextNode = NULL;
newFreeNode = (struct OsSecureHeapNode *)((UINT8 *)allocNode + allocSize);
newFreeNode->preNode = allocNode;
newFreeNode->size = allocNode->size - allocSize;
newFreeNode->used = OS_SECURE_HEAP_NODE_FREE;
allocNode->size = allocSize;
nextNode = OS_SECURE_HEAP_NEXT_NODE(newFreeNode);
nextNode->preNode = newFreeNode;
if (nextNode->used == OS_SECURE_HEAP_NODE_FREE) {
OsSecureHeapListDelete(&nextNode->freeNode);
OsSecureHeapMergeNode(nextNode);
}
OsSecureHeapListAdd(&g_secureHeapFreeList, &newFreeNode->freeNode);
}
STATIC INLINE VOID OsSecureHeapFreeNode(struct OsSecureHeapNode *node)
{
struct OsSecureHeapNode *nextNode = NULL;
if ((node->preNode != NULL) && (node->preNode->used == OS_SECURE_HEAP_NODE_FREE)) {
struct OsSecureHeapNode *preNode = node->preNode;
OsSecureHeapMergeNode(node);
nextNode = OS_SECURE_HEAP_NEXT_NODE(preNode);
if (nextNode->used == OS_SECURE_HEAP_NODE_FREE) {
OsSecureHeapListDelete(&nextNode->freeNode);
OsSecureHeapMergeNode(nextNode);
}
OsSecureHeapListDelete(&preNode->freeNode);
preNode->used = OS_SECURE_HEAP_NODE_FREE;
OsSecureHeapListAdd(&g_secureHeapFreeList, &preNode->freeNode);
} else {
nextNode = OS_SECURE_HEAP_NEXT_NODE(node);
if (nextNode->used == OS_SECURE_HEAP_NODE_FREE) {
OsSecureHeapListDelete(&nextNode->freeNode);
OsSecureHeapMergeNode(nextNode);
}
node->used = OS_SECURE_HEAP_NODE_FREE;
OsSecureHeapListAdd(&g_secureHeapFreeList, &node->freeNode);
}
}
STATIC INLINE VOID *OsSecureHeapAllocNode(UINT32 size)
{
struct OsSecureHeapNode *allocNode = NULL;
UINT32 allocSize;
allocSize = LOS_Align(size + OS_SECURE_HEAP_NODE_HEAD_SIZE, OS_SECURE_HEAP_ALIGN_SIZE);
allocNode = OsSecureHeapFindSuitableFreeBlock(allocSize);
if (allocNode == NULL) {
return NULL;
}
if ((allocSize + OS_SECURE_HEAP_NODE_HEAD_SIZE + OS_SECURE_HEAP_ALIGN_SIZE) <= allocNode->size) {
OsSecureHeapSplitNode(allocNode, allocSize);
}
OsSecureHeapListDelete(&allocNode->freeNode);
allocNode->used = OS_SECURE_HEAP_NODE_USED;
return (allocNode + 1);
}
STATIC INLINE VOID OsSecureHeapInit(VOID)
{
struct OsSecureHeapNode *newNode = NULL;
struct OsSecureHeapNode *endNode = NULL;
newNode = OS_SECURE_HEAP_FIRST_NODE;
newNode->size = LOSCFG_SECURE_HEAP_SIZE - OS_SECURE_HEAP_NODE_HEAD_SIZE;
newNode->preNode = OS_SECURE_HEAP_END_NODE;
newNode->used = OS_SECURE_HEAP_NODE_FREE;
OsSecureHeapListInit(&g_secureHeapFreeList);
OsSecureHeapListAdd(&g_secureHeapFreeList, &newNode->freeNode);
endNode = OS_SECURE_HEAP_END_NODE;
endNode->preNode = newNode;
endNode->size = OS_SECURE_HEAP_NODE_HEAD_SIZE;
endNode->used = OS_SECURE_HEAP_NODE_USED;
}
OS_CMSE_NS_ENTRY VOID *HalSecureMalloc(UINT32 size)
{
if (size == 0) {
return NULL;
}
if ((g_secureHeapFreeList.pstPrev == NULL) &&
(g_secureHeapFreeList.pstNext == NULL)) {
OsSecureHeapInit();
}
return OsSecureHeapAllocNode(size);
}
OS_CMSE_NS_ENTRY VOID HalSecureFree(VOID *ptr)
{
struct OsSecureHeapNode *node = NULL;
if (ptr == NULL) {
return;
}
node = (struct OsSecureHeapNode *)((UINTPTR)ptr - OS_SECURE_HEAP_NODE_HEAD_SIZE);
if (node->used != OS_SECURE_HEAP_NODE_USED) {
return;
}
OsSecureHeapFreeNode(node);
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -29,10 +29,10 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_PRINTF_PRI_H
#define _LOS_PRINTF_PRI_H
#ifndef _LOS_SECURE_HEAP_H
#define _LOS_SECURE_HEAP_H
#include "los_printf.h"
#include "los_config.h"
#ifdef __cplusplus
#if __cplusplus
@@ -40,10 +40,8 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
VOID _dprintf(const CHAR *fmt, va_list ap);
INT32 __dprintf(const CHAR *fmt, va_list ap, VOID (*uart_fputc)(UINT32 n, VOID *cookie), CHAR *cookie);
VOID *HalSecureMalloc(UINT32 size);
VOID HalSecureFree(VOID *ptr);
#ifdef __cplusplus
#if __cplusplus
@@ -51,4 +49,5 @@ INT32 __dprintf(const CHAR *fmt, va_list ap, VOID (*uart_fputc)(UINT32 n, VOID *
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_PRINTF_PRI_H */
#endif

View File

@@ -0,0 +1,58 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_SECURE_MACROS_H
#define _LOS_SECURE_MACROS_H
#include "los_config.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define OS_CMSE_NS_ENTRY __attribute__((cmse_nonsecure_entry))
#define OS_CMSE_NS_CALL __attribute__((cmse_nonsecure_call))
#define OS_IPSR_READ(ipsr) __asm volatile("MRS %0, IPSR" : "=r" (ipsr))
#define OS_SVC_ALLOCATE_SECURE_CONTEXT 0
#define OS_SVC_FREE_SECURE_CONTEXT 1
#define OS_SVC_START_SCHEDULE 2
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif

View File

@@ -0,0 +1,37 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_m/liteos.gni")
module_group("iar") {
if (defined(LOSCFG_SECURE_TRUSTZONE)) {
modules = [ "TZ" ]
} else {
modules = [ "NTZ" ]
}
}

View File

@@ -0,0 +1,45 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_m/liteos.gni")
module_name = "arch"
kernel_module(module_name) {
sources = [
"los_context.c",
"los_dispatch.S",
"los_exc.S",
"los_interrupt.c",
"los_timer.c",
]
configs += [ "$LITEOSTOPDIR:warn_config" ]
}
config("public") {
include_dirs = [ "." ]
}

View File

@@ -0,0 +1,297 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_ATOMIC_H
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
STATIC INLINE INT32 ArchAtomicRead(const Atomic *v)
{
INT32 val;
asm volatile("ldrex %0, [%1]\n"
: "=&r"(val)
: "r"(v)
: "cc");
return val;
}
STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
{
UINT32 status;
do {
asm volatile("ldrex %0, [%1]\n"
"strex %0, %2, [%1]\n"
: "=&r"(status)
: "r"(v), "r"(setVal)
: "cc");
} while (status != 0);
}
STATIC INLINE INT32 ArchAtomicAdd(Atomic *v, INT32 addVal)
{
INT32 val;
UINT32 status;
do {
asm volatile("ldrex %1, [%2]\n"
"add %1, %1, %3\n"
"strex %0, %1, [%2]"
: "=&r"(status), "=&r"(val)
: "r"(v), "r"(addVal)
: "cc");
} while (status != 0);
return val;
}
STATIC INLINE INT32 ArchAtomicSub(Atomic *v, INT32 subVal)
{
INT32 val;
UINT32 status;
do {
asm volatile("ldrex %1, [%2]\n"
"sub %1, %1, %3\n"
"strex %0, %1, [%2]"
: "=&r"(status), "=&r"(val)
: "r"(v), "r"(subVal)
: "cc");
} while (status != 0);
return val;
}
STATIC INLINE VOID ArchAtomicInc(Atomic *v)
{
(VOID)ArchAtomicAdd(v, 1);
}
STATIC INLINE VOID ArchAtomicDec(Atomic *v)
{
(VOID)ArchAtomicSub(v, 1);
}
STATIC INLINE INT32 ArchAtomicIncRet(Atomic *v)
{
return ArchAtomicAdd(v, 1);
}
STATIC INLINE INT32 ArchAtomicDecRet(Atomic *v)
{
return ArchAtomicSub(v, 1);
}
/**
* @ingroup los_arch_atomic
* @brief Atomic exchange for 32-bit variable.
*
* @par Description:
* This API is used to implement the atomic exchange for 32-bit variable
* and return the previous value of the atomic variable.
* @attention
* <ul>The pointer v must not be NULL.</ul>
*
* @param v [IN] The variable pointer.
* @param val [IN] The exchange value.
*
* @retval #INT32 The previous value of the atomic variable
* @par Dependency:
* <ul><li>los_arch_atomic.h: the header file that contains the API declaration.</li></ul>
* @see
*/
STATIC INLINE INT32 ArchAtomicXchg32bits(volatile INT32 *v, INT32 val)
{
INT32 prevVal = 0;
UINT32 status = 0;
do {
asm volatile("ldrex %0, [%2]\n"
"strex %1, %3, [%2]"
: "=&r"(prevVal), "=&r"(status)
: "r"(v), "r"(val)
: "cc");
} while (status != 0);
return prevVal;
}
/**
* @ingroup los_arch_atomic
* @brief Atomic exchange for 32-bit variable with compare.
*
* @par Description:
* This API is used to implement the atomic exchange for 32-bit variable, if the value of variable is equal to oldVal.
* @attention
* <ul>The pointer v must not be NULL.</ul>
*
* @param v [IN] The variable pointer.
* @param val [IN] The new value.
* @param oldVal [IN] The old value.
*
* @retval TRUE The previous value of the atomic variable is not equal to oldVal.
* @retval FALSE The previous value of the atomic variable is equal to oldVal.
* @par Dependency:
* <ul><li>los_arch_atomic.h: the header file that contains the API declaration.</li></ul>
* @see
*/
STATIC INLINE BOOL ArchAtomicCmpXchg32bits(volatile INT32 *v, INT32 val, INT32 oldVal)
{
INT32 prevVal = 0;
UINT32 status = 0;
do {
asm volatile("ldrex %0, [%2]\n"
"mov %1, #0\n"
"cmp %0, %3\n"
"bne 1f\n"
"strex %1, %4, [%2]\n"
"1:"
: "=&r"(prevVal), "=&r"(status)
: "r"(v), "r"(oldVal), "r"(val)
: "cc");
} while (status != 0);
return prevVal != oldVal;
}
STATIC INLINE INT64 ArchAtomic64Read(const Atomic64 *v)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE VOID ArchAtomic64Set(Atomic64 *v, INT64 setVal)
{
UINT32 intSave;
intSave = LOS_IntLock();
*v = setVal;
LOS_IntRestore(intSave);
}
STATIC INLINE INT64 ArchAtomic64Add(Atomic64 *v, INT64 addVal)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v += addVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE INT64 ArchAtomic64Sub(Atomic64 *v, INT64 subVal)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v -= subVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE VOID ArchAtomic64Inc(Atomic64 *v)
{
(VOID)ArchAtomic64Add(v, 1);
}
STATIC INLINE INT64 ArchAtomic64IncRet(Atomic64 *v)
{
return ArchAtomic64Add(v, 1);
}
STATIC INLINE VOID ArchAtomic64Dec(Atomic64 *v)
{
(VOID)ArchAtomic64Sub(v, 1);
}
STATIC INLINE INT64 ArchAtomic64DecRet(Atomic64 *v)
{
return ArchAtomic64Sub(v, 1);
}
STATIC INLINE INT64 ArchAtomicXchg64bits(Atomic64 *v, INT64 val)
{
INT64 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
*v = val;
LOS_IntRestore(intSave);
return prevVal;
}
STATIC INLINE BOOL ArchAtomicCmpXchg64bits(Atomic64 *v, INT64 val, INT64 oldVal)
{
INT64 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
if (prevVal == oldVal) {
*v = val;
}
LOS_IntRestore(intSave);
return prevVal != oldVal;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_ATOMIC_H */

View File

@@ -0,0 +1,131 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_CONTEXT_H
#define _LOS_ARCH_CONTEXT_H
#include "los_config.h"
#include "los_compiler.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
typedef struct TagTskContext {
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
UINT32 S16;
UINT32 S17;
UINT32 S18;
UINT32 S19;
UINT32 S20;
UINT32 S21;
UINT32 S22;
UINT32 S23;
UINT32 S24;
UINT32 S25;
UINT32 S26;
UINT32 S27;
UINT32 S28;
UINT32 S29;
UINT32 S30;
UINT32 S31;
#endif
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
UINT32 uwR0;
UINT32 uwR1;
UINT32 uwR2;
UINT32 uwR3;
UINT32 uwR12;
UINT32 uwLR;
UINT32 uwPC;
UINT32 uwxPSR;
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
UINT32 S0;
UINT32 S1;
UINT32 S2;
UINT32 S3;
UINT32 S4;
UINT32 S5;
UINT32 S6;
UINT32 S7;
UINT32 S8;
UINT32 S9;
UINT32 S10;
UINT32 S11;
UINT32 S12;
UINT32 S13;
UINT32 S14;
UINT32 S15;
UINT32 FPSCR;
UINT32 NO_NAME;
#endif
} TaskContext;
/**
* @ingroup los_config
* @brief: Task start running function.
*
* @par Description:
* This API is used to start a task.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param: None.
*
* @retval None.
*
* @par Dependency:
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalStartToRun(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_CONTEXT_H */

View File

@@ -0,0 +1,621 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_INTERRUPT_H
#define _LOS_ARCH_INTERRUPT_H
#include "los_common_interrupt.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* *
* @ingroup los_arch_interrupt
* Highest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_HIGHEST
#define OS_HWI_PRIO_HIGHEST 0
#endif
/* *
* @ingroup los_arch_interrupt
* Lowest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_LOWEST
#define OS_HWI_PRIO_LOWEST 7
#endif
/* *
* @ingroup los_arch_interrupt
* AIRCR register priority group parameter .
*/
#define OS_NVIC_AIRCR_PRIGROUP 7
/* *
* @ingroup los_arch_interrupt
* Boot interrupt vector table.
*/
extern UINT32 _BootVectors[];
/* *
* @ingroup los_arch_interrupt
* Count of M-Core system interrupt vector.
*/
#define OS_SYS_VECTOR_CNT 16
/* *
* @ingroup los_arch_interrupt
* Count of M-Core interrupt vector.
*/
#define OS_VECTOR_CNT (OS_SYS_VECTOR_CNT + OS_HWI_MAX_NUM)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt number.
*
* Value: 0x02000900
*
* Solution: Ensure that the interrupt number is valid.
* The value range of the interrupt number applicable for a Cortex-M33 platform is [OS_USER_HWI_MIN,OS_USER_HWI_MAX].
*/
#define OS_ERRNO_HWI_NUM_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x00)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Null hardware interrupt handling function.
*
* Value: 0x02000901
*
* Solution: Pass in a valid non-null hardware interrupt handling function.
*/
#define OS_ERRNO_HWI_PROC_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x01)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Insufficient interrupt resources for hardware interrupt creation.
*
* Value: 0x02000902
*
* Solution: Increase the configured maximum number of supported hardware interrupts.
*/
#define OS_ERRNO_HWI_CB_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x02)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Insufficient memory for hardware interrupt initialization.
*
* Value: 0x02000903
*
* Solution: Expand the configured memory.
*/
#define OS_ERRNO_HWI_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x03)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: The interrupt has already been created.
*
* Value: 0x02000904
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x04)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt priority.
*
* Value: 0x02000905
*
* Solution: Ensure that the interrupt priority is valid.
* The value range of the interrupt priority applicable for a Cortex-M33 platform is [0,15].
*/
#define OS_ERRNO_HWI_PRIO_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x05)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Incorrect interrupt creation mode.
*
* Value: 0x02000906
*
* Solution: The interrupt creation mode can be only set to OS_HWI_MODE_COMM or
* OS_HWI_MODE_FAST of which the value can be 0 or 1.
*/
#define OS_ERRNO_HWI_MODE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x06)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: The interrupt has already been created as a fast interrupt.
*
* Value: 0x02000907
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_FASTMODE_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x07)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt operation function.
*
* Value: 0x0200090c
*
* Solution: Set a valid interrupt operation function
*/
#define OS_ERRNO_HWI_OPS_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x0c)
/* *
* @ingroup los_arch_interrupt
* SysTick control and status register.
*/
#define OS_SYSTICK_CONTROL_REG 0xE000E010
/* *
* @ingroup los_hw
* SysTick current value register.
*/
#define OS_SYSTICK_CURRENT_REG 0xE000E018
/* *
* @ingroup los_arch_interrupt
* Interrupt Priority-Level Registers.
*/
#define OS_NVIC_PRI_BASE 0xE000E400
/* *
* @ingroup los_arch_interrupt
* Interrupt enable register for 0-31.
*/
#define OS_NVIC_SETENA_BASE 0xE000E100
/* *
* @ingroup los_arch_interrupt
* interrupt pending register.
*/
#define OS_NVIC_SETPEND_BASE 0xE000E200
/* *
* @ingroup los_arch_interrupt
* Interrupt active register.
*/
#define OS_NVIC_INT_ACT_BASE 0xE000E300
/* *
* @ingroup los_arch_interrupt
* Interrupt disable register for 0-31.
*/
#define OS_NVIC_CLRENA_BASE 0xE000E180
/* *
* @ingroup los_arch_interrupt
* Interrupt control and status register.
*/
#define OS_NVIC_INT_CTRL 0xE000ED04
/* *
* @ingroup los_arch_interrupt
* Vector table offset register.
*/
#define OS_NVIC_VTOR 0xE000ED08
/* *
* @ingroup los_arch_interrupt
* Application interrupt and reset control register
*/
#define OS_NVIC_AIRCR 0xE000ED0C
/* *
* @ingroup los_arch_interrupt
* System exception priority register.
*/
#define OS_NVIC_EXCPRI_BASE 0xE000ED18
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 1 :reset.
*/
#define OS_EXC_RESET 1
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 2 :Non-Maskable Interrupt.
*/
#define OS_EXC_NMI 2
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 3 :(hard)fault.
*/
#define OS_EXC_HARD_FAULT 3
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 4 :MemManage fault.
*/
#define OS_EXC_MPU_FAULT 4
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 5 :Bus fault.
*/
#define OS_EXC_BUS_FAULT 5
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 6 :Usage fault.
*/
#define OS_EXC_USAGE_FAULT 6
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 11 :SVCall.
*/
#define OS_EXC_SVC_CALL 11
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 12 :Debug monitor.
*/
#define OS_EXC_DBG_MONITOR 12
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 14 :PendSV.
*/
#define OS_EXC_PEND_SV 14
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 15 :SysTick.
*/
#define OS_EXC_SYS_TICK 15
/* *
* @ingroup los_hwi
* @brief: Hardware interrupt entry function.
*
* @par Description:
* This API is used as all hardware interrupt handling function entry.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalInterrupt(VOID);
/* *
* @ingroup los_arch_interrupt
* @brief: Reset the vector table.
*
* @par Description:
* This API is used to reset the vector table.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID Reset_Handler(VOID);
/* *
* @ingroup los_arch_interrupt
* @brief: Pended System Call.
*
* @par Description:
* PendSV can be pended and is useful for an OS to pend an exception
* so that an action can be performed after other important tasks are completed.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalPendSV(VOID);
#define OS_EXC_MAX_BUF_LEN 25
#define OS_EXC_MAX_NEST_DEPTH 1
#define OS_EXC_FLAG_NO_FLOAT 0x10000000
#define OS_NVIC_SHCSR 0xE000ED24
#define OS_NVIC_CCR 0xE000ED14
#define OS_NVIC_INT_ENABLE_SIZE 0x20
#define OS_NVIC_INT_PRI_SIZE 0xF0
#define OS_NVIC_EXCPRI_SIZE 0xC
#define OS_NVIC_INT_CTRL_SIZE 4
#define OS_NVIC_SHCSR_SIZE 4
#define OS_NVIC_INT_PEND_SIZE OS_NVIC_INT_ACT_SIZE
#define OS_NVIC_INT_ACT_SIZE OS_NVIC_INT_ENABLE_SIZE
/**
* @ingroup los_exc
* the struct of register files
*
* description: the register files that saved when exception triggered
*
* notes:the following register with prefix 'uw' correspond to the registers in the cpu data sheet.
*/
typedef struct TagExcContext {
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
UINT32 S16;
UINT32 S17;
UINT32 S18;
UINT32 S19;
UINT32 S20;
UINT32 S21;
UINT32 S22;
UINT32 S23;
UINT32 S24;
UINT32 S25;
UINT32 S26;
UINT32 S27;
UINT32 S28;
UINT32 S29;
UINT32 S30;
UINT32 S31;
#endif
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
/* auto save */
UINT32 uwSP;
UINT32 uwR0;
UINT32 uwR1;
UINT32 uwR2;
UINT32 uwR3;
UINT32 uwR12;
UINT32 uwLR;
UINT32 uwPC;
UINT32 uwxPSR;
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED) && (__FPU_USED== 1U)))
UINT32 S0;
UINT32 S1;
UINT32 S2;
UINT32 S3;
UINT32 S4;
UINT32 S5;
UINT32 S6;
UINT32 S7;
UINT32 S8;
UINT32 S9;
UINT32 S10;
UINT32 S11;
UINT32 S12;
UINT32 S13;
UINT32 S14;
UINT32 S15;
UINT32 FPSCR;
UINT32 NO_NAME;
#endif
} EXC_CONTEXT_S;
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
VOID HalExcNMI(VOID);
VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID);
VOID HalSVCHandler(VOID);
VOID HalHwiInit(VOID);
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the bus status register was being pushed.
*/
#define OS_EXC_BF_STKERR 1
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the bus status register was out of the stack.
*/
#define OS_EXC_BF_UNSTKERR 2
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register imprecise data access violation.
*/
#define OS_EXC_BF_IMPRECISERR 3
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register exact data access violation.
*/
#define OS_EXC_BF_PRECISERR 4
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register access violation while pointing.
*/
#define OS_EXC_BF_IBUSERR 5
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the memory management status register was being pushed.
*/
#define OS_EXC_MF_MSTKERR 6
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the memory management status register was out of the stack.
*/
#define OS_EXC_MF_MUNSTKERR 7
/**
* @ingroup los_exc
* Cortex-M exception types: Memory management status register data access violation.
*/
#define OS_EXC_MF_DACCVIOL 8
/**
* @ingroup los_exc
* Cortex-M exception types: Memory management status register access violation.
*/
#define OS_EXC_MF_IACCVIOL 9
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage indicating that the divisor is zero during the division operation.
*/
#define OS_EXC_UF_DIVBYZERO 10
/**
* @ingroup los_exc
* Cortex-M exception types: Usage error, error caused by unaligned access.
*/
#define OS_EXC_UF_UNALIGNED 11
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage attempting to execute coprocessor related instruction.
*/
#define OS_EXC_UF_NOCP 12
/**
* @ingroup los_exc
* Cortex-M exception types: Usage error attempting to load EXC_RETURN to PC illegally on exception return.
*/
#define OS_EXC_UF_INVPC 13
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage, attempting to cut to ARM state.
*/
#define OS_EXC_UF_INVSTATE 14
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage. Executed instruction whose code is undefined.
*/
#define OS_EXC_UF_UNDEFINSTR 15
/**
* @ingroup los_exc
* Cortex-M exception types: NMI
*/
#define OS_EXC_CAUSE_NMI 16
/**
* @ingroup los_exc
* Cortex-M exception types: hard fault
*/
#define OS_EXC_CAUSE_HARDFAULT 17
/**
* @ingroup los_exc
* Cortex-M exception types: The task handler exits.
*/
#define OS_EXC_CAUSE_TASK_EXIT 18
/**
* @ingroup los_exc
* Cortex-M exception types: A fatal error.
*/
#define OS_EXC_CAUSE_FATAL_ERR 19
/**
* @ingroup los_exc
* Cortex-M exception types: Hard Fault caused by a debug event.
*/
#define OS_EXC_CAUSE_DEBUGEVT 20
/**
* @ingroup los_exc
* Cortex-M exception types: A hard fault that occurs when a quantity is oriented.
*/
#define OS_EXC_CAUSE_VECTBL 21
/**
* @ingroup los_exc
* Exception information structure
*
* Description: Exception information saved when an exception is triggered on the Cortex-M33 platform.
*
*/
typedef struct TagExcInfo {
/**< Exception occurrence phase: 0 means that an exception occurs in initialization,
* 1 means that an exception occurs in a task, and 2 means that an exception occurs in an interrupt */
UINT16 phase;
/**< Exception type. When exceptions occur, check the numbers 1 - 21 listed above */
UINT16 type;
/**< If the exact address access error indicates the wrong access address when the exception occurred */
UINT32 faultAddr;
/**< An exception occurs in an interrupt, indicating the interrupt number.
* An exception occurs in the task, indicating the task ID, or 0xFFFFFFFF if it occurs during initialization */
UINT32 thrdPid;
/**< Number of nested exceptions. Currently only registered hook functions are supported
* when an exception is entered for the first time */
UINT16 nestCnt;
/**< reserve */
UINT16 reserved;
/**< Hardware context at the time an exception to the automatic stack floating-point register occurs */
EXC_CONTEXT_S *context;
} ExcInfo;
extern ExcInfo g_excInfo;
extern UINT32 g_curNestCount;
extern UINT8 g_uwExcTbl[32];
#define MAX_INT_INFO_SIZE (8 + 0x164)
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_INTERRUPT_H */

View File

@@ -1,52 +1,52 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_EVENT_PRI_H
#define _LOS_EVENT_PRI_H
#include "los_event.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
extern UINT32 OsEventReadOnce(PEVENT_CB_S eventCB, UINT32 eventMask, UINT32 mode, UINT32 timeOut);
extern UINT32 OsEventWriteOnce(PEVENT_CB_S eventCB, UINT32 events);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_EVENT_PRI_H */
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_TIMER_H
#define _LOS_ARCH_TIMER_H
#include "los_config.h"
#include "los_compiler.h"
#include "los_timer.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_TIMER_H */

View File

@@ -0,0 +1,158 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_context.h"
#include "securec.h"
#include "los_arch_context.h"
#include "los_arch_interrupt.h"
#include "los_task.h"
#include "los_sched.h"
#include "los_interrupt.h"
#include "los_debug.h"
/* ****************************************************************************
Function : ArchInit
Description : arch init function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
{
HalHwiInit();
}
/* ****************************************************************************
Function : ArchSysExit
Description : Task exit function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
(VOID)LOS_IntLock();
while (1) {
}
}
/* ****************************************************************************
Function : ArchTskStackInit
Description : Task stack initialization function
Input : taskID --- TaskID
stackSize --- Total size of the stack
topStack --- Top of task's stack
Output : None
Return : Context pointer
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID *ArchTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
{
TaskContext *context = (TaskContext *)((UINTPTR)topStack + stackSize - sizeof(TaskContext));
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
context->S16 = 0xAA000010;
context->S17 = 0xAA000011;
context->S18 = 0xAA000012;
context->S19 = 0xAA000013;
context->S20 = 0xAA000014;
context->S21 = 0xAA000015;
context->S22 = 0xAA000016;
context->S23 = 0xAA000017;
context->S24 = 0xAA000018;
context->S25 = 0xAA000019;
context->S26 = 0xAA00001A;
context->S27 = 0xAA00001B;
context->S28 = 0xAA00001C;
context->S29 = 0xAA00001D;
context->S30 = 0xAA00001E;
context->S31 = 0xAA00001F;
context->S0 = 0xAA000000;
context->S1 = 0xAA000001;
context->S2 = 0xAA000002;
context->S3 = 0xAA000003;
context->S4 = 0xAA000004;
context->S5 = 0xAA000005;
context->S6 = 0xAA000006;
context->S7 = 0xAA000007;
context->S8 = 0xAA000008;
context->S9 = 0xAA000009;
context->S10 = 0xAA00000A;
context->S11 = 0xAA00000B;
context->S12 = 0xAA00000C;
context->S13 = 0xAA00000D;
context->S14 = 0xAA00000E;
context->S15 = 0xAA00000F;
context->FPSCR = 0x00000000;
context->NO_NAME = 0xAA000011;
#endif
context->uwR4 = 0x04040404L;
context->uwR5 = 0x05050505L;
context->uwR6 = 0x06060606L;
context->uwR7 = 0x07070707L;
context->uwR8 = 0x08080808L;
context->uwR9 = 0x09090909L;
context->uwR10 = 0x10101010L;
context->uwR11 = 0x11111111L;
context->uwPriMask = 0;
context->uwR0 = taskID;
context->uwR1 = 0x01010101L;
context->uwR2 = 0x02020202L;
context->uwR3 = 0x03030303L;
context->uwR12 = 0x12121212L;
context->uwLR = (UINT32)(UINTPTR)ArchSysExit;
context->uwPC = (UINT32)(UINTPTR)OsTaskEntry;
context->uwxPSR = 0x01000000L;
return (VOID *)context;
}
VOID *ArchSignalContextInit(VOID *stackPointer, VOID *stackTop, UINTPTR sigHandler, UINT32 param)
{
UNUSED(stackTop);
TaskContext *context = (TaskContext *)((UINTPTR)stackPointer - sizeof(TaskContext));
(VOID)memset_s((VOID *)context, sizeof(TaskContext), 0, sizeof(TaskContext));
context->uwR0 = param;
context->uwPC = sigHandler;
context->uwxPSR = 0x01000000L; /* Thumb flag, always set 1 */
return (VOID *)context;
}
LITE_OS_SEC_TEXT_INIT UINT32 ArchStartSchedule(VOID)
{
(VOID)LOS_IntLock();
OsSchedStart();
HalStartToRun();
return LOS_OK; /* never return */
}

View File

@@ -0,0 +1,175 @@
;
; Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
; Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this list of
; conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice, this list
; of conditions and the following disclaimer in the documentation and/or other materials
; provided with the distribution.
;
; 3. Neither the name of the copyright holder nor the names of its contributors may be used
; to endorse or promote products derived from this software without specific prior written
; permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
; ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
PRESERVE8
EXPORT ArchIntLock
EXPORT ArchIntUnLock
EXPORT ArchIntRestore
EXPORT HalStartToRun
EXPORT ArchTaskSchedule
EXPORT HalPendSV
IMPORT OsSchedTaskSwitch
IMPORT OsSignalTaskContextRestore
IMPORT g_losTask
OS_FPU_CPACR EQU 0xE000ED88
OS_FPU_CPACR_ENABLE EQU 0x00F00000
OS_NVIC_INT_CTRL EQU 0xE000ED04
OS_NVIC_SYSPRI2 EQU 0xE000ED20
OS_NVIC_PENDSV_PRI EQU 0xF0F00000
OS_NVIC_PENDSVSET EQU 0x10000000
OS_TASK_STATUS_RUNNING EQU 0x0010
SECTION .text:CODE(2)
THUMB
REQUIRE8
MACRO SIGNAL_CONTEXT_RESTORE
PUSH {R12, LR}
BLX OsSignalTaskContextRestore
POP {R12, LR}
CMP R0, #0
MOV R1, R0
BNE SignalContextRestore
ENDM
HalStartToRun
LDR R4, =OS_NVIC_SYSPRI2
LDR R5, =OS_NVIC_PENDSV_PRI
STR R5, [R4]
MOV R0, #2
MSR CONTROL, R0
LDR R1, =g_losTask
LDR R0, [R1, #4]
LDR R12, [R0]
LDR.W R1, =OS_FPU_CPACR
LDR R1, [R1]
AND R1, R1, #OS_FPU_CPACR_ENABLE
CMP R1, #OS_FPU_CPACR_ENABLE
BNE __DisabledFPU
ADD R12, R12, #100
LDMFD R12!, {R0-R7}
ADD R12, R12, #72
MSR PSP, R12
VPUSH S0;
VPOP S0;
MOV LR, R5
CPSIE I
BX R6
__DisabledFPU
ADD R12, R12, #36
LDMFD R12!, {R0-R7}
MSR PSP, R12
MOV LR, R5
CPSIE I
BX R6
ArchIntLock
MRS R0, PRIMASK
CPSID I
BX LR
ArchIntUnLock
MRS R0, PRIMASK
CPSIE I
BX LR
ArchIntRestore
MSR PRIMASK, R0
BX LR
ArchTaskSchedule
LDR R0, =OS_NVIC_INT_CTRL
LDR R1, =OS_NVIC_PENDSVSET
STR R1, [R0]
DSB
ISB
BX LR
HalPendSV
MRS R12, PRIMASK
CPSID I
HalTaskSwitch
PUSH {R12, LR}
BLX OsSchedTaskSwitch
POP {R12, LR}
CMP R0, #0
MOV R0, LR
BNE TaskContextSwitch
MSR PRIMASK, R12
BX LR
TaskContextSwitch
MOV LR, R0
MRS R0, PSP
STMFD R0!, {R4-R12}
LDR.W R3, =OS_FPU_CPACR
LDR R3, [R3]
AND R3, R3, #OS_FPU_CPACR_ENABLE
CMP R3, #OS_FPU_CPACR_ENABLE
BNE __DisabledFPU1
VSTMDB R0!, {D8-D15}
__DisabledFPU1
LDR R5, =g_losTask
LDR R6, [R5]
STR R0, [R6]
LDR R0, [R5, #4]
STR R0, [R5]
LDR R1, [R0]
SignalContextRestore
LDR.W R3, =OS_FPU_CPACR
LDR R3, [R3]
AND R3, R3, #OS_FPU_CPACR_ENABLE
CMP R3, #OS_FPU_CPACR_ENABLE
BNE __DisabledFPU2
VLDMIA R1!, {D8-D15}
__DisabledFPU2
LDMFD R1!, {R4-R12}
MSR PSP, R1
MSR PRIMASK, R12
BX LR
END

View File

@@ -0,0 +1,285 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
PRESERVE8
SECTION .text:CODE(2)
THUMB
EXPORT HalExcNMI
EXPORT HalExcHardFault
EXPORT HalExcMemFault
EXPORT HalExcBusFault
EXPORT HalExcUsageFault
EXPORT HalSVCHandler
IMPORT HalExcHandleEntry
IMPORT g_uwExcTbl
IMPORT g_taskScheduled
OS_FLG_BGD_ACTIVE EQU 0x0002
OS_EXC_CAUSE_NMI EQU 16
OS_EXC_CAUSE_HARDFAULT EQU 17
HF_DEBUGEVT EQU 20
HF_VECTBL EQU 21
FLAG_ADDR_VALID EQU 0x10000
FLAG_HWI_ACTIVE EQU 0x20000
FLAG_NO_FLOAT EQU 0x10000000
OS_NVIC_FSR EQU 0xE000ED28 ;include BusFault/MemFault/UsageFault State Register
OS_NVIC_HFSR EQU 0xE000ED2C ;HardFault State Register
OS_NVIC_BFAR EQU 0xE000ED38
OS_NVIC_MMAR EQU 0xE000ED34
OS_NVIC_ACT_BASE EQU 0xE000E300
OS_NVIC_SHCSRS EQU 0xE000ED24
OS_NVIC_SHCSR_MASK EQU 0xC00
HalExcNMI
MOV R0, #OS_EXC_CAUSE_NMI
MOV R1, #0
B osExcDispatch
HalExcHardFault
MOV R0, #OS_EXC_CAUSE_HARDFAULT
LDR R2, =OS_NVIC_HFSR
LDR R2, [R2]
MOV R1, #HF_DEBUGEVT
ORR R0, R0, R1, LSL #0x8
TST R2, #0x80000000
BNE osExcDispatch ; DEBUGEVT
AND R0, R0 , #0x000000FF
MOV R1, #HF_VECTBL
ORR R0, R0, R1, LSL #0x8
TST R2, #0x00000002
BNE osExcDispatch ; VECTBL
;if not DEBUGEVT and VECTBL then is FORCED
AND R0, R0, #0x000000FF
LDR R2, =OS_NVIC_FSR
LDR R2, [R2]
TST R2, #0x8000 ; BFARVALID
BNE _HFBusFault ; BusFault
TST R2, #0x80 ; MMARVALID
BNE _HFMemFault ; MemFault
MOV R12,#0
B osHFExcCommonBMU
_HFBusFault
LDR R1, =OS_NVIC_BFAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
B osHFExcCommonBMU
_HFMemFault
LDR R1, =OS_NVIC_MMAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
osHFExcCommonBMU
CLZ R2, R2
LDR R3, =g_uwExcTbl
ADD R3, R3, R2
LDRB R2, [R3]
ORR R0, R0, R2, LSL #0x8
ORR R0, R0 ,R12
B osExcDispatch
HalSVCHandler
TST LR, #0x4
ITE EQ
MRSEQ R0, MSP
MRSNE R0, PSP
LDR R1, [R0,#24]
LDRB R0, [R1,#-2]
MOV R1, #0
B osExcDispatch
HalExcBusFault
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
TST R0, #0x8000 ; BFARVALID
BEQ _ExcBusNoADDR
LDR R1, =OS_NVIC_BFAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
AND R0, R0, #0x1F00
B osExcCommonBMU
_ExcBusNoADDR
MOV R12,#0
B osExcCommonBMU
HalExcMemFault
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
TST R0, #0x80 ; MMARVALID
BEQ _ExcMemNoADDR
LDR R1, =OS_NVIC_MMAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
AND R0, R0, #0x1B
B osExcCommonBMU
_ExcMemNoADDR
MOV R12,#0
B osExcCommonBMU
HalExcUsageFault
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
MOV R1, #0x030F
LSL R1, R1, #16
AND R0, R0, R1
MOV R12, #0
osExcCommonBMU
CLZ R0, R0
LDR R3, =g_uwExcTbl
ADD R3, R3, R0
LDRB R0, [R3]
ORR R0, R0, R12
; R0 -- EXCCAUSE(bit 16 is 1 if EXCADDR valid), R1 -- EXCADDR
osExcDispatch
LDR R2, =OS_NVIC_ACT_BASE
MOV R12, #8 ; R12 is hwi check loop counter
_hwiActiveCheck
LDR R3, [R2] ; R3 store active hwi register when exc
CMP R3, #0
BEQ _hwiActiveCheckNext
; exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
AND R12, R12, #1
ADD R2, R2, R12, LSL #5 ; calculate R2 (hwi number) as uwPid
_ExcInMSP
CMP LR, #0xFFFFFFE9
BNE _NoFloatInMsp
ADD R3, R13, #104
PUSH {R3}
MRS R12, PRIMASK ; store message-->exc: disable int?
PUSH {R4-R12} ; store message-->exc: {R4-R12}
VPUSH {D8-D15}
B _handleEntry
_NoFloatInMsp
ADD R3, R13, #32
PUSH {R3} ; save IRQ SP ; store message-->exc: MSP(R13)
MRS R12, PRIMASK ; store message-->exc: disable int?
PUSH {R4-R12} ; store message-->exc: {R4-R12}
ORR R0, R0, #FLAG_NO_FLOAT
B _handleEntry
_hwiActiveCheckNext
ADD R2, R2, #4 ; next NVIC ACT ADDR
SUBS R12, R12, #1
BNE _hwiActiveCheck
;/*NMI interrupt excption*/
LDR R2, =OS_NVIC_SHCSRS
LDRH R2,[R2]
LDR R3,=OS_NVIC_SHCSR_MASK
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
; exc occurred in Task or Init or exc
; reserved for register info from task stack
LDR R2, =g_taskScheduled
LDR R2, [R2]
TST R2, #1 ; OS_FLG_BGD_ACTIVE
BEQ _ExcInMSP ; if exc occurred in Init then branch
CMP LR, #0xFFFFFFED ;auto push floating registers
BNE _NoFloatInPsp
; exc occurred in Task
MOV R2, R13
SUB R13, #96 ; add 8 Bytes reg(for STMFD)
MRS R3, PSP
ADD R12, R3, #104
PUSH {R12} ; save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
VPUSH {D8-D15}
; copy auto saved task register
LDMFD R3!, {R4-R11} ; R4-R11 store PSP reg(auto push when exc in task)
VLDMIA R3!, {D8-D15}
VSTMDB R2!, {D8-D15}
STMFD R2!, {R4-R11}
B _handleEntry
_NoFloatInPsp
MOV R2, R13 ;no auto push floating registers
SUB R13, #32 ; add 8 Bytes reg(for STMFD)
MRS R3, PSP
ADD R12, R3, #32
PUSH {R12} ; save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
LDMFD R3, {R4-R11} ; R4-R11 store PSP reg(auto push when exc in task)
STMFD R2!, {R4-R11}
ORR R0, R0, #FLAG_NO_FLOAT
_handleEntry
MOV R3, R13 ; R13:the 4th param
CPSID I
CPSID F
B HalExcHandleEntry
NOP
END

View File

@@ -0,0 +1,433 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdarg.h>
#include "securec.h"
#include "los_context.h"
#include "los_arch_interrupt.h"
#include "los_hook.h"
#include "los_task.h"
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
/* ****************************************************************************
Function : HwiNumGet
Description : Get an interrupt number
Input : None
Output : None
Return : Interrupt Indexes number
**************************************************************************** */
STATIC UINT32 HwiNumGet(VOID)
{
return __get_IPSR();
}
STATIC UINT32 HwiUnmask(HWI_HANDLE_T hwiNum)
{
NVIC_EnableIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiMask(HWI_HANDLE_T hwiNum)
{
NVIC_DisableIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiSetPriority(HWI_HANDLE_T hwiNum, UINT8 priority)
{
NVIC_SetPriority((IRQn_Type)hwiNum, priority);
return LOS_OK;
}
STATIC UINT32 HwiPending(HWI_HANDLE_T hwiNum)
{
NVIC_SetPendingIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiClear(HWI_HANDLE_T hwiNum)
{
NVIC_ClearPendingIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiCreate(HWI_HANDLE_T hwiNum, HWI_PRIOR_T hwiPrio)
{
HwiSetPriority(hwiNum, hwiPrio);
HwiUnmask(hwiNum);
return LOS_OK;
}
STATIC HwiControllerOps g_archHwiOps = {
.enableIrq = HwiUnmask,
.disableIrq = HwiMask,
.setIrqPriority = HwiSetPriority,
.getCurIrqNum = HwiNumGet,
.triggerIrq = HwiPending,
.clearIrq = HwiClear,
.createIrq = HwiCreate,
};
HwiControllerOps *ArchIntOpsGet(VOID)
{
return &g_archHwiOps;
}
/* ****************************************************************************
Function : HalInterrupt
Description : Hardware interrupt entry function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
{
UINT32 hwiIndex;
UINT32 intSave;
#if (LOSCFG_KERNEL_RUNSTOP == 1)
SCB->SCR &= (UINT32) ~((UINT32)SCB_SCR_SLEEPDEEP_Msk);
#endif
intSave = LOS_IntLock();
g_intCount++;
LOS_IntRestore(intSave);
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (g_hwiHandlerForm[hwiIndex].pfnHandler != 0) {
g_hwiHandlerForm[hwiIndex].pfnHandler((VOID *)g_hwiHandlerForm[hwiIndex].pParm);
}
#else
if (g_hwiHandlerForm[hwiIndex] != 0) {
g_hwiHandlerForm[hwiIndex]();
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
g_intCount--;
LOS_IntRestore(intSave);
}
#define FAULT_STATUS_REG_BIT 32
#define USGFAULT (1 << 18)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
UINT8 g_uwExcTbl[FAULT_STATUS_REG_BIT] = {
0, 0, 0, 0, 0, 0, OS_EXC_UF_DIVBYZERO, OS_EXC_UF_UNALIGNED,
0, 0, 0, 0, OS_EXC_UF_NOCP, OS_EXC_UF_INVPC, OS_EXC_UF_INVSTATE, OS_EXC_UF_UNDEFINSTR,
0, 0, 0, OS_EXC_BF_STKERR, OS_EXC_BF_UNSTKERR, OS_EXC_BF_IMPRECISERR, OS_EXC_BF_PRECISERR, OS_EXC_BF_IBUSERR,
0, 0, 0, OS_EXC_MF_MSTKERR, OS_EXC_MF_MUNSTKERR, 0, OS_EXC_MF_DACCVIOL, OS_EXC_MF_IACCVIOL
};
#if (LOSCFG_KERNEL_PRINTF != 0)
STATIC VOID OsExcNvicDump(VOID)
{
#define OS_NR_NVIC_EXC_DUMP_TYPES 7
UINT32 *base = NULL;
UINT32 len, i, j;
UINT32 rgNvicBases[OS_NR_NVIC_EXC_DUMP_TYPES] = {
OS_NVIC_SETENA_BASE, OS_NVIC_SETPEND_BASE, OS_NVIC_INT_ACT_BASE,
OS_NVIC_PRI_BASE, OS_NVIC_EXCPRI_BASE, OS_NVIC_SHCSR, OS_NVIC_INT_CTRL
};
UINT32 rgNvicLens[OS_NR_NVIC_EXC_DUMP_TYPES] = {
OS_NVIC_INT_ENABLE_SIZE, OS_NVIC_INT_PEND_SIZE, OS_NVIC_INT_ACT_SIZE,
OS_NVIC_INT_PRI_SIZE, OS_NVIC_EXCPRI_SIZE, OS_NVIC_SHCSR_SIZE,
OS_NVIC_INT_CTRL_SIZE
};
CHAR strRgEnable[] = "enable";
CHAR strRgPending[] = "pending";
CHAR strRgActive[] = "active";
CHAR strRgPriority[] = "priority";
CHAR strRgException[] = "exception";
CHAR strRgShcsr[] = "shcsr";
CHAR strRgIntCtrl[] = "control";
CHAR *strRgs[] = {
strRgEnable, strRgPending, strRgActive, strRgPriority,
strRgException, strRgShcsr, strRgIntCtrl
};
PRINTK("\r\nOS exception NVIC dump:\n");
for (i = 0; i < OS_NR_NVIC_EXC_DUMP_TYPES; i++) {
base = (UINT32 *)rgNvicBases[i];
len = rgNvicLens[i];
PRINTK("interrupt %s register, base address: %p, size: 0x%x\n", strRgs[i], base, len);
len = (len >> 2); /* 2: Gets the next register offset */
for (j = 0; j < len; j++) {
PRINTK("0x%x ", *(base + j));
if ((j != 0) && ((j % 16) == 0)) { /* 16: print wrap line */
PRINTK("\n");
}
}
PRINTK("\n");
}
}
STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
{
PRINTK("Current task info:\n");
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
} else if (excInfo->phase == OS_EXC_IN_HWI) {
PRINTK("Exception occur in interrupt phase!\n");
} else {
PRINTK("Exception occur in system init phase!\n");
}
}
STATIC VOID OsExcRegInfo(const ExcInfo *excInfo)
{
PRINTK("Exception reg dump:\n");
PRINTK("PC = 0x%x\n", excInfo->context->uwPC);
PRINTK("LR = 0x%x\n", excInfo->context->uwLR);
PRINTK("SP = 0x%x\n", excInfo->context->uwSP);
PRINTK("R0 = 0x%x\n", excInfo->context->uwR0);
PRINTK("R1 = 0x%x\n", excInfo->context->uwR1);
PRINTK("R2 = 0x%x\n", excInfo->context->uwR2);
PRINTK("R3 = 0x%x\n", excInfo->context->uwR3);
PRINTK("R4 = 0x%x\n", excInfo->context->uwR4);
PRINTK("R5 = 0x%x\n", excInfo->context->uwR5);
PRINTK("R6 = 0x%x\n", excInfo->context->uwR6);
PRINTK("R7 = 0x%x\n", excInfo->context->uwR7);
PRINTK("R8 = 0x%x\n", excInfo->context->uwR8);
PRINTK("R9 = 0x%x\n", excInfo->context->uwR9);
PRINTK("R10 = 0x%x\n", excInfo->context->uwR10);
PRINTK("R11 = 0x%x\n", excInfo->context->uwR11);
PRINTK("R12 = 0x%x\n", excInfo->context->uwR12);
PRINTK("PriMask = 0x%x\n", excInfo->context->uwPriMask);
PRINTK("xPSR = 0x%x\n", excInfo->context->uwxPSR);
}
#if (LOSCFG_KERNEL_BACKTRACE == 1)
STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
{
UINTPTR LR[LOSCFG_BACKTRACE_DEPTH] = {0};
UINT32 index;
OsBackTraceHookCall(LR, LOSCFG_BACKTRACE_DEPTH, 0, excInfo->context->uwSP);
PRINTK("----- backtrace start -----\n");
for (index = 0; index < LOSCFG_BACKTRACE_DEPTH; index++) {
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
#endif
STATIC VOID OsExcMemPoolCheckInfo(VOID)
{
PRINTK("\r\nmemory pools check:\n");
#if (LOSCFG_PLATFORM_EXC == 1)
MemInfoCB memExcInfo[OS_SYS_MEM_NUM];
UINT32 errCnt;
UINT32 i;
(VOID)memset_s(memExcInfo, sizeof(memExcInfo), 0, sizeof(memExcInfo));
errCnt = OsMemExcInfoGet(OS_SYS_MEM_NUM, memExcInfo);
if (errCnt < OS_SYS_MEM_NUM) {
errCnt += OsMemboxExcInfoGet(OS_SYS_MEM_NUM - errCnt, memExcInfo + errCnt);
}
if (errCnt == 0) {
PRINTK("all memory pool check passed!\n");
return;
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
if (ret == LOS_OK) {
PRINTK("system heap memcheck over, all passed!\n");
}
PRINTK("memory pool check end!\n");
}
#endif
STATIC VOID OsExcInfoDisplay(const ExcInfo *excInfo)
{
#if (LOSCFG_KERNEL_PRINTF != 0)
PRINTK("*************Exception Information**************\n");
OsExcTypeInfo(excInfo);
OsExcCurTaskInfo(excInfo);
OsExcRegInfo(excInfo);
#if (LOSCFG_KERNEL_BACKTRACE == 1)
OsExcBackTraceInfo(excInfo);
#endif
OsGetAllTskInfo();
OsExcNvicDump();
OsExcMemPoolCheckInfo();
#endif
}
LITE_OS_SEC_TEXT_INIT VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr)
{
UINT16 tmpFlag = (excType >> 16) & OS_NULL_SHORT; /* 16: Get Exception Type */
g_intCount++;
g_excInfo.nestCnt++;
g_excInfo.type = excType & OS_NULL_SHORT;
if (tmpFlag & OS_EXC_FLAG_FAULTADDR_VALID) {
g_excInfo.faultAddr = faultAddr;
} else {
g_excInfo.faultAddr = OS_EXC_IMPRECISE_ACCESS_ADDR;
}
if (g_losTask.runTask != NULL) {
if (tmpFlag & OS_EXC_FLAG_IN_HWI) {
g_excInfo.phase = OS_EXC_IN_HWI;
g_excInfo.thrdPid = pid;
} else {
g_excInfo.phase = OS_EXC_IN_TASK;
g_excInfo.thrdPid = g_losTask.runTask->taskID;
}
} else {
g_excInfo.phase = OS_EXC_IN_INIT;
g_excInfo.thrdPid = OS_NULL_INT;
}
if (excType & OS_EXC_FLAG_NO_FLOAT) {
g_excInfo.context = (EXC_CONTEXT_S *)((CHAR *)excBufAddr - LOS_OFF_SET_OF(EXC_CONTEXT_S, uwR4));
} else {
g_excInfo.context = excBufAddr;
}
OsDoExcHook(EXC_INTERRUPT);
OsExcInfoDisplay(&g_excInfo);
ArchSysExit();
}
WEAK VOID SysTick_Handler(VOID)
{
return;
}
/* ****************************************************************************
Function : HalHwiInit
Description : initialization of the hardware interrupt
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
{
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
HWI_PROC_FUNC *hwiForm = (HWI_PROC_FUNC *)ArchGetHwiFrom();
hwiForm[0] = 0; /* [0] Top of Stack */
hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)hwiForm;
#endif
#if (__CORTEX_M >= 0x03U) /* only for Cortex-M3 and above */
NVIC_SetPriorityGrouping(OS_NVIC_AIRCR_PRIGROUP);
#endif
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
return;
}

View File

@@ -0,0 +1,126 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_timer.h"
#include "los_config.h"
#include "los_tick.h"
#include "los_arch_interrupt.h"
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
STATIC ArchTickTimer g_archTickTimer = {
.freq = 0,
.irqNum = SysTick_IRQn,
.periodMax = LOSCFG_BASE_CORE_TICK_RESPONSE_MAX,
.init = SysTickStart,
.getCycle = SysTickCycleGet,
.reload = SysTickReload,
.lock = SysTickLock,
.unlock = SysTickUnlock,
.tickHandler = NULL,
};
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
{
UINT32 ret;
ArchTickTimer *tick = &g_archTickTimer;
tick->freq = OS_SYS_CLOCK;
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(tick->irqNum, handler, NULL);
#else
OsSetVector(tick->irqNum, handler);
#endif
#endif
ret = SysTick_Config(LOSCFG_BASE_CORE_TICK_RESPONSE_MAX);
if (ret == 1) {
return LOS_ERRNO_TICK_PER_SEC_TOO_SMALL;
}
return LOS_OK;
}
STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
{
if (nextResponseTime > g_archTickTimer.periodMax) {
nextResponseTime = g_archTickTimer.periodMax;
}
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)
{
UINT32 hwCycle = 0;
UINTPTR intSave = LOS_IntLock();
UINT32 val = SysTick->VAL;
*period = SysTick->LOAD;
if (val != 0) {
hwCycle = *period - val;
}
LOS_IntRestore(intSave);
return (UINT64)hwCycle;
}
STATIC VOID SysTickLock(VOID)
{
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
}
STATIC VOID SysTickUnlock(VOID)
{
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
}
ArchTickTimer *ArchSysTickTimerGet(VOID)
{
return &g_archTickTimer;
}
UINT32 ArchEnterSleep(VOID)
{
__DSB();
__WFI();
__ISB();
return LOS_OK;
}

View File

@@ -0,0 +1,297 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_ATOMIC_H
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
STATIC INLINE INT32 ArchAtomicRead(const Atomic *v)
{
INT32 val;
asm volatile("ldrex %0, [%1]\n"
: "=&r"(val)
: "r"(v)
: "cc");
return val;
}
STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
{
UINT32 status;
do {
asm volatile("ldrex %0, [%1]\n"
"strex %0, %2, [%1]\n"
: "=&r"(status)
: "r"(v), "r"(setVal)
: "cc");
} while (status != 0);
}
STATIC INLINE INT32 ArchAtomicAdd(Atomic *v, INT32 addVal)
{
INT32 val;
UINT32 status;
do {
asm volatile("ldrex %1, [%2]\n"
"add %1, %1, %3\n"
"strex %0, %1, [%2]"
: "=&r"(status), "=&r"(val)
: "r"(v), "r"(addVal)
: "cc");
} while (status != 0);
return val;
}
STATIC INLINE INT32 ArchAtomicSub(Atomic *v, INT32 subVal)
{
INT32 val;
UINT32 status;
do {
asm volatile("ldrex %1, [%2]\n"
"sub %1, %1, %3\n"
"strex %0, %1, [%2]"
: "=&r"(status), "=&r"(val)
: "r"(v), "r"(subVal)
: "cc");
} while (status != 0);
return val;
}
STATIC INLINE VOID ArchAtomicInc(Atomic *v)
{
(VOID)ArchAtomicAdd(v, 1);
}
STATIC INLINE VOID ArchAtomicDec(Atomic *v)
{
(VOID)ArchAtomicSub(v, 1);
}
STATIC INLINE INT32 ArchAtomicIncRet(Atomic *v)
{
return ArchAtomicAdd(v, 1);
}
STATIC INLINE INT32 ArchAtomicDecRet(Atomic *v)
{
return ArchAtomicSub(v, 1);
}
/**
* @ingroup los_arch_atomic
* @brief Atomic exchange for 32-bit variable.
*
* @par Description:
* This API is used to implement the atomic exchange for 32-bit variable
* and return the previous value of the atomic variable.
* @attention
* <ul>The pointer v must not be NULL.</ul>
*
* @param v [IN] The variable pointer.
* @param val [IN] The exchange value.
*
* @retval #INT32 The previous value of the atomic variable
* @par Dependency:
* <ul><li>los_arch_atomic.h: the header file that contains the API declaration.</li></ul>
* @see
*/
STATIC INLINE INT32 ArchAtomicXchg32bits(volatile INT32 *v, INT32 val)
{
INT32 prevVal = 0;
UINT32 status = 0;
do {
asm volatile("ldrex %0, [%2]\n"
"strex %1, %3, [%2]"
: "=&r"(prevVal), "=&r"(status)
: "r"(v), "r"(val)
: "cc");
} while (status != 0);
return prevVal;
}
/**
* @ingroup los_arch_atomic
* @brief Atomic exchange for 32-bit variable with compare.
*
* @par Description:
* This API is used to implement the atomic exchange for 32-bit variable, if the value of variable is equal to oldVal.
* @attention
* <ul>The pointer v must not be NULL.</ul>
*
* @param v [IN] The variable pointer.
* @param val [IN] The new value.
* @param oldVal [IN] The old value.
*
* @retval TRUE The previous value of the atomic variable is not equal to oldVal.
* @retval FALSE The previous value of the atomic variable is equal to oldVal.
* @par Dependency:
* <ul><li>los_arch_atomic.h: the header file that contains the API declaration.</li></ul>
* @see
*/
STATIC INLINE BOOL ArchAtomicCmpXchg32bits(volatile INT32 *v, INT32 val, INT32 oldVal)
{
INT32 prevVal = 0;
UINT32 status = 0;
do {
asm volatile("ldrex %0, [%2]\n"
"mov %1, #0\n"
"cmp %0, %3\n"
"bne 1f\n"
"strex %1, %4, [%2]\n"
"1:"
: "=&r"(prevVal), "=&r"(status)
: "r"(v), "r"(oldVal), "r"(val)
: "cc");
} while (status != 0);
return prevVal != oldVal;
}
STATIC INLINE INT64 ArchAtomic64Read(const Atomic64 *v)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE VOID ArchAtomic64Set(Atomic64 *v, INT64 setVal)
{
UINT32 intSave;
intSave = LOS_IntLock();
*v = setVal;
LOS_IntRestore(intSave);
}
STATIC INLINE INT64 ArchAtomic64Add(Atomic64 *v, INT64 addVal)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v += addVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE INT64 ArchAtomic64Sub(Atomic64 *v, INT64 subVal)
{
INT64 val;
UINT32 intSave;
intSave = LOS_IntLock();
*v -= subVal;
val = *v;
LOS_IntRestore(intSave);
return val;
}
STATIC INLINE VOID ArchAtomic64Inc(Atomic64 *v)
{
(VOID)ArchAtomic64Add(v, 1);
}
STATIC INLINE INT64 ArchAtomic64IncRet(Atomic64 *v)
{
return ArchAtomic64Add(v, 1);
}
STATIC INLINE VOID ArchAtomic64Dec(Atomic64 *v)
{
(VOID)ArchAtomic64Sub(v, 1);
}
STATIC INLINE INT64 ArchAtomic64DecRet(Atomic64 *v)
{
return ArchAtomic64Sub(v, 1);
}
STATIC INLINE INT64 ArchAtomicXchg64bits(Atomic64 *v, INT64 val)
{
INT64 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
*v = val;
LOS_IntRestore(intSave);
return prevVal;
}
STATIC INLINE BOOL ArchAtomicCmpXchg64bits(Atomic64 *v, INT64 val, INT64 oldVal)
{
INT64 prevVal;
UINT32 intSave;
intSave = LOS_IntLock();
prevVal = *v;
if (prevVal == oldVal) {
*v = val;
}
LOS_IntRestore(intSave);
return prevVal != oldVal;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_ATOMIC_H */

View File

@@ -0,0 +1,134 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_CONTEXT_H
#define _LOS_ARCH_CONTEXT_H
#include "los_config.h"
#include "los_compiler.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
typedef struct TagTskContext {
UINT32 secureContext;
UINT32 stackLmit;
UINT32 excReturn;
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
UINT32 S16;
UINT32 S17;
UINT32 S18;
UINT32 S19;
UINT32 S20;
UINT32 S21;
UINT32 S22;
UINT32 S23;
UINT32 S24;
UINT32 S25;
UINT32 S26;
UINT32 S27;
UINT32 S28;
UINT32 S29;
UINT32 S30;
UINT32 S31;
#endif
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
UINT32 uwR0;
UINT32 uwR1;
UINT32 uwR2;
UINT32 uwR3;
UINT32 uwR12;
UINT32 uwLR;
UINT32 uwPC;
UINT32 uwxPSR;
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
UINT32 S0;
UINT32 S1;
UINT32 S2;
UINT32 S3;
UINT32 S4;
UINT32 S5;
UINT32 S6;
UINT32 S7;
UINT32 S8;
UINT32 S9;
UINT32 S10;
UINT32 S11;
UINT32 S12;
UINT32 S13;
UINT32 S14;
UINT32 S15;
UINT32 FPSCR;
UINT32 NO_NAME;
#endif
} TaskContext;
/**
* @ingroup los_config
* @brief: Task start running function.
*
* @par Description:
* This API is used to start a task.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param: None.
*
* @retval None.
*
* @par Dependency:
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalStartToRun(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_CONTEXT_H */

View File

@@ -0,0 +1,621 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_INTERRUPT_H
#define _LOS_ARCH_INTERRUPT_H
#include "los_common_interrupt.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* *
* @ingroup los_arch_interrupt
* Highest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_HIGHEST
#define OS_HWI_PRIO_HIGHEST 0
#endif
/* *
* @ingroup los_arch_interrupt
* Lowest priority of a hardware interrupt.
*/
#ifndef OS_HWI_PRIO_LOWEST
#define OS_HWI_PRIO_LOWEST 7
#endif
/* *
* @ingroup los_arch_interrupt
* AIRCR register priority group parameter .
*/
#define OS_NVIC_AIRCR_PRIGROUP 7
/* *
* @ingroup los_arch_interrupt
* Boot interrupt vector table.
*/
extern UINT32 _BootVectors[];
/* *
* @ingroup los_arch_interrupt
* Count of M-Core system interrupt vector.
*/
#define OS_SYS_VECTOR_CNT 16
/* *
* @ingroup los_arch_interrupt
* Count of M-Core interrupt vector.
*/
#define OS_VECTOR_CNT (OS_SYS_VECTOR_CNT + OS_HWI_MAX_NUM)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt number.
*
* Value: 0x02000900
*
* Solution: Ensure that the interrupt number is valid.
* The value range of the interrupt number applicable for a Cortex-M33 platform is [OS_USER_HWI_MIN,OS_USER_HWI_MAX].
*/
#define OS_ERRNO_HWI_NUM_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x00)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Null hardware interrupt handling function.
*
* Value: 0x02000901
*
* Solution: Pass in a valid non-null hardware interrupt handling function.
*/
#define OS_ERRNO_HWI_PROC_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x01)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Insufficient interrupt resources for hardware interrupt creation.
*
* Value: 0x02000902
*
* Solution: Increase the configured maximum number of supported hardware interrupts.
*/
#define OS_ERRNO_HWI_CB_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x02)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Insufficient memory for hardware interrupt initialization.
*
* Value: 0x02000903
*
* Solution: Expand the configured memory.
*/
#define OS_ERRNO_HWI_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x03)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: The interrupt has already been created.
*
* Value: 0x02000904
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x04)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt priority.
*
* Value: 0x02000905
*
* Solution: Ensure that the interrupt priority is valid.
* The value range of the interrupt priority applicable for a Cortex-M33 platform is [0,15].
*/
#define OS_ERRNO_HWI_PRIO_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x05)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Incorrect interrupt creation mode.
*
* Value: 0x02000906
*
* Solution: The interrupt creation mode can be only set to OS_HWI_MODE_COMM or
* OS_HWI_MODE_FAST of which the value can be 0 or 1.
*/
#define OS_ERRNO_HWI_MODE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x06)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: The interrupt has already been created as a fast interrupt.
*
* Value: 0x02000907
*
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/
#define OS_ERRNO_HWI_FASTMODE_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x07)
/* *
* @ingroup los_arch_interrupt
* Hardware interrupt error code: Invalid interrupt operation function.
*
* Value: 0x0200090c
*
* Solution: Set a valid interrupt operation function
*/
#define OS_ERRNO_HWI_OPS_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x0c)
/* *
* @ingroup los_arch_interrupt
* SysTick control and status register.
*/
#define OS_SYSTICK_CONTROL_REG 0xE000E010
/* *
* @ingroup los_hw
* SysTick current value register.
*/
#define OS_SYSTICK_CURRENT_REG 0xE000E018
/* *
* @ingroup los_arch_interrupt
* Interrupt Priority-Level Registers.
*/
#define OS_NVIC_PRI_BASE 0xE000E400
/* *
* @ingroup los_arch_interrupt
* Interrupt enable register for 0-31.
*/
#define OS_NVIC_SETENA_BASE 0xE000E100
/* *
* @ingroup los_arch_interrupt
* interrupt pending register.
*/
#define OS_NVIC_SETPEND_BASE 0xE000E200
/* *
* @ingroup los_arch_interrupt
* Interrupt active register.
*/
#define OS_NVIC_INT_ACT_BASE 0xE000E300
/* *
* @ingroup los_arch_interrupt
* Interrupt disable register for 0-31.
*/
#define OS_NVIC_CLRENA_BASE 0xE000E180
/* *
* @ingroup los_arch_interrupt
* Interrupt control and status register.
*/
#define OS_NVIC_INT_CTRL 0xE000ED04
/* *
* @ingroup los_arch_interrupt
* Vector table offset register.
*/
#define OS_NVIC_VTOR 0xE000ED08
/* *
* @ingroup los_arch_interrupt
* Application interrupt and reset control register
*/
#define OS_NVIC_AIRCR 0xE000ED0C
/* *
* @ingroup los_arch_interrupt
* System exception priority register.
*/
#define OS_NVIC_EXCPRI_BASE 0xE000ED18
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 1 :reset.
*/
#define OS_EXC_RESET 1
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 2 :Non-Maskable Interrupt.
*/
#define OS_EXC_NMI 2
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 3 :(hard)fault.
*/
#define OS_EXC_HARD_FAULT 3
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 4 :MemManage fault.
*/
#define OS_EXC_MPU_FAULT 4
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 5 :Bus fault.
*/
#define OS_EXC_BUS_FAULT 5
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 6 :Usage fault.
*/
#define OS_EXC_USAGE_FAULT 6
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 11 :SVCall.
*/
#define OS_EXC_SVC_CALL 11
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 12 :Debug monitor.
*/
#define OS_EXC_DBG_MONITOR 12
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 14 :PendSV.
*/
#define OS_EXC_PEND_SV 14
/* *
* @ingroup los_arch_interrupt
* Interrupt No. 15 :SysTick.
*/
#define OS_EXC_SYS_TICK 15
/* *
* @ingroup los_hwi
* @brief: Hardware interrupt entry function.
*
* @par Description:
* This API is used as all hardware interrupt handling function entry.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalInterrupt(VOID);
/* *
* @ingroup los_arch_interrupt
* @brief: Reset the vector table.
*
* @par Description:
* This API is used to reset the vector table.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID Reset_Handler(VOID);
/* *
* @ingroup los_arch_interrupt
* @brief: Pended System Call.
*
* @par Description:
* PendSV can be pended and is useful for an OS to pend an exception
* so that an action can be performed after other important tasks are completed.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param:None.
*
* @retval:None.
* @par Dependency:
* <ul><li>los_arch_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalPendSV(VOID);
#define OS_EXC_MAX_BUF_LEN 25
#define OS_EXC_MAX_NEST_DEPTH 1
#define OS_EXC_FLAG_NO_FLOAT 0x10000000
#define OS_NVIC_SHCSR 0xE000ED24
#define OS_NVIC_CCR 0xE000ED14
#define OS_NVIC_INT_ENABLE_SIZE 0x20
#define OS_NVIC_INT_PRI_SIZE 0xF0
#define OS_NVIC_EXCPRI_SIZE 0xC
#define OS_NVIC_INT_CTRL_SIZE 4
#define OS_NVIC_SHCSR_SIZE 4
#define OS_NVIC_INT_PEND_SIZE OS_NVIC_INT_ACT_SIZE
#define OS_NVIC_INT_ACT_SIZE OS_NVIC_INT_ENABLE_SIZE
/**
* @ingroup los_exc
* the struct of register files
*
* description: the register files that saved when exception triggered
*
* notes:the following register with prefix 'uw' correspond to the registers in the cpu data sheet.
*/
typedef struct TagExcContext {
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
UINT32 S16;
UINT32 S17;
UINT32 S18;
UINT32 S19;
UINT32 S20;
UINT32 S21;
UINT32 S22;
UINT32 S23;
UINT32 S24;
UINT32 S25;
UINT32 S26;
UINT32 S27;
UINT32 S28;
UINT32 S29;
UINT32 S30;
UINT32 S31;
#endif
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
/* auto save */
UINT32 uwSP;
UINT32 uwR0;
UINT32 uwR1;
UINT32 uwR2;
UINT32 uwR3;
UINT32 uwR12;
UINT32 uwLR;
UINT32 uwPC;
UINT32 uwxPSR;
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED) && (__FPU_USED== 1U)))
UINT32 S0;
UINT32 S1;
UINT32 S2;
UINT32 S3;
UINT32 S4;
UINT32 S5;
UINT32 S6;
UINT32 S7;
UINT32 S8;
UINT32 S9;
UINT32 S10;
UINT32 S11;
UINT32 S12;
UINT32 S13;
UINT32 S14;
UINT32 S15;
UINT32 FPSCR;
UINT32 NO_NAME;
#endif
} EXC_CONTEXT_S;
typedef VOID (*EXC_PROC_FUNC)(UINT32, EXC_CONTEXT_S *);
VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr);
VOID HalExcNMI(VOID);
VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID);
VOID HalSVCHandler(VOID);
VOID HalHwiInit(VOID);
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the bus status register was being pushed.
*/
#define OS_EXC_BF_STKERR 1
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the bus status register was out of the stack.
*/
#define OS_EXC_BF_UNSTKERR 2
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register imprecise data access violation.
*/
#define OS_EXC_BF_IMPRECISERR 3
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register exact data access violation.
*/
#define OS_EXC_BF_PRECISERR 4
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register access violation while pointing.
*/
#define OS_EXC_BF_IBUSERR 5
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the memory management status register was being pushed.
*/
#define OS_EXC_MF_MSTKERR 6
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the memory management status register was out of the stack.
*/
#define OS_EXC_MF_MUNSTKERR 7
/**
* @ingroup los_exc
* Cortex-M exception types: Memory management status register data access violation.
*/
#define OS_EXC_MF_DACCVIOL 8
/**
* @ingroup los_exc
* Cortex-M exception types: Memory management status register access violation.
*/
#define OS_EXC_MF_IACCVIOL 9
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage indicating that the divisor is zero during the division operation.
*/
#define OS_EXC_UF_DIVBYZERO 10
/**
* @ingroup los_exc
* Cortex-M exception types: Usage error, error caused by unaligned access.
*/
#define OS_EXC_UF_UNALIGNED 11
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage attempting to execute coprocessor related instruction.
*/
#define OS_EXC_UF_NOCP 12
/**
* @ingroup los_exc
* Cortex-M exception types: Usage error attempting to load EXC_RETURN to PC illegally on exception return.
*/
#define OS_EXC_UF_INVPC 13
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage, attempting to cut to ARM state.
*/
#define OS_EXC_UF_INVSTATE 14
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage. Executed instruction whose code is undefined.
*/
#define OS_EXC_UF_UNDEFINSTR 15
/**
* @ingroup los_exc
* Cortex-M exception types: NMI
*/
#define OS_EXC_CAUSE_NMI 16
/**
* @ingroup los_exc
* Cortex-M exception types: hard fault
*/
#define OS_EXC_CAUSE_HARDFAULT 17
/**
* @ingroup los_exc
* Cortex-M exception types: The task handler exits.
*/
#define OS_EXC_CAUSE_TASK_EXIT 18
/**
* @ingroup los_exc
* Cortex-M exception types: A fatal error.
*/
#define OS_EXC_CAUSE_FATAL_ERR 19
/**
* @ingroup los_exc
* Cortex-M exception types: Hard Fault caused by a debug event.
*/
#define OS_EXC_CAUSE_DEBUGEVT 20
/**
* @ingroup los_exc
* Cortex-M exception types: A hard fault that occurs when a quantity is oriented.
*/
#define OS_EXC_CAUSE_VECTBL 21
/**
* @ingroup los_exc
* Exception information structure
*
* Description: Exception information saved when an exception is triggered on the Cortex-M33 platform.
*
*/
typedef struct TagExcInfo {
/**< Exception occurrence phase: 0 means that an exception occurs in initialization,
* 1 means that an exception occurs in a task, and 2 means that an exception occurs in an interrupt */
UINT16 phase;
/**< Exception type. When exceptions occur, check the numbers 1 - 21 listed above */
UINT16 type;
/**< If the exact address access error indicates the wrong access address when the exception occurred */
UINT32 faultAddr;
/**< An exception occurs in an interrupt, indicating the interrupt number.
* An exception occurs in the task, indicating the task ID, or 0xFFFFFFFF if it occurs during initialization */
UINT32 thrdPid;
/**< Number of nested exceptions. Currently only registered hook functions are supported
* when an exception is entered for the first time */
UINT16 nestCnt;
/**< reserve */
UINT16 reserved;
/**< Hardware context at the time an exception to the automatic stack floating-point register occurs */
EXC_CONTEXT_S *context;
} ExcInfo;
extern ExcInfo g_excInfo;
extern UINT32 g_curNestCount;
extern UINT8 g_uwExcTbl[32];
#define MAX_INT_INFO_SIZE (8 + 0x164)
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_INTERRUPT_H */

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_ARCH_TIMER_H
#define _LOS_ARCH_TIMER_H
#include "los_config.h"
#include "los_compiler.h"
#include "los_timer.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_ARCH_TIMER_H */

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -29,75 +29,43 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_base.h"
#include "los_task_pri.h"
#include "los_hw.h"
#include "los_priqueue_pri.h"
#include "los_context.h"
#include "securec.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#include "los_arch_context.h"
#include "los_arch_interrupt.h"
#include "los_task.h"
#include "los_sched.h"
#include "los_interrupt.h"
#include "los_debug.h"
/* ****************************************************************************
Function : OsSchedule
Description : task scheduling
Function : ArchInit
Description : arch init function
Input : None
Output : None
Return : None
**************************************************************************** */
VOID OsSchedule(VOID)
LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
{
osTaskSchedule();
HalHwiInit();
}
/* ****************************************************************************
Function : LOS_Schedule
Description : Function to determine whether task scheduling is required.
Input : None
Output : None
Return : None
**************************************************************************** */
VOID LOS_Schedule(VOID)
{
UINTPTR intSave;
intSave = LOS_IntLock();
/* Find the highest task */
g_losTask.newTask = LOS_DL_LIST_ENTRY(OsPriqueueTop(), LosTaskCB, pendList);
/* In case that running is not highest then reschedule */
if (g_losTask.runTask != g_losTask.newTask) {
if (!g_losTaskLock) {
LOS_IntRestore(intSave);
osTaskSchedule();
return;
}
}
LOS_IntRestore(intSave);
}
/* ****************************************************************************
Function : OsTaskExit
Function : ArchSysExit
Description : Task exit function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID OsTaskExit(VOID)
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
{
__disable_irq();
while (1) {}
(VOID)LOS_IntLock();
while (1) {
}
}
/* ****************************************************************************
Function : OsTskStackInit
Function : ArchTskStackInit
Description : Task stack initialization function
Input : taskID --- TaskID
stackSize --- Total size of the stack
@@ -105,19 +73,9 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTaskExit(VOID)
Output : None
Return : Context pointer
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
LITE_OS_SEC_TEXT_INIT VOID *ArchTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
{
TaskContext *context = NULL;
errno_t result;
/* initialize the task stack, write magic num to stack top */
result = memset_s(topStack, stackSize, (INT32)(OS_TASK_STACK_INIT & 0xFF), stackSize);
if (result != EOK) {
printf("memset_s is failed:%s[%d]\r\n", __FUNCTION__, __LINE__);
}
*((UINT32 *)(topStack)) = OS_TASK_MAGIC_WORD;
context = (TaskContext *)(((UINTPTR)topStack + stackSize) - sizeof(TaskContext));
TaskContext *context = (TaskContext *)((UINTPTR)topStack + stackSize - sizeof(TaskContext));
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
@@ -157,6 +115,10 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID
context->NO_NAME = 0xAA000011;
#endif
context->secureContext = 0UL;
context->stackLmit = (UINT32)topStack;
context->excReturn = 0xFFFFFFBC;
context->uwR4 = 0x04040404L;
context->uwR5 = 0x05050505L;
context->uwR6 = 0x06060606L;
@@ -171,24 +133,31 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID
context->uwR2 = 0x02020202L;
context->uwR3 = 0x03030303L;
context->uwR12 = 0x12121212L;
context->uwLR = (UINT32)(UINTPTR)OsTaskExit;
context->uwLR = (UINT32)(UINTPTR)ArchSysExit;
context->uwPC = (UINT32)(UINTPTR)OsTaskEntry;
context->uwxPSR = 0x01000000L;
return (VOID *)context;
}
LITE_OS_SEC_TEXT_INIT VOID OsEnterSleep(VOID)
VOID *ArchSignalContextInit(VOID *stackPointer, VOID *stackTop, UINTPTR sigHandler, UINT32 param)
{
__DSB();
__WFI();
__ISB();
TaskContext *context = (TaskContext *)((UINTPTR)stackPointer - sizeof(TaskContext));
(VOID)memset_s((VOID *)context, sizeof(TaskContext), 0, sizeof(TaskContext));
context->uwR0 = param;
context->uwPC = sigHandler;
context->stackLimit = (UINT32)stackTop;
context->excReturn = 0xFFFFFFBC;
context->uwxPSR = 0x01000000L; /* Thumb flag, always set 1 */
return (VOID *)context;
}
#ifdef __cplusplus
#if __cplusplus
LITE_OS_SEC_TEXT_INIT UINT32 ArchStartSchedule(VOID)
{
(VOID)LOS_IntLock();
OsSchedStart();
HalStartToRun();
return LOS_OK; /* never return */
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -0,0 +1,237 @@
;
; Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
; Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this list of
; conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice, this list
; of conditions and the following disclaimer in the documentation and/or other materials
; provided with the distribution.
;
; 3. Neither the name of the copyright holder nor the names of its contributors may be used
; to endorse or promote products derived from this software without specific prior written
; permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
; ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
PRESERVE8
EXPORT ArchIntLock
EXPORT ArchIntUnLock
EXPORT ArchIntRestore
EXPORT ArchTaskSchedule
EXPORT HalPendSV
EXPORT HalSVCHandler
EXPORT HalStartFirstTask
EXPORT HalSVCStartSchedule
EXPORT HalSVCSecureContextAlloc
EXPORT HalSVCSecureContextFree
IMPORT OsSignalTaskContextRestore
IMPORT OsSchedTaskSwitch
IMPORT g_losTask
EXTERN HalSecureSVCHandler
EXTERN HalSecureContextSave
EXTERN HalSecureContextLoad
EXTERN g_secureContext
OS_FPU_CPACR EQU 0xE000ED88
OS_FPU_CPACR_ENABLE EQU 0x00F00000
OS_NVIC_INT_CTRL EQU 0xE000ED04
OS_NVIC_SYSPRI2 EQU 0xE000ED20
OS_NVIC_PENDSV_PRI EQU 0xF0F00000
OS_NVIC_PENDSVSET EQU 0x10000000
OS_TASK_STATUS_RUNNING EQU 0x0010
SECTION .text:CODE(2)
THUMB
REQUIRE8
MACRO SIGNAL_CONTEXT_RESTORE
PUSH {R12, LR}
BLX OsSignalTaskContextRestore
POP {R12, LR}
CMP R0, #0
MOV R1, R0
BNE SignalContextRestore
ENDM
HalStartFirstTask
MOV R0, #2
MSR CONTROL, R0
LDR R1, =g_losTask
LDR R0, [R1, #4]
LDR R12, [R0] /* Get the stack pointer of the current task. */
LDMFD R12!, {R1-R3} /* Read from stack: R1 = secureContext, R2 = stackLmit and R3 = excReturn.*/
LDR R4, =g_secureContext
STR R1, [R4] /* Set the secureContext to g_secureContext handler. */
MSR PSPLIM, R2 /* Set the stackLmit for the PSPLIM about current task. */
ISB
LDR.W R1, =OS_FPU_CPACR
LDR R1, [R1]
AND R1, R1, #OS_FPU_CPACR_ENABLE
CMP R1, #OS_FPU_CPACR_ENABLE
BNE __DisabledFPU1
ADD R12, R12, #64
VPUSH S0;
VPOP S0;
__DisabledFPU1
ADD R12, R12, #36
MSR PSP, R12
CPSIE I
BX R3
ArchIntLock
MRS R0, PRIMASK
CPSID I
BX LR
ArchIntUnLock
MRS R0, PRIMASK
CPSIE I
BX LR
ArchIntRestore
MSR PRIMASK, R0
BX LR
ArchTaskSchedule
LDR R0, =OS_NVIC_INT_CTRL
LDR R1, =OS_NVIC_PENDSVSET
STR R1, [R0]
DSB
ISB
BX LR
HalPendSV
MRS R12, PRIMASK
CPSID I
HalTaskSwitch
SIGNAL_CONTEXT_RESTORE
PUSH {R12, LR}
BLX OsSchedTaskSwitch
POP {R12, LR}
CMP R0, #0
MOV R0, LR
BNE TaskContextSwitch
MSR PRIMASK, R12
BX LR
TaskContextSwitch
MOV LR, R0
MRS R0, PSP
LDR R2, =g_secureContext
LDR R1, [R2]
CBZ R1, __SaveNSContext /* If the g_secureContext is NULL, so no secure context to save. */
PUSH {R0-R1, R12, R14} /* Store registers, include LR, PRIMASK. */
BL HalSecureContextSave /* Store the secure context to g_secureContext->curStackPointer. */
POP {R0-R3}
MOV LR, R3
MOV R12, R2 /* R2 = PRIMASK. */
__SaveNSContext
STMFD R0!, {R4-R12}
LDR.W R3, =OS_FPU_CPACR
LDR R3, [R3]
AND R3, R3, #OS_FPU_CPACR_ENABLE
CMP R3, #OS_FPU_CPACR_ENABLE
BNE __DisabledFPU2
VSTMDB R0!, {D8-D15}
__DisabledFPU2
LDR R5, =g_losTask
LDR R6, [R5] /* Get the stackPointer handler of the current task. */
SUBS R0, R0, #12
STR R0, [R6] /* Save the new top of stack in TCB. */
MRS R2, PSPLIM
MOV R3, LR
STMIA R0!, {R1, R2-R3} /* Store g_secureContext, PSPLIM and LR on the stack of current task. */
LDR R0, [R5, #4]
STR R0, [R5]
LDR R1, [R0]
SignalContextRestore
LDMIA R1!, {R0, R2-R3} /* Restore secureContext, PSPLIM and LR from the current task stack. */
MSR PSPLIM, R2
MOV LR, R3
LDR R2, =g_secureContext
STR R0, [R2] /* Set the secureContext of the new task to g_secureContext. */
CBZ R0, __RestoreNSContext /* If there is no secure context for the new task, so restore from the non-secure context. */
PUSH {R1, R3}
BL HalSecureContextLoad /* Restore the secure context. */
POP {R1, R3}
MOV LR, R3
__RestoreNSContext
LDR.W R3, =OS_FPU_CPACR
LDR R3, [R3]
AND R3, R3, #OS_FPU_CPACR_ENABLE
CMP R3, #OS_FPU_CPACR_ENABLE
BNE __DisabledFPU3
VLDMIA R1!, {D8-D15}
__DisabledFPU3
LDMFD R1!, {R4-R12}
MSR PSP, R1
MSR PRIMASK, R12
BX LR
HalSVCStartSchedule
LDR R4, =OS_NVIC_SYSPRI2
LDR R5, =OS_NVIC_PENDSV_PRI
STR R5, [R4]
CPSIE I
DSB
ISB
SVC 2
HalSVCSecureContextAlloc
SVC 0
BX LR
HalSVCSecureContextFree
SVC 1
BX LR
HalSVCHandler
TST LR, #0x04
ITE EQ
MRSEQ R1, MSP
MRSNE R1, PSP
LDR R0, [R1, #24]
LDRB R0, [R0, #-2] /* Get the SVC number. */
PUSH {LR}
MOV R2, R1 /* Get the stack for R2. */
LDMFD R2!, {R1} /* Get the input arg for HalSecureSVCHandler. */
STMFD R2!, {R1}
BL HalSecureSVCHandler
POP {LR}
BX LR
END

View File

@@ -0,0 +1,274 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
PRESERVE8
SECTION .text:CODE(2)
THUMB
EXPORT HalExcNMI
EXPORT HalExcHardFault
EXPORT HalExcMemFault
EXPORT HalExcBusFault
EXPORT HalExcUsageFault
IMPORT HalExcHandleEntry
IMPORT g_uwExcTbl
IMPORT g_taskScheduled
OS_FLG_BGD_ACTIVE EQU 0x0002
OS_EXC_CAUSE_NMI EQU 16
OS_EXC_CAUSE_HARDFAULT EQU 17
HF_DEBUGEVT EQU 20
HF_VECTBL EQU 21
FLAG_ADDR_VALID EQU 0x10000
FLAG_HWI_ACTIVE EQU 0x20000
FLAG_NO_FLOAT EQU 0x10000000
OS_NVIC_FSR EQU 0xE000ED28 ;include BusFault/MemFault/UsageFault State Register
OS_NVIC_HFSR EQU 0xE000ED2C ;HardFault State Register
OS_NVIC_BFAR EQU 0xE000ED38
OS_NVIC_MMAR EQU 0xE000ED34
OS_NVIC_ACT_BASE EQU 0xE000E300
OS_NVIC_SHCSRS EQU 0xE000ED24
OS_NVIC_SHCSR_MASK EQU 0xC00
HalExcNMI
MOV R0, #OS_EXC_CAUSE_NMI
MOV R1, #0
B osExcDispatch
HalExcHardFault
MOV R0, #OS_EXC_CAUSE_HARDFAULT
LDR R2, =OS_NVIC_HFSR
LDR R2, [R2]
MOV R1, #HF_DEBUGEVT
ORR R0, R0, R1, LSL #0x8
TST R2, #0x80000000
BNE osExcDispatch ; DEBUGEVT
AND R0, R0 , #0x000000FF
MOV R1, #HF_VECTBL
ORR R0, R0, R1, LSL #0x8
TST R2, #0x00000002
BNE osExcDispatch ; VECTBL
;if not DEBUGEVT and VECTBL then is FORCED
AND R0, R0, #0x000000FF
LDR R2, =OS_NVIC_FSR
LDR R2, [R2]
TST R2, #0x8000 ; BFARVALID
BNE _HFBusFault ; BusFault
TST R2, #0x80 ; MMARVALID
BNE _HFMemFault ; MemFault
MOV R12,#0
B osHFExcCommonBMU
_HFBusFault
LDR R1, =OS_NVIC_BFAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
B osHFExcCommonBMU
_HFMemFault
LDR R1, =OS_NVIC_MMAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
osHFExcCommonBMU
CLZ R2, R2
LDR R3, =g_uwExcTbl
ADD R3, R3, R2
LDRB R2, [R3]
ORR R0, R0, R2, LSL #0x8
ORR R0, R0 ,R12
B osExcDispatch
HalExcBusFault
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
TST R0, #0x8000 ; BFARVALID
BEQ _ExcBusNoADDR
LDR R1, =OS_NVIC_BFAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
AND R0, R0, #0x1F00
B osExcCommonBMU
_ExcBusNoADDR
MOV R12,#0
B osExcCommonBMU
HalExcMemFault
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
TST R0, #0x80 ; MMARVALID
BEQ _ExcMemNoADDR
LDR R1, =OS_NVIC_MMAR
LDR R1, [R1]
MOV R12, #FLAG_ADDR_VALID
AND R0, R0, #0x1B
B osExcCommonBMU
_ExcMemNoADDR
MOV R12,#0
B osExcCommonBMU
HalExcUsageFault
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
MOV R1, #0x030F
LSL R1, R1, #16
AND R0, R0, R1
MOV R12, #0
osExcCommonBMU
CLZ R0, R0
LDR R3, =g_uwExcTbl
ADD R3, R3, R0
LDRB R0, [R3]
ORR R0, R0, R12
; R0 -- EXCCAUSE(bit 16 is 1 if EXCADDR valid), R1 -- EXCADDR
osExcDispatch
LDR R2, =OS_NVIC_ACT_BASE
MOV R12, #8 ; R12 is hwi check loop counter
_hwiActiveCheck
LDR R3, [R2] ; R3 store active hwi register when exc
CMP R3, #0
BEQ _hwiActiveCheckNext
; exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
AND R12, R12, #1
ADD R2, R2, R12, LSL #5 ; calculate R2 (hwi number) as pid
_ExcInMSP
CMP LR, #0xFFFFFFE9
BNE _NoFloatInMsp
ADD R3, R13, #104
PUSH {R3}
MRS R12, PRIMASK ; store message-->exc: disable int?
PUSH {R4-R12} ; store message-->exc: {R4-R12}
VPUSH {D8-D15}
B _handleEntry
_NoFloatInMsp
ADD R3, R13, #32
PUSH {R3} ; save IRQ SP ; store message-->exc: MSP(R13)
MRS R12, PRIMASK ; store message-->exc: disable int?
PUSH {R4-R12} ; store message-->exc: {R4-R12}
ORR R0, R0, #FLAG_NO_FLOAT
B _handleEntry
_hwiActiveCheckNext
ADD R2, R2, #4 ; next NVIC ACT ADDR
SUBS R12, R12, #1
BNE _hwiActiveCheck
;/*NMI interrupt excption*/
LDR R2, =OS_NVIC_SHCSRS
LDRH R2,[R2]
LDR R3,=OS_NVIC_SHCSR_MASK
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
; exc occurred in Task or Init or exc
; reserved for register info from task stack
LDR R2, =g_taskScheduled
LDR R2, [R2]
TST R2, #1 ; OS_FLG_BGD_ACTIVE
BEQ _ExcInMSP ; if exc occurred in Init then branch
CMP LR, #0xFFFFFFED ;auto push floating registers
BNE _NoFloatInPsp
; exc occurred in Task
MOV R2, R13
SUB R13, #96 ; add 8 Bytes reg(for STMFD)
MRS R3, PSP
ADD R12, R3, #104
PUSH {R12} ; save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
VPUSH {D8-D15}
; copy auto saved task register
LDMFD R3!, {R4-R11} ; R4-R11 store PSP reg(auto push when exc in task)
VLDMIA R3!, {D8-D15}
VSTMDB R2!, {D8-D15}
STMFD R2!, {R4-R11}
B _handleEntry
_NoFloatInPsp
MOV R2, R13 ;no auto push floating registers
SUB R13, #32 ; add 8 Bytes reg(for STMFD)
MRS R3, PSP
ADD R12, R3, #32
PUSH {R12} ; save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
LDMFD R3, {R4-R11} ; R4-R11 store PSP reg(auto push when exc in task)
STMFD R2!, {R4-R11}
ORR R0, R0, #FLAG_NO_FLOAT
_handleEntry
MOV R3, R13 ; R13:the 4th param
CPSID I
CPSID F
B HalExcHandleEntry
NOP
END

View File

@@ -0,0 +1,433 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdarg.h>
#include "securec.h"
#include "los_context.h"
#include "los_arch_interrupt.h"
#include "los_hook.h"
#include "los_task.h"
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
/* ****************************************************************************
Function : HwiNumGet
Description : Get an interrupt number
Input : None
Output : None
Return : Interrupt Indexes number
**************************************************************************** */
STATIC UINT32 HwiNumGet(VOID)
{
return __get_IPSR();
}
STATIC UINT32 HwiUnmask(HWI_HANDLE_T hwiNum)
{
NVIC_EnableIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiMask(HWI_HANDLE_T hwiNum)
{
NVIC_DisableIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiSetPriority(HWI_HANDLE_T hwiNum, UINT8 priority)
{
NVIC_SetPriority((IRQn_Type)hwiNum, priority);
return LOS_OK;
}
STATIC UINT32 HwiPending(HWI_HANDLE_T hwiNum)
{
NVIC_SetPendingIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiClear(HWI_HANDLE_T hwiNum)
{
NVIC_ClearPendingIRQ((IRQn_Type)hwiNum);
return LOS_OK;
}
STATIC UINT32 HwiCreate(HWI_HANDLE_T hwiNum, HWI_PRIOR_T hwiPrio)
{
HwiSetPriority(hwiNum, hwiPrio);
HwiUnmask(hwiNum);
return LOS_OK;
}
STATIC HwiControllerOps g_archHwiOps = {
.enableIrq = HwiUnmask,
.disableIrq = HwiMask,
.setIrqPriority = HwiSetPriority,
.getCurIrqNum = HwiNumGet,
.triggerIrq = HwiPending,
.clearIrq = HwiClear,
.createIrq = HwiCreate,
};
HwiControllerOps *ArchIntOpsGet(VOID)
{
return &g_archHwiOps;
}
/* ****************************************************************************
Function : HalInterrupt
Description : Hardware interrupt entry function
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
{
UINT32 hwiIndex;
UINT32 intSave;
#if (LOSCFG_KERNEL_RUNSTOP == 1)
SCB->SCR &= (UINT32) ~((UINT32)SCB_SCR_SLEEPDEEP_Msk);
#endif
intSave = LOS_IntLock();
g_intCount++;
LOS_IntRestore(intSave);
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (g_hwiHandlerForm[hwiIndex].pfnHandler != 0) {
g_hwiHandlerForm[hwiIndex].pfnHandler((VOID *)g_hwiHandlerForm[hwiIndex].pParm);
}
#else
if (g_hwiHandlerForm[hwiIndex] != 0) {
g_hwiHandlerForm[hwiIndex]();
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
g_intCount--;
LOS_IntRestore(intSave);
}
#define FAULT_STATUS_REG_BIT 32
#define USGFAULT (1 << 18)
#define BUSFAULT (1 << 17)
#define MEMFAULT (1 << 16)
#define DIV0FAULT (1 << 4)
#define HARDFAULT_IRQN (-13)
ExcInfo g_excInfo = {0};
UINT8 g_uwExcTbl[FAULT_STATUS_REG_BIT] = {
0, 0, 0, 0, 0, 0, OS_EXC_UF_DIVBYZERO, OS_EXC_UF_UNALIGNED,
0, 0, 0, 0, OS_EXC_UF_NOCP, OS_EXC_UF_INVPC, OS_EXC_UF_INVSTATE, OS_EXC_UF_UNDEFINSTR,
0, 0, 0, OS_EXC_BF_STKERR, OS_EXC_BF_UNSTKERR, OS_EXC_BF_IMPRECISERR, OS_EXC_BF_PRECISERR, OS_EXC_BF_IBUSERR,
0, 0, 0, OS_EXC_MF_MSTKERR, OS_EXC_MF_MUNSTKERR, 0, OS_EXC_MF_DACCVIOL, OS_EXC_MF_IACCVIOL
};
#if (LOSCFG_KERNEL_PRINTF != 0)
STATIC VOID OsExcNvicDump(VOID)
{
#define OS_NR_NVIC_EXC_DUMP_TYPES 7
UINT32 *base = NULL;
UINT32 len, i, j;
UINT32 rgNvicBases[OS_NR_NVIC_EXC_DUMP_TYPES] = {
OS_NVIC_SETENA_BASE, OS_NVIC_SETPEND_BASE, OS_NVIC_INT_ACT_BASE,
OS_NVIC_PRI_BASE, OS_NVIC_EXCPRI_BASE, OS_NVIC_SHCSR, OS_NVIC_INT_CTRL
};
UINT32 rgNvicLens[OS_NR_NVIC_EXC_DUMP_TYPES] = {
OS_NVIC_INT_ENABLE_SIZE, OS_NVIC_INT_PEND_SIZE, OS_NVIC_INT_ACT_SIZE,
OS_NVIC_INT_PRI_SIZE, OS_NVIC_EXCPRI_SIZE, OS_NVIC_SHCSR_SIZE,
OS_NVIC_INT_CTRL_SIZE
};
CHAR strRgEnable[] = "enable";
CHAR strRgPending[] = "pending";
CHAR strRgActive[] = "active";
CHAR strRgPriority[] = "priority";
CHAR strRgException[] = "exception";
CHAR strRgShcsr[] = "shcsr";
CHAR strRgIntCtrl[] = "control";
CHAR *strRgs[] = {
strRgEnable, strRgPending, strRgActive, strRgPriority,
strRgException, strRgShcsr, strRgIntCtrl
};
PRINTK("\r\nOS exception NVIC dump:\n");
for (i = 0; i < OS_NR_NVIC_EXC_DUMP_TYPES; i++) {
base = (UINT32 *)rgNvicBases[i];
len = rgNvicLens[i];
PRINTK("interrupt %s register, base address: %p, size: 0x%x\n", strRgs[i], base, len);
len = (len >> 2); /* 2: Gets the next register offset */
for (j = 0; j < len; j++) {
PRINTK("0x%x ", *(base + j));
if ((j != 0) && ((j % 16) == 0)) { /* 16: print wrap line */
PRINTK("\n");
}
}
PRINTK("\n");
}
}
STATIC VOID OsExcTypeInfo(const ExcInfo *excInfo)
{
CHAR *phaseStr[] = {"exc in init", "exc in task", "exc in hwi"};
PRINTK("Type = %d\n", excInfo->type);
PRINTK("ThrdPid = %d\n", excInfo->thrdPid);
PRINTK("Phase = %s\n", phaseStr[excInfo->phase]);
PRINTK("FaultAddr = 0x%x\n", excInfo->faultAddr);
}
STATIC VOID OsExcCurTaskInfo(const ExcInfo *excInfo)
{
PRINTK("Current task info:\n");
if (excInfo->phase == OS_EXC_IN_TASK) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
PRINTK("Task name = %s\n", taskCB->taskName);
PRINTK("Task ID = %d\n", taskCB->taskID);
PRINTK("Task SP = %p\n", taskCB->stackPointer);
PRINTK("Task ST = 0x%x\n", taskCB->topOfStack);
PRINTK("Task SS = 0x%x\n", taskCB->stackSize);
} else if (excInfo->phase == OS_EXC_IN_HWI) {
PRINTK("Exception occur in interrupt phase!\n");
} else {
PRINTK("Exception occur in system init phase!\n");
}
}
STATIC VOID OsExcRegInfo(const ExcInfo *excInfo)
{
PRINTK("Exception reg dump:\n");
PRINTK("PC = 0x%x\n", excInfo->context->uwPC);
PRINTK("LR = 0x%x\n", excInfo->context->uwLR);
PRINTK("SP = 0x%x\n", excInfo->context->uwSP);
PRINTK("R0 = 0x%x\n", excInfo->context->uwR0);
PRINTK("R1 = 0x%x\n", excInfo->context->uwR1);
PRINTK("R2 = 0x%x\n", excInfo->context->uwR2);
PRINTK("R3 = 0x%x\n", excInfo->context->uwR3);
PRINTK("R4 = 0x%x\n", excInfo->context->uwR4);
PRINTK("R5 = 0x%x\n", excInfo->context->uwR5);
PRINTK("R6 = 0x%x\n", excInfo->context->uwR6);
PRINTK("R7 = 0x%x\n", excInfo->context->uwR7);
PRINTK("R8 = 0x%x\n", excInfo->context->uwR8);
PRINTK("R9 = 0x%x\n", excInfo->context->uwR9);
PRINTK("R10 = 0x%x\n", excInfo->context->uwR10);
PRINTK("R11 = 0x%x\n", excInfo->context->uwR11);
PRINTK("R12 = 0x%x\n", excInfo->context->uwR12);
PRINTK("PriMask = 0x%x\n", excInfo->context->uwPriMask);
PRINTK("xPSR = 0x%x\n", excInfo->context->uwxPSR);
}
#if (LOSCFG_KERNEL_BACKTRACE == 1)
STATIC VOID OsExcBackTraceInfo(const ExcInfo *excInfo)
{
UINTPTR LR[LOSCFG_BACKTRACE_DEPTH] = {0};
UINT32 index;
OsBackTraceHookCall(LR, LOSCFG_BACKTRACE_DEPTH, 0, excInfo->context->uwSP);
PRINTK("----- backtrace start -----\n");
for (index = 0; index < LOSCFG_BACKTRACE_DEPTH; index++) {
if (LR[index] == 0) {
break;
}
PRINTK("backtrace %d -- lr = 0x%x\n", index, LR[index]);
}
PRINTK("----- backtrace end -----\n");
}
#endif
STATIC VOID OsExcMemPoolCheckInfo(VOID)
{
PRINTK("\r\nmemory pools check:\n");
#if (LOSCFG_PLATFORM_EXC == 1)
MemInfoCB memExcInfo[OS_SYS_MEM_NUM];
UINT32 errCnt;
UINT32 i;
(VOID)memset_s(memExcInfo, sizeof(memExcInfo), 0, sizeof(memExcInfo));
errCnt = OsMemExcInfoGet(OS_SYS_MEM_NUM, memExcInfo);
if (errCnt < OS_SYS_MEM_NUM) {
errCnt += OsMemboxExcInfoGet(OS_SYS_MEM_NUM - errCnt, memExcInfo + errCnt);
}
if (errCnt == 0) {
PRINTK("all memory pool check passed!\n");
return;
}
for (i = 0; i < errCnt; i++) {
PRINTK("pool num = %d\n", i);
PRINTK("pool type = %d\n", memExcInfo[i].type);
PRINTK("pool addr = 0x%x\n", memExcInfo[i].startAddr);
PRINTK("pool size = 0x%x\n", memExcInfo[i].size);
PRINTK("pool free = 0x%x\n", memExcInfo[i].free);
PRINTK("pool blkNum = %d\n", memExcInfo[i].blockSize);
PRINTK("pool error node addr = 0x%x\n", memExcInfo[i].errorAddr);
PRINTK("pool error node len = 0x%x\n", memExcInfo[i].errorLen);
PRINTK("pool error node owner = %d\n", memExcInfo[i].errorOwner);
}
#endif
UINT32 ret = LOS_MemIntegrityCheck(LOSCFG_SYS_HEAP_ADDR);
if (ret == LOS_OK) {
PRINTK("system heap memcheck over, all passed!\n");
}
PRINTK("memory pool check end!\n");
}
#endif
STATIC VOID OsExcInfoDisplay(const ExcInfo *excInfo)
{
#if (LOSCFG_KERNEL_PRINTF != 0)
PRINTK("*************Exception Information**************\n");
OsExcTypeInfo(excInfo);
OsExcCurTaskInfo(excInfo);
OsExcRegInfo(excInfo);
#if (LOSCFG_KERNEL_BACKTRACE == 1)
OsExcBackTraceInfo(excInfo);
#endif
OsGetAllTskInfo();
OsExcNvicDump();
OsExcMemPoolCheckInfo();
#endif
}
LITE_OS_SEC_TEXT_INIT VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr)
{
UINT16 tmpFlag = (excType >> 16) & OS_NULL_SHORT; /* 16: Get Exception Type */
g_intCount++;
g_excInfo.nestCnt++;
g_excInfo.type = excType & OS_NULL_SHORT;
if (tmpFlag & OS_EXC_FLAG_FAULTADDR_VALID) {
g_excInfo.faultAddr = faultAddr;
} else {
g_excInfo.faultAddr = OS_EXC_IMPRECISE_ACCESS_ADDR;
}
if (g_losTask.runTask != NULL) {
if (tmpFlag & OS_EXC_FLAG_IN_HWI) {
g_excInfo.phase = OS_EXC_IN_HWI;
g_excInfo.thrdPid = pid;
} else {
g_excInfo.phase = OS_EXC_IN_TASK;
g_excInfo.thrdPid = g_losTask.runTask->taskID;
}
} else {
g_excInfo.phase = OS_EXC_IN_INIT;
g_excInfo.thrdPid = OS_NULL_INT;
}
if (excType & OS_EXC_FLAG_NO_FLOAT) {
g_excInfo.context = (EXC_CONTEXT_S *)((CHAR *)excBufAddr - LOS_OFF_SET_OF(EXC_CONTEXT_S, uwR4));
} else {
g_excInfo.context = excBufAddr;
}
OsDoExcHook(EXC_INTERRUPT);
OsExcInfoDisplay(&g_excInfo);
ArchSysExit();
}
WEAK VOID SysTick_Handler(VOID)
{
return;
}
/* ****************************************************************************
Function : HalHwiInit
Description : initialization of the hardware interrupt
Input : None
Output : None
Return : None
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
{
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
HWI_PROC_FUNC *hwiForm = (HWI_PROC_FUNC *)ArchGetHwiFrom();
hwiForm[0] = 0; /* [0] Top of Stack */
hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)hwiForm;
#endif
#if (__CORTEX_M >= 0x03U) /* only for Cortex-M3 and above */
NVIC_SetPriorityGrouping(OS_NVIC_AIRCR_PRIGROUP);
#endif
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
return;
}

View File

@@ -0,0 +1,128 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_timer.h"
#include "los_config.h"
#include "los_tick.h"
#include "los_arch_interrupt.h"
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
STATIC ArchTickTimer g_archTickTimer = {
.freq = 0,
.irqNum = SysTick_IRQn,
.periodMax = LOSCFG_BASE_CORE_TICK_RESPONSE_MAX,
.init = SysTickStart,
.getCycle = SysTickCycleGet,
.reload = SysTickReload,
.lock = SysTickLock,
.unlock = SysTickUnlock,
.tickHandler = NULL,
};
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
{
UINT32 ret;
ArchTickTimer *tick = &g_archTickTimer;
tick->freq = OS_SYS_CLOCK;
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(tick->irqNum, handler, NULL);
#else
OsSetVector(tick->irqNum, handler);
#endif
#endif
ret = SysTick_Config(LOSCFG_BASE_CORE_TICK_RESPONSE_MAX);
if (ret == 1) {
return LOS_ERRNO_TICK_PER_SEC_TOO_SMALL;
}
return LOS_OK;
}
STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
{
if (nextResponseTime > g_archTickTimer.periodMax) {
nextResponseTime = g_archTickTimer.periodMax;
}
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)
{
UINT32 hwCycle = 0;
UINTPTR intSave = LOS_IntLock();
UINT32 val = SysTick->VAL;
*period = SysTick->LOAD;
if (val != 0) {
hwCycle = *period - val;
}
LOS_IntRestore(intSave);
return (UINT64)hwCycle;
}
STATIC VOID SysTickLock(VOID)
{
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
}
STATIC VOID SysTickUnlock(VOID)
{
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
}
ArchTickTimer *ArchSysTickTimerGet(VOID)
{
return &g_archTickTimer;
}
UINT32 ArchEnterSleep(VOID)
{
__DSB();
__WFI();
__ISB();
return LOS_OK;
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_trustzone.h"
#include "los_secure_macros.h"
#include "los_secure_context.h"
#include "los_debug.h"
#include "los_arch_context.h"
#include "los_interrupt.h"
OsSecureContext *g_secureContext = NULL;
VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
{
switch (svcID) {
case OS_SVC_START_SCHEDULE:
HalSecureContextInit();
HalStartFirstTask();
break;
case OS_SVC_ALLOCATE_SECURE_CONTEXT:
g_secureContext = HalSecureContextAlloc(arg);
LOS_ASSERT(g_secureContext != NULL);
HalSecureContextLoad(g_secureContext);
break;
case OS_SVC_FREE_SECURE_CONTEXT:
LOS_ASSERT(g_secureContext != NULL);
HalSecureContextFree(g_secureContext);
break;
default:
PRINT_ERR("Incorrect svc id = %u\n", svcID);
break;
}
}
VOID HalStartToRun(VOID)
{
HalSVCStartSchedule();
}
VOID LOS_SecureContextAlloc(UINT32 secureStackSize)
{
if (secureStackSize == 0) {
return;
}
LOS_ASSERT((__get_IPSR() == 0) && (__get_PRIMASK() == 0));
secureStackSize = LOS_Align(secureStackSize, sizeof(UINTPTR));
HalSVCSecureContextAlloc(secureStackSize);
}
VOID LOS_SecureContextFree(VOID)
{
HalSVCSecureContextFree();
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_TRUSTZONE_H
#define _LOS_TRUSTZONE_H
#include "los_config.h"
#include "los_task.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
extern VOID LOS_SecureContextAlloc(UINT32 secureStackSize);
extern VOID LOS_SecureContextFree(VOID);
extern VOID HalStartFirstTask(VOID);
extern VOID HalSVCStartSchedule(VOID);
extern VOID HalSVCSecureContextAlloc(UINT32 secureStackSize);
extern VOID HalSVCSecureContextFree(VOID);
extern VOID HalSVCHandler(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif

Some files were not shown because too many files have changed in this diff Show More