Compare commits

...

141 Commits

Author SHA1 Message Date
openharmony_ci
df9387c28f !725 fix: 修复系统时间比RTC时间过快的问题
Merge pull request !725 from zhushengle/tick_master
2022-06-25 09:41:52 +00:00
openharmony_ci
d08a3e3f13 !732 LOSCFG_PLATFORM_HWI_WITH_ARG开启后M核编译失败修改
Merge pull request !732 from wangchen/0623_hwi
2022-06-24 11:49:12 +00:00
openharmony_ci
48ff5189b8 !727 OsShellCmdFreeInfo打印换行修改
Merge pull request !727 from wangchen/0622_m
2022-06-24 10:37:52 +00:00
zhushengle
600283a96f fix: 修复系统时间比RTC时间过快的问题
1.标记在时间接口中更新base后在中断中不再更新base
2.优化tick计算

Close #I5DCRB

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

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

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

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

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

【修改方案】
删除\r

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

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

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

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

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

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

【修改方案】
Recyle -> Recycle

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

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

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

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

close #I58COM

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

close #I58CNP

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

close #I58CM9

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

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

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

re #I4QBG2

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

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

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

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

fix #I52IID

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

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

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

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

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

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

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

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

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

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

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

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

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

re #I4XZN3

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

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

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

re #I4X2DP

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

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

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

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

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

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

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

    【修改方案】

     re #I4WV56

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

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

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

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

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

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

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

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

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

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

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

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

re #I4UR9P
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-02-22 08:12:01 +00:00
284 changed files with 8514 additions and 3086 deletions

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:
@@ -82,11 +82,10 @@ config("stdinc_config") {
"-isystem",
std_include,
]
cflags += [ "-nostdinc" ]
asmflags = cflags
if (defined(LOSCFG_LIBC_NEWLIB)) {
cflags -= [ "-nostdinc" ]
if (defined(LOSCFG_LIBC_MUSL)) {
cflags += [ "-nostdinc" ]
}
asmflags = cflags
}
config("ssp_config") {

29
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 information of mem node.
config BASE_MEM_NODE_INTEGRITY_CHECK
bool "Enable integrity check or not"
default n
@@ -590,6 +597,11 @@ config VM_OVERLAP_CHECK
depends on DEBUG_VERSION && MEM_DEBUG
help
Answer Y to enable vm overlap check.
config TASK_MEM_USED
bool "Enable show task mem used or not"
default n
depends on DEBUG_VERSION && MEM_DEBUG
endmenu
@@ -600,11 +612,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 +627,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

@@ -26,6 +26,7 @@ OpenHarmony LiteOS-M内核是面向IoT领域构建的轻量级物联网操作系
│ │ ├── cortex-m3 # cortex-m3架构代码
│ │ ├── cortex-m33 # cortex-m33架构代码
│ │ ├── cortex-m4 # cortex-m4架构代码
│ │ ├── cortex-m55 # cortex-m55架构代码
│ │ ├── cortex-m7 # cortex-m7架构代码
│ │ └── include # arm架构公共头文件目录
│ ├── csky # csky架构代码
@@ -131,5 +132,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

@@ -39,6 +39,9 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
#include "los_reg.h"
#define OS_INT_IRQ_ENABLE (1U << 0)
@@ -61,6 +64,30 @@ ExcInfo g_excInfo = {0};
*/
STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -163,7 +190,6 @@ inline UINT32 ArchIsIntActive(VOID)
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
@@ -205,6 +231,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -218,8 +247,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -269,6 +306,12 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask(hwiNum);
LOS_IntRestore(intSave);

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

@@ -39,15 +39,16 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
/*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
/* *
@@ -56,6 +57,30 @@ LITE_OS_SEC_VEC
*/
STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -198,7 +223,6 @@ inline UINT32 ArchIsIntActive(VOID)
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
@@ -240,6 +264,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -253,8 +280,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -309,6 +344,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -579,19 +622,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;
@@ -602,7 +645,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);

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)

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

@@ -39,12 +39,13 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
#define DEF_HANDLER_START_INDEX 2
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
/* *
* @ingroup los_hwi
@@ -52,6 +53,30 @@ UINT32 g_intCount = 0;
*/
STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -189,7 +214,6 @@ inline UINT32 ArchIsIntActive(VOID)
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
@@ -231,6 +255,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -244,8 +271,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -300,6 +335,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -575,14 +618,14 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)OsTickHandler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;
@@ -593,7 +636,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);

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

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)

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

@@ -39,19 +39,43 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
#define DEF_HANDLER_START_INDEX 2
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
/* *
* @ingroup los_hwi
* Hardware interrupt form mapping handling function array.
*/
STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -231,6 +255,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -244,8 +271,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -300,6 +335,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -575,14 +618,14 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)OsTickHandler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;
@@ -593,7 +636,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);

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

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

@@ -40,19 +40,46 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
/*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.
*/
STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -239,6 +266,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -252,8 +282,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -308,6 +346,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -577,19 +623,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

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

@@ -40,19 +40,46 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
/*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.
*/
STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -239,6 +266,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -252,8 +282,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -308,6 +346,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -577,19 +623,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

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

@@ -39,18 +39,42 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
/* *
* @ingroup los_hwi
* Hardware interrupt form mapping handling function array.
*/
STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -193,7 +217,6 @@ inline UINT32 ArchIsIntActive(VOID)
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
@@ -235,6 +258,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -248,8 +274,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -304,6 +338,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -584,19 +626,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;
@@ -607,7 +649,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

@@ -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,15 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
/*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
@@ -57,6 +58,30 @@ LITE_OS_SEC_VEC
*/
STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -241,6 +266,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -254,8 +282,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -310,6 +346,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -580,19 +624,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;
@@ -603,7 +647,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);

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

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

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

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

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

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

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

@@ -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
@@ -313,19 +313,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)

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

@@ -38,12 +38,13 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
#define DEF_HANDLER_START_INDEX 2
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
/* *
* @ingroup los_hwi
@@ -51,6 +52,30 @@ UINT32 g_intCount = 0;
*/
STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -193,7 +218,6 @@ inline UINT32 ArchIsIntActive(VOID)
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
@@ -235,6 +259,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -248,8 +275,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -304,6 +339,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -583,14 +626,14 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)OsTickHandler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

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

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

@@ -39,18 +39,42 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
/*lint -restore*/
/* *
* @ingroup los_hwi
* Hardware interrupt form mapping handling function array.
*/
STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -188,7 +212,6 @@ inline UINT32 ArchIsIntActive(VOID)
Output : None
Return : None
**************************************************************************** */
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
@@ -230,6 +253,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -243,8 +269,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -299,6 +333,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -569,19 +611,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;
@@ -592,7 +634,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

