米尔开发板测试记录

环境:

底层加载环境变量 source /opt/fsl-imx-fb/5.4-zeus/environment-setup-cortexa7t2hf-neon-poky-linux-gnueabi
$CC --version
rm-poky-linux-gnueabi-gcc (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
应用层加载环境变量 source /opt/fsl-imx-core/5.4/environment-setup-cortexa7t2hf-neon-poky-linux-gnueabi
$CC --version
arm-poky-linux-gnueabi-gcc (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

设置arm
make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- distclean
make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- myd_imx6ull_nand_ddr256_defconfig
make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi-

编译U-boot
cd myir-imx-uboot
make distclean
make myd_imx6ull_nand_ddr256_defconfig
make -j16

编译kernel
tar -xvf myir-imx-linux.tar.gz
cd myir-imx-linux
make distclean
make myd_y6ulx_defconfig
make zImage dtbs -j16

make zImage dtbs modules

make modules

下载文件 :

删除文件夹 :sudo rm -rf wt
tftp -g -r 1.txt 192.168.1.5


目录下的 zImage 下载到 目标设备当前目录下。
tftp -g -r zImage -l zImage 192.168.1.5
config 文件上传到 tftp 服务端之前 配置的<WORKDIR>/tftpboot 目录下,并重新命名为 config_01。
tftp -p -l config -r config_01 192.168.1.5


tftp -g -r sftp-server -/usr/libexec sftp-server 192.168.1.5
cp sftp-server /usr/libexec
ls /usr/libexec

网口设置ip:

ifconfig eth0 192.168.1.100 netmask 255.255.255.0
route add default gw 192.168.1.1

编译modbus库

增加运行权限
chmod 777 gpio_led
1.运行LED程序
./gpio_led /sys/class/leds/cpu/brightness

安装modbus库
创建安装目录
mkdir install
进入解压的目录
cd libmodbus-3.0.6
配置编译选项(注:--prefix选项是安装目录,根据自己环境确定)
./configure --host=arm-fsl-linux-gnueabi --enable-static --prefix=/home/wt/source/test/install/
./configure --host=arm-poky-linux-gnueabi --enable-static --prefix=/home/wt/source/test/install/
./configure --host=arm-poky-linux-gnueabi --enable-static --prefix=/usr/local/modbus/install/
编译
make
安装
make install
在install生成三个目录:include lib share

ln -s libmodbus.so.5.1.0 libmodbus.so.5
ln -s libmodbus.so.5 libmodbus.so
压缩文件 sudo tar cvf XXX.tar ./*

编译goahead:

1.解压 tar -xzvf goahead-4.0.2-src.tgz
2../configure
3.sudo make install
4.cd src 然后输入 sudo cp self.crt self.key /etc/goahead/
5.cd ../build/linux-x86-default/bin/
6.sudo goahead -v --home /etc/goahead /var/www/goahead 0.0.0.0:8080 运行goadhead
chmod 777 /goahead/bin/goahead
/goahead/bin/goahead -v --home /etc/goahead/ /www/goahead/ *:8080
/goahead/bin/goahead-test -v --home /etc/goahead/ /www/goahead/web/ *:8080

7 移植goahead 成功 拷贝release文件到系统中 直接运行
chmod 777 /web/webserver/goahead
/web/webserver/goahead -v --home /web/webserver/ /web/webroot/ *:8080

8.
/web/webserver/goahead -v --home /web/webserver/ /web/webroot/ *:8080

sqlite3的应用:

创建数据库:sqlite3 XXX.db
.output file_name.sql 将输出重定向到文件,文件名和后缀自定义则可。
.dump [table_name]将数据库表的创建导出到脚本;如果没有参数table_name则表示导出整个数据库;
.exit 退出
使用 .read fine_name.sql 可以执行文件里面的sql语句,通过脚本自动创建数据库;
sqlite3 yangxt.db .dump > create_yangxt_table.sql # 导出数据库到create_yangxt_table.sql文件
.table 查看数据库表
select * from yangxt;
.header on # 显示表头
.mode colum # 列左对齐
.timer on # 开启定时器

rm -f yangxt.db 删除数据库
sqlite3 yangxt.db < create_yangxt_table.sql # 重新导入数据库

4.使用 .import 导入数据库表的内容
sqlite> delete from yangxt; # 把yangxt表中原来的内容删除
sqlite> select * from yangxt; # 查询确认yangxt表中内容已经被删除
sqlite> .import yangxt_table.txt yangxt # 将上面导出到yangxt_table.txt文件的yangxt表内容重新导入到表
sqlite> select * from yangxt; # 导入表之后再次查询,数据内容和我们导入的内容一致

5.附加数据库 attach/detach

1.删除表
DROP TABLE database_name.table_name;
2.查询(select)/新建(insert)/更新(update)/删除(delete) 语句
SELECT column1, column2, columnN FROM table_name;

3.用于向数据库的某个表中添加新的数据行。
INSERT INTO TABLE_NAME [(column1, column2, column3,...columnN)]
VALUES (value1, value2, value3,...valueN);

4.UPDATE
UPDATE table_name
SET column1 = value1, column2 = value2...., columnN = valueN
WHERE [condition];

5.DELETE
DELETE FROM table_name
WHERE [condition];

有几个内置的函数,比如 avg()、sum()、count(),等等,执行被称为对一个表或一个特定的表列的汇总数据计算。
SELECT COUNT(*) AS "RECORDS" FROM table1;

SELECT * FROM table1 WHERE id LIKE '1%';


查询数据表
.separator 分隔
.headers on 标题
.mode column 显示模式
select * from student;