neptune操作系统代码启动流程 原创

鸿蒙开发
发布于 2021-9-9 10:15
浏览
1收藏

neptune开发板启动运行串口打印的原始log如下:
[09:44:52.097]收←◆entering kernel init…

[09:44:52.176]收←◆Begin to run the OHOS SYSTEM
start test task …Begin to run the user main

user task:20:35:09:May 14 2021
NVS operation failed, can’t retrieve the bonding info
hiview init success.00 00:00:00 0 132 D 0/HIVIEW: log limit init success.
00 00:00:00 0 132 I 1/SAMGR: Bootstrap core services(count:3).
00 00:00:00 0 132 I 1/SAMGR: Init service:0x817cd34 TaskPool:0x2003a6a4
00 00:00:00 0 132 I 1/SAMGR: Init service:0x817cf1b TaskPool:0x2003a6bc
00 00:00:00 0 132 I 1/SAMGR: Init service:0x817cf25 TaskPool:0x2003a6d4
00 00:00:00 0 84 I 1/SAMGR: Init service 0x817cf25 <time: 28ms> success!
00 00:00:00 0 252 I 1/SAMGR: Init service 0x817cf1b <time: 34ms> success!
00 00:00:00 0 164 I 1/SAMGR: Init service 0x817cd34 <time: 36ms> success!
00 00:00:00 0 164 I 1/SAMGR: Initialized all core system services!
00 00:00:00 0 252 I 1/SAMGR: Bootstrap system and application services(count:0).
00 00:00:00 0 252 I 1/SAMGR: Initialized all system and application services!
00 00:00:00 0 252 I 1/SAMGR: Bootstrap dynamic registered services(count:0).
通过查看wm800芯片文档,neptune中包括rom固件,板子上电后从rom开始执行,然后过渡到flash中得boot,然后在从boot跳转到os。
neptune操作系统代码启动流程-鸿蒙开发者社区
我们把生成的img文件写到flash中后,运行打印如下:
[09:45:05.249]收←◆Begin to run the OHOS SYSTEM
GpioIsr entry
Begin to run the user main

user task:11:17:57:Sep 8 2021
ble_npl_eventq_init:bigger queue 64

[09:45:05.285]收←◆ LED_OFF!
00 00:00:00 0 92 D 0/HIVIEW: hilog init success.
00 00:00:00 0 92 D 0/HIVIEW: log limit init success.
00 00:00:00 0 92 I 1/SAMGR: Bootstrap core services(count:3).
00 00:00:00 0 92 I 1/SAMGR: Init service:0x81775a3 TaskPool:0x200121f4
00 00:00:00 0 92 I 1/SAMGR: Init service:0x81775c5 TaskPool:0x20012864
00 00:00:00 0 92 I 1/SAMGR: Init service:0x8177739 TaskPool:0x20012a24
00 00:00:00 0 244 I 1/SAMGR: Init service 0x81775c5 <time: 26ms> success!
00 00:00:00 0 160 I 1/SAMGR: Init service 0x81775a3 <time: 36ms> success!
00 00:00:00 0 72 D 0/HIVIEW: hiview init success.
00 00:00:00 0 72 I 1/SAMGR: Init service 0x8177739 <time: 36ms> success!
00 00:00:00 0 72 I 1/SAMGR: Initialized all core system services!
00 00:00:00 0 160 I 1/SAMGR: Bootstrap system and application services(count:0).
00 00:00:00 0 160 I 1/SAMGR: Initialized all system and application services!
00 00:00:00 0 160 I 1/SAMGR: Bootstrap dynamic registered services(count:0).

[09:45:06.286]收←◆ LED_OFF!
代码工程和开发板初始的程序串口输出有点不一样,我们既然已经烧录了新代码,就按我们新代码分析启动吧。
最先运行的代码是startup.S,这是个汇编代码,是和处理器紧密相关的代码,其中一个跳转语句跳转到了c程序的main函数。
neptune操作系统代码启动流程-鸿蒙开发者社区
neptune操作系统代码启动流程-鸿蒙开发者社区
main函数在wm_main.c中实现,main函数初始化了好多东西后,创建了task_start任务并开始了任务调度。
neptune操作系统代码启动流程-鸿蒙开发者社区
neptune操作系统代码启动流程-鸿蒙开发者社区
task_start函数中可以看到了我们的打印输出字符串:
neptune操作系统代码启动流程-鸿蒙开发者社区
OHOS_SystemInit的位置如下:
neptune操作系统代码启动流程-鸿蒙开发者社区
然后进入UserMain函数并查看代码:
neptune操作系统代码启动流程-鸿蒙开发者社区
neptune操作系统代码启动流程-鸿蒙开发者社区
怎么样,看到了user task的输出和时间日期了吧,这篇介绍到这里,鸿蒙相关的任务代码后续会有文章分享。

©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
WM_W800_ROM功能简述_V1.0.pdf 743.98K 37次下载
WM_W800_SECBOOT功能简述_V1.0.pdf 379.51K 26次下载
已于2021-9-23 11:20:28修改
4
收藏 1
回复
举报
1条回复
按时间正序
/
按时间倒序
liangkz_梁开祝
liangkz_梁开祝

期待有更多的精彩内容分享~

回复
2021-9-9 10:28:42
回复
    相关推荐