项目背景:使用KE系列MCU实现远程升级功能,要求支持断点续传。
1、官网给的KE系列的bootloader例子的bootloader代码在MCU上电后工作在其它程序前的。那远程升级时需要让单片机掉电再重新上电吗。bootloader能不能随时监听,收到远程升级报文后再开启bootloader功能,等待更新?
2、bootloader的机制是怎样的,是传完后判断数据无误后再开始升级程序还是边接收边升级,如果是后者这样的机制,远程升级时受到各方面影响导致数据中断、误码、丢包,那MCU是否就死机了?
3、KE系列的官方例程是基于KE02的,移植到KE04需要什么操作呢?
恳请指导!
Hi,
1、因为flash被分成bootloader和app,bootloader是从地址0开始。所以只要想办法让mcu从头开始执行就行。可以考虑让mcu软件复位,就不必重启。远程端可以和MCU建立一个标志,远程端发送标志,MCU接收到标志出就软件复位,执行bootloader。
2、边收边升级。接收完代码,可以让远程端发送校验码,mcu自己也进行校验比对校验码。如果出错就不执行app,继续运行bootloader,只有校验码通过才执行app,这样就不会死机
3、注意修改linker文件,包括flash大小,sram地址等。
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
感谢回复,另外请教下,断点续传这个功能要如何实现?
Hi,
MCU的flash擦写必须是一个扇区,那么你的数据必须等分为n个扇区。远程端和MCU都计数传输了几个扇区,如果中断了,那么双方通信传输到第几个扇区。比如第5个扇区没有传输完成,那么MCU首先把5扇区擦除,再重写。
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
感谢回复,最后再请教个问题:512K的代码量,全部传输过来并且校验完毕后,开始重写FLASH,重写FLASH的这个时间大概是多少?
Hi,
芯片的datasheet有Flash characteristics,你可以参考
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------