HI3516备份Flash

(dd if=/dev/mtd0; dd if=/dev/mtd1; dd if=/dev/mtd2; dd if=/dev/mtd3; dd if=/dev/mtd4; dd if=/dev/mtd5) > /mnt/sd/hisi_flash.bin

(dd if=/dev/mtd0; dd if=/dev/mtd1; dd if=/dev/mtd2) > /mnt/sd/hisi_flash.bin

(dd if=/dev/mtd0; dd if=/dev/mtd1; dd if=/dev/mtd2) > /mnt/nfs/hisi_flash.binRelated: sarpy county assessor gis property search, snejana jens before surgery, what happens if a teacher gets a dui, cochise steele burrows, atlantic mills grand rapids, mi, marie from cartel crew goes to jail, dandy nicholls cause of death, bertha rogers well, list of doctors at etobicoke medical centre, edsby regina public schools, lab day 6: solubility behavior of various organic compounds, stouffer’s meatloaf copycat recipe, town of wells maine new building permits, marie and bruce monologue, ultraviolet node replit,Related: describe two features of stretcher bearers, security forces brevity codes, mercedes benz gear shifter 2021, jump around royalties, tweaked apps without verification, rp33 sonar manual pdf, pierre edwards parents, land of confusion drinking game, dog friendly walks glasshouse mountains, is bo hopkins related to anthony hopkins, , manger avec un ami murphy harry potter, pete beale yamaha, viral video of man jumping off roof, why did charlotte tilbury discontinue magic foundation,Related: who played grady in catch and release, soundcloud image resizer, toothpaste face mask benefits, journal entry for purchasing equipment with note payable, james sterling shawn williams, scott corrigan name change, atlantic, iowa funeral announcements, does ammonia repel snakes, cfs relapse after covid vaccine, earhart expressway ambush, traditional mexican furniture manufacturers in guadalajara mexico, david wilson homes upgrade packages, protected birds in tennessee, guilford county elections 2022, coriolanus snow family tree,Related: how old was queen esther when she died, midheaven in pisces 10th house, why can’t i find rold gold pretzel rods, venezuela crime rate by year, silly podcast names, jackson public schools job application, 4 bedroom house for rent in lewistown, pa, figwort magical properties, how to make maple syrup candle, craig gibson folbigg now, stocks with weekly options under $20, chuck yeager death covid, how to fix dried out magnetic eyeliner, music education conferences 2022, syracuse, ny obituaries this past week,Related: is gabapentin a controlled substance in oregon, old celebrities still alive 2022, how long do elf bars take to charge, cid warrant officer requirements, brannon family murders, abandoned places in medford oregon, harris wedding hashtag, abigail morgan sellers barnett, has anyone received a 4464c letter, are william and harold castro brothers, brian peters obituary nahant, mobile homes for rent wilson county, nc, legend of legaia gameshark codes quick level up, sol pelicanos email address, daryl ann denner net worth,Related: culture bound crime examples, signos que dominan a otros signos, may allah protect us in arabic, list of ofac general licenses, charles sebastian houseman, is sophie ecclestone related to bernie, miss truth ending explained, leonard lake and charles ng videos, spiritual jobs remote, ludwig and qtcinderella, france sworn statement covid, river trails school district 26 salary schedule, what size shed requires a permit in florida, data togel taiwan sahabat4d, dad when are you coming back with the milk it’s been 4 months text,Related: chase hudson girlfriend, barnett funeral home obits, jess harnell wife age, all the light we cannot see ending explained, does valdosta state accept florida bright futures, oceanside unified school district superintendent, north yorkshire coroners inquests, mmo champion guild recruitment, how to use smoker on dcs grill, ruston high school football state championships, prolific prep basketball players, hardy williams obituary, madison county dump jackson, tn, snap jacket piling for sale, duggar grandchildren in heaven,

交叉编译NTP

下载源代码
wget https://www.eecis.udel.edu/\~ntp/ntp_spool//ntp4/ntp-4.2/ntp-4.2.8p15.tar.gz

