1. 前言
全志平台默认的SDK系统启动+相机出图的时间较长,普遍是十几秒,使用体验较差; 这里尝试通过一些方法优化整体启动时间
2.统计内核耗时模块
打开这个宏initial_debug,每个驱动的初始化起始时间和结束时间都打印出来了。有了这个时间,基本就可以确定哪些部分需要优化了。 我的做法是只关注耗时10000us以上的驱动。
根据上面统计,可根据使用场景的需求, 尝试可以关闭相应不需要的模块
3. 降低打印等级
开发过程中往往会把系统的打印等级设置为最高,而实际上发布出的固件是不需要这么的打印等级的,可以修改 lichee\tools\pack\chips\sun8iw11p1\configs\default\env_nor.cf文件中的loglevel减少打印等级到4. (时间明显减少)
4. 修改printk
尽量去掉printk对时间测量的影响,可以调整kernel/printk.c中的DEFAULT_CONSOLE_LOGLEVEL宏,把级别较低的信息去掉改成5之后, 【没什么明显减少时间】