Compare commits

...

128 Commits

Author SHA1 Message Date
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
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
369 changed files with 10739 additions and 3788 deletions

24
Kconfig
View File

@@ -1,5 +1,5 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device 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:
@@ -317,7 +317,7 @@ config CPUP_INCLUDE_IRQ
help
If you wish to include irq usage for cpup.
config DYNLINK
config KERNEL_DYNLINK
bool "Enable Dynamic Link Feature"
default n
depends on KERNEL_EXTKERNEL && ARCH_ARM
@@ -369,7 +369,7 @@ config KERNEL_LMK
default n
depends on KERNEL_EXTKERNEL
help
Configuration item for low momery killer tailoring.
Configuration item for low memory killer tailoring.
If you wish to build LiteOS with support for low memory killer.
config KERNEL_LMK_DEBUG
@@ -554,6 +554,13 @@ config 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 USB_DEBUG
bool "Enable USB Debug"
default n
@@ -574,7 +581,7 @@ config MEM_LEAKCHECK
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 infomations of mem node.
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the informations of mem node.
config BASE_MEM_NODE_INTEGRITY_CHECK
bool "Enable integrity check or not"
default n
@@ -600,11 +607,11 @@ endmenu
######################## config options os security #######################
menu "Security"
osource "security/Kconfig"
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
@@ -615,6 +622,13 @@ config SECURE_STACK_DEFAULT_SIZE
depends on SECURE_TRUSTZONE
help
The secure stack must be allocated before the task calls non-secure functions.
config SECURE
bool "Enable Security"
default n
select MPU_ENABLE
config MPU_ENABLE
bool "Enable MPU"
default n
endmenu
menu "Test"

View File