配置静态编译
./configure –prefix=/media/server_disk/nfs/ntp/output –host=arm-linux-gnueabi CC=arm-himix200-linux-gcc –enable-static –with-yielding-select=no –with-openssl-incdir=/home/leon/Workspace/opensshd/output/include/openssl –with-openssl-libdir=/home/leon/Workspace/opensshd/output/lib

make

make install

在output/bin文件夹找到ntpdate文件,拷贝到目标板,

首先确定目标板可正常联网,比如ping baidu.com可以ping通,然后

执行:ntpdate stdtime.gov.hk
或者:ntpdate time.nist.gov
成功获取时间
Dec 02:14:43 ntpdate[910]: adjust time server 223.255.185.2 offset -0.001138 sec
使用date命令检查系统时间,发现时区不对

从别的机器上拷贝/usr/localtime 文件到目标板
再运行 date -R查看:
Thu, 03 Dec 2020 10:34:48 +0800

大功造成

Makefile

cc = arm-himix200-linux-gcc
prom = psdk_com
deps = $(shell find ./ -name “*.h”)
src = $(shell find ./ -name “*.c”)
obj = $(src:%.c=%.o)

root_dir = $(shell pwd)

ccflags = -lpthread -I$(root_dir)

$(prom): $(obj)
$(cc) $(ccflags) -o $(prom) $(obj)

%.o: %.c $(deps)
$(cc) $(ccflags) -c $< -o $@ clean: rm -rf $(obj) $(prom)

串口文件传输协议

所有数据以小端模式传输,字符串为UTF8编码

报文格式定义
命令 长度 数据 校验
uint8 uint8 uint16 uint8[] uint16
0xAA 见命令定义 后面数据段的长度0~65535 数据内容,字节数组 标准modbusCRC16校验
基础命令定义
命令名称 命令值 数据内容 数据长度 响应命令 响应内容 响应长度 备注
握手 0x01 0xAA 0xBB 0xCC 0xDD 固定长度4 0x81 0xAA 0xBB 0xCC 0xDD 固定长度4
时间同步 0x10 unix时间戳(uint32) 固定长度4 0x90 成功返回1,失败返回0(uint8) 固定长度1 此命令一般由主机每秒发一次,可以回复,也可以不回复
文件命令定义
命令名称 命令值 数据内容 数据长度 响应命令 响应内容 响应长度 备注
打开文件 0x02 完整的文件路径,字符串形式 字符串长度 0x82 文件描述符,sint32,<0表示打开失败 固定长度4 以读写方式打开文件,文件不存在则返回-1
读取文件 0x03 文件描述符(sint32)+读取位置(uint32)+读取数据最大长度(uint16) 固定长度10 0x83 实际数据长度(uint16)+数据内容 2+数据长度
创建文件 0x04 完整的文件路径,字符串形式 字符串长度 0x84 文件描述符,sint32,<0表示创建失败 固定长度4 文件存在则以读方式直接打开,不存在则创建
写入文件 0x05 文件描述符(sint32)+写入数据长度(uint16)+写入数据 6+数据长度 0x85 实际写入数据长度(uint16) 固定长度2 以追加方式写入
删除文件 0x06 完整的文件路径,字符串形式 字符串长度 0x86 uint8,1代表成功,0代表失败 固定长度1
关闭文件 0x07 文件描述符(sint32) 固定长度4 0x87 uint8,1代表成功,0代表失败 固定长度1
获取文件信息 0x08 完整的文件路径,字符串形式 字符串长度 0x88 文件是否可用(uint8)+文件大小(uint32)+创建时间戳(uint32)+修改时间戳(uint32) 固定长度13 如果文件不可用,则其他信息无效
控制命令定义
命令名称 命令值 数据内容 数据长度 响应命令 响应内容 响应长度 备注
通道触发指令 0x11 通道(uint8)+触发序号(uint32),每位代表一个通道 固定长度1 0x91 返回(uint8),成功相应通道置1,失败为置0 固定长度1 此命令必须回复,执行失败则主机会重发
反馈事件上报 0x12 事件个数(uint8)+[触发序号(uint32)+反馈通道(uint8)+反馈时间(uint32)] 1+事件个数*5 0x92 成功返回1,失败返回0(uint8) 固定长度1 此命令必须回复,执行失败需要重发
云台控制 0x13 待定 待定 0x93 待定 待定 此命令必须回复,执行失败需要重发

