liteos 从入门到放弃

摘要:
您需要在解压缩的开发包的根目录中输入“make”。make工具将根据当前Makefile设置统一编译。统一的编译结果将得到pub目录下的两个目录boot和tools。它们分别保存U引导映像和文件系统映像制作工具。统一编译生成的U-boot图像可以直接用于刻录到板上。文件系统映像工具可用于创建yaffs和jffs2文件系统的映像。有关具体用途,请参阅本文档中的4.2.3安装文件系统映像。

这两天收到一份sdk,hisi 3516cv200 liteos的sdk

正好手头有硬件,就随便编译玩玩.

解压sdk.

Hi3518E_SDK_V5.0.5.0

ll@ubuntu:~/work2016/liteos/Hi3518E_SDK_V5.0.5.0$ ls -lh
total 32K
drwxrwxr-x 4 ll ll 4.0K Oct 25 19:15 drv
drwxrwxr-x 8 ll ll 4.0K Oct 25 19:16 mpp
drwxrwxr-x 4 ll ll 4.0K Oct 25 19:16 osal
drwxrwxr-x 6 ll ll 4.0K Feb 27 09:54 osdrv
drwxrwxr-x 2 ll ll 4.0K Oct 25 19:16 package
drwxrwxr-x 2 ll ll 4.0K Oct 25 19:16 scripts
-rwxrwxr-x 1 ll ll  675 Oct 25 19:16 sdk.cleanup
-rwxrwxr-x 1 ll ll 2.2K Oct 25 19:16 sdk.unpack

和其他版本sdk也没什么区别.

1.安装交叉编译工具

交叉工具在osdrv/toolchain 和以前版本没有区别,

ll@ubuntu:~/work2016/liteos/Hi3518E_SDK_V5.0.5.0/osdrv/toolchain$ ls -lh
total 273M
-rwxrwxr-x 1 ll ll 1.9K Oct 25 19:16 arm-hisiv500-linux.install
-rw-rw-r-- 1 ll ll 273M Oct 25 19:16 arm-hisiv500-linux.tar.bz2

2.目录结构和以前sdk版本没有区别,唯一的区别就多了一个liteos 目录,这个目录就是liteos 内核所在目录

ll@ubuntu:~/work2016/liteos/Hi3518E_SDK_V5.0.5.0/osdrv/opensource$ ls -lh
total 8.0K
drwxrwxr-x 3 ll ll 4.0K Feb 27 09:56 liteos
drwxrwxr-x 3 ll ll 4.0K Feb 27 09:54 u-boot

3.编译整个系统,具体的请参考01.softwareoarddocument_cnHi35xx Huawei LiteOS开发环境用户指南.pdf 这个文档

统一编译。用户需要在开发包解压根目录下输入:“ make”。 make 工具将会根据当
Makefile 设置编译进行统一编译,统一编译结果将在 pub 目录下得到两个目录
boot tools。两者分别保存 U-boot 镜像与文件系统镜像制作工具。由统一编译
生成的 U-boot 镜像可直接用于烧写到单板,文件系统镜像工具可用于制作 yaffs
jffs2 文件系统镜像,具体使用可参考本文档 4.2.3 挂载文件系统镜像

因为makefile都配置好了,直接make就可以了..编译整个sdk相当快,因为liteos是假开源,都是给的.a文件.都没有源代码...

4.编译boot,这个有其他sdk版本uboot没区别.可以共用.

5.编译sample.liteos 版本和linux版本的mpp基本一样,还有流程都没区别...我这儿编个venc玩玩.

