声明:原创作品,严禁用于商业目的。 本系列文章适合研发工程师,欢迎和我交流:408797506@qq.com(微信:408797506)
环境:Ubuntu系统
源码:博通SDK,芯片3384xx
文章目录
1. 编译
(1)相关文件目录如下:
bootloader linux zOEMtools_eCos build.sh REV
(2)编译步骤和结果
#prepare build env
#PACK_DIR is your project diy
export CXC_COMPILER_ROOT_DIR=${PACK_DIR}/zOEMtools_eCos/eCos20/gnutools/mipsisa32-elf-i386-linux
PATH="$CXC_COMPILER_ROOT_DIR/bin:$PACK_DIR/REV/rbb_cm_src/BrcmUtils:$PATH"
cd ${PACK_DIR}/bootloader/app
./makeapp 3383 linux dualflash pid xxxx #xxxx is the product id,4 hex characters
#where is bootloader bin file
${PACK_DIR}/bootloader/app/bcm/bootl_xxxx_dload.bin
2. 功能
目前bootloader支持了一下菜单中列出的功能:
Main Menu:
==========
b) Boot from flash #关闭ethernet并从flash启动
g) Download and run from RAM #用tftp下载image到RAM,并从RAM启动
d) Download and save to flash #用tftp下载bootloader/image并写入flash
e) Erase flash sector #拆除指定的flash区块
m) Set mode #设置启动模式,具体模式见下表
s) Store bootloader parameters to flash #更新参数(board mac/ip/mask,tftp server ip...)到flash
i) Re-init ethernet #重新配置/初始化ethernet
r) Read memory #读取指定地址内容
w) Write memory #更新指定地址内容
j) Jump to arbitrary address #执行指定地址的程序
p) Print flash partition map #查看flash分区信息
E) Erase flash region/partition #擦除flash指定分区,目前只允许擦除分区1,即CM image1
X) Erase all of flash except the bootloader #擦除flash除第一个区块外的所有区块,第一个64KB的区块存放bootloader
z) Reset #重启
对应m)选项的启动模式:
Mode Configuration Bits
=======================
0x8000 Boot #正常从flash启动,默认设置
0x4000 Load-N-Go #启动自动进入tftp下载模式,tftp server ip,filename等参数从flash中获取。启动后在2s内任意键输入可取消此模式
0x0020 Boot image 3 #优先启动image3,即linux
0x0004 Boot image 1 #CM有image1 image2,优先启动image1
0x0002 Verify image CRC #是否对image进行检验,默认设置
0x0001 Prompt #可配置bootloader参数,默认设置
3. 启动流程分析
4. 移植分析
针对升级image为eCos(默认写入image2)
UDP Parse – ok
Tftp download – ok
File check – ok
Write specific flash block – ok
LED behavior control – ok
Phy button control – nok yet,but can be improved
特殊需求的扩展
指定image分区的升级
包括bootloader/eCos(2个分区)/linux kernel/linux app/linux rootfs
需扩展CDP协议本身,增加配置参数
升级覆盖整个flash的bin文件
在支持"指定image分区的升级"的基础上增加bootloader中擦写整个flash的api
必要条件:可用内存要大于整个flash大小
升级客户定制化firmware,这个需求的提出基于以下情况:
Firmware由客户提供,且可能不是基于Broadcom SDK(不同的flash partition或image header);
Hardware由Cameo提供,且为了测试硬体先烧入了Cameo测试Firmware;等hardware,firmware都准备好之后,升级客户firmware
这个方式在支持"升级覆盖整个flash的bin文件"的基础上,需将file check部分作客制化修改