linux nfs

服务端:
安装
sudo apt-get install nfs-kernel-server # 安装 NFS服务器端
sudo apt-get install nfs-common # 安装 NFS客户端

修改
sudo vim /etc/exports
如下:
/media/server_disk/nfs *(rw,sync,no_root_squash,no_subtree_check)

客户端:
mount -t nfs 192.168.8.200:/media/server_disk/nfs /mnt/nfs

由于ubuntu上mount -tcifs 必须使用sudo,挂载后目录属于root,其他用户无写入权限
可以挂载指定用户来解决:
sudo mount -t cifs //192.168.8.200/OfficeServer ./OfficeServer -o username=leon,password=123456,uid=1000,gid=1000

HI3516EV300 开启串口1和串口2

参考:https://blog.csdn.net/sbddbfm/article/details/100883650
SDK默认只打开了uart0,但我实际上要用三个串口。
ls /dev/ttyAMA*可以看到:
/dev/ttyAMA0 /dev/ttyAMA1
看实际只有ttyAMA0可以用,也就是上电默认的终端
使用echo测试:
~ # echo 123 > /dev/ttyAMA0
123

~ # echo 123 > /dev/ttyAMA1
can not create file:/dev/ttyAMA1

首先看内核配置文件arch/arm/boot/dts/hi3516ev300.dtsi:
uart0: uart@12040000 {
compatible = “arm,pl011”, “arm,primecell”;
reg = <0x12040000 0x1000>;
interrupts = <0 7 4>;
clocks = <&clock HI3516EV300_UART0_CLK>;
clock-names = “apb_pclk”;
status = “disabled”;
};

uart1: uart@12041000 {
compatible = “arm,pl011”, “arm,primecell”;
reg = <0x12041000 0x1000>;
interrupts = <0 8 4>;
clocks = <&clock HI3516EV300_UART1_CLK>;
clock-names = “apb_pclk”;
status = “disabled”;
};

uart2: uart@12042000 {
compatible = “arm,pl011”, “arm,primecell”;
reg = <0x12042000 0x1000>;
interrupts = <0 9 4>;
clocks = <&clock HI3516EV300_UART2_CLK>;
clock-names = “apb_pclk”;
status = “disabled”;
};
可见是有个串口的,但都是disable的状态,其实起作用的是另一个文件: arch/arm/boot/dts/hi3516ev300-demb.dts:
&uart0 {
status = “okay”;
};
所以再copy两份就可以了,在下面添加:
&uart1 {
status = “okay”;
};
&uart2 {
status = “okay”;
};
重新编译内核,下载到目标板,启动后ls /dev/ttyAMA*可以看到:
/dev/ttyAMA0 /dev/ttyAMA1 /dev/ttyAMA2
echo测试都可以成功,但与实际串口相连的设备没有收到数据,查资料得知,还得配置引脚复用寄存器。

使用hisi工具btools,具体使用方法可参考另一文章:

我的板子串口发送接在E1脚
查文档如下:

默认值为0x1E00,应该修改为0x1E04
使用himd.l读取寄存器的值:
~ # himd.l 0x120C0014
*** Board tools : ver0.0.1_20121120 ***
[debug]: {source/utils/cmdshell.c:168}cmdstr:himd.l
====dump memory 0x120C0014====
0000: 00001e00 00001d00 00001400 00001d00
0010: 00000000 00000000 00000000 00000000
0020: 00000000 00000000 00000000 00000000
0030: 00000000 00000000 00000000 00000000
0040: 00000000 00000000 00000000 00000000
0050: 00000000 00000000 00000000 00000000
0060: 00000000 00000000 00000000 00000000
0070: 00000000 00000000 00000000 00000000
0080: 00000000 00000000 00000000 00000000
0090: 00000000 00000000 00000000 00000000
00a0: 00000000 00000000 00000000 00000000
00b0: 00000000 00000000 00000000 00000000
00c0: 00000000 00000000 00000000 00000000
00d0: 00000000 00000000 00000000 00000000
00e0: 00000000 00000000 00000000 00000000
00f0: 00000000 00000000 00000000 00000000
[END]
寄存器的值还是默认值,修改它:
~ # himm 0x120C0014 0x00001e04
*** Board tools : ver0.0.1_20121120 ***
[debug]: {source/utils/cmdshell.c:168}cmdstr:himm
0x120C0014: 0x00001E00 –> 0x00001E04
[END]