@@ -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,19 +40,44 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
/*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.
*/
STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -237,6 +262,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -250,8 +278,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -306,6 +342,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -576,19 +620,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;
@@ -599,7 +643,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);

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;
@@ -334,7 +333,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
intSave = LOS_IntLock();
g_intCount--;
#ifndef CPU_CK804
HalIrqEndCheckNeedSched();
#endif
LOS_IntRestore(intSave);
}
@@ -586,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
@@ -604,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,7 +50,11 @@ 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 UINT64 SysTickReload(UINT64 nextResponseTime);

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

@@ -214,6 +214,12 @@ STATIC INLINE HwiControllerOps *ArchIntOpsGet(VOID)
return &g_archHwiOps;
}
#if (LOSCFG_DEBUG_TOOLS == 1)
extern UINT32 OsGetHwiFormCnt(UINT32 index);
extern CHAR *OsGetHwiFormName(UINT32 index);
extern BOOL OsGetHwiCreated(UINT32 index);
#endif
#ifdef __cplusplus
#if __cplusplus
}

View File

@@ -51,7 +51,7 @@ extern "C" {
/**
* @ingroup los_hwi
* Count of Nuclei interrupt vector maxium, which is configurable.
* Count of Nuclei interrupt vector maximum, which is configurable.
*/
#define OS_RISCV_CUSTOM_IRQ_VECTOR_CNT SOC_INT_MAX

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

@@ -193,15 +193,15 @@ VOID HalDisplayTaskInfo(VOID)
/* ****************************************************************************
Function : HalUnalignedAccessFix
Description : Unaligned acess fixes are not supported by default
Description : Unaligned access fixes are not supported by default
Input : None
Output : None
Return : None
**************************************************************************** */
WEAK UINT32 HalUnalignedAccessFix(UINTPTR mcause, UINTPTR mepc, UINTPTR mtval, VOID *sp)
{
/* Unaligned acess fixes are not supported by default */
PRINTK("Unaligned acess fixes are not support by default!\r\n");
/* Unaligned access fixes are not supported by default */
PRINTK("Unaligned access fixes are not support by default!\r\n");
return LOS_NOK;
}

View File

@@ -62,9 +62,9 @@
* - ZEm(data): Zero-Extend data to m-bit.
* - ABS(x): Calculate the absolute value of `x`.
* - CONCAT(x,y): Concatinate `x` and `y` to form a value.
* - u<: Unsinged less than comparison.
* - u<=: Unsinged less than & equal comparison.
* - u>: Unsinged greater than comparison.
* - u<: Unsigned less than comparison.
* - u<=: Unsigned less than & equal comparison.
* - u>: Unsigned greater than comparison.
* - s*: Signed multiplication.
* - u*: Unsigned multiplication.
*
@@ -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.
@@ -2641,7 +2641,7 @@ __STATIC_FORCEINLINE long __RV_KHMTT(unsigned int a, unsigned int b)
/* ===== Inline Function Start for 3.38.1. KMABB ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMABB (SIMD Saturating Signed Multiply Bottom Halfs & Add)
* \brief KMABB (SIMD Saturating Signed Multiply Bottom Halves & Add)
* \details
* **Type**: SIMD
*
@@ -2704,7 +2704,7 @@ __STATIC_FORCEINLINE long __RV_KMABB(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.38.2. KMABT ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMABT (SIMD Saturating Signed Multiply Bottom & Top Halfs & Add)
* \brief KMABT (SIMD Saturating Signed Multiply Bottom & Top Halves & Add)
* \details
* **Type**: SIMD
*
@@ -2767,7 +2767,7 @@ __STATIC_FORCEINLINE long __RV_KMABT(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.38.3. KMATT ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMATT (SIMD Saturating Signed Multiply Top Halfs & Add)
* \brief KMATT (SIMD Saturating Signed Multiply Top Halves & Add)
* \details
* **Type**: SIMD
*
@@ -2830,7 +2830,7 @@ __STATIC_FORCEINLINE long __RV_KMATT(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.39.1. KMADA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMADA (SIMD Saturating Signed Multiply Two Halfs and Two Adds)
* \brief KMADA (SIMD Saturating Signed Multiply Two Halves and Two Adds)
* \details
* **Type**: SIMD
*
@@ -2894,7 +2894,7 @@ __STATIC_FORCEINLINE long __RV_KMADA(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.39.2. KMAXDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMAXDA (SIMD Saturating Signed Crossed Multiply Two Halfs and Two Adds)
* \brief KMAXDA (SIMD Saturating Signed Crossed Multiply Two Halves and Two Adds)
* \details
* **Type**: SIMD
*
@@ -2958,7 +2958,7 @@ __STATIC_FORCEINLINE long __RV_KMAXDA(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.40.1. KMADS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMADS (SIMD Saturating Signed Multiply Two Halfs & Subtract & Add)
* \brief KMADS (SIMD Saturating Signed Multiply Two Halves & Subtract & Add)
* \details
* **Type**: SIMD
*
@@ -3030,7 +3030,7 @@ __STATIC_FORCEINLINE long __RV_KMADS(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.40.2. KMADRS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMADRS (SIMD Saturating Signed Multiply Two Halfs & Reverse Subtract & Add)
* \brief KMADRS (SIMD Saturating Signed Multiply Two Halves & Reverse Subtract & Add)
* \details
* **Type**: SIMD
*
@@ -3102,7 +3102,7 @@ __STATIC_FORCEINLINE long __RV_KMADRS(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.40.3. KMAXDS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMAXDS (SIMD Saturating Signed Crossed Multiply Two Halfs & Subtract & Add)
* \brief KMAXDS (SIMD Saturating Signed Crossed Multiply Two Halves & Subtract & Add)
* \details
* **Type**: SIMD
*
@@ -3242,7 +3242,7 @@ __STATIC_FORCEINLINE long long __RV_KMAR64(long long t, long a, long b)
/* ===== Inline Function Start for 3.42.1. KMDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMDA (SIMD Signed Multiply Two Halfs and Add)
* \brief KMDA (SIMD Signed Multiply Two Halves and Add)
* \details
* **Type**: SIMD
*
@@ -3293,7 +3293,7 @@ __STATIC_FORCEINLINE long __RV_KMDA(unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.42.2. KMXDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMXDA (SIMD Signed Crossed Multiply Two Halfs and Add)
* \brief KMXDA (SIMD Signed Crossed Multiply Two Halves and Add)
* \details
* **Type**: SIMD
*
@@ -4330,7 +4330,7 @@ __STATIC_FORCEINLINE long __RV_KMMWT2_U(long a, unsigned long b)
/* ===== Inline Function Start for 3.51.1. KMSDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMSDA (SIMD Saturating Signed Multiply Two Halfs & Add & Subtract)
* \brief KMSDA (SIMD Saturating Signed Multiply Two Halves & Add & Subtract)
* \details
* **Type**: SIMD
*
@@ -4392,7 +4392,7 @@ __STATIC_FORCEINLINE long __RV_KMSDA(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.51.2. KMSXDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMSXDA (SIMD Saturating Signed Crossed Multiply Two Halfs & Add & Subtract)
* \brief KMSXDA (SIMD Saturating Signed Crossed Multiply Two Halves & Add & Subtract)
* \details
* **Type**: SIMD
*
@@ -5558,7 +5558,7 @@ __STATIC_FORCEINLINE long __RV_KSUBH(int a, int b)
* **Description**:\n
* The signed lower 32-bit content of Rs2 is subtracted from the signed lower 32-bit
* content of Rs1. And the result is saturated to the 32-bit signed integer range of [-2^31, 2^31-1] and then
* sign-extened and written to Rd. If saturation happens, this instruction sets the OV flag.
* sign-extended and written to Rd. If saturation happens, this instruction sets the OV flag.
*
* **Operations**:\n
* ~~~
@@ -7337,7 +7337,7 @@ __STATIC_FORCEINLINE unsigned long __RV_SLL16(unsigned long a, unsigned int b)
/* ===== Inline Function Start for 3.104. SMAL ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMAL (Signed Multiply Halfs & Add 64-bit)
* \brief SMAL (Signed Multiply Halves & Add 64-bit)
* \details
* **Type**: Partial-SIMD
*
@@ -7397,7 +7397,7 @@ __STATIC_FORCEINLINE long long __RV_SMAL(long long a, unsigned long b)
/* ===== Inline Function Start for 3.105.1. SMALBB ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALBB (Signed Multiply Bottom Halfs & Add 64-bit)
* \brief SMALBB (Signed Multiply Bottom Halves & Add 64-bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -7561,7 +7561,7 @@ __STATIC_FORCEINLINE long long __RV_SMALBT(long long t, unsigned long a, unsigne
/* ===== Inline Function Start for 3.105.3. SMALTT ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALTT (Signed Multiply Top Halfs & Add 64-bit)
* \brief SMALTT (Signed Multiply Top Halves & Add 64-bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -7643,7 +7643,7 @@ __STATIC_FORCEINLINE long long __RV_SMALTT(long long t, unsigned long a, unsigne
/* ===== Inline Function Start for 3.106.1. SMALDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALDA (Signed Multiply Two Halfs and Two Adds 64-bit)
* \brief SMALDA (Signed Multiply Two Halves and Two Adds 64-bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -7727,7 +7727,7 @@ __STATIC_FORCEINLINE long long __RV_SMALDA(long long t, unsigned long a, unsigne
/* ===== Inline Function Start for 3.106.2. SMALXDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALXDA (Signed Crossed Multiply Two Halfs and Two Adds 64-bit)
* \brief SMALXDA (Signed Crossed Multiply Two Halves and Two Adds 64-bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -7811,7 +7811,7 @@ __STATIC_FORCEINLINE long long __RV_SMALXDA(long long t, unsigned long a, unsign
/* ===== Inline Function Start for 3.107.1. SMALDS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALDS (Signed Multiply Two Halfs & Subtract & Add 64-bit)
* \brief SMALDS (Signed Multiply Two Halves & Subtract & Add 64-bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -7902,7 +7902,7 @@ __STATIC_FORCEINLINE long long __RV_SMALDS(long long t, unsigned long a, unsigne
/* ===== Inline Function Start for 3.107.2. SMALDRS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALDRS (Signed Multiply Two Halfs & Reverse Subtract & Add 64- bit)
* \brief SMALDRS (Signed Multiply Two Halves & Reverse Subtract & Add 64- bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -7993,7 +7993,7 @@ __STATIC_FORCEINLINE long long __RV_SMALDRS(long long t, unsigned long a, unsign
/* ===== Inline Function Start for 3.107.3. SMALXDS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALXDS (Signed Crossed Multiply Two Halfs & Subtract & Add 64- bit)
* \brief SMALXDS (Signed Crossed Multiply Two Halves & Subtract & Add 64- bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -8459,7 +8459,7 @@ __STATIC_FORCEINLINE long __RV_SMTT16(unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.114.1. SMDS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief SMDS (SIMD Signed Multiply Two Halfs and Subtract)
* \brief SMDS (SIMD Signed Multiply Two Halves and Subtract)
* \details
* **Type**: SIMD
*
@@ -8518,7 +8518,7 @@ __STATIC_FORCEINLINE long __RV_SMDS(unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.114.2. SMDRS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief SMDRS (SIMD Signed Multiply Two Halfs and Reverse Subtract)
* \brief SMDRS (SIMD Signed Multiply Two Halves and Reverse Subtract)
* \details
* **Type**: SIMD
*
@@ -8577,7 +8577,7 @@ __STATIC_FORCEINLINE long __RV_SMDRS(unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.114.3. SMXDS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief SMXDS (SIMD Signed Crossed Multiply Two Halfs and Subtract)
* \brief SMXDS (SIMD Signed Crossed Multiply Two Halves and Subtract)
* \details
* **Type**: SIMD
*
@@ -9016,7 +9016,7 @@ __STATIC_FORCEINLINE long __RV_SMMWT_U(long a, unsigned long b)
/* ===== Inline Function Start for 3.120.1. SMSLDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMSLDA (Signed Multiply Two Halfs & Add & Subtract 64-bit)
* \brief SMSLDA (Signed Multiply Two Halves & Add & Subtract 64-bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -9098,7 +9098,7 @@ __STATIC_FORCEINLINE long long __RV_SMSLDA(long long t, unsigned long a, unsigne
/* ===== Inline Function Start for 3.120.2. SMSLXDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMSLXDA (Signed Crossed Multiply Two Halfs & Add & Subtract 64- bit)
* \brief SMSLXDA (Signed Crossed Multiply Two Halves & Add & Subtract 64- bit)
* \details
* **Type**: DSP (64-bit Profile)
*

View File

@@ -282,7 +282,7 @@ __STATIC_FORCEINLINE uint32_t __ECLIC_GetCfgNlbits(void)
* This function gets the hardware version information from CLICINFO register.
* \return hardware version number in CLICINFO register.
* \remarks
* - This function gets harware version information from CLICINFO register.
* - This function gets hardware version information from CLICINFO register.
* - Bit 20:17 for architecture version, bit 16:13 for implementation version.
* \sa
* - \ref ECLIC_GetInfoNum

View File

@@ -81,7 +81,7 @@
* \details
* * We can save power by disable FPU Unit.
* * When FPU Unit is disabled, any access to FPU related CSR registers
* and FPU instructions will cause illegal Instuction Exception.
* and FPU instructions will cause illegal Instruction Exception.
* */
#define __disable_FPU() __RV_CSR_CLEAR(CSR_MSTATUS, MSTATUS_FS)

View File

@@ -282,7 +282,7 @@ __STATIC_FORCEINLINE void SysTimer_SoftwareReset(void)
* \details Initializes the System Timer and its non-vector interrupt, and starts the System Tick Timer.
*
* In our default implementation, the timer counter will be set to zero, and it will start a timer compare non-vector interrupt
* when it matchs the ticks user set, during the timer interrupt user should reload the system tick using \ref SysTick_Reload function
* when it matches the ticks user set, during the timer interrupt user should reload the system tick using \ref SysTick_Reload function
* or similar function written by user, so it can produce period timer interrupt.
* \param [in] ticks Number of ticks between two interrupts.
* \return 0 Function succeeded.

View File

@@ -325,7 +325,7 @@
* \brief NMSIS Core CSR Register Definitions
* \details
*
* The following macros are used for CSR Register Defintions.
* The following macros are used for CSR Register Definitions.
* @{
*/
/* === Standard RISC-V CSR Registers === */

View File

@@ -47,7 +47,7 @@
* - Neural Network Support Functions
*
* The library has separate functions for operating on different weight and activation data
* types including 8-bit integers (q7_t) and 16-bit integers (q15_t). The descrition of the
* types including 8-bit integers (q7_t) and 16-bit integers (q15_t). The description of the
* kernels are included in the function description. The implementation details are also
* described in this paper [1].
*
@@ -119,7 +119,7 @@ extern "C"
/**
* @brief Basic Q7 convolution function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -156,8 +156,8 @@ extern "C"
/**
* @brief Basic Q7 convolution function (non-sqaure shape)
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in_x input tensor dimention x
* @param[in] dim_im_in_y input tensor dimention y
* @param[in] dim_im_in_x input tensor dimension x
* @param[in] dim_im_in_y input tensor dimension y
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -202,7 +202,7 @@ extern "C"
/**
* @brief Basic Q15 convolution function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -239,7 +239,7 @@ extern "C"
/**
* @brief Fast Q7 convolution function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -257,7 +257,7 @@ extern "C"
* <code>RISCV_MATH_SIZE_MISMATCH</code> or <code>RISCV_MATH_SUCCESS</code> based on the outcome of size checking.
*
* This function is the version with full list of optimization tricks, but with
* some contraints:
* some constraints:
* ch_im_in is multiple of 4
* ch_im_out is multiple of 2
*/
@@ -281,8 +281,8 @@ extern "C"
/**
* @brief Fast Q7 convolution function (non-sqaure shape)
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in_x input tensor dimention x
* @param[in] dim_im_in_y input tensor dimention y
* @param[in] dim_im_in_x input tensor dimension x
* @param[in] dim_im_in_y input tensor dimension y
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -304,7 +304,7 @@ extern "C"
* <code>RISCV_MATH_SIZE_MISMATCH</code> or <code>RISCV_MATH_SUCCESS</code> based on the outcome of size checking.
*
* This function is the version with full list of optimization tricks, but with
* some contraints:
* some constraints:
* ch_im_in is multiple of 4
* ch_im_out is multiple of 2
*/
@@ -333,8 +333,8 @@ extern "C"
/**
* @brief Fast Q7 version of 1x1 convolution (non-sqaure shape)
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in_x input tensor dimention x
* @param[in] dim_im_in_y input tensor dimention y
* @param[in] dim_im_in_x input tensor dimension x
* @param[in] dim_im_in_y input tensor dimension y
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -360,7 +360,7 @@ extern "C"
* second half of MobileNets after depthwise separable convolution.
*
* This function is the version with full list of optimization tricks, but with
* some contraints:
* some constraints:
* ch_im_in is multiple of 4
* ch_im_out is multiple of 2
*/
@@ -388,7 +388,7 @@ extern "C"
/**
* @brief Q7 version of convolution for RGB image
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -429,7 +429,7 @@ extern "C"
/**
* @brief Fast Q15 convolution function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -447,7 +447,7 @@ extern "C"
* <code>RISCV_MATH_SIZE_MISMATCH</code> or <code>RISCV_MATH_SUCCESS</code> based on the outcome of size checking.
*
* This function is the version with full list of optimization tricks, but with
* some contraints:
* some constraints:
* ch_im_in is multiple of 2
* ch_im_out is multiple of 2
*/
@@ -471,8 +471,8 @@ extern "C"
/**
* @brief Fast Q15 convolution function (non-sqaure shape)
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in_x input tensor dimention x
* @param[in] dim_im_in_y input tensor dimention y
* @param[in] dim_im_in_x input tensor dimension x
* @param[in] dim_im_in_y input tensor dimension y
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -505,7 +505,7 @@ extern "C"
*
* ch_im_in is multiple of 2
*
* ch_im_out is multipe of 2
* ch_im_out is multiple of 2
*
*/
@@ -534,7 +534,7 @@ extern "C"
/**
* @brief Q7 depthwise separable convolution function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -552,7 +552,7 @@ extern "C"
* <code>RISCV_MATH_SIZE_MISMATCH</code> or <code>RISCV_MATH_SUCCESS</code> based on the outcome of size checking.
*
* This function is the version with full list of optimization tricks, but with
* some contraints:
* some constraints:
* ch_im_in is multiple of 2
* ch_im_out is multiple of 2
*/
@@ -576,8 +576,8 @@ extern "C"
/**
* @brief Q7 depthwise separable convolution function (non-square shape)
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in_x input tensor dimention x
* @param[in] dim_im_in_y input tensor dimention y
* @param[in] dim_im_in_x input tensor dimension x
* @param[in] dim_im_in_y input tensor dimension y
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -599,7 +599,7 @@ extern "C"
* <code>RISCV_MATH_SIZE_MISMATCH</code> or <code>RISCV_MATH_SUCCESS</code> based on the outcome of size checking.
*
* This function is the version with full list of optimization tricks, but with
* some contraints:
* some constraints:
* ch_im_in is multiple of 2
* ch_im_out is multiple of 2
*/
@@ -986,7 +986,7 @@ extern "C"
/**
* @brief Q7 max pooling function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] dim_kernel filter kernel size
* @param[in] padding padding sizes
@@ -1011,7 +1011,7 @@ extern "C"
/**
* @brief Q7 average pooling function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] dim_kernel filter kernel size
* @param[in] padding padding sizes
@@ -1043,7 +1043,7 @@ extern "C"
/**
* @brief Q7 softmax function
* @param[in] vec_in pointer to input vector
* @param[in] dim_vec input vector dimention
* @param[in] dim_vec input vector dimension
* @param[out] p_out pointer to output vector
* @return none.
*
@@ -1054,7 +1054,7 @@ extern "C"
/**
* @brief Q15 softmax function
* @param[in] vec_in pointer to input vector
* @param[in] dim_vec input vector dimention
* @param[in] dim_vec input vector dimension
* @param[out] p_out pointer to output vector
* @return none.
*
@@ -1081,7 +1081,7 @@ extern "C"
* @param[in] dilation_x Dilation along width. Not used and intended for future enhancement.
* @param[in] dilation_y Dilation along height. Not used and intended for future enhancement.
* @param[in] bias Pointer to optional bias values. If no bias is
* availble, NULL is expected
* available, NULL is expected
* @param[in] input_offset Input tensor zero offset
* @param[in] filter_offset Kernel tensor zero offset
* @param[in] output_offset Output tensor zero offset

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

@@ -332,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

@@ -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
@@ -93,6 +94,5 @@
├── los_hook.h
├── los_list.h --- Doubly linked list
└── los_reg.h --- Register macros
└── src
```

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
@@ -92,6 +93,5 @@
├── los_hook.h
├── los_list.h --- 双向链表
└── los_reg.h --- 寄存器读写宏定义
└── src
```

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

@@ -35,8 +35,15 @@
#include "los_debug.h"
#include "los_tick.h"
#if (LOSCFG_BASE_CORE_CPUP == 1)
#if (LOSCFG_BASE_CORE_SWTMR == 1)
#include "los_swtmr.h"
#endif
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_arch_interrupt.h"
#endif
#if (LOSCFG_BASE_CORE_CPUP == 1)
/**
* @ingroup los_cpup
* CPU usage-type macro: used for tasks.
@@ -54,7 +61,79 @@
LITE_OS_SEC_BSS UINT16 g_cpupInitFlg = 0;
LITE_OS_SEC_BSS OsCpupCB *g_cpup = NULL;
LITE_OS_SEC_BSS UINT64 g_lastRecordTime;
LITE_OS_SEC_BSS UINT16 g_hisPos; /* <current Sampling point of historyTime */
LITE_OS_SEC_BSS UINT16 g_hisPos; /* current Sampling point of historyTime */
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
LITE_OS_SEC_BSS UINT16 g_irqCpupInitFlg = 0;
LITE_OS_SEC_BSS UINT16 g_irqHisPos = 0; /* current Sampling point of historyTime */
LITE_OS_SEC_BSS UINT64 g_irqLastRecordTime;
LITE_OS_SEC_BSS OsIrqCpupCB *g_irqCpup = NULL;
LITE_OS_SEC_BSS STATIC UINT64 g_cpuHistoryTime[OS_CPUP_HISTORY_RECORD_NUM];
#define OS_CPUP_USED 0x1U
#if (LOSCFG_BASE_CORE_SWTMR == 1)
LITE_OS_SEC_TEXT_INIT VOID OsCpupGuard(VOID)
{
UINT16 prevPos;
UINT32 loop;
UINT32 intSave;
intSave = LOS_IntLock();
prevPos = g_irqHisPos;
if (g_irqHisPos == OS_CPUP_HISTORY_RECORD_NUM - 1) {
g_irqHisPos = 0;
} else {
g_irqHisPos++;
}
g_cpuHistoryTime[prevPos] = 0;
for (loop = 0; loop < LOSCFG_PLATFORM_HWI_LIMIT; loop++) {
if (g_irqCpup[loop].status != OS_CPUP_USED) {
continue;
}
g_irqCpup[loop].historyTime[prevPos] = g_irqCpup[loop].allTime;
g_cpuHistoryTime[prevPos] += g_irqCpup[loop].allTime;
}
LOS_IntRestore(intSave);
return;
}
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupGuardCreator(VOID)
{
UINT32 cpupSwtmrID;
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
(VOID)LOS_SwtmrCreate(LOSCFG_BASE_CORE_TICK_PER_SECOND, LOS_SWTMR_MODE_PERIOD,
(SWTMR_PROC_FUNC)OsCpupGuard, &cpupSwtmrID, 0,
OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE);
#else
(VOID)LOS_SwtmrCreate(LOSCFG_BASE_CORE_TICK_PER_SECOND, LOS_SWTMR_MODE_PERIOD,
(SWTMR_PROC_FUNC)OsCpupGuard, &cpupSwtmrID, 0);
#endif
(VOID)LOS_SwtmrStart(cpupSwtmrID);
return LOS_OK;
}
#endif
/*****************************************************************************
Function : OsCpupDaemonInit
Description: initialization of CPUP Daemon
Input : None
Return : LOS_OK or Error Information
*****************************************************************************/
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupDaemonInit()
{
#if (LOSCFG_BASE_CORE_SWTMR == 1)
(VOID)OsCpupGuardCreator();
g_irqCpupInitFlg = 1;
#endif
return LOS_OK;
}
#endif
/*****************************************************************************
Function : OsCpupInit
@@ -65,16 +144,24 @@ Return : LOS_OK or Error Information
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit()
{
UINT32 size;
CHAR *cpupMem = NULL;
size = g_taskMaxNum * sizeof(OsCpupCB);
g_cpup = (OsCpupCB *)LOS_MemAlloc(m_aucSysMem0, size);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
size += LOSCFG_PLATFORM_HWI_LIMIT * sizeof(OsIrqCpupCB);
#endif
if (g_cpup == NULL) {
cpupMem = LOS_MemAlloc(m_aucSysMem0, size);
if (cpupMem == NULL) {
return LOS_ERRNO_CPUP_NO_MEMORY;
}
(VOID)memset_s(cpupMem, size, 0, size);
g_cpup = (OsCpupCB *)cpupMem;
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
g_irqCpup = (OsIrqCpupCB *)(cpupMem + g_taskMaxNum * sizeof(OsCpupCB));
#endif
// Ignore the return code when matching CSEC rule 6.6(3).
(VOID)memset_s(g_cpup, size, 0, size);
g_cpupInitFlg = 1;
return LOS_OK;
@@ -82,7 +169,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
*****************************************************************************/
@@ -513,4 +600,146 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_CpupUsageMonitor(CPUP_TYPE_E type, CPUP_MODE_E
return LOS_OK;
}
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
LITE_OS_SEC_TEXT_MINOR VOID OsCpupIrqStart(UINT32 intNum)
{
if (g_irqCpupInitFlg == 0) {
return;
}
g_irqCpup[intNum].startTime = LOS_SysCycleGet();
return;
}
LITE_OS_SEC_TEXT_MINOR VOID OsCpupIrqEnd(UINT32 intNum)
{
UINT64 cpuCycle;
UINT64 usedTime;
if (g_irqCpupInitFlg == 0) {
return;
}
if (g_irqCpup[intNum].startTime == 0) {
return;
}
cpuCycle = LOS_SysCycleGet();
if (cpuCycle < g_irqCpup[intNum].startTime) {
cpuCycle += g_cyclesPerTick;
}
g_irqCpup[intNum].cpupID = intNum;
g_irqCpup[intNum].status = OS_CPUP_USED;
usedTime = cpuCycle - g_irqCpup[intNum].startTime;
if (g_irqCpup[intNum].count <= 1000) { /* 1000, Take 1000 samples */
g_irqCpup[intNum].allTime += usedTime;
g_irqCpup[intNum].count++;
} else {
g_irqCpup[intNum].allTime = 0;
g_irqCpup[intNum].count = 0;
}
g_irqCpup[intNum].startTime = 0;
if (usedTime > g_irqCpup[intNum].timeMax) {
g_irqCpup[intNum].timeMax = usedTime;
}
return;
}
LITE_OS_SEC_TEXT_MINOR OsIrqCpupCB *OsGetIrqCpupArrayBase(VOID)
{
return g_irqCpup;
}
LITE_OS_SEC_TEXT_MINOR STATIC VOID OsGetIrqPositions(UINT16 mode, UINT16* curPosAddr, UINT16* prePosAddr)
{
UINT16 curPos;
UINT16 prePos = 0;
curPos = g_irqHisPos;
if (mode == CPUP_IN_1S) {
curPos = OsGetPrePos(curPos);
prePos = OsGetPrePos(curPos);
} else if (mode == CPUP_LESS_THAN_1S) {
curPos = OsGetPrePos(curPos);
}
*curPosAddr = curPos;
*prePosAddr = prePos;
}
LITE_OS_SEC_TEXT_MINOR STATIC UINT64 OsGetIrqAllTime(VOID)
{
INT32 i;
UINT64 cpuCycleAll = 0;
for (i = 0; i < OS_CPUP_HISTORY_RECORD_NUM; i++) {
cpuCycleAll += g_cpuHistoryTime[i];
}
return cpuCycleAll;
}
LITE_OS_SEC_TEXT_MINOR STATIC UINT64 OsGetIrqAllHisTime(UINT32 num)
{
INT32 i;
UINT64 historyTime = 0;
for (i = 0; i < OS_CPUP_HISTORY_RECORD_NUM; i++) {
historyTime += g_irqCpup[num].historyTime[i];
}
return historyTime;
}
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_GetAllIrqCpuUsage(UINT16 mode, CPUP_INFO_S *cpupInfo)
{
UINT16 loopNum;
UINT16 curPos;
UINT16 prePos = 0;
UINT32 intSave;
UINT64 cpuCycleAll;
UINT64 cpuCycleCurIrq;
if (g_irqCpupInitFlg == 0) {
return LOS_ERRNO_CPUP_NO_INIT;
}
if (cpupInfo == NULL) {
return LOS_ERRNO_CPUP_TASK_PTR_NULL;
}
intSave = LOS_IntLock();
OsGetIrqPositions(mode, &curPos, &prePos);
if (mode == CPUP_IN_10S) {
cpuCycleAll = OsGetIrqAllTime();
} else {
cpuCycleAll = g_cpuHistoryTime[curPos] - g_cpuHistoryTime[prePos];
}
for (loopNum = 0; loopNum < LOSCFG_PLATFORM_HWI_LIMIT; loopNum++) {
if (g_irqCpup[loopNum].status != OS_CPUP_USED) {
continue;
}
cpupInfo[loopNum].usStatus = g_irqCpup[loopNum].status;
if (mode == CPUP_IN_10S) {
cpuCycleCurIrq = OsGetIrqAllHisTime(loopNum);
} else {
cpuCycleCurIrq = g_irqCpup[loopNum].historyTime[curPos] - g_irqCpup[loopNum].historyTime[prePos];
}
if (cpuCycleAll != 0) {
cpupInfo[loopNum].uwUsage = (UINT32)((LOS_CPUP_PRECISION * cpuCycleCurIrq) / cpuCycleAll);
}
}
LOS_IntRestore(intSave);
return LOS_OK;
}
#endif
#endif /* LOSCFG_BASE_CORE_CPUP */

View File

@@ -139,6 +139,18 @@ typedef struct {
extern OsCpupCB *g_cpup;
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
typedef struct {
UINT32 cpupID; /**< Irq ID */
UINT16 status; /**< Irq status */
UINT64 allTime; /**< Total running time */
UINT64 startTime; /**< Time before a task is invoked */
UINT64 timeMax; /**< Irq samples count */
UINT64 count; /**< Irq samples count */
UINT64 historyTime[OS_CPUP_HISTORY_RECORD_NUM]; /**< Historical running time */
} OsIrqCpupCB;
#endif
/**
* @ingroup los_cpup
* @brief Initialization cpup.
@@ -159,6 +171,7 @@ extern OsCpupCB *g_cpup;
*/
extern UINT32 OsCpupInit(VOID);
extern UINT32 OsCpupDaemonInit(VOID);
/**
* @ingroup los_cpup
* @brief Start task to get cycles count in current task ending.
@@ -357,6 +370,13 @@ extern UINT32 LOS_AllTaskCpuUsage(CPUP_INFO_S *cpupInfo, UINT16 mode);
*/
extern UINT32 LOS_CpupUsageMonitor(CPUP_TYPE_E type, CPUP_MODE_E mode, UINT32 taskID);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
extern VOID OsCpupIrqStart(UINT32 intNum);
extern VOID OsCpupIrqEnd(UINT32 intNum);
extern OsIrqCpupCB *OsGetIrqCpupArrayBase(VOID);
extern UINT32 LOS_GetAllIrqCpuUsage(UINT16 mode, CPUP_INFO_S *cpupInfo);
#endif
#ifdef __cplusplus
#if __cplusplus
}

View File

@@ -0,0 +1,44 @@
# 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_hwidump.c",
"los_schedtrace.c",
"los_stackdump.c",
]
configs += [ "$LITEOSTOPDIR:warn_config" ]
}
config("public") {
include_dirs = [ "." ]
}