ll@ubuntu:~/work2016/liteos/Hi3518E_SDK_V5.0.5.0/mpp/sample/venc$ ls -lh
total 12M
-rw-rw-r-- 1 ll ll  173 Oct 25 19:16 Makefile
-rwxrwxr-x 1 ll ll 4.3M Feb 27 14:16 sample_venc
-rwxrwxr-x 1 ll ll 3.5M Feb 27 14:16 sample_venc.bin
-rw-rw-r-- 1 ll ll  47K Oct 25 19:16 sample_venc.c
-rw-rw-r-- 1 ll ll 3.7M Feb 27 14:16 sample_venc.map
-rw-rw-r-- 1 ll ll  40K Feb 27 14:16 sample_venc.o
sample_venc.bin 就是编译出来的程序,有4.3M,这个程序可以理解为linux的kernel+rootfs+venc所有的功能..uboot起来后直接加载这个玩意就可以跑venc这个app了.

6.烧写uboot.直接用hiburn工具搞进去.uboot sdk下已经自带了.也可以自己编译,编译流程和以前版本sdk基本没区别.

7.烧写sample_venc.bin 可以用网络,因为我这没有以太网接口,也只能用hiburn+com,烧写在1M开始的地方.
8.修改bootargs.
hisilicon # printenv 
bootargs=mem=160M console=ttyAMA0,115200 root=/dev/mtdblock3 rootfstype=jffs2 mtdparts=hi_sfc:1M(boot),2688K(kernel),384K(cfg),12M(rootfs)
bootdelay=1
baudrate=115200
ethaddr=00:00:23:34:45:66
ipaddr=192.168.1.10
serverip=192.168.1.2
netmask=255.255.255.0
bootfile="uImage"
bootcmd=sf probe 0;sf read 0x80008000 0x100000 0x700000;go 0x80008000
stdin=serial
stdout=serial
stderr=serial
verify=n
ver=U-Boot 2010.06 (Oct 25 2016 - 19:13:43)

Environment size: 438/262140 bytes

和linux也没啥差别

bootcmd=sf probe 0;sf read 0x80008000 0x100000 0x700000;go 0x80008000

spi flash 如下

setenv bootcmd 'sf probe 0;sf read 80008000 0x100000 0x700000;go 80008000'
saveenv

这行是关键行,因为我的sample_venc.bin 烧写在1M的地址~go 80008000这个写死的,因为liteos提供的是.a,所以你没没法修改了....

9.保存bootargs 系统就可以起来了.起来log如下.

System startup


U-Boot 2010.06 (Oct 25 2016 - 19:13:43)

Check Flash Memory Controller v100 ... Found
SPI Nor(cs 0) ID: 0xc2 0x20 0x18
Block:64KB Chip:16MB Name:"MX25L128XX"
SPI Nor total size: 16MB
MMC:   
EMMC/MMC/SD controller initialization.
Card did not respond to voltage select!
No EMMC/MMC/SD device found !
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0 
16384 KiB hi_fmc at 0:0 is now current device

## Starting application at 0x80008000 ...
********hello Huawei LiteOS ARM926********

version : Huawei LiteOS V100R002C00SPC001B011
open-version : Huawei LiteOS 1.2.2
build data : Feb 27 2017 09:56:29

**********************************
osAppInit
os vfs init ...
Mount procfs finished.
uart init ...
shell init ...