再次echo测试:
~ # echo 123 > /dev/ttyAMA2
不成功,为什么呢?收发接反了!!!再次尝试,乱码,波特率不对,初始波特率是9600

UART1&UART2引脚复用寄存器
信号 UART1_TXD UART1_RXD UART2_TXD UART2_RXD
引脚 F17 F16 E1 D2
寄存器地址 0x100C000C 0x100C0010 0x120C0014 0x120C0010
寄存器初始值 0x1000 0x1000 0x1E00 0x1E00
寄存器设定值 0x1002 0x1002 0x1E04 0x1E04

hisi btools

1、编译
进入Hi3516EV200_SDK_V1.0.0.2/osdrv/tools/board/reg-tools-1.0.0
修改Makefile中的目标芯片的目标编译器,我的是3516EV300,对应编译器是himix200
ifndef CHIP
CHIP = hi3516ev300
endif

ifndef OSDRV_CROSS
OSDRV_CROSS ?= arm-himix200-linux
endif
保存直接make即可在bin文件夹下生成btools文件和几个软件连接
2、拷贝
把生成的btools文件拷贝到目标板,我放在sbin目录下了
3、软连接
以下是手工生成,太笨了,搞完才发现,可以自动
~ # ln -s /sbin/btools /sbin/himc
~ # ln -s /sbin/btools /sbin/himd
~ # ln -s /sbin/btools /sbin/himd.l
~ # ln -s /sbin/btools /sbin/himm
~ # ln -s /sbin/btools /sbin/hivd
~ # ln -s /sbin/btools /sbin/himdb
~ # ln -s /sbin/btools /sbin/hiddrs
~ # ln -s /sbin/btools /sbin/i2c_read
~ # ln -s /sbin/btools /sbin/i2c_write
~ # ln -s /sbin/btools /sbin/ssp_read
~ # ln -s /sbin/btools /sbin/ssp_write
自动生成命令:
进入/sbin目录,执行:btools -i
4、使用
himc : memory clear
himd : memory display (8bit)
himd.l : memory display (32bit)
himm : memory modify
hivd : video dump
himdb : video dump
hiddrs : ddr statistic
i2c_read : i2c device read
i2c_write : i2c device read
ssp_read : ssp device read
ssp_write : ssp device read

以下是修改E1引脚的复用功能为UART2_TXD
himd.l 0x120C0014
*** Board tools : ver0.0.1_20121120 ***
[debug]: {source/utils/cmdshell.c:168}cmdstr:himd.l
====dump memory 0x120C0014====
0000: 00001e00 00001d00 00001400 00001d00
0010: 00000000 00000000 00000000 00000000
0020: 00000000 00000000 00000000 00000000
0030: 00000000 00000000 00000000 00000000
0040: 00000000 00000000 00000000 00000000
0050: 00000000 00000000 00000000 00000000
0060: 00000000 00000000 00000000 00000000
0070: 00000000 00000000 00000000 00000000
0080: 00000000 00000000 00000000 00000000
0090: 00000000 00000000 00000000 00000000
00a0: 00000000 00000000 00000000 00000000
00b0: 00000000 00000000 00000000 00000000
00c0: 00000000 00000000 00000000 00000000
00d0: 00000000 00000000 00000000 00000000
00e0: 00000000 00000000 00000000 00000000
00f0: 00000000 00000000 00000000 00000000
[END]

himm 0x120C0014 0x00001e04
*** Board tools : ver0.0.1_20121120 ***
[debug]: {source/utils/cmdshell.c:168}cmdstr:himm
0x120C0014: 0x00001E00 –> 0x00001E04
[END]

