DA1458x bootloader在多个image存在时的判断条件

来源:互联网 发布:炉石淘宝买卡背 编辑:程序博客网 时间:2024/05/17 11:58
mkimage:
1.mkimage single
    image.image_id(uint8_t) = 0xff;
2.mkimage multi
    image1.image_id = 0x01;
    image2.image_id = 0x00;

bootloader:
1.从0x1f000读product_header,解析出两个image在flash中的位置imageposition1 imageposition2;
2.从imageposition1 imageposition2读出两个image的imageHeader
3.判断两个image是否合法,如果只有image1有效,则将image1整个读入内存;
  如果两个image都有效,则要判断哪个是新版本,判断条件如下:
  if(image1.image_id==0xff && image2.image_id==0) image2;
  if(image1.image_id==0 && image2.image_id==0xff) image1;
  if(image1.image_id >= image2.image_id) image1;
  else image2;

依上:
1.第一次mkimage multi生成的固件,启动后image1有效;(0x01>0x00)

2.第二次mkimage single 生成的待更新版本,使用suota下载到flash的image2位置后启动,image2有效;(0xff > 0x01)

3.如果再需要更新版本,新版本image1的image_id只需设置为0即可;

0xff>0xfe>...0x01>0>0xff>...


另外,手机APP SUOTA使用时要注意:
1.BLE设备要使能diss profile,起码要在广播中添加diss标记,否则APP SUOTA不识别该BLE设备;
2.要更新的image_new.version要比image_old.version大(或者不同即可,待验证),否则APP在读完imageHeader后会报错:
  Same Image Error
  接着会断开连接,有些Android版本的软件在下载image时直接提示连接断开,基本上就是这个问题;
1 0
原创粉丝点击