Huawei LiteOS # spi nor flash init ...
Spi Nor ID:0xC2 0x20 0x18 0xC2 0x20 0x18 0xC2 0x20 
Spi Nor Flash Info:
Name:"MX25L128XX" Size:16MB Block:64KB
<5>Inode #2 was a directory with children - removing those too...
<5>Inode #5 was a directory with children - removing those too...
<5>Inode #6 was a directory with children - removing those too...
<5>Inode #8 was a directory with children - removing those too...
<5>Inode #9 was a directory with children - removing those too...
<5>Inode #139 was a directory with children - removing those too...
<5>Inode #14 was a directory with children - removing those too...
<5>Inode #143 was a directory with children - removing those too...
<5>Inode #18 was a directory with children - removing those too...
<5>Inode #19 was a directory with children - removing those too...
<5>Inode #23 was a directory with children - removing those too...
<5>Inode #151 was a directory with children - removing those too...
<5>Inode #24 was a directory with children - removing those too...
<5>Inode #152 was a directory with children - removing those too...
<5>Inode #153 was a directory with children - removing those too...
<5>Inode #163 was a directory with children - removing those too...
<5>Inode #177 was a directory with children - removing those too...
<5>Inode #589 was a directory with children - removing those too...
<5>Inode #594 was a directory with children - removing those too...
<5>Inode #227 was a directory with children - removing those too...
<5>Inode #363 was a directory with children - removing those too...
<5>Inode #365 was a directory with children - removing those too...
<5>Inode #366 was a directory with children - removing those too...
<5>Inode #367 was a directory with children - removing those too...
<5>Inode #368 was a directory with children - removing those too...
<5>Inode #587 was a directory with children - removing those too...
<5>Inode #546 was a directory with children - removing those too...
spi bus init ...
i2c bus init ...
gpio init ...
dmac init
random init ...
net init ...

Calling lwIPRegSecSspCbk
enter hisi_eth_init!

hisi_eth init begin.
hisi_eth: User did not set phy mode, use default=rmii
hisi_eth: User did not set phy addr, auto scan...
Can't find PHY device - id: ffffffff
cmd_startnetwork : DHCP_BOUND finished
usb init ...

******** usb_init in **********
usb v2.10 2016-09-18 10:28
usb 0 ~+ 256 KB
*** usb init memory error!! ***

sd/mmc host init ...

********mmc host init ! ********
Now shell working dir is :/
g_sys_mem_addr_end=0x82000000,
done init!
Date:Feb 27 2017.
Time:14:16:10.
<6>Hisilicon Media Memory Zone Manager
load sys.ko for Hi3518EV200...OK!
load tde.ko ...OK!
load region.ko for Hi3518EV200...OK!
load vgs.ko for Hi3518EV200...OK!
load viu.ko for Hi3518EV200...OK!

 Do not support tasklet. 
ISP Mod init!
load vpss.ko for Hi3518EV200...OK!
load vou.ko for Hi3518EV200...OK!
Load hifb.ko OK!
load rc.ko for Hi3518EV200...OK!
load venc.ko for Hi3518EV200...OK!
load chnl.ko for Hi3518EV200...OK!
load h264e.ko for Hi3518EV200...OK!
load jpege.ko for Hi3518EV200...OK!
Load hi_cipher.ko success. mipi_init
init phy power successful!
load hi_mipi driver successful!
acodec [acodec_device_init ,1091]: misc addr:0x20120000, acodec addr:0x201200c4

acodec [acodec_device_init ,1107]: crg addr:0x20030000, acodec crg addr:0x2003008c

load ive.ko for Hi3518EV200...OK!
SDK init ok...

Huawei LiteOS # 

系统起来相当快,大概3秒的样子吧。所有的都加载完成了..回车可以输入命令.

支持的命令主要有下面这些.不能tab补全,像我这样拼音不太好的,输一条目录好苦逼.

Huawei LiteOS # help
*******************shell commands:*************************

arp           call          cat           cat_logmpp    cd            cp            cpup          dns           
findsym       format        free          help          himd          himm          hwi           i2c_read      
i2c_write     ifconfig      lddrop        ldinit        ls            mclose        memcheck      mkdir         
mopen         mount         nand_bad      netstat       ntpdate       partition     ping          pwd           
readreg       reset         rm            rmdir         sample        sem           ssp_read      ssp_write     
statfs        swtmr         sync          systeminfo    task          telnet        tftp          touch         
uart_close    uart_config   uart_read     uart_write    umount        uname         writeproc     writereg      

10.执行sample,直接在shell里面输入sample 会车,就会跑venc这个app了.

因为代码里面sample 注册了一个shell的回调函数.这个地方我也琢磨了下代码,才明白怎么运行sample.大致代码如下

