Smart4418裸机开发(一):相关工具准备

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/M_N_N/article/details/82056494

交叉编译器

摘自官方wiki:http://wiki.friendlyarm.com/wiki/index.php/Smart4418/zh

首先下载并解压编译器:

git clone https://github.com/friendlyarm/prebuilts.git
sudo mkdir -p /opt/FriendlyARM/toolchain
sudo tar xf prebuilts/gcc-x64/arm-cortexa9-linux-gnueabihf-4.9.3.tar.xz -C /opt/FriendlyARM/toolchain/

然后将编译器的路径加入到PATH中,用vi编辑vi ~/.bashrc,在末尾加入以下内容:

export PATH=/opt/FriendlyARM/toolchain/4.9.3/bin:$PATH
export GCC_COLORS=auto
执行一下~/.bashrc脚本让设置立即在当前shell窗口中生效,注意”.”后面有个空格:

. ~/.bashrc
这个编译器是64位的,不能在32位的Linux系统上运行,安装完成后,你可以快速的验证是否安装成功:

$ arm-linux-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gcc
COLLECT_LTO_WRAPPER=/opt/FriendlyARM/toolchain/4.9.3/libexec/gcc/arm-cortexa9-linux-gnueabihf/4.9.3/lto-wrapper
Target: arm-cortexa9-linux-gnueabihf
Configured with: /work/toolchain/build/src/gcc-4.9.3/configure --build=x86_64-build_pc-linux-gnu
--host=x86_64-build_pc-linux-gnu --target=arm-cortexa9-linux-gnueabihf --prefix=/opt/FriendlyARM/toolchain/4.9.3
--with-sysroot=/opt/FriendlyARM/toolchain/4.9.3/arm-cortexa9-linux-gnueabihf/sys-root --enable-languages=c,c++
--with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3 --with-float=hard
...
Thread model: posix
gcc version 4.9.3 (ctng-1.21.0-229g-FA)

串口工具

  • putty或者MobaXterm
     

U-boot编译与烧写

编译U-Boot
下载U-Boot源代码并编译,注意分支是nanopi2-lollipop-mr1:

git clone https://github.com/friendlyarm/uboot_nanopi2.git
cd uboot_nanopi2
git checkout nanopi2-lollipop-mr1
make s5p4418_nanopi2_config
make CROSS_COMPILE=arm-linux-

编译成功结束后您将获得u-boot.bin,您可以通过fastboot来更新正在运行的NanoPi2板上SD的U-Boot,方法如下:
1) 在电脑上先用命令 sudo apt-get install android-tools-fastboot 安装 fastboot 工具;
2) 用串口配件连接开发板和电脑,在上电启动的2秒内,在串口终端上按下回车,进入 u-boot 的命令行模式;
3) 在u-boot 命令行模式下输入命令 fastboot 回车,进入 fastboot 模式;
4) 用microUSB线连接Smart4418和电脑,在电脑上输入以下命令烧写u-boot.bin:
fastboot flash bootloader u-boot.bin
 
注意:您不能直接使用dd来更新SD卡,否则有可能会导致无法正常启动。

板子进入fastboot模式后,电脑设备管理器会新增Google ADB设备,若显示Android 1.0设备,并且有感叹号提示,安装驱动精灵解决。如果虚拟机中执行fastboot flash bootloader u-boot.bin 显示<wait for device>,就换windows下的fastboot工具,百度网盘下载:链接: https://pan.baidu.com/s/1LQRQAM6aFHWJAZg-HOMuEA 密码: r3bn

将虚拟机中编译好的uboot.bin拷出来

G:\ARM\tools\fastboot烧写工具\platform-tools>fastboot.exe flash bootloader u-boot.bin  //烧写uboot
sending ‘bootloader’ (243 KB)…
OKAY [ 0.323s]
writing ‘bootloader’…
OKAY [ 0.149s]
finished. total time: 0.473s
 
G:\ARM\tools\fastboot烧写工具\platform-tools>fastboot.exe reboot  //重启开发板
rebooting…
 
finished. total time: 0.000s
 
G:\ARM\tools\fastboot烧写工具\platform-tools>

扫描二维码关注公众号,回复: 2928456 查看本文章

板子重启2秒内按任意键,进去uboot模式,输出信息可以看到uboot的更新时间;

这样更新的前提是板子已经烧了uboot,如果板子上本来没有uboot呢?求解
 
 

裸机程序下载工具

以下是4412的工具,4418上貌似用不了
dnw:参考:Tiny4412裸机开发过程(四) — 点亮LED灯和下载裸机程序

源码下载链接: https://pan.baidu.com/s/1fuksm84-yg5biaXq9XjYtQ 密码: juuy
Makefile修改参考:ubuntu16 dnw for tiny4412

如果是ubuntu12工具应该能make然后直接使用,在ubuntu16编译会报错(需要修改驱动的makefile):

Ubuntu16.04下要修改:
vim ./src/driver/Makefile
将原本的内容全部替换为

LINUX_KERNEL_PATH:=/lib/modules/$(shell uname -r)/build

all:
        $(MAKE) -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) modules
clean:   
        rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versions

obj-m += secbulk.o

然后make
make
这里写图片描述

./src/driver目录下会生成 secbulk.ko 模块;
insmod secbulk.ko 安装该模块
lamod 可以查看已安装的模块

然后在dnw_linux 目录下执行 sudo make install
输出信息
这里写图片描述

使用dnw:
Usage: dwn [-a load_addr] <filename>
Default load address: 0x57e00000

猜你喜欢

转载自blog.csdn.net/M_N_N/article/details/82056494
今日推荐