View File

@@ -0,0 +1,89 @@
/*
* 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 */
/* StackDump print format */
#define PRINT_PER_ROW 4
/* SchedTrace records number */
#define TRACE_NUM 200
/* sched trace info, users can add their own */
typedef struct {
UINT32 newTaskID;
CHAR newTaskName[LOS_TASK_NAMELEN];
UINT32 runTaskID;
CHAR runTaskName[LOS_TASK_NAMELEN];
} SchedTraceInfo;
/* SchedTrace record callback */
typedef void (*SchedTraceRecordCB)(LosTaskCB *newTask, LosTaskCB *runTask);
/* SchedTrace show callback, buf is overwrite ringbuf, max amount of storage is TRACE_NUM */
typedef void (*SchedTraceShowCB)(SchedTraceInfo *ringBuf, UINT32 count);
/* Shell callback */
extern UINT32 OsShellCmdStackDump(INT32 argc, const CHAR **argv);
extern UINT32 OsShellCmdHwiDump(INT32 argc, const CHAR **argv);
extern UINT32 OsShellCmdSchedTrace(INT32 argc, const CHAR **argv);
/* Other module callback */
extern VOID OsSchedTraceRecord(LosTaskCB *newTask, LosTaskCB *runTask);
/* External interface */
/* dump stack by task id, can be called at any time */
extern VOID LOS_TaskStackDump(UINT32 taskID);
/* register sched trace handle, If not registered, the default fun will be used */
extern VOID LOS_SchedTraceHandleRegister(SchedTraceRecordCB recordCB, SchedTraceShowCB showCB);
/* start sched trace, will alloc buf, and start write to buf when sched */
extern VOID LOS_SchedTraceStart(VOID);
/* stop sched trace, will stop record and free buf */
extern VOID LOS_SchedTraceStop(VOID);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif

