Professional Documents
Culture Documents
IP Camera SoC
AR
SN986 Series SDK 介绍&使用手册
T
Document No.:
ES
Version: v0.00
Revision Date Description
0.00 2014-05-30 Initial Version
N
Apply to
O
H
or
lf
tia
en
fid
on
C
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
1
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
Table of Contents
1 简介 ............................................................................................................................................ 3
1.1 基本介绍......................................................................................................................... 3
1.2 平台开发环境 ................................................................................................................. 3
1.2.1 主机系统 ............................................................................................................. 3
AR
1.2.2 Target Platform ................................................................................................. 4
1.3 SN986 Series SDK .......................................................................................................... 5
2 U-boot....................................................................................................................................... 11
T
2.1 U-boot 介绍 .................................................................................................................. 11
2.2 建立 U-boot ................................................................................................................. 11
ES
2.2.1 U-boot 配置 ....................................................................................................... 11
2.2.2 编译 U-boot ....................................................................................................... 11
2.3 U-boot 运行 ................................................................................................................. 11
N
2.3.1 U-boot 环境变量 .............................................................................................. 13
3 Linux 核心 ............................................................................................................................... 15
3.1
O
Linux 核心程序代码 .................................................................................................... 15
Linux 核心配置 ............................................................................................................ 15
H
3.2
3.3 编译 Linux 核心.......................................................................................................... 16
4 Root File System ....................................................................................................................... 17
or
5.1
5.2 开发自行模块 ............................................................................................................... 19
5.2.1 如何 build 自行开发模块 .................................................................................. 19
fid
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
2
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
1 简介
1.1 基本介绍
AR
由于嵌入式系统限制的资源,我们不会透过在嵌入式主板(EVB or Demo board)去开发撰写代
码和编译程序。开发编译执行程序环境是需要 PC 或 notebook(host) 和 platform。主机(host )
和平台(platform)(EVB)通常通过 UART 连接,同时也支持通过网络或 JTAG
T
(SN98610&SN98601)的连接,SN98600 不支持 JATG 但支持电视输出.
ES
1.2 平台开发环境
N
Tera Term),SN986 platform.我们藉由 Window 控制面板终端机去编译程序. 然后可以通过网络
(nfs) or SD 卡传递编译后的文件到平台.也能透过 Quake tool or SD 卡去更新整个韧体.若开发
者不想要对于 Linux 服务器设置一个单独的主机,我们也建议可以在 Window 的 PC 使用虚拟机
O
H
器.
or
1.2.1 主机系统
对于嵌入式主机系统所需的环境,如下所述:
lf
OS Fedora 18
Glibc-2.16-24.fc18.i686.rpm
on
Nss-softokn-freebl-3.14-5.fc18.i686.rpm
Zlib-1.2.7-9.fc18.i686.rpm
Linux server Perl 5.18.0
C
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
3
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
AR
Equipment Software Description
Boot Program U-boot, version: 2011.09
SONiX Linux distribution. The Linux kernel is
T
OS developed based on the standard Linux kernel
V2.6.35.12
ES
SN986 series platform
driver Video, audio, gpio…
N
Library uClibc-0.9.32
注意:
SN986Serial platform 的一些硬件要求: O
H
SN98601:
16MB/32MB onboard Serial Flash
or
SN98600 /98610:
16MB/32MB onboard Serial Flash or 128MB onboard NAND Flash
lf
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
4
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
Setting Value
Baud rate 115200bps
Data bit 8 bits
Parity check N/A
Stop bit 1
AR
Flow control N/A
以 Tera Term 为例设定如下
Port 部分需根据开发者环境选择 COMNumber
T
ES
N
O
H
or
lf
tia
Directory Description
fid
Directory Description
toolchain Directory for the repository of the cross compilation tools and image tools
bootloader Directory for the U-boot
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
5
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
AR
filesystem Directory for the repository of the Busybox & default file for file system
buildscript-sdk Directory for SONIX SDK configurations
image Directory for the images
T
board-info Directory for the board parameter (DDR, hw-setting..)
ES
N
O
H
or
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
6
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
T AR
ES
N
O
H
Platform
or
lf
tia
en
fid
on
C
DDR
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
7
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
T AR
ES
N
O
H
Sonix Driver
or
Wifi driver
lf
tia
en
fid
on
C
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
8
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
T AR
ES
N
O
H
Sensor driver
or
lf
tia
en
fid
on
C
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
9
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
T AR
ES
N
O
H
10. 调整所需的相关配置并储存(Save an Alternate Configuration File)
or
image
fid
on
C
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
10
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
2 U-boot
2.1 U-boot 介绍
AR
SN986 Serial SDK U-boot 开发基础是 U-boot-2011-09. U-Boot 的是一个运行在 Linux 内核启
动前的一个小程序. 嵌入式系统 U-boot 执行这些功能:
初始化硬件装置, 特别是内存控制器.
设置内存的 mapping
T
提供的参数(软件/硬件环境)给 Linux 内核。
ES
开始 OS linux
读取和写入任意内存位置
N
2.2 建立 U-boot
U-boot 配置
2.2.1
2.2.2 编译 U-boot
# make u-boot-2011-09
tia
# make bootimage
成功编译后,有应生成两个目标文件:
en
2.3 U-boot 运行
on
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
11
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
T AR
ES
比较常用的 U-boot 指令
Command Name Categories Description
显示特定命令的所有命令或详细的帮助信息列表.
N
help Information
句法: help [command …]
printenv Environment
显示环境变量
句法: printenv [name …]
O
H
设定变量
setenv Environment
句法: setenv name [value]
储存变量在 flash 中
or
saveenv Environment
句法: saveenv
执行 Memory 中的二进制代码,一个简单的跳转到指定地址
lf
执行 Memory 中的二进制代码
bootm Control 句法: bootm [ addr [ arg …] ]
en
注意:
tftp Download
透过网络下载程序,需要先设定好网络配置
C
ex
#> setenv ipaddr 192.168.1.2 /* set the IP address */
#> setenv netmask 255.255.255.0 /* set the subnet mask */
#> setenv serverip 192.168.1.1 /* set the server IP address */
#> tftp 0x01000000 uImage
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
12
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
复制一块内存数据到另一块内存中
句法: cp [.b, .w, .l] source target count
cp Memory
[.b, .w, .l]代表了查看和修改形式:byte、word、long
预设为 l
显示内存中位置的内容.
AR
句法: md [.b, .w, .l] address
md Memory
[.b, .w, .l]代表了查看和修改形式:byte、word、long
T
预设为 l
用指定的数据填充内存
ES
句法: mw[.b, .w, .l] address value [count]
Set the DDR2 size starting from address with the size of count to
N
mw Memory
value.
O
[.b, .w, .l]代表了查看和修改形式:byte、word、long
预设为 l.
H
比较两块内存区
句法: cmp[.b, .w, .l] addr1 addr2 count
or
刻录图像文件到 flash
tia
update Flash
句法: update addr
列出 mmc device 中可用的 partition
mmc part SD flash
en
读入 FAT 中的一个档案
fatload SD flash
句法: fatload mmc N addr file
on
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
13
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
AR
设定 gateway IP 位置
gatewayip
Syn 句法: setenv gatewayip XXX.XXX.XXX.XXX
设定 OS 开始起来的开机参数.
T
句法: setenv bootargs arg1=value1 arg2=value2 … argN=valueN
ES
bootargs ex:
setenv bootargs ‘console=ttyS0,115200 root=/dev/mtdblock2 init=/linuxrc
mem=64M’
设定 U-boot 自动开始模式跟执行的指令.
N
句法: setenv bootcmd cmd1; cmd2; … cmdN
bootcmd
Example:
O
setenv bootcmd ‘bootm 0x80040000’
H
设定 auto-boot delay 时间. 用户可以按任意键在延迟时间内切换到命令行模式.
bootdelay 单位是秒 second. 假如设为-1, auto-boot 将被关闭
句法: setenv bootdelay value
or
lf
tia
en
fid
on
C
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
14
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
3 Linux 核心
AR
Sonix SN986 Serial SDK 中 Linux 核心版本为 2.6.35.12 而且在 Sonix 平台上做了一些优化跟
修改.在 SN986 series SDK 中,核心码放在目录 kernel/linux-2.6.35.12/src 下.开发者可以去这
目录修改跟新增所需相关的应用.
T
3.2 Linux 核心配置
ES
SN986 Serial platform 预设的配置在被存放在“kernel/linux-2.6.35.12/src/arch/arm/configs”.
当在编译核心 image 文件时他将会被读取.
注意:
N
如果你不熟悉的内核和 SN986 Serial platform,不应去更改预设配置.
修改配置
储存配置后跳出
一般情况下,重新配置 Linux 内核的目的总结如下:
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
15
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
客制化电路板的功能。
客制化硬件设备:添加或删除特定的设备
客制化内核的功能:添加或删除一个内核功能,如 USB 支持
AR
3.3 编译 Linux 核心
T
#make kernelimage”
ES
File Path Description
KERNEL.bin /image Kernel image
uImage ./image Kernel uimage
N
O
H
or
lf
tia
en
fid
on
C
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
16
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
AR
Root file system 是构成 file system 的最小集合,它包含所有 Linux 开机时需要的档案及文
件夹,如 init.d 里的各项服务,/etc、/proc、/lib 等,而且位置全都是从根目录( / )开始,它
可以算是整个 filesystem 的源头。在嵌入式系统中, root filesystem 通常包含了能满足各种
基本使用的工具,如 ls 、 mount 等,之后如果需要额外的储存空间或档案则是再透过 mount
T
来把其他的储存装置挂载进来.
ES
Directory Description
bin Executable binary files of basic commands
root Root user directory, (/root/etc_default/: Sonix
N
platform default system configuration file)
etc System configuration files
lib
sbin
System libraries
Executable binary files O
H
tmp DDR storage space
or
SONiX SN986 series SDK 可以建立一个 root file system, 而且我们提供很多 BusyBox 功能.
en
4.2.2 BusyBox 配置
C
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
17
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
T AR
ES
N
新增或关闭相关 Utilities.
储存设定然后跳出(Save Configuration to an Alternate File)
O
H
设置 BusyBox 建立 root filesystem
or
4.2.3
编译 BusyBox
设置 BusyBox 到特定目录 snx_sdk/rootfs/
编译驱动模块,middleware.app(假如有修改)后移动到特定目录 snx_sdk/rootfs/
en
注意:
假如没有特别要求,SN986 SDK 配置的 rootfs 可以直接使用.若开发者自行开发相关的执行檔
(binary)和 library 要放到 root filesystem 内,则可先将档案放到 snx_sdk/rootfs/内相对应的
on
路径
ex: library -> /rootfs/lib/下
binary -> /root/user/bin/下
C
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
18
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
SONiX SN986 series SDK 提供了很多相模块包含了 application & middleware &device driver.
AR
当在” “buildscript-sdk”下,执行 make 时就会自动编译全部的相关 application & middleware &
驱动模块.当开发者若想要针对特定非 U-boot &Kernel 内的档案作修改编译时
我们提供了相关编译的方法
T
5.1 编译相关模块
ES
跟之前 U-boot or Kernel 一样需先知道 release 相对应模块名称
以 gpio middleware 为例,
若要执行 clean 动作,则指令如下
N
#make middleware_gpio-clean
若要编译指令为
#make middleware_gpio
当编译完成后可在编译 root filesytem,则修改过的 gpio middleware 档案则会被放在新的 O
H
ROOTFS-R.bin& rootfs-cramfs 内
5.2 开发自行模块
or
5.2.2 如何执行测试自行开发模块
fid
5.2.2.1 使用 nfs
on
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
19
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.
5.2.2.2 使用 SD 卡
AR
#cd /media/mmcblk1
#./test
T
ES
N
O
H
or
lf
tia
en
fid
on
C
本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
20