HI3516EV300编译环境搭建(三)

单独编译U-boot
注意:发布包默认按照DMEB板的配置发布,如果客户单板和DEMB板不一致,需要根据客户自己的单板环境修改uboot表格才能使用,否则可能导致uboot无法启动或者其他问题。

待进入boot源代码目录后,执行以下操作
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- hi3516ev300_defconfig
(emmc启动时执行如下操作:make ARCH=arm CROSS_COMPILE=arm-himix200-linux- hi3516ev300_emmc_defconfig)

make ARCH=arm CROSS_COMPILE=arm-himix100-linux- -j 20

make -C ../../../tools/pc/hi_gzip

cp ../../../tools/pc/hi_gzip/bin/gzip arch/arm/cpu/armv7/hi3516ev200/hw_compressed/ -rf

Windowns下进入到osdrv/tools/pc/uboot_tools/目录下打开对应单板的Excel文件,在main标签中点击”Generate reg bin file”按钮,生成reg_info.bin即为对应平台的表格文件。
从osdrv/tools/pc/uboot_tools目录拷贝reg_info.bin到boot源代码目录,重命名为.reg
cp ../../../tools/pc/uboot_tools/reg_info.bin .reg

make ARCH=arm CROSS_COMPILE=arm-himix200-linux- u-boot-z.bin

opensource/uboot/u-boot-2016.11下生成的u-boot-hi3516ev300.bin即为可用的u-boot镜像

HI3516EV300编译环境搭建(四)

单独编译内核

本文档简要说明将内核的补丁打到v4.9.37的linux kernel上。

1、从linux开源社区下载v4.9.37版本的内核:
1)进入网站:www.kernel.org
2)选择HTTP协议资源的https://www.kernel.org/pub/选项,进入子页面
3)选择linux/菜单项,进入子页面
4)选择kernel/菜单项,进入子页面
5)选择v4.x/菜单项,进入子页面
6)下载linux-4.9.37.tar.gz(或linux-4.9.37.tar.xz)

2、打补丁
1)将下载的 linux-4.9.37.tar.gz 存放到 osdrv的opensource/kernel目录中
2)在linux服务器中进入 osdrv 的根目录,执行如下命令:
cd opensource/kernel
tar -zxf linux-4.9.37.tar.gz
mv linux-4.9.37 linux-4.9.y
cd linux-4.9.y
patch -p1 < ../linux-4.9.37.patch cd ../ tar -czf linux-4.9.y.tgz linux-4.9.y cd ../../ 注意: 若下载的内核格式为linux-4.9.37.tar.xz, 第一步先用: xz -d linux-4.9.37.tar.xz 命令将linux-4.9.37.tar.xz解压为linux-4.9.37.tar。 第二步再用: tar -xvf linux-4.9.37.tar 解压linux-4.9.37.tar。 进入内核根目录 编译: 步骤 1. 手动拷贝.config 文件: cp arch/arm/configs/hi3516ev300_xxx_defconfig .config 步骤 2. 用户通过“make menuconfig” 进行内核配置: make ARCH=arm CROSS_COMPILE=arm-himix200-linux- menuconfig 步骤 3. 选择需要的模块。 步骤 4. 选择完毕后,保存并退出。 步骤 5. 编译内核,生成uImage镜像 make ARCH=arm CROSS_COMPILE=arm-himix200-linux- uImage -j20 此命令可能需要几分钟时间,编译完成,生成文件:arch/arm/boot/uImage,此文件可以烧写到目标板内核分区加载执行

Linux文件写权限与“删除权限”

linux下,文件有写权限却不能删除,可能是因为对文件的父目录没有写权限,因为目录是一种特殊的文件,它里面保存着目录下的文件列表,删除其下的文件,需要修改目录里面保存的信息。“一切皆文件”的思想又一次得到体现。

Once a month, the entire school meets to discuss how to homeworkhelper.net act positively and responsibly, to recite the pledge, to discuss how to be a successful student, and to honor students who have exhibited superior character traits.