View File

@@ -0,0 +1,149 @@
/*
* 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"
#include "los_interrupt.h"
#include "los_arch_interrupt.h"
#if (LOSCFG_DEBUG_TOOLS == 1)
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) && (LOSCFG_BASE_CORE_SWTMR == 1)
#include "los_cpup.h"
#define IRQ_CPUP_INFO_SIZE (sizeof(CPUP_INFO_S) * LOSCFG_PLATFORM_HWI_LIMIT)
#define IRQ_CPUP_ALL_INFO_SIZE (IRQ_CPUP_INFO_SIZE + IRQ_CPUP_INFO_SIZE)
#define IRQ_DATA_SIZE sizeof(OsIrqCpupCB)
#define CPUP_PRECISION_MULT LOS_CPUP_PRECISION_MULT
STATIC VOID ShellCmdHwiInfoShow(OsIrqCpupCB *irqData, CPUP_INFO_S *hwiCpup1s,
CPUP_INFO_S *hwiCpup10s)
{
UINT32 i;
UINT32 intSave;
UINT32 count;
UINT64 cycles = 0;
UINT64 timeMax = 0;
CHAR *irqName = NULL;
OsIrqCpupCB *irqDataBase = OsGetIrqCpupArrayBase();
if (irqDataBase == NULL) {
PRINT_ERR("get hwi info error\n");
return;
}
for (i = 0; i < LOSCFG_PLATFORM_HWI_LIMIT; i++) {
if ((OsGetHwiCreated(i) != TRUE) || (OsGetHwiFormCnt(i) == 0)) {
continue;
}
intSave = LOS_IntLock();
(VOID)memcpy_s(irqData, IRQ_DATA_SIZE, &irqDataBase[i], IRQ_DATA_SIZE);
LOS_IntRestore(intSave);
if (irqData->status == 0) {
continue;
}
count = OsGetHwiFormCnt(i);
if (count != 0) {
if (irqData->count != 0) {
cycles = (irqData->allTime * OS_NS_PER_CYCLE) / (irqData->count * OS_SYS_NS_PER_US);
}
timeMax = (irqData->timeMax * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
}
irqName = OsGetHwiFormName(i);
PRINTK(" %10d:%11u%11llu%10llu%9u.%-2u%9u.%-2u %-12s\n", i - OS_SYS_VECTOR_CNT, count, cycles, timeMax,
hwiCpup1s[i].uwUsage / CPUP_PRECISION_MULT, hwiCpup1s[i].uwUsage % CPUP_PRECISION_MULT,
hwiCpup10s[i].uwUsage / CPUP_PRECISION_MULT, hwiCpup10s[i].uwUsage % CPUP_PRECISION_MULT,
(irqName != NULL) ? irqName : NULL);
}
}
STATIC VOID HwiInfoDump(VOID)
{
UINT32 size;
size = IRQ_CPUP_ALL_INFO_SIZE + IRQ_DATA_SIZE;
CHAR *irqCpup = LOS_MemAlloc(m_aucSysMem0, size);
if (irqCpup == NULL) {
return;
}
CPUP_INFO_S *hwiCpup10s = (CPUP_INFO_S *)(irqCpup);
CPUP_INFO_S *hwiCpup1s = (CPUP_INFO_S *)(hwiCpup10s + IRQ_CPUP_INFO_SIZE);
OsIrqCpupCB *irqData = (OsIrqCpupCB *)(irqCpup + IRQ_CPUP_ALL_INFO_SIZE);
(VOID)LOS_GetAllIrqCpuUsage(CPUP_IN_1S, hwiCpup1s);
(VOID)LOS_GetAllIrqCpuUsage(CPUP_IN_10S, hwiCpup10s);
PRINTK(" InterruptNo Count ATime(us) MTime(us) CPUUSE1s CPUUSE10s Name\n");
ShellCmdHwiInfoShow(irqData, hwiCpup1s, hwiCpup10s);
(VOID)LOS_MemFree(m_aucSysMem0, irqCpup);
return;
}
#else
STATIC VOID HwiInfoDump(VOID)
{
INT32 i;
PRINTK(" InterruptNo Count Name\n");
for (i = 0; i < LOSCFG_PLATFORM_HWI_LIMIT; i++) {
if ((OsGetHwiCreated(i) != TRUE) || (OsGetHwiFormCnt(i) == 0)) {
continue;
}
if (OsGetHwiFormName(i) != NULL) {
PRINTK(" %8d:%10d %-s\n", i - OS_SYS_VECTOR_CNT, OsGetHwiFormCnt(i), OsGetHwiFormName(i));
} else {
PRINTK(" %8d:%10d\n", i - OS_SYS_VECTOR_CNT, OsGetHwiFormCnt(i));
}
}
return;
}
#endif
UINT32 OsShellCmdHwiDump(INT32 argc, const CHAR **argv)
{
(VOID)argv;
if (argc > 1) {
PRINT_ERR("\nUsage:hwi\n");
return LOS_NOK;
}
HwiInfoDump();
return LOS_OK;
}
#endif /* LOSCFG_STACK_DUMP == 1 */