liteos 从入门到放弃第1张liteos 从入门到放弃第2张
void app_sample(int argc, char **argv )
{
    int i = 0, ret = 0;
    int len = 0;
    char *pch = NULL;
    TSK_INIT_PARAM_S stappTask;

    if(argc < 1) {
        dprintf("illegal parameter!
");
    }

    if (taskid != -1) {
        dprintf("There's a app_main task existed.");
    }
    args_buf_t = zalloc(ARG_BUF_LEN_T);
    memset(&stappTask, 0, sizeof(TSK_INIT_PARAM_S));
    pch = args_buf_t;
    for(i=0; i<ARGS_SIZE_T; i++) {
        ptask_args[i] = NULL;
    }
    argc++;
    ptask_args[0] = "app_sample";

    for(i = 1; i < argc; i++)
    {
        len =  strlen(argv[i-1]);
        memcpy(pch , argv[i-1], len);
        ptask_args[i] = pch;
        //keep a '

免责声明:内容来源于网络,仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇802.11 (b/g/a/n/ac) (2017.7.15更新)[转载]JS拖动技术 关于setCapture下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

迅为龙芯2K1000开发板Linux工具之make工具和Makefile文件

在编译程序hello world的时候我们是直接使用gcc命令进行编译的。我们编译一个程序是非常的简单的, 直接输入 gcc 然后跟上程序的名称再跟上指定生成程序的名称, 就可以很轻松的编译出可执行文件。但是大家有没有想过,如果要编译一个工程,这个工程里面有很多的源文件, 这时候我们全部使用这个命令来编译那就非常的麻烦了。为了解决编译一个工程非常繁琐这个问...

汇编语言程序入门实验二:在dos下建立子目录操作

汇编语言程序入门实验二:在dos下建立子目录操作 1,背景     在读此文,并读懂前,建议读者先阅读这两篇博客 1,在dos环境下汇编语言程序设计入门(输出hello world)和masm32的下载、安装与使用。详情请见链接:http://blog.csdn.net/u010043538/article/details/12720447。 2,汇编语言...

转发 GSLB概要和实现原理

What is GSLB Global Server Load Balancing 中文:全局负载均衡 SLB(Server load balancing)是对集群内物理主机的负载均衡,而GSLB是对物理集群的负载均衡。这里的负载均衡可能不只是简单的流量均匀分配,而是会根据策略的不同实现不同场景的应用交付。 GSLB是依赖于用户和实际部署环境的互联网资源...

Debian下编译安装MPlayer

Debian下编译安装MPlayer MPlayer是Linux下一款优秀的媒体播放软件,然而在我的Debian系统下却一直没有用起来。说起其中的原因,一是因为如果使用Apt来查找安装,那么所安装上的是非GUI下的MPlayer程序,其实要论起来,这样的程序也是一样可以播放媒体文件,然而就个人的使用来看,如果只是播放一些MP3文件,那么还是相当不错的,...

GCC编译之后的代码信息

arm-none-eabi-gcc编译之后会显示一些信息,比如 下面就来说受每个字段的含义以及它们与bin文件大小的关系。text区是代码区,就是程序编译之后源码的区域,在烧录之后一直位于Flash ROM中。 data和bss都是指的全局变量以及函数内static的变量,区别是data是有初始值的而bss没有。data的初始值同样存在Rom里,当单片机启...

制作C/C++动态链接库(dll)若干注意事项

一、CC++ 运行时库编译选项简单说明 问题:我的dll别人没法用 运行时库是个很复杂的东西,作为开发过程中dll制作需要了解的一部分,这里主要简单介绍一下如何选择编译选项。 在我们的开发过程中时常会遇到这样的问题: 1. 我的VS版本比较高(比如:VS2012),我想制作一个dll,封装了几个函数给别人用。 2. 打包后发现我的dll引用了msvcr1...