@@ -85,11 +85,11 @@ Before setting up the environment for a development board, you must set up the b
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 that are already supported
### 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)
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)
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
@@ -131,4 +131,4 @@ How to contribute a chip based on Liteos-M kernel:
[Kernel Subsystem](https://gitee.com/openharmony/docs/blob/HEAD/en/readme/kernel-subsystem.md)
**kernel\_liteos\_m**
[kernel\_liteos\_m](https://gitee.com/openharmony/kernel_liteos_m/blob/master/README.md)

View File

@@ -131,5 +131,5 @@ LiteOS-M内核移植的具体开发板的工程由社区开发者提供可以
[内核子系统](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**
[kernel\_liteos\_m](https://gitee.com/openharmony/kernel_liteos_m/blob/master/README_zh.md)

View File

@@ -39,7 +39,8 @@ module_group("arch") {
"$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") {
} else if ("$board_cpu" == "ck802" || "$board_cpu" == "e802" ||
"$board_cpu" == "ck804ef") {
modules += [ "csky" ]
} else if ("$board_cpu" == "") {
if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") {

View File

@@ -16,12 +16,16 @@ config ARCH_ARM_AARCH32
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
#
@@ -84,23 +88,20 @@ config ARCH_CORTEX_M7
select ARCH_ARM_AARCH32
select ARCH_FPU_VFP_V4
select ARCH_FPU_VFP_D32
select ARCH_FPU_VFP_NEON
config ARCH_CORTEX_M33
bool
select ARCH_ARM_V7M
select ARCH_ARM_V8M
select ARCH_ARM_AARCH32
select ARCH_FPU_VFP_V4
select ARCH_FPU_VFP_D32
select ARCH_FPU_VFP_NEON
config ARCH_CORTEX_M55
bool
select ARCH_ARM_V7M
select ARCH_ARM_V8M
select ARCH_ARM_AARCH32
select ARCH_FPU_VFP_V4
select ARCH_FPU_VFP_D32
select ARCH_FPU_VFP_NEON
config ARCH_ARM9
bool

View File

@@ -76,6 +76,7 @@ LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
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;

View File

@@ -163,21 +163,21 @@ inline UINT32 ArchIsIntActive(VOID)
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -231,21 +231,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
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
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 mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -259,9 +260,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask(hwiNum);
LOS_IntRestore(intSave);
@@ -273,11 +279,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -52,7 +52,7 @@
#define OS_TIMER_READ_VAL_ADDR (OS_TIMER_REG_BASE + 20)
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -60,6 +60,7 @@ 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,
@@ -107,12 +108,17 @@ STATIC VOID SysTickClockIrqClear(VOID)
} while (status & mask);
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
{
if (nextResponseTime > g_archTickTimer.periodMax) {
nextResponseTime = g_archTickTimer.periodMax;
}
SysTickLock();
WRITE_UINT32(nextResponseTime, OS_TIMER_PERIOD_REG_ADDR);
WRITE_UINT32((UINT32)nextResponseTime, OS_TIMER_PERIOD_REG_ADDR);
SysTickClockIrqClear();
SysTickUnlock();
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

0
arch/arm/cortex-m3/keil/los_atomic.S Executable file → Normal file
View File

View File

@@ -190,7 +190,7 @@ _hwiActiveCheck
CMP R3, #0
BEQ _hwiActiveCheckNext
; exc occured in IRQ
; exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
@@ -228,19 +228,19 @@ _hwiActiveCheckNext
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
; exc occured in Task or Init or exc
; 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 occured in Init then branch
BEQ _ExcInMSP ; if exc occurred in Init then branch
CMP LR, #0xFFFFFFED ;auto push floating registers
BNE _NoFloatInPsp
; exc occured in Task
; exc occurred in Task
MOV R2, R13
SUB R13, #96 ; add 8 Bytes reg(for STMFD)

View File

@@ -40,14 +40,12 @@
#include "los_memory.h"
#include "los_membox.h"
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
#ifdef __ICCARM__
#pragma location = ".data.vector"
#elif defined(__CC_ARM) || defined(__GNUC__)
#pragma data_alignment=LOSCFG_ARCH_HWI_VECTOR_ALIGN
#pragma data_alignment = LOSCFG_ARCH_HWI_VECTOR_ALIGN
LITE_OS_SEC_VEC
#endif
/* *
@@ -198,21 +196,21 @@ inline UINT32 ArchIsIntActive(VOID)
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -266,21 +264,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
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
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 mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -298,9 +297,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -314,11 +318,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {
@@ -593,7 +599,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
/* 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);

View File

@@ -37,7 +37,7 @@
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -45,6 +45,7 @@ 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,
@@ -76,13 +77,19 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
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 */
NVIC_ClearPendingIRQ(SysTick_IRQn);
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

0
arch/arm/cortex-m33/gcc/NTZ/los_arch_atomic.h Executable file → Normal file
View File

0
arch/arm/cortex-m33/gcc/NTZ/los_arch_context.h Executable file → Normal file
View File

0
arch/arm/cortex-m33/gcc/NTZ/los_arch_interrupt.h Executable file → Normal file
View File

8
arch/arm/cortex-m33/gcc/NTZ/los_exc.S Executable file → Normal file
View File

@@ -263,7 +263,7 @@ _hwiActiveCheck:
CMP R3, #0
BEQ _hwiActiveCheckNext
// exc occured in IRQ
// exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
@@ -316,19 +316,19 @@ _hwiActiveCheckNext:
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
// exc occured in Task or Init or exc
// 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 occured in Init then branch
BEQ _ExcInMSP // if exc occurred in Init then branch
CMP LR, #0xFFFFFFED //auto push floating registers
BNE _NoFloatInPsp
// exc occured in Task
// exc occurred in Task
MOV R2, R13
SUB R13, #96 // add 8 Bytes reg(for STMFD)

38
arch/arm/cortex-m33/gcc/NTZ/los_interrupt.c Executable file → Normal file
View File

@@ -41,10 +41,8 @@
#include "los_membox.h"
#define DEF_HANDLER_START_INDEX 2
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
/* *
* @ingroup los_hwi
@@ -189,21 +187,21 @@ inline UINT32 ArchIsIntActive(VOID)
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -257,21 +255,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
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
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 mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -289,9 +288,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -305,11 +309,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {
@@ -584,7 +590,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
/* 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);

10
arch/arm/cortex-m33/gcc/NTZ/los_timer.c Executable file → Normal file
View File

@@ -36,7 +36,7 @@
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -44,6 +44,7 @@ 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,
@@ -75,13 +76,18 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
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 */
NVIC_ClearPendingIRQ(SysTick_IRQn);
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

View File

View File

View File

8
arch/arm/cortex-m33/gcc/TZ/non_secure/los_exc.S Executable file → Normal file
View File

@@ -247,7 +247,7 @@ _hwiActiveCheck:
CMP R3, #0
BEQ _hwiActiveCheckNext
// exc occured in IRQ
// exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
@@ -300,19 +300,19 @@ _hwiActiveCheckNext:
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
// exc occured in Task or Init or exc
// 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 occured in Init then branch
BEQ _ExcInMSP // if exc occurred in Init then branch
CMP LR, #0xFFFFFFED //auto push floating registers
BNE _NoFloatInPsp
// exc occured in Task
// exc occurred in Task
MOV R2, R13
SUB R13, #96 // add 8 Bytes reg(for STMFD)

38
arch/arm/cortex-m33/gcc/TZ/non_secure/los_interrupt.c Executable file → Normal file
View File

@@ -41,11 +41,8 @@
#include "los_membox.h"
#define DEF_HANDLER_START_INDEX 2
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
/* *
* @ingroup los_hwi
* Hardware interrupt form mapping handling function array.
@@ -192,18 +189,19 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -257,21 +255,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
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
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 mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -289,9 +288,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -305,11 +309,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {
@@ -584,7 +590,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
/* 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);

10
arch/arm/cortex-m33/gcc/TZ/non_secure/los_timer.c Executable file → Normal file
View File

@@ -35,7 +35,7 @@
#include "los_arch_interrupt.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -43,6 +43,7 @@ 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,
@@ -74,13 +75,18 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
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 */
NVIC_ClearPendingIRQ(SysTick_IRQn);
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

0
arch/arm/cortex-m33/gcc/TZ/non_secure/los_trustzone.c Executable file → Normal file
View File

0
arch/arm/cortex-m33/gcc/TZ/non_secure/los_trustzone.h Executable file → Normal file
View File

0
arch/arm/cortex-m33/gcc/TZ/secure/los_secure_context.c Executable file → Normal file
View File

0
arch/arm/cortex-m33/gcc/TZ/secure/los_secure_context.h Executable file → Normal file
View File

View File

0
arch/arm/cortex-m33/gcc/TZ/secure/los_secure_heap.c Executable file → Normal file
View File

0
arch/arm/cortex-m33/gcc/TZ/secure/los_secure_heap.h Executable file → Normal file
View File

0
arch/arm/cortex-m33/gcc/TZ/secure/los_secure_macros.h Executable file → Normal file
View File

View File

@@ -56,8 +56,8 @@ 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 Regeister
OS_NVIC_HFSR EQU 0xE000ED2C ;HardFault State Regeister
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
@@ -190,7 +190,7 @@ _hwiActiveCheck
CMP R3, #0
BEQ _hwiActiveCheckNext
; exc occured in IRQ
; exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
@@ -228,19 +228,19 @@ _hwiActiveCheckNext
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
; exc occured in Task or Init or exc
; 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 occured in Init then branch
BEQ _ExcInMSP ; if exc occurred in Init then branch
CMP LR, #0xFFFFFFED ;auto push floating registers
BNE _NoFloatInPsp
; exc occured in Task
; exc occurred in Task
MOV R2, R13
SUB R13, #96 ; add 8 Bytes reg(for STMFD)

View File

@@ -46,7 +46,7 @@ UINT32 g_intCount = 0;
/*lint -restore*/
#pragma location = ".data.vector"
#pragma data_alignment=LOSCFG_ARCH_HWI_VECTOR_ALIGN
#pragma data_alignment = LOSCFG_ARCH_HWI_VECTOR_ALIGN
/* *
* @ingroup los_hwi
* hardware interrupt form mapping handling function array.
@@ -198,18 +198,19 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -265,21 +266,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
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
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 mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINTPTR intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -297,9 +299,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -313,11 +320,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -36,7 +36,7 @@
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -44,6 +44,7 @@ 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,
@@ -75,13 +76,17 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
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 */
NVIC_ClearPendingIRQ(SysTick_IRQn);
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

View File

@@ -55,8 +55,8 @@ 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 Regeister
OS_NVIC_HFSR EQU 0xE000ED2C ;HardFault State Regeister
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
@@ -179,7 +179,7 @@ _hwiActiveCheck
CMP R3, #0
BEQ _hwiActiveCheckNext
; exc occured in IRQ
; exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
@@ -217,19 +217,19 @@ _hwiActiveCheckNext
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
; exc occured in Task or Init or exc
; 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 occured in Init then branch
BEQ _ExcInMSP ; if exc occurred in Init then branch
CMP LR, #0xFFFFFFED ;auto push floating registers
BNE _NoFloatInPsp
; exc occured in Task
; exc occurred in Task
MOV R2, R13
SUB R13, #96 ; add 8 Bytes reg(for STMFD)

View File

@@ -46,7 +46,7 @@ UINT32 g_intCount = 0;
/*lint -restore*/
#pragma location = ".data.vector"
#pragma data_alignment=LOSCFG_ARCH_HWI_VECTOR_ALIGN
#pragma data_alignment = LOSCFG_ARCH_HWI_VECTOR_ALIGN
/* *
* @ingroup los_hwi
* hardware interrupt form mapping handling function array.
@@ -198,18 +198,19 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -265,21 +266,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
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
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 mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINTPTR intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -297,9 +299,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -313,11 +320,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -36,7 +36,7 @@
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -44,6 +44,7 @@ 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,
@@ -75,13 +76,18 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
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 */
NVIC_ClearPendingIRQ(SysTick_IRQn);
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

View File

@@ -34,7 +34,7 @@
#include "los_config.h"
#include "los_list.h"
#pragma data_alignment=0x4
#pragma data_alignment = 0x4
STATIC UINT8 g_secureHeap[LOSCFG_SECURE_HEAP_SIZE] = {0};
STATIC LOS_DL_LIST g_secureHeapFreeList = {NULL, NULL};

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device 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:
@@ -121,6 +121,29 @@ typedef struct TagTskContext {
*/
extern VOID HalStartToRun(VOID);
#if (LOSCFG_SECURE == 1)
/**
* @ingroup los_config
* @brief: User Task Stack Initialize.
*
* @par Description:
* This API is used to init a user task stack.
*
* @attention:
* <ul><li>None.</li></ul>
*
* @param: context [IN] Task context.
* @param: taskEntry [IN] Task entry function address.
* @param: stack [IN] Task stack address.
*
* @retval None.
*
* @par Dependency: <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID HalUserTaskStackInit(TaskContext *context, UINTPTR taskEntry, UINTPTR stack);
#endif
#ifdef __cplusplus
#if __cplusplus
}

View File

@@ -148,6 +148,15 @@ VOID *ArchSignalContextInit(VOID *stackPointer, VOID *stackTop, UINTPTR sigHandl
return (VOID *)context;
}
#if (LOSCFG_SECURE == 1)
VOID HalUserTaskStackInit(TaskContext *context, UINTPTR taskEntry, UINTPTR stack)
{
context->uwR0 = stack;
context->uwPC = (UINT32)taskEntry;
context->uwxPSR = 0x01000000L; /* Thumb flag, always set 1 */
}
#endif
LITE_OS_SEC_TEXT_INIT UINT32 ArchStartSchedule(VOID)
{
(VOID)LOS_IntLock();

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device 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:
@@ -40,6 +40,12 @@
.equ OS_NVIC_PENDSV_PRI, 0xF0F00000
.equ OS_NVIC_PENDSVSET, 0x10000000
.equ OS_TASK_STATUS_RUNNING, 0x0010
.equ OS_CONTROL_FPCA_ENABLE, 0x4
.equ OS_CONTROL_KERNEL_MODE, 0x2
#if (LOSCFG_SECURE == 1)
.equ OS_CONTROL_USER_MODE, 0x3
.equ OS_TASK_FLAG_USER_TASK, 0x0200
#endif
.section .text
.thumb
@@ -63,7 +69,7 @@ HalStartToRun:
ldr r5, =OS_NVIC_PENDSV_PRI
str r5, [r4]
mov r0, #2
mov r0, #OS_CONTROL_KERNEL_MODE
msr CONTROL, r0
ldr r1, =g_losTask
@@ -141,7 +147,7 @@ ArchTaskSchedule:
bx lr
dsb
isb
.fnend
.fnend
.type HalPendSV, %function
.global HalPendSV
@@ -194,6 +200,14 @@ SignalContextRestore:
vldmia r1!, {d8-d15}
__DisabledFPU2:
#if (LOSCFG_SECURE == 1)
ldrh r7, [r0, #4]
tst r7, #OS_TASK_FLAG_USER_TASK
ite eq
moveq r3, #OS_CONTROL_KERNEL_MODE
movne r3, #OS_CONTROL_USER_MODE
msr CONTROL, r3
#endif
ldmfd r1!, {r4-r12}
msr psp, r1

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device 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:
@@ -57,15 +57,15 @@
.equ FLAG_ADDR_VALID, 0x10000
.equ FLAG_HWI_ACTIVE, 0x20000
.equ FLAG_NO_FLOAT, 0x10000000
.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
.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
@@ -155,10 +155,25 @@ HalExcSvcCall:
.cantunwind
TST LR, #0x4
ITE EQ
MRSEQ R0, MSP
MRSNE R0, PSP
LDR R1, [R0,#24]
LDRB R0, [R1,#-2]
MRSEQ R1, MSP
BNE _svcCallFromPsp
B _svcCall
_svcCallFromPsp:
#ifdef LOSCFG_SECURE
PUSH {R0-R12, LR}
MOV R0, SP
CPSIE I
BL OsSyscallHandle
CPSID I
MRS R12, PSP
STM R12, {R0-R1}
POP {R0-R12, LR}
BX LR
#endif
MRS R1, PSP
_svcCall:
LDR R0, [R1,#24]
LDRB R0, [R0,#-2]
MOV R1, #0
B osExcDispatch
.fnend
@@ -263,7 +278,7 @@ _hwiActiveCheck:
CMP R3, #0
BEQ _hwiActiveCheckNext
// exc occured in IRQ
// exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
@@ -284,7 +299,7 @@ _ExcInMSP:
PUSH {R4-R12} // store message-->exc: {R4-R12}
VPUSH {D8-D15} // FPU
B _handleEntry
.fnend
.fnend
.type _NoFloatInMsp, %function
.global _NoFloatInMsp
@@ -298,7 +313,7 @@ _NoFloatInMsp:
PUSH {R4-R12} // store message-->exc: {R4-R12}
ORR R0, R0, #FLAG_NO_FLOAT
B _handleEntry
.fnend
.fnend
.type _hwiActiveCheckNext, %function
.global _hwiActiveCheckNext
@@ -316,19 +331,19 @@ _hwiActiveCheckNext:
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
// exc occured in Task or Init or exc
// 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 occured in Init then branch
BEQ _ExcInMSP // if exc occurred in Init then branch
CMP LR, #0xFFFFFFED //auto push floating registers
BNE _NoFloatInPsp
// exc occured in Task
// exc occurred in Task
MOV R2, R13
SUB R13, #96 // add 8 Bytes reg(for STMFD)
@@ -347,7 +362,7 @@ _hwiActiveCheckNext:
VSTMDB R2!, {D8-D15} // FPU
STMFD R2!, {R4-R11}
B _handleEntry
.fnend
.fnend
.type _NoFloatInPsp, %function
.global _NoFloatInPsp
@@ -367,7 +382,7 @@ _NoFloatInPsp:
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
.fnend
.type _handleEntry, %function
.global _handleEntry
@@ -380,4 +395,4 @@ _handleEntry:
B HalExcHandleEntry
NOP
.fnend
.fnend

View File

@@ -40,11 +40,8 @@
#include "los_memory.h"
#include "los_membox.h"
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
/* *
* @ingroup los_hwi
* Hardware interrupt form mapping handling function array.
@@ -193,21 +190,21 @@ inline UINT32 ArchIsIntActive(VOID)
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -261,21 +258,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
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
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 mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -293,9 +291,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -309,11 +312,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {
@@ -598,7 +603,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
/* 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);

View File

@@ -36,7 +36,7 @@
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -44,6 +44,7 @@ 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,
@@ -75,13 +76,17 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
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 */
NVIC_ClearPendingIRQ(SysTick_IRQn);
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

View File

@@ -190,7 +190,7 @@ _hwiActiveCheck
CMP R3, #0
BEQ _hwiActiveCheckNext
; exc occured in IRQ
; exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
@@ -228,19 +228,19 @@ _hwiActiveCheckNext
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
; exc occured in Task or Init or exc
; 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 occured in Init then branch
BEQ _ExcInMSP ; if exc occurred in Init then branch
CMP LR, #0xFFFFFFED ;auto push floating registers
BNE _NoFloatInPsp
; exc occured in Task
; exc occurred in Task
MOV R2, R13
SUB R13, #96 ; add 8 Bytes reg(for STMFD)

View File

@@ -41,13 +41,11 @@
#include "los_memory.h"
#include "los_membox.h"
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
#ifdef __ICCARM__
#pragma location = ".data.vector"
#pragma data_alignment=LOSCFG_ARCH_HWI_VECTOR_ALIGN
#pragma data_alignment = LOSCFG_ARCH_HWI_VECTOR_ALIGN
#elif defined(__CC_ARM) || defined(__GNUC__)
LITE_OS_SEC_VEC
#endif
@@ -202,18 +200,19 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -267,21 +266,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
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
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 mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -299,9 +299,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -315,11 +320,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {
@@ -594,7 +601,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
/* 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);

View File

@@ -36,7 +36,7 @@
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -44,6 +44,7 @@ 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,
@@ -75,13 +76,17 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
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 */
NVIC_ClearPendingIRQ(SysTick_IRQn);
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

0
arch/arm/cortex-m55/gcc/BUILD.gn Executable file → Normal file
View File

0
arch/arm/cortex-m55/gcc/NTZ/BUILD.gn Executable file → Normal file
View File

0
arch/arm/cortex-m55/gcc/NTZ/los_arch_atomic.h Executable file → Normal file
View File

20
arch/arm/cortex-m55/gcc/NTZ/los_arch_context.h Executable file → Normal file
View File

@@ -41,6 +41,17 @@ extern "C" {
#endif /* __cplusplus */
typedef struct TagTskContext {
UINT32 uwPspLim;
UINT32 uwExcLR;
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
UINT32 S16;
@@ -60,15 +71,6 @@ typedef struct TagTskContext {
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;

61
arch/arm/cortex-m55/gcc/NTZ/los_arch_interrupt.h Executable file → Normal file
View File

@@ -505,133 +505,150 @@ VOID HalExcUsageFault(VOID);
VOID HalSVCHandler(VOID);
VOID HalHwiInit(VOID);
/**
* @ingroup los_exc
* Cortex-M exception types: Record whether a precise BusFault occurred during floating-point lazy state preservation.
*/
#define OS_EXC_BF_LSPERR 1
/**
* @ingroup los_exc
* Cortex-M exception types: An error occurred while the bus status register was being pushed.
*/
#define OS_EXC_BF_STKERR 1
#define OS_EXC_BF_STKERR 2
/**
* @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
#define OS_EXC_BF_UNSTKERR 3
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register imprecise data access violation.
*/
#define OS_EXC_BF_IMPRECISERR 3
#define OS_EXC_BF_IMPRECISERR 4
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register exact data access violation.
*/
#define OS_EXC_BF_PRECISERR 4
#define OS_EXC_BF_PRECISERR 5
/**
* @ingroup los_exc
* Cortex-M exception types: Bus status register access violation while pointing.
*/
#define OS_EXC_BF_IBUSERR 5
#define OS_EXC_BF_IBUSERR 6
/**
* @ingroup los_exc
* Cortex-M exception types: Record whether a MemManage fault occurred during floating-point lazy state preservation.
*/
#define OS_EXC_MF_MLSPERR 7
/**
* @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
#define OS_EXC_MF_MSTKERR 8
/**
* @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
#define OS_EXC_MF_MUNSTKERR 9
/**
* @ingroup los_exc
* Cortex-M exception types: Memory management status register data access violation.
*/
#define OS_EXC_MF_DACCVIOL 8
#define OS_EXC_MF_DACCVIOL 10
/**
* @ingroup los_exc
* Cortex-M exception types: Memory management status register access violation.
*/
#define OS_EXC_MF_IACCVIOL 9
#define OS_EXC_MF_IACCVIOL 11
/**
* @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
#define OS_EXC_UF_DIVBYZERO 12
/**
* @ingroup los_exc
* Cortex-M exception types: Usage error, error caused by unaligned access.
*/
#define OS_EXC_UF_UNALIGNED 11
#define OS_EXC_UF_UNALIGNED 13
/**
* @ingroup los_exc
* Cortex-M exception types: Sticky flag indicating whether a stack overflow error has occurred.
*/
#define OS_EXC_UF_STKOF 14
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage attempting to execute coprocessor related instruction.
*/
#define OS_EXC_UF_NOCP 12
#define OS_EXC_UF_NOCP 15
/**
* @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
#define OS_EXC_UF_INVPC 16
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage, attempting to cut to ARM state.
*/
#define OS_EXC_UF_INVSTATE 14
#define OS_EXC_UF_INVSTATE 17
/**
* @ingroup los_exc
* Cortex-M exception types: Incorrect usage. Executed instruction whose code is undefined.
*/
#define OS_EXC_UF_UNDEFINSTR 15
#define OS_EXC_UF_UNDEFINSTR 18
/**
* @ingroup los_exc
* Cortex-M exception types: NMI
*/
#define OS_EXC_CAUSE_NMI 16
#define OS_EXC_CAUSE_NMI 19
/**
* @ingroup los_exc
* Cortex-M exception types: hard fault
*/
#define OS_EXC_CAUSE_HARDFAULT 17
#define OS_EXC_CAUSE_HARDFAULT 20
/**
* @ingroup los_exc
* Cortex-M exception types: The task handler exits.
*/
#define OS_EXC_CAUSE_TASK_EXIT 18
#define OS_EXC_CAUSE_TASK_EXIT 21
/**
* @ingroup los_exc
* Cortex-M exception types: A fatal error.
*/
#define OS_EXC_CAUSE_FATAL_ERR 19
#define OS_EXC_CAUSE_FATAL_ERR 22
/**
* @ingroup los_exc
* Cortex-M exception types: Hard Fault caused by a debug event.
*/
#define OS_EXC_CAUSE_DEBUGEVT 20
#define OS_EXC_CAUSE_DEBUGEVT 23
/**
* @ingroup los_exc
* Cortex-M exception types: A hard fault that occurs when a quantity is oriented.
*/
#define OS_EXC_CAUSE_VECTBL 21
#define OS_EXC_CAUSE_VECTBL 24
/**
* @ingroup los_exc

0
arch/arm/cortex-m55/gcc/NTZ/los_arch_timer.h Executable file → Normal file
View File

5
arch/arm/cortex-m55/gcc/NTZ/los_context.c Executable file → Normal file
View File

@@ -112,8 +112,11 @@ LITE_OS_SEC_TEXT_INIT VOID *ArchTskStackInit(UINT32 taskID, UINT32 stackSize, VO
context->S15 = 0xAA00000F;
context->FPSCR = 0x00000000;
context->NO_NAME = 0xAA000011;
context->uwExcLR = 0xFFFFFFEDL;
#else
context->uwExcLR = 0xFFFFFFFDL;
#endif
context->uwPspLim = (UINT32)topStack;
context->uwR4 = 0x04040404L;
context->uwR5 = 0x05050505L;
context->uwR6 = 0x06060606L;

65
arch/arm/cortex-m55/gcc/NTZ/los_dispatch.S Executable file → Normal file
View File

@@ -33,13 +33,10 @@
.fpu vfpv3-d16-fp16
.thumb
.equ OS_FPU_CPACR, 0xE000ED88
.equ OS_FPU_CPACR_ENABLE, 0x00F00000
.equ OS_NVIC_INT_CTRL, 0xE000ED04
.equ OS_NVIC_SYSPRI3, 0xE000ED20
.equ OS_NVIC_PENDSV_PRI, 0xF0F00000
.equ OS_NVIC_PENDSVSET, 0x10000000
.equ OS_TASK_STATUS_RUNNING, 0x0010
.section .text
.thumb
@@ -70,13 +67,12 @@ HalStartToRun:
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
ldr r2, [r12, #4]
tst r2, #0x10
it ne
bne __DisabledFPU
add r12, r12, #100
add r12, r12, #108
ldmfd r12!, {r0-r7}
add r12, r12, #72
msr psp, r12
@@ -88,7 +84,7 @@ HalStartToRun:
bx r6
__DisabledFPU:
add r12, r12, #36
add r12, r12, #44
ldmfd r12!, {r0-r7}
msr psp, r12
@@ -165,38 +161,31 @@ HalTaskSwitch:
bx lr
TaskContextSwitch:
mov lr, r0
mrs r0, psp
stmfd r0!, {r4-r12}
mov lr, r0
mrs r0, psp
tst lr, #0x10
it eq
vstmdbeq r0!, {d8-d15}
mrs r2, psplim
mov r3, lr
stmfd r0!, {r2-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}
ldr r5, =g_losTask
ldr r6, [r5]
str r0, [r6]
__DisabledFPU1:
ldr r5, =g_losTask
ldr r6, [r5]
str r0, [r6]
ldr r0, [r5, #4]
str r0, [r5]
ldr r1, [r0]
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}
ldmfd r1!, {r2-r12}
msr psplim, r2
tst r3, #0x10
it eq
vldmiaeq r1!, {d8-d15}
msr psp, r1
msr PRIMASK, r12
__DisabledFPU2:
ldmfd r1!, {r4-r12}
msr psp, r1
msr PRIMASK, r12
bx lr
bx lr
.fnend

96
arch/arm/cortex-m55/gcc/NTZ/los_exc.S Executable file → Normal file
View File

@@ -46,23 +46,23 @@
.extern g_taskScheduled
.equ OS_FLG_BGD_ACTIVE, 0x0002
.equ OS_EXC_CAUSE_NMI, 16
.equ OS_EXC_CAUSE_HARDFAULT, 17
.equ OS_EXC_CAUSE_NMI, 19
.equ OS_EXC_CAUSE_HARDFAULT, 20
.equ HF_DEBUGEVT, 20
.equ HF_VECTBL, 21
.equ HF_DEBUGEVT, 23
.equ HF_VECTBL, 24
.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
.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
@@ -71,7 +71,7 @@ HalExcNMI:
.cantunwind
MOV R0, #OS_EXC_CAUSE_NMI
MOV R1, #0
B osExcDispatch
B osExcDispatch
.fnend
.type HalExcHardFault, %function
@@ -88,7 +88,7 @@ HalExcHardFault:
TST R2, #0x80000000
BNE osExcDispatch // DEBUGEVT
AND R0, R0 , #0x000000FF
AND R0, R0, #0x000000FF
MOV R1, #HF_VECTBL
ORR R0, R0, R1, LSL #0x8
TST R2, #0x00000002
@@ -106,7 +106,7 @@ HalExcHardFault:
TST R2, #0x80 // MMARVALID
BNE _HFMemFault // MemFault
MOV R12,#0
MOV R12, #0
B osHFExcCommonBMU
.fnend
@@ -141,7 +141,7 @@ osHFExcCommonBMU:
ADD R3, R3, R2
LDRB R2, [R3]
ORR R0, R0, R2, LSL #0x8
ORR R0, R0 ,R12
ORR R0, R0, R12
B osExcDispatch
.fnend
@@ -183,7 +183,7 @@ HalExcBusFault:
_ExcBusNoADDR:
.fnstart
.cantunwind
MOV R12,#0
MOV R12, #0
B osExcCommonBMU
.fnend
@@ -210,7 +210,7 @@ HalExcMemFault:
_ExcMemNoADDR:
.fnstart
.cantunwind
MOV R12,#0
MOV R12, #0
B osExcCommonBMU
.fnend
@@ -222,7 +222,7 @@ HalExcUsageFault:
LDR R0, =OS_NVIC_FSR
LDR R0, [R0]
MOVW R1, #0x030F
MOVW R1, #0x031F
LSL R1, R1, #16
AND R0, R0, R1
MOV R12, #0
@@ -248,7 +248,7 @@ osExcDispatch:
.fnstart
.cantunwind
LDR R2, =OS_NVIC_ACT_BASE
MOV R12, #8 // R12 is hwi check loop counter
MOV R12, #16 // R12 is hwi check loop counter
.fnend
.type _hwiActiveCheck, %function
@@ -260,7 +260,7 @@ _hwiActiveCheck:
CMP R3, #0
BEQ _hwiActiveCheckNext
// exc occured in IRQ
// exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
@@ -277,8 +277,8 @@ _ExcInMSP:
BNE _NoFloatInMsp
ADD R3, R13, #104
PUSH {R3}
MRS R12, PRIMASK // store message-->exc: disable int?
PUSH {R4-R12} // store message-->exc: {R4-R12}
MRS R12, PRIMASK // store message-->exc: disable int?
PUSH {R4-R12} // store message-->exc: {R4-R12}
VPUSH {D8-D15}
B _handleEntry
.fnend
@@ -291,8 +291,8 @@ _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}
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
@@ -308,42 +308,42 @@ _hwiActiveCheckNext:
/*NMI interrupt excption*/
LDR R2, =OS_NVIC_SHCSRS
LDRH R2,[R2]
LDR R3,=OS_NVIC_SHCSR_MASK
AND R2, R2,R3
CMP R2,#0
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
// 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 occured in Init then branch
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
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)
// exc occurred in Task
MOV R2, R13
SUB R13, #96 // add 8 Bytes reg(for STMFD)
MRS R3, PSP
MRS R3, PSP
ADD R12, R3, #104
PUSH {R12} // save task SP
PUSH {R12} // save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
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)
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
STMFD R2!, {R4-R11}
B _handleEntry
.fnend
.type _NoFloatInPsp, %function
@@ -351,15 +351,15 @@ _hwiActiveCheckNext:
_NoFloatInPsp:
.fnstart
.cantunwind
MOV R2, R13 // no auto push floating registers
MOV R2, R13 // no auto push floating registers
SUB R13, #32 // add 8 Bytes reg(for STMFD)
MRS R3, PSP
MRS R3, PSP
ADD R12, R3, #32
PUSH {R12} // save task SP
MRS R12, PRIMASK
PUSH {R4-R12}
PUSH {R4-R12}
LDMFD R3, {R4-R11} // R4-R11 store PSP reg(auto push when exc in task)
STMFD R2!, {R4-R11}
@@ -371,10 +371,10 @@ _NoFloatInPsp:
_handleEntry:
.fnstart
.cantunwind
MOV R3, R13 // R13:the 4th param
MOV R3, R13 // R13:the 4th param
CPSID I
CPSID F
B HalExcHandleEntry
B HalExcHandleEntry
NOP
.fnend

48
arch/arm/cortex-m55/gcc/NTZ/los_interrupt.c Executable file → Normal file
View File

@@ -40,10 +40,8 @@
#include "los_membox.h"
#define DEF_HANDLER_START_INDEX 2
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
/* *
* @ingroup los_hwi
@@ -193,21 +191,21 @@ inline UINT32 ArchIsIntActive(VOID)
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -261,21 +259,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
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
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 mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -293,9 +292,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -309,11 +313,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {
@@ -342,10 +348,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
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
0, 0, 0, 0,
0, 0, OS_EXC_UF_DIVBYZERO, OS_EXC_UF_UNALIGNED,
0, 0, 0, OS_EXC_UF_STKOF,
OS_EXC_UF_NOCP, OS_EXC_UF_INVPC, OS_EXC_UF_INVSTATE, OS_EXC_UF_UNDEFINSTR,
0, 0, OS_EXC_BF_LSPERR, OS_EXC_BF_STKERR,
OS_EXC_BF_UNSTKERR, OS_EXC_BF_IMPRECISERR, OS_EXC_BF_PRECISERR, OS_EXC_BF_IBUSERR,
0, 0, OS_EXC_MF_MLSPERR, OS_EXC_MF_MSTKERR,
OS_EXC_MF_MUNSTKERR, 0, OS_EXC_MF_DACCVIOL, OS_EXC_MF_IACCVIOL
};
#if (LOSCFG_KERNEL_PRINTF != 0)

10
arch/arm/cortex-m55/gcc/NTZ/los_timer.c Executable file → Normal file
View File

@@ -35,7 +35,7 @@
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -43,6 +43,7 @@ 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,
@@ -74,13 +75,18 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
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 */
NVIC_ClearPendingIRQ(SysTick_IRQn);
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

View File

@@ -137,7 +137,7 @@ ArchTaskSchedule:
dsb
isb
bx lr
.fnend
.fnend
.type HalPendSV, %function
.global HalPendSV
@@ -178,7 +178,7 @@ TaskContextSwitch:
str r0, [r5]
ldr r1, [r0]
SignalContextRestore:
SignalContextRestore:
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U)))
vldmia r1!, {d8-d15}

View File

@@ -29,9 +29,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.syntax unified
.arch armv7e-m
.thumb
.syntax unified
.arch armv7e-m
.thumb
.fpu fpv5-d16
.section .text
@@ -263,7 +263,7 @@ _hwiActiveCheck:
CMP R3, #0
BEQ _hwiActiveCheckNext
// exc occured in IRQ
// exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
@@ -284,7 +284,7 @@ _ExcInMSP:
PUSH {R4-R12} // store message-->exc: {R4-R12}
VPUSH {D8-D15}
B _handleEntry
.fnend
.fnend
.type _NoFloatInMsp, %function
.global _NoFloatInMsp
@@ -298,7 +298,7 @@ _NoFloatInMsp:
PUSH {R4-R12} // store message-->exc: {R4-R12}
ORR R0, R0, #FLAG_NO_FLOAT
B _handleEntry
.fnend
.fnend
.type _hwiActiveCheckNext, %function
.global _hwiActiveCheckNext
@@ -316,19 +316,19 @@ _hwiActiveCheckNext:
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
// exc occured in Task or Init or exc
// 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 occured in Init then branch
BEQ _ExcInMSP // if exc occurred in Init then branch
CMP LR, #0xFFFFFFED //auto push floating registers
BNE _NoFloatInPsp
// exc occured in Task
// exc occurred in Task
MOV R2, R13
SUB R13, #96 // add 8 Bytes reg(for STMFD)
@@ -347,7 +347,7 @@ _hwiActiveCheckNext:
VSTMDB R2!, {D8-D15}
STMFD R2!, {R4-R11}
B _handleEntry
.fnend
.fnend
.type _NoFloatInPsp, %function
.global _NoFloatInPsp
@@ -367,7 +367,7 @@ _NoFloatInPsp:
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
.fnend
.type _handleEntry, %function
.global _handleEntry
@@ -380,5 +380,5 @@ _handleEntry:
B HalExcHandleEntry
NOP
.fnend
.fnend

View File

@@ -40,11 +40,8 @@
#include "los_memory.h"
#include "los_membox.h"
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
/* *
* @ingroup los_hwi
* Hardware interrupt form mapping handling function array.
@@ -188,21 +185,21 @@ inline UINT32 ArchIsIntActive(VOID)
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -256,21 +253,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
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
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 mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -288,9 +286,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -304,11 +307,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {
@@ -583,7 +588,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
/* 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);

View File

@@ -36,7 +36,7 @@
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -44,6 +44,7 @@ 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,
@@ -75,13 +76,17 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
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 */
NVIC_ClearPendingIRQ(SysTick_IRQn);
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

View File

@@ -190,7 +190,7 @@ _hwiActiveCheck
CMP R3, #0
BEQ _hwiActiveCheckNext
; exc occured in IRQ
; exc occurred in IRQ
ORR R0, R0, #FLAG_HWI_ACTIVE
RBIT R2, R3
CLZ R2, R2
@@ -228,19 +228,19 @@ _hwiActiveCheckNext
AND R2, R2,R3
CMP R2,#0
BNE _ExcInMSP
; exc occured in Task or Init or exc
; 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 occured in Init then branch
BEQ _ExcInMSP ; if exc occurred in Init then branch
CMP LR, #0xFFFFFFED ;auto push floating registers
BNE _NoFloatInPsp
; exc occured in Task
; exc occurred in Task
MOV R2, R13
SUB R13, #96 ; add 8 Bytes reg(for STMFD)

View File

@@ -41,12 +41,10 @@
#include "los_memory.h"
#include "los_membox.h"
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
#pragma location = ".data.vector"
#pragma data_alignment=LOSCFG_ARCH_HWI_VECTOR_ALIGN
#pragma data_alignment = LOSCFG_ARCH_HWI_VECTOR_ALIGN
/* *
* @ingroup los_hwi
* Hardware interrupt form mapping handling function array.
@@ -198,18 +196,19 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -263,21 +262,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
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
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 mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -295,9 +295,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -311,11 +316,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {
@@ -590,7 +597,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
/* Enable USGFAULT, BUSFAULT, MEMFAULT */
*(volatile UINT32 *)OS_NVIC_SHCSR |= (USGFAULT | BUSFAULT | MEMFAULT);
/* Enable DIV 0 and unaligned exception */
*(volatile UINT32 *)OS_NVIC_CCR |= (DIV0FAULT | UNALIGNFAULT);

View File

@@ -36,7 +36,7 @@
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -44,6 +44,7 @@ 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,
@@ -75,13 +76,17 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
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 */
NVIC_ClearPendingIRQ(SysTick_IRQn);
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

0
arch/csky/v2/gcc/BUILD.gn Executable file → Normal file
View File

View File

@@ -59,13 +59,33 @@ typedef struct TagTskContext {
UINT32 R12;
UINT32 R13;
UINT32 R15;
#ifdef CPU_CK804
UINT32 R16;
UINT32 R17;
UINT32 R18;
UINT32 R19;
UINT32 R20;
UINT32 R21;
UINT32 R22;
UINT32 R23;
UINT32 R24;
UINT32 R25;
UINT32 R26;
UINT32 R27;
UINT32 R28;
UINT32 R29;
UINT32 R30;
UINT32 R31;
#endif
UINT32 EPSR;
UINT32 EPC;
} TaskContext;
VOID HalStartToRun(VOID);
VOID HalTaskContextSwitch(VOID);
#ifndef CPU_CK804
VOID HalIrqEndCheckNeedSched(VOID);
#endif
#ifdef __cplusplus
#if __cplusplus

View File

@@ -82,7 +82,7 @@ typedef VOID (**HWI_VECTOR_FUNC)(VOID);
* @ingroup los_arch_interrupt
* Count of interrupts.
*/
extern UINT32 g_intCount;
extern volatile UINT32 g_intCount;
/* *
* @ingroup los_arch_interrupt

View File

@@ -38,7 +38,9 @@
#include "los_interrupt.h"
#include "los_debug.h"
#ifndef CPU_CK804
STATIC UINT32 g_sysNeedSched = FALSE;
#endif
/* ****************************************************************************
Function : ArchInit
@@ -93,8 +95,29 @@ LITE_OS_SEC_TEXT_INIT VOID *ArchTskStackInit(UINT32 taskID, UINT32 stackSize, VO
context->R11 = 0x11111111L;
context->R12 = 0x12121212L;
context->R13 = 0x13131313L;
#ifdef CPU_CK804
context->R15 = (UINT32)ArchSysExit;
context->R16 = 0x16161616L;
context->R17 = 0x17171717L;
context->R18 = 0x18181818L;
context->R19 = 0x19191919L;
context->R20 = 0x20202020L;
context->R21 = 0x21212121L;
context->R22 = 0x22222222L;
context->R23 = 0x23232323L;
context->R24 = 0x24242424L;
context->R25 = 0x25252525L;
context->R26 = 0x26262626L;
context->R27 = 0x27272727L;
context->R28 = 0x28282828L;
context->R29 = 0x29292929L;
context->R30 = 0x30303030L;
context->R31 = 0x31313131L;
context->EPSR = 0x80000340L;
#else
context->R15 = (UINT32)ArchSysExit;
context->EPSR = 0xe0000144L;
#endif
context->EPC = (UINT32)OsTaskEntry;
return (VOID *)context;
}
@@ -107,6 +130,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchStartSchedule(VOID)
return LOS_OK; /* never return */
}
#ifndef CPU_CK804
VOID HalIrqEndCheckNeedSched(VOID)
{
if (g_sysNeedSched && g_taskScheduled && LOS_CHECK_SCHEDULE) {
@@ -132,3 +156,10 @@ VOID ArchTaskSchedule(VOID)
LOS_IntRestore(intSave);
return;
}
#else
VOID ArchTaskSchedule(VOID)
{
HalTaskContextSwitch();
}
#endif

View File

@@ -32,6 +32,89 @@
#define OS_TASK_STATUS_RUNNING 0x0010
#define VIC_TSPDR 0XE000EC08
#ifdef CPU_CK804
.section .text
.align 2
.type HalStartToRun, %function
.global HalStartToRun
HalStartToRun:
lrw r1, g_losTask
lrw r2, g_losTask + 4
ldw r0, (r2)
st.w r0, (r1)
st.w r0, (r2)
ldw sp, (r0)
ldw r0, (sp, 128)
mtcr r0, epc
ldw r0, (sp, 124)
mtcr r0, epsr
ldw r15, (sp, 56)
ldm r0-r13, (sp)
addi sp, 60
ldm r16-r31, (sp)
addi sp, 72
rte
.align 2
.type HalTaskContextSwitch, %function
.global HalTaskContextSwitch
HalTaskContextSwitch:
lrw r0, VIC_TSPDR
bgeni r1, 0
stw r1, (r0)
nop
nop
nop
rts
.align 2
.type tspend_handler, %function
.global tspend_handler
tspend_handler:
subi sp, 132
stm r0-r13, (sp)
stw r15, (sp, 56)
addi r0, sp, 60
stm r16-r31, (r0)
mfcr r1, epsr
stw r1, (sp, 124)
mfcr r1, epc
stw r1, (sp, 128)
jbsr OsSchedTaskSwitch
bez r0, ret_con
lrw r2, g_losTask
ldw r0, (r2)
stw sp, (r0)
lrw r3, g_losTask + 4
ldw r0, (r3)
stw r0, (r2)
ldw sp, (r0)
ret_con:
ldw r0, (sp, 128)
mtcr r0, epc
ldw r0, (sp, 124)
mtcr r0, epsr
ldw r15, (sp, 56)
ldm r0-r13, (sp)
addi sp, 60
ldm r16-r31, (sp)
addi sp, 72
rte
#else
.section .text
.align 2
.type HalStartToRun, %function
@@ -87,3 +170,4 @@ HalTaskContextSwitch:
rte
#endif

View File

@@ -32,6 +32,57 @@
.import HalExcHandleEntry
.extern g_trapStackBase
#ifdef CPU_CK804
.section .text
.align 2
.global HandleEntry
HandleEntry:
mov r10, sp
lrw r14, g_trapStackBase
stm r0-r15, (sp)
stw r10, (sp, 56)
addi r0, sp, 64
stm r16-r31, (r0)
mfcr r0, epsr
stw r0, (sp, 128)
mfcr r0, epc
stw r0, (sp, 132)
mov r0, sp
mfcr r1, epc
mov sp, r10
lrw r2, HalExcHandleEntry
jmp r2
.section .text
.align 2
.global IrqEntry
IrqEntry:
psrset ee
subi sp, 136
stm r0-r15, (sp)
addi r0, sp, 64
stm r16-r31, (r0)
mfcr r0, epsr
stw r0, (sp, 128)
mfcr r0, epc
stw r0, (sp, 132)
jbsr HalInterrupt
ldw r0, (sp, 132)
mtcr r0, epc
ldw r0, (sp, 128)
bseti r0, r0, 6
mtcr r0, epsr
ldm r0-r15, (sp)
addi sp, 64
ldm r16-r31, (sp)
addi sp, 72
rte
#else
.section .text
.align 2
.global HandleEntry
@@ -75,3 +126,4 @@ IrqEntry:
ldm r0-r15, (sp)
addi sp, 72
rte
#endif

View File

@@ -52,13 +52,12 @@
#define MASK_8_BITS 0xFF
#define MASK_32_BITS 0xFFFFFFFF
#define BYTES_OF_128_INT 4
#define TIM_INT_NUM 1
#define OS_USER_HWI_MIN 0
#define OS_USER_HWI_MAX (LOSCFG_PLATFORM_HWI_LIMIT - 1)
#define HWI_ALIGNSIZE 0x400
UINT32 g_intCount = 0;
UINT32 volatile g_intCount = 0;
CHAR g_trapStackBase[OS_TRAP_STACK_SIZE];
VIC_TYPE *VIC_REG = (VIC_TYPE *)VIC_REG_BASE;
@@ -256,7 +255,7 @@ VOID OsSetVector(UINT32 num, HWI_PROC_FUNC vector)
**************************************************************************** */
STATIC UINT32 HwiNumGet(VOID)
{
return HalGetPsr();
return (HalGetPsr() >> PSR_VEC_OFFSET) & MASK_8_BITS;
}
HwiControllerOps g_archHwiOps = {
@@ -282,19 +281,19 @@ inline UINT32 ArchIsIntActive(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
irqNum = (irqNum >> PSR_VEC_OFFSET) & MASK_8_BITS;
PRINT_ERR("%s irqnum:%x\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%x\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -315,7 +314,6 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
LOS_IntRestore(intSave);
hwiIndex = HwiNumGet();
hwiIndex = (hwiIndex >> PSR_VEC_OFFSET) & MASK_8_BITS;
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
HalPreInterruptHandler(hwiIndex);
@@ -335,7 +333,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
intSave = LOS_IntLock();
g_intCount--;
#ifndef CPU_CK804
HalIrqEndCheckNeedSched();
#endif
LOS_IntRestore(intSave);
}
@@ -344,21 +344,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
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
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 mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
if (hwiNum >= OS_HWI_MAX_NUM) {
@@ -375,9 +376,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
}
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask(hwiNum);
(VOID)HwiSetPriority(hwiNum, (UINT8)hwiPrio);
@@ -390,11 +396,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {
@@ -579,6 +587,10 @@ WEAK VOID __stack_chk_fail(VOID)
__builtin_return_address(0));
}
WEAK void HalHwiHandleReInit(UINT32 hwiFormAddr)
{
}
/* ****************************************************************************
Function : HalHwiInit
Description : initialization of the hardware interrupt
@@ -597,6 +609,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
for (i = OS_SYS_VECTOR_CNT; i < (LOSCFG_PLATFORM_HWI_LIMIT + OS_SYS_VECTOR_CNT); i++) {
g_hwiForm[i] = (HWI_PROC_FUNC)IrqEntry;
}
HalHwiHandleReInit((UINT32)&g_hwiForm);
HalSetVbr((UINT32)&g_hwiForm);
for (int i = 0; i < BYTES_OF_128_INT; i++) {

View File

@@ -50,10 +50,14 @@ typedef struct {
#define CORETIM_SOURCE (1UL << 2)
#define CORETIM_MODE (1UL << 16)
#ifdef CPU_CK804
#define TIM_INT_NUM 25
#else
#define TIM_INT_NUM 1
#endif
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -61,6 +65,7 @@ STATIC VOID SysTickUnlock(VOID);
STATIC ArchTickTimer g_archTickTimer = {
.freq = 0,
.irqNum = TIM_INT_NUM,
.periodMax = LOSCFG_BASE_CORE_TICK_RESPONSE_MAX,
.init = SysTickStart,
.getCycle = SysTickCycleGet,
.reload = SysTickReload,
@@ -98,12 +103,16 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
{
if (nextResponseTime > g_archTickTimer.periodMax) {
nextResponseTime = g_archTickTimer.periodMax;
}
SysTick->CTRL &= ~CORETIM_ENABLE;
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
SysTick->CTRL |= CORETIM_ENABLE;
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

View File

@@ -41,6 +41,52 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#if defined(__ICCARM__) || defined(__CC_ARM)
STATIC INLINE UINTPTR ArchSpGet(VOID)
{
UINTPTR sp;
__asm("mov %0, sp" : "=r" (sp));
return sp;
}
STATIC INLINE UINTPTR ArchPspGet(VOID)
{
UINTPTR psp;
__asm("mrs %0, psp" : "=r" (psp));
return psp;
}
STATIC INLINE UINTPTR ArchMspGet(VOID)
{
UINTPTR msp;
__asm("mrs %0, msp" : "=r" (msp));
return msp;
}
#elif defined(__CLANG_ARM) || defined(__GNUC__)
STATIC INLINE UINTPTR ArchSpGet(VOID)
{
UINTPTR sp;
__asm volatile("mov %0, sp" : "=r" (sp));
return sp;
}
STATIC INLINE UINTPTR ArchPspGet(VOID)
{
UINTPTR psp;
__asm volatile("mrs %0, psp" : "=r" (psp));
return psp;
}
STATIC INLINE UINTPTR ArchMspGet(VOID)
{
UINTPTR msp;
__asm volatile("mrs %0, msp" : "=r" (msp));
return msp;
}
#else
/* Other platforms to be improved */
#endif
VOID ArchInit(VOID);
#ifdef __cplusplus

0
arch/include/los_atomic.h Executable file → Normal file
View File

View File

@@ -53,6 +53,11 @@ typedef VOID (*HWI_PROC_FUNC)(VOID *parm);
#else
typedef VOID (*HWI_PROC_FUNC)(void);
#endif
typedef struct tagIrqParam {
int swIrq; /**< The interrupt number */
VOID *pDevId; /**< The pointer to the device ID that launches the interrupt */
const CHAR *pName; /**< The interrupt name */
} HwiIrqParam;
typedef struct {
UINT32 (*triggerIrq)(HWI_HANDLE_T hwiNum);
@@ -80,6 +85,7 @@ UINT32 ArchIsIntActive(VOID);
#define LOS_HwiDisable ArchIntDisable
#define LOS_HwiClear ArchIntClear
#define LOS_HwiSetPriority ArchIntSetPriority
#define LOS_HwiCurIrqNum ArchIntCurIrqNum
UINT32 ArchIntLock(VOID);
#define LOS_IntLock ArchIntLock
@@ -108,14 +114,15 @@ UINT32 ArchIntUnLock(VOID);
* </ul>
*
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a Cortex-A7 platform is [32,95].
*
* @param irqParam [IN] Type #HwiIrqParam *. ID of hardware interrupt which will base on
* when delete the hardware interrupt.
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
* @retval #LOS_OK 0 : The interrupt is successfully delete.
* @par Dependency:
* <ul><li>los_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum);
UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam);
/**
* @ingroup los_interrupt
@@ -136,7 +143,8 @@ UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum);
* @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.
* @param irqParam [IN] Type#HwiIrqParam: 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.
@@ -151,7 +159,7 @@ UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg);
HwiIrqParam *irqParam);
STATIC INLINE UINT32 ArchIntTrigger(HWI_HANDLE_T hwiNum)
{
@@ -193,6 +201,14 @@ STATIC INLINE UINT32 ArchIntSetPriority(HWI_HANDLE_T hwiNum, HWI_PRIOR_T priorit
return g_archHwiOps.setIrqPriority(hwiNum, priority);
}
STATIC INLINE UINT32 ArchIntCurIrqNum(VOID)
{
if (g_archHwiOps.getCurIrqNum == NULL) {
return LOS_NOK;
}
return g_archHwiOps.getCurIrqNum();
}
STATIC INLINE HwiControllerOps *ArchIntOpsGet(VOID)
{
return &g_archHwiOps;

View File

@@ -56,9 +56,10 @@ extern "C" {
typedef struct {
UINT32 freq;
INT32 irqNum;
UINT64 periodMax;
UINT32 (*init)(HWI_PROC_FUNC tickHandler);
UINT64 (*getCycle)(UINT32 *period);
VOID (*reload)(UINT64 time);
UINT64 (*reload)(UINT64 time);
VOID (*lock)(VOID);
VOID (*unlock)(VOID);
HWI_PROC_FUNC tickHandler;

View File

@@ -179,7 +179,6 @@ exc_entry:
csrr a0, mcause
mv a1, sp
/*
* TODO: Call the exception handler function
* By default, the function template is provided in
* system_Device.c, you can adjust it as you want
*/

View File

@@ -86,9 +86,9 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
mode --- hwi interrupt mode, between vector or non-vector
handler --- hwi handler
arg --- set trig mode of the hwi handler
hwiMode --- hwi interrupt hwiMode, between vector or non-vector
hwiHandler --- hwi handler
irqParam --- set trig hwiMode of the hwi handler
Level Triggerred = 0
Postive/Rising Edge Triggered = 1
Negtive/Falling Edge Triggered = 3
@@ -97,24 +97,24 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
*****************************************************************************/
UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
if (hwiNum > SOC_INT_MAX) {
return OS_ERRNO_HWI_NUM_INVALID;
}
if (mode > ECLIC_VECTOR_INTERRUPT) {
if (hwiMode > ECLIC_VECTOR_INTERRUPT) {
return OS_ERRNO_HWI_MODE_INVALID;
}
if (arg > ECLIC_NEGTIVE_EDGE_TRIGGER) {
if ((irqParam == NULL) || (irqParam->pDevId > ECLIC_NEGTIVE_EDGE_TRIGGER)) {
return OS_ERRNO_HWI_ARG_INVALID;
}
/* set interrupt vector mode */
ECLIC_SetShvIRQ(hwiNum, mode);
/* set interrupt trigger mode and polarity */
ECLIC_SetTrigIRQ(hwiNum, arg);
/* set interrupt vector hwiMode */
ECLIC_SetShvIRQ(hwiNum, hwiMode);
/* set interrupt trigger hwiMode and polarity */
ECLIC_SetTrigIRQ(hwiNum, irqParam->pDevId);
/* set interrupt level */
// default to 0
ECLIC_SetLevelIRQ(hwiNum, 0);
@@ -124,9 +124,9 @@ UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
/* set interrupt priority */
// low 16 bit for priority
ECLIC_SetPriorityIRQ(hwiNum, (hwiPrio & 0xffff));
if (handler != NULL) {
if (hwiHandler != NULL) {
/* set interrupt handler entry to vector table */
ECLIC_SetVector(hwiNum, (rv_csr_t)handler);
ECLIC_SetVector(hwiNum, (rv_csr_t)hwiHandler);
}
/* enable interrupt */
HwiUnmask(hwiNum);
@@ -137,10 +137,12 @@ UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Return : LOS_OK on success or error code on failure
*****************************************************************************/
LITE_OS_SEC_TEXT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
LITE_OS_SEC_TEXT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
// change func to default func
ECLIC_SetVector(hwiNum, (rv_csr_t)HalHwiDefaultHandler);
// disable interrupt

View File

@@ -47,7 +47,7 @@ STATIC HWI_PROC_FUNC g_sysTickHandler = (HWI_PROC_FUNC)NULL;
extern UINT32 g_intCount;
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -55,6 +55,7 @@ STATIC VOID SysTickUnlock(VOID);
STATIC ArchTickTimer g_archTickTimer = {
.freq = 0,
.irqNum = SysTimer_IRQn,
.periodMax = LOSCFG_BASE_CORE_TICK_RESPONSE_MAX,
.init = SysTickStart,
.getCycle = SysTickCycleGet,
.reload = SysTickReload,
@@ -95,9 +96,10 @@ void ArchTickSysTickHandler(void)
}
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
{
SysTick_Reload(nextResponseTime);
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

View File

@@ -105,7 +105,7 @@
* Based on the types of the four 8-bit arithmetic operations, the SIMD 8-bit add/subtract instructions
* can be classified into 2 main categories: Addition (four 8-bit addition), and Subtraction (four 8-bit
* subtraction).
* Based on the way of how an overflow condition is handled for singed or unsigned operation, the
* Based on the way of how an overflow condition is handled for signed or unsigned operation, the
* SIMD 8-bit add/subtract instructions can be classified into 5 groups: Wrap-around (dropping
* overflow), Signed Halving (keeping overflow by dropping 1 LSB bit), Unsigned Halving, Signed
* Saturation (clipping overflow), and Unsigned Saturation.

View File

@@ -33,6 +33,7 @@
#define _LOS_ARCH_ATOMIC_H
#include "los_compiler.h"
#include "los_interrupt.h"
#ifdef __cplusplus
#if __cplusplus

View File

@@ -165,7 +165,7 @@ LITE_OS_SEC_TEXT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HWI_ARG_T irqParam)
HwiIrqParam *irqParam)
{
UINT32 intSave;
@@ -186,8 +186,11 @@ LITE_OS_SEC_TEXT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
g_hwiForm[hwiNum].pfnHook = hwiHandler;
g_hwiForm[hwiNum].uwParam = (VOID *)irqParam;
if (irqParam != NULL) {
g_hwiForm[hwiNum].uwParam = (VOID *)irqParam->pDevId;
} else {
g_hwiForm[hwiNum].uwParam = NULL;
}
if (hwiNum >= OS_RISCV_SYS_VECTOR_CNT) {
HalSetLocalInterPri(hwiNum, hwiPrio);
}
@@ -201,10 +204,12 @@ LITE_OS_SEC_TEXT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Return : LOS_OK on success or error code on failure
*****************************************************************************/
LITE_OS_SEC_TEXT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
LITE_OS_SEC_TEXT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {
@@ -327,7 +332,7 @@ VOID HalExcEntry(const LosExcContext *excBufAddr)
ExcInfoDisplay(excBufAddr);
if (LOS_TaskIsRunning()) {
PRINTK("----------------All Task infomation ------------\n");
PRINTK("----------------All Task information ------------\n");
OsGetAllTskInfo();
}

View File

@@ -39,7 +39,7 @@
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -47,6 +47,7 @@ STATIC VOID SysTickUnlock(VOID);
STATIC ArchTickTimer g_archTickTimer = {
.freq = 0,
.irqNum = RISCV_MACH_TIMER_IRQ,
.periodMax = LOSCFG_BASE_CORE_TICK_RESPONSE_MAX,
.init = SysTickStart,
.getCycle = SysTickCycleGet,
.reload = SysTickReload,
@@ -60,7 +61,10 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
ArchTickTimer *tick = &g_archTickTimer;
UINT32 period = (UINT32)LOSCFG_BASE_CORE_TICK_RESPONSE_MAX;
UINT32 ret = LOS_HwiCreate(RISCV_MACH_TIMER_IRQ, 0x1, 0, handler, period);
HwiIrqParam irqParam;
irqParam.pDevId = (VOID *)period;
UINT32 ret = LOS_HwiCreate(RISCV_MACH_TIMER_IRQ, 0x1, 0, handler, &irqParam);
if (ret != LOS_OK) {
return ret;
}
@@ -75,7 +79,7 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
{
UINT64 timeMax = (UINT64)LOSCFG_BASE_CORE_TICK_RESPONSE_MAX - 1;
UINT64 timer;
@@ -94,6 +98,7 @@ STATIC VOID SysTickReload(UINT64 nextResponseTime)
WRITE_UINT32((UINT32)timer, MTIMERCMP);
WRITE_UINT32((UINT32)(timer >> SHIFT_32_BIT), MTIMERCMP + MTIMER_HI_OFFSET);
HalIrqEnable(RISCV_MACH_TIMER_IRQ);
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

View File

@@ -249,18 +249,19 @@ INLINE UINT32 ArchIsIntActive(VOID)
**************************************************************************** */
VOID HalHwiDefaultHandler(VOID)
{
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
while (1) {}
}
WEAK VOID HalPreInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
WEAK VOID HalAftInterruptHandler(UINT32 arg)
{
(VOID)arg;
return;
}
@@ -312,21 +313,22 @@ VOID HalInterrupt(VOID)
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
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (handler == NULL) {
if (hwiHandler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -344,9 +346,14 @@ UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
OsSetVector(hwiNum, handler, arg);
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
#else
OsSetVector(hwiNum, handler);
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
HwiUnmask(hwiNum);
@@ -359,11 +366,13 @@ UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
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)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -37,7 +37,7 @@
#include "los_debug.h"
STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler);
STATIC VOID SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickReload(UINT64 nextResponseTime);
STATIC UINT64 SysTickCycleGet(UINT32 *period);
STATIC VOID SysTickLock(VOID);
STATIC VOID SysTickUnlock(VOID);
@@ -45,6 +45,7 @@ STATIC VOID SysTickUnlock(VOID);
STATIC ArchTickTimer g_archTickTimer = {
.freq = 0,
.irqNum = OS_TICK_INT_NUM,
.periodMax = LOSCFG_BASE_CORE_TICK_RESPONSE_MAX,
.init = SysTickStart,
.getCycle = SysTickCycleGet,
.reload = SysTickReload,
@@ -77,12 +78,17 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
return LOS_OK;
}
STATIC VOID SysTickReload(UINT64 nextResponseTime)
STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
{
UINT32 timerL;
if (nextResponseTime > g_archTickTimer.periodMax) {
nextResponseTime = g_archTickTimer.periodMax;
}
timerL = GetCcount();
timerL += nextResponseTime;
SetCcompare(timerL);
return nextResponseTime;
}
STATIC UINT64 SysTickCycleGet(UINT32 *period)

View File

@@ -48,7 +48,9 @@
│ ├── lms --- Lite memory sanitizer functions
│ ├── net --- Networking functions
│ ├── power --- Power management
│ ├── security --- Security isolation
│ ├── shell --- Shell function
│ ├── signal --- Signal support
│ ├── fs --- File systems
│ └── trace --- Trace tool
├── drivers --- driver Kconfig
@@ -71,14 +73,13 @@
│   │   └── los_tick.h --- Tick
│   └── src
├── targets
│   └── targets
   ── riscv_nuclei_demo_soc_gcc
│ ├── GCC --- Compilation config
│ ├── OS_CONFIG --- Board config
── SoC --- SOC codes
│ └── Src --- Application codes
│   └── riscv_nuclei_gd32vf103_soc_gcc
│   └── riscv_sifive_fe310_gcc
│   └── riscv_nuclei_demo_soc_gcc
── GCC --- Compilation config
│ │ ├── OS_CONFIG --- Board config
│ │ ├── SoC --- SOC codes
│ │ ── Src --- Application codes
   └── riscv_nuclei_gd32vf103_soc_gcc
│   └── riscv_sifive_fe310_gcc
├── testsuites --- Kernel testsuites
├── tools --- Kernel tools
└── utils

View File

@@ -48,7 +48,9 @@
│ ├── lms --- Lite memory sanitizer 机制
│ ├── net --- Network功能
│ ├── power --- 低功耗管理
│ ├── security --- 安全隔离
│ ├── shell --- shell功能
│ ├── signal --- signal支持
│ └── trace --- trace 工具
├── drivers --- 驱动框架Kconfig
├── kal --- 内核抽象层提供内核对外接口当前支持CMSIS接口和部分POSIX接口
@@ -70,14 +72,13 @@
│   │   └── los_tick.h --- Tick时钟
   └── src
├── targets
   └── targets
   ── riscv_nuclei_demo_soc_gcc
│ ├── GCC --- 编译相关
│ ├── OS_CONFIG --- 开发板配置功能开关和配置参数
── SoC --- SOC相关代码
│ └── Src --- Application相关代码
   └── riscv_nuclei_gd32vf103_soc_gcc
│   └── riscv_sifive_fe310_gcc
└── riscv_nuclei_demo_soc_gcc
── GCC --- 编译相关
│ │ ├── OS_CONFIG --- 开发板配置功能开关和配置参数
│ │ ├── SoC --- SOC相关代码
│ │ ── Src --- Application相关代码
└── riscv_nuclei_gd32vf103_soc_gcc
│ └── riscv_sifive_fe310_gcc
├── testsuites --- 内核测试用例
├── tools --- 内核工具
└── utils

View File

@@ -1,5 +1,5 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device 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:
@@ -34,6 +34,7 @@ group("components") {
"backtrace",
"cppsupport",
"cpup",
"debugtools",
"dynlink",
"exchook",
"fs",
@@ -41,6 +42,7 @@ group("components") {
"lms",
"net",
"power",
"security",
"shell",
"signal",
"trace",
@@ -57,10 +59,12 @@ config("public") {
"fs:public",
"net:public",
"power:public",
"security:public",
"shell:public",
"trace:public",
"lmk:public",
"lms:public",
"signal:public",
"debugtools:public",
]
}

View File

@@ -32,6 +32,7 @@
#include "los_backtrace.h"
#include "los_task.h"
#include "los_debug.h"
#include "los_arch.h"
#if (LOSCFG_BACKTRACE_TYPE == 4)
#include "los_arch_regs.h"
#endif
@@ -60,52 +61,6 @@ WEAK BOOL OsStackDataIsCodeAddr(UINTPTR value)
#define OS_BLX_INX_MASK 0xFF00
#define OS_BLX_INX 0x4700
#if defined(__ICCARM__) || defined(__CC_ARM)
STATIC INLINE UINTPTR HalSpGet(VOID)
{
UINTPTR sp;
__asm("mov %0, sp" : "=r" (sp));
return sp;
}
STATIC INLINE UINTPTR HalPspGet(VOID)
{
UINTPTR psp;
__asm("mrs %0, psp" : "=r" (psp));
return psp;
}
STATIC INLINE UINTPTR HalMspGet(VOID)
{
UINTPTR msp;
__asm("mrs %0, msp" : "=r" (msp));
return msp;
}
#elif defined(__CLANG_ARM) || defined(__GNUC__)
STATIC INLINE UINTPTR HalSpGet(VOID)
{
UINTPTR sp;
__asm volatile("mov %0, sp" : "=r" (sp));
return sp;
}
STATIC INLINE UINTPTR HalPspGet(VOID)
{
UINTPTR psp;
__asm volatile("mrs %0, psp" : "=r" (psp));
return psp;
}
STATIC INLINE UINTPTR HalMspGet(VOID)
{
UINTPTR msp;
__asm volatile("mrs %0, msp" : "=r" (msp));
return msp;
}
#else
#error Unknown compiler.
#endif
STATIC INLINE BOOL OsInsIsBlOrBlx(UINTPTR addr)
{
UINT16 ins1 = *((UINT16 *)addr);
@@ -138,8 +93,8 @@ STATIC INLINE UINT32 OsStackAddrGet(UINTPTR *stackStart, UINTPTR *stackEnd, UINT
}
}
} else {
if (HalSpGet() != HalPspGet()) {
*stackStart = HalMspGet();
if (ArchSpGet() != ArchPspGet()) {
*stackStart = ArchMspGet();
*stackEnd = CSTACK_END_ADDR;
if ((*stackStart < CSTACK_START_ADDR) || (*stackStart >= CSTACK_END_ADDR)) {
PRINT_ERR("msp stack [0x%x, 0x%x], cur sp(0x%x) is overflow!\n",
@@ -148,7 +103,7 @@ STATIC INLINE UINT32 OsStackAddrGet(UINTPTR *stackStart, UINTPTR *stackEnd, UINT
}
PRINTK("msp, start = %x, end = %x\n", *stackStart, *stackEnd);
} else {
*stackStart = HalPspGet();
*stackStart = ArchPspGet();
UINT32 taskID = LOS_CurTaskIDGet();
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
*stackEnd = (UINTPTR)taskCB->topOfStack + taskCB->stackSize;

View File

@@ -52,8 +52,8 @@ extern "C" {
#define CODE_SECTION_NAME ".text"
/* The default C stack section name is CSTACK */
#define CSTACK_SECTION_NAME "CSTACK"
#pragma section=CODE_SECTION_NAME
#pragma section=CSTACK_SECTION_NAME
#pragma section = CODE_SECTION_NAME
#pragma section = CSTACK_SECTION_NAME
/* Default only one code section. In fact, there may be more than one.
You can define more than one and redefine the OsStackDataIsCodeAddr function

View File

@@ -82,7 +82,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit()
/*****************************************************************************
Function : OsTskCycleStart
Description: start task to get cycles count in current task begining
Description: start task to get cycles count in current task beginning
Input : None
Return : None
*****************************************************************************/

40
components/debugtools/BUILD.gn Executable file
View File

@@ -0,0 +1,40 @@
# 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_switch = defined(LOSCFG_DEBUG_TOOLS)
module_name = get_path_info(rebase_path("."), "name")
kernel_module(module_name) {
sources = [ "los_stackdump.c" ]
configs += [ "$LITEOSTOPDIR:warn_config" ]
}
config("public") {
include_dirs = [ "." ]
}

View File

@@ -0,0 +1,59 @@
/*
* 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.
*/
#ifndef _LOS_DEBUGTOOLS_H
#define _LOS_DEBUGTOOLS_H
#include "los_config.h"
#include "los_task.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define PRINT_PER_ROW 4
/* Shell Callback */
extern UINT32 OsShellCmdStackDump(INT32 argc, const CHAR **argv);
/* other module Callback */
/* External Interface */
extern VOID LOS_TaskStackDump(UINT32 taskID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif

View File

@@ -0,0 +1,155 @@
/*
* 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.
*/
#include "los_debugtools.h"
#include "securec.h"
#include "los_debug.h"
#include "los_memory.h"
#include "los_arch.h"
#if (LOSCFG_DEBUG_TOOLS == 1)
typedef struct {
UINT32 waterLine;
UINT32 taskSPTop;
UINT32 taskSPLimit;
UINTPTR taskSP;
} DumpInfo;
STATIC VOID ShowFormat(UINTPTR *buf, DumpInfo *info)
{
INT32 i;
UINT32 len = info->waterLine / sizeof(UINTPTR);
UINTPTR addr = (info->taskSPLimit - info->waterLine);
for (i = 0; i < len; i++) {
if ((i % PRINT_PER_ROW) == 0) {
PRINTK("\r\n 0x%08x: ", addr);
}
if (addr == info->taskSP) {
PRINTK(" *%08x", buf[i]);
} else {
PRINTK(" %08x", buf[i]);
}
addr += sizeof(UINTPTR);
}
PRINTK("\r\n");
}
STATIC INT32 DumpTaskInfo(UINT32 taskID, UINTPTR *buf, DumpInfo *info)
{
errno_t ret;
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
if (taskID == LOS_CurTaskIDGet()) {
info->taskSP = ArchSpGet();
} else {
info->taskSP = (UINTPTR)taskCB->stackPointer;
}
info->taskSPTop = taskCB->topOfStack;
info->taskSPLimit = taskCB->topOfStack + taskCB->stackSize;
if ((info->taskSP > info->taskSPLimit) || (info->taskSP < info->taskSPTop)) {
return LOS_NOK;
}
ret = memcpy_s(buf, info->waterLine, (const VOID *)(info->taskSPLimit - info->waterLine), info->waterLine);
if (ret != EOK) {
return LOS_NOK;
}
return LOS_OK;
}
VOID LOS_TaskStackDump(UINT32 taskID)
{
UINTPTR *buf = NULL;
DumpInfo info;
UINT32 intSave;
INT32 ret;
if (taskID > g_taskMaxNum) {
PRINT_ERR("error taskID %u\r\n", taskID);
return;
}
if (OS_INT_ACTIVE) {
PRINT_ERR("called during an interrupt.\r\n");
return;
}
intSave = LOS_IntLock();
info.waterLine = OsGetTaskWaterLine(taskID);
if (info.waterLine == OS_NULL_INT) {
LOS_IntRestore(intSave);
return;
}
buf = (UINTPTR *)LOS_MemAlloc(OS_SYS_MEM_ADDR, info.waterLine);
if (buf == NULL) {
LOS_IntRestore(intSave);
PRINT_ERR("alloc failed for dump\n");
return;
}
(VOID)memset_s(buf, info.waterLine, 0, info.waterLine);
ret = DumpTaskInfo(taskID, buf, &info);
if (ret != LOS_OK) {
LOS_IntRestore(intSave);
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, buf);
PRINT_ERR("SP 0x%x may error or memcpy_s failed, stack space from 0x%x to 0x%x\r\n", \
info.taskSP, info.taskSPTop, info.taskSPLimit);
return;
}
LOS_IntRestore(intSave);
PRINTK("Task %u, SP 0x%x, WaterLine 0x%x", taskID, info.taskSP, info.waterLine);
ShowFormat(buf, &info);
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, buf);
return;
}
UINT32 OsShellCmdStackDump(INT32 argc, const CHAR **argv)
{
UINT32 taskID;
if (argc != 1) {
PRINT_ERR("\nUsage: stack taskID\n");
return LOS_NOK;
}
taskID = (UINT32)atoi(argv[0]);
LOS_TaskStackDump(taskID);
return LOS_OK;
}
#endif /* LOSCFG_STACK_DUMP == 1 */

21
components/dynlink/los_dynlink.c Executable file → Normal file
View File

@@ -73,8 +73,8 @@ const SymInfo symTableEnd __attribute__((section(".table.end"))) = {
.name = "end",
.addr = 0
};
#pragma section=".TABLE.START"
#pragma section=".table.end"
#pragma section = ".TABLE.START"
#pragma section = ".table.end"
#elif defined(__CLANG_ARM) || defined(__GNUC__)
/**
* Place instructions below in rodata segment of .ld linker file:
@@ -796,13 +796,13 @@ VOID *LOS_SoLoad(const CHAR *fileName, VOID *pool)
return dso;
ERR2:
LOS_MemFree(dso->pool, (VOID *)dso->loadBase);
(VOID)LOS_MemFree(dso->pool, (VOID *)dso->loadBase);
ERR1:
close(dso->fd);
(VOID)LOS_MuxPost(g_dynlinkMux);
LOS_MemFree(OS_SYS_MEM_ADDR, dso->dlInfo->elfPhdr);
LOS_MemFree(OS_SYS_MEM_ADDR, dso->dlInfo);
LOS_MemFree(OS_SYS_MEM_ADDR, dso);
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, dso->dlInfo->elfPhdr);
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, dso->dlInfo);
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, dso);
return NULL;
}
@@ -902,9 +902,12 @@ INT32 LOS_SoUnload(VOID *handle)
LOS_ListDelete(&dso->dsoNode);
(VOID)LOS_MuxPost(g_dynlinkMux);
LOS_MemFree(dso->pool, (VOID *)dso->loadBase);
LOS_MemFree(OS_SYS_MEM_ADDR, dso->dlInfo);
LOS_MemFree(OS_SYS_MEM_ADDR, dso);
(VOID)LOS_MemFree(dso->pool, (VOID *)dso->loadBase);
if (dso->dlInfo != NULL) {
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, dso->dlInfo->elfPhdr);
}
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, dso->dlInfo);
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, dso);
return LOS_OK;
ERR:

2
components/dynlink/los_dynlink.h Executable file → Normal file
View File

@@ -169,7 +169,7 @@ VOID *LOS_SoLoad(const CHAR *fileName, VOID *pool);
VOID *LOS_FindSym(VOID *handle, const CHAR *name);
/*
* @brief Decrement the reference count on the loaded shared library refered to by handle.
* @brief Decrement the reference count on the loaded shared library referred to by handle.
* If the reference count drops to zero, then the library is unloaded.
*
* This function validates that the handle is valid.

View File

@@ -55,7 +55,7 @@ STATIC ExcInfoArray g_excArray[OS_EXC_TYPE_MAX];
STATIC UINT32 OsExcSaveIntStatus(UINT32 type, VOID *arg)
{
UINT32 ret;
errno_t ret;
UINTPTR excContentEnd = (UINTPTR)MAX_INT_INFO_SIZE + (UINTPTR)g_excContent;
(VOID)arg;
@@ -92,6 +92,9 @@ STATIC UINT32 OsExcSaveIntStatus(UINT32 type, VOID *arg)
/* save IRQ Priority reg group */
ret = memcpy_s(g_excContent, excContentEnd - (UINTPTR)g_excContent,
(const VOID *)OS_NVIC_PRI_BASE, OS_NVIC_INT_PRI_SIZE);
if (ret != EOK) {
return LOS_NOK;
}
g_excContent = (UINT8 *)g_excContent + OS_NVIC_INT_PRI_SIZE;
/* save Exception Priority reg group */
@@ -294,5 +297,3 @@ VOID OsExcMsgDumpInit(VOID)
(VOID)LOS_RegExcHook(EXC_INTERRUPT, (ExcHookFn)OsExcMsgDump);
}
#endif

View File

@@ -36,39 +36,3 @@ config FS_FAT
help
Answer Y to enable LiteOS support fat filesystem.
config FS_FAT_CACHE
bool "Enable FAT Cache"
default y
depends on FS_FAT
help
Answer Y to enable LiteOS fat filesystem support cache.
config FS_FAT_CACHE_SYNC_THREAD
bool "Enable FAT Cache Sync Thread"
default n
depends on FS_FAT_CACHE
help
Answer Y to enable LiteOS fat filesystem support cache sync thread.
config FS_FAT_CHINESE
bool "Enable Chinese"
default y
depends on FS_FAT
help
Answer Y to enable LiteOS fat filesystem support Chinese.
config FS_FAT_VIRTUAL_PARTITION
bool "Enabel Virtual Partition"
default n
depends on FS_FAT
config FS_FAT_VOLUMES
int
depends on FS_FAT
default 32 if PLATFORM_HI3731
default 16
config FS_FAT_DISK
bool "Enable partinfo for storage device"
depends on FS_FAT
default y

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