首先按照环境所依赖的包:
sudo apt-get install git wget libc6-i386 lib32ncurses5 make bc gawk ncurses-dev
开始获取SDK源码,并且修改权限:
git clone https://github.com/ambiot/ambd_sdk.git
sudo chmod -R 777 ambd_sdk
然后开始编译,因为8720DN有两个核,所以要进去两个核的源码进行编译。先在低核编译,再在高核编译。
//KM0 核
cd ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp
make all
//KM4 核
cd ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp
make all
编译成功之后,在对应的 images 下面的三个 bin 文件是我们所需要的:
ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/image/km0_boot_all.bin
ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/km4_boot_all.bin
ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/km0_km4_image2.bin
暂时还不支持在 Linux 烧录固件,所以我们把固件复制到 VM 共享文件夹下面,在 window 下面进行烧录固件。这里,分享一下我使用的脚本:
#!/bin/bash
rm -f out/km0_boot_all.bin
rm -f out/km4_boot_all.bin
rm -f out/km0_km4_image2.bin
rm -f project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/image/km0_boot_all.bin
rm -f project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/km4_boot_all.bin
rm -f project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/km0_km4_image2.bin
mkdir out
cd project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/
make all
if [ $? -ne 0 ]
then
echo -e "\033[31m project_lp compile error! \033[0m"
exit 1
fi
cp asdk/image/km0_boot_all.bin ../../../../out/
cp asdk/image/km0_boot_all.bin /mnt/Ubuntu_Share/Ubuntu_Share/BW16/out
cd ../project_hp/
make all
if [ $? -ne 0 ]
then
echo -e "\033[31m project_hp compile error! \033[0m"
exit 2
fi
cp asdk/image/km4_boot_all.bin ../../../../out/
cp asdk/image/km0_km4_image2.bin ../../../../out/
# 复制到VM共享文件夹,文件夹路径根据您的系统去修改
cp asdk/image/km4_boot_all.bin /mnt/Ubuntu_Share/Ubuntu_Share/BW16/out
cp asdk/image/km0_km4_image2.bin /mnt/Ubuntu_Share/Ubuntu_Share/BW16/out
cd ../../../../..
echo -e "\033[32m all build success! \033[0m"
- 打开烧录工具,点击红色选型选择芯片类型为 8721dn 。
- 选择所需要的串口端口号。
- 我这里选择的是安信可BW16-Kit-V1.2开发板,所以flash大小改为2048表示 2MB 的 FLASH;
- 开发板接线图如下,即 GA30/PA7TX_2/LOG_TX 接 GA23/PB1TX_0 , GA18/PB2RX_0 接 GA29/PA8RX_2/LOG_RX。
- 最后,用 Mico USB 数据线连接电脑,先按下 Burn 按键,再按一下 RST 按键,即可进去烧录模式。
打开串口调试助手,波特率 115200 ,按一下复位按键,即可看到打印信息。
?#calibration_ok:[2:19:11]
#interface 0 is initialized
interface 1 is initialized
Initializing WIFI ...[FAST_CONNECT] Fast connect profile is empty, abort fast connection
WIFI initialized
init_thread(58), Available heap 0x26660