View File

@@ -0,0 +1,164 @@
/*
* 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)
STATIC BOOL g_startTrace = FALSE;
STATIC SchedTraceInfo *g_traceRingBuf = NULL;
STATIC UINT32 g_schedCount = 0;
STATIC SchedTraceRecordCB g_recordCB = NULL;
STATIC SchedTraceShowCB g_showCB = NULL;
STATIC VOID DefaultShowFormat(SchedTraceInfo *buf, UINT32 count)
{
INT32 i;
UINT32 cycle = count / TRACE_NUM;
UINT32 point = count % TRACE_NUM;
PRINTK ("sched %u time, last %u is:\r\n", count, TRACE_NUM);
PRINTK("RunTaskID RunTaskName NewTaskID NewTaskName \r\n");
if (cycle > 0) {
for (i = point; i < TRACE_NUM; i++) {
PRINTK("%4u %20s, %4u %20s\n",
g_traceRingBuf[i].runTaskID, g_traceRingBuf[i].runTaskName,
g_traceRingBuf[i].newTaskID, g_traceRingBuf[i].newTaskName);
}
}
for (i = 0; i < point; i++) {
PRINTK("%4u %20s, %4u %20s\n",
g_traceRingBuf[i].runTaskID, g_traceRingBuf[i].runTaskName,
g_traceRingBuf[i].newTaskID, g_traceRingBuf[i].newTaskName);
}
PRINTK("\r\n");
}
STATIC VOID DefaultRecordHandle(LosTaskCB *newTask, LosTaskCB *runTask)
{
UINT32 point = g_schedCount % TRACE_NUM;
g_traceRingBuf[point].newTaskID = newTask->taskID;
(VOID)memcpy_s(g_traceRingBuf[point].newTaskName, LOS_TASK_NAMELEN, newTask->taskName, LOS_TASK_NAMELEN);
g_traceRingBuf[point].runTaskID = runTask->taskID;
(VOID)memcpy_s(g_traceRingBuf[point].runTaskName, LOS_TASK_NAMELEN, runTask->taskName, LOS_TASK_NAMELEN);
g_schedCount++;
}
STATIC VOID ShowFormat(SchedTraceInfo *buf, UINT32 count)
{
if (count == 0) {
PRINT_ERR("none shed happened\n");
return;
}
if (g_showCB != NULL) {
g_showCB(buf, count);
}
}
VOID OsSchedTraceRecord(LosTaskCB *newTask, LosTaskCB *runTask)
{
if (g_startTrace == FALSE) {
return;
}
if (g_recordCB != NULL) {
g_recordCB(newTask, runTask);
}
}
VOID LOS_SchedTraceStart(VOID)
{
if (g_recordCB == NULL) {
g_recordCB = DefaultRecordHandle;
}
g_traceRingBuf = (SchedTraceInfo *)LOS_MemAlloc(OS_SYS_MEM_ADDR, TRACE_NUM * sizeof(SchedTraceInfo));
if (g_traceRingBuf == NULL) {
PRINT_ERR("alloc failed for dump\n");
return;
}
(VOID)memset_s(g_traceRingBuf, TRACE_NUM * sizeof(SchedTraceInfo), 0, TRACE_NUM * sizeof(SchedTraceInfo));
g_startTrace = TRUE;
}
VOID LOS_SchedTraceStop(VOID)
{
if (g_showCB == NULL) {
g_showCB = DefaultShowFormat;
}
g_startTrace = FALSE;
ShowFormat(g_traceRingBuf, g_schedCount);
g_schedCount = 0;
if (g_traceRingBuf != NULL) {
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, g_traceRingBuf);
g_traceRingBuf = NULL;
}
return;
}
VOID LOS_SchedTraceHandleRegister(SchedTraceRecordCB recordCB, SchedTraceShowCB showCB)
{
g_recordCB = recordCB;
g_showCB = showCB;
}
UINT32 OsShellCmdSchedTrace(INT32 argc, const CHAR **argv)
{
if (argc != 1) {
PRINT_ERR("\nUsage: st -h\n");
return LOS_NOK;
}
if (strcmp(argv[0], "-s") == 0) {
LOS_SchedTraceStart();
} else if (strcmp(argv[0], "-e") == 0) {
LOS_SchedTraceStop();
} else if (strcmp(argv[0], "-h") == 0) {
PRINTK("\nUsage: \nst -s , SchedTrace start\n");
PRINTK("st -e , SchedTrace end and show\n");
} else {
PRINTK("\nUsage: st -h\n");
return OS_ERROR;
}
return LOS_OK;
}
#endif /* LOSCFG_STACK_DUMP == 1 */

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:

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

@@ -134,7 +134,7 @@ typedef struct {
} SymInfo;
#define SYM_EXPORT(func) \
const SymInfo sym_##func __attribute__((section(".sym."#func))) = { \
const SymInfo sym_##func __attribute__((__used__, section(".sym."#func))) = { \
.name = #func, \
.addr = (UINTPTR)func \
};
@@ -149,7 +149,7 @@ const SymInfo sym_##func __attribute__((section(".sym."#func))) = { \
* then the shared library will be loaded to the heap by pool.
*
* @note When the heap, pool, is not NULL, you should call LOS_MemInit() to initialize the
* pool before calling LOS_SoLoad(). By the way, the system will comsume a certain amount
* pool before calling LOS_SoLoad(). By the way, the system will consume a certain amount
* of memory to initialize the pool. LOS_SoLoad must not be called in interrupt callback.
*
* @return Return NULL if error. Return non-NULL if success.
@@ -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

@@ -60,6 +60,6 @@ ${READELF} -l $1 | while read line; do
done
NEED_SIZE=`tail -n 1 ${TMP_FILE}`
echo "${NEED_SIZE} kb memory to reserve for $1!"
echo "${NEED_SIZE} bytes memory to reserve for $1!"
${RM} -f ${TMP_FILE}

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

File diff suppressed because it is too large Load Diff

View File

@@ -32,14 +32,7 @@
#ifndef _FATFS_H
#define _FATFS_H
#include "dirent.h"
#include "fatfs_conf.h"
#include "fcntl.h"
#include "fs_config.h"
#include "sys/mount.h"
#include "sys/stat.h"
#include "sys/statfs.h"
#include "unistd.h"
#include "ff.h"
#ifdef __cplusplus
#if __cplusplus
@@ -47,56 +40,7 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
int fatfs_mount(const char *source, const char *target,
const char *filesystemtype, unsigned long mountflags,
const void *data);
int fatfs_umount(const char *target);
int fatfs_umount2(const char *target, int flag);
int fatfs_open(const char *path, int oflag, ...);
int fatfs_close(int fd);
ssize_t fatfs_read(int fd, void *buf, size_t nbyte);
ssize_t fatfs_write(int fd, const void *buf, size_t nbyte);
off_t fatfs_lseek(int fd, off_t offset, int whence);
int fatfs_unlink(const char *path);
int fatfs_fstat(int fd, struct stat *buf);
int fatfs_stat(const char *path, struct stat *buf);
int fatfs_fsync(int fd);
int fatfs_mkdir(const char *path, mode_t mode);
DIR *fatfs_opendir(const char *dirName);
struct dirent *fatfs_readdir(DIR *dir);
int fatfs_closedir(DIR *dir);
int fatfs_rmdir(const char *path);
int fatfs_rename(const char *oldName, const char *newName);
int fatfs_statfs(const char *path, struct statfs *buf);
int fatfs_ftruncate(int fd, off_t length);
/**
* @brief divide a physical drive (SD card, U disk, and MMC card), this function is OHOS-specific
* @param pdrv physical drive number.
* @param partTbl list of partition size to create on the drive.
* -- item is <= 100: specifies the partition size in percentage of the entire drive space.
* -- item is > 100: specifies number of sectors.
* @return fdisk result
* @retval -1 fdisk error
* @retval 0 fdisk successful
*/
int fatfs_fdisk(int pdrv, const unsigned int *partTbl);
/**
* @brief format FAT device (SD card, U disk, and MMC card), this function is OHOS-specific
* @param dev device name.
* @param sectors sectors per cluster, can be 0 OR power of 2. The sector size for standard FAT volumes is 512 bytes.
* -- sector number is 0 OR >128: automatically choose the appropriate cluster size.
* -- sector number is 1 ~ 128: cluster size = sectors per cluster * 512B.
* @param option file system type.
* -- FMT_FAT
* -- FMT_FAT32
* -- FMT_ANY
* @return format result
* @retval -1 format error
* @retval 0 format successful
*/
int fatfs_format(const char *dev, int sectors, int option);
void FatFsInit(void);
#ifdef __cplusplus
#if __cplusplus

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