杭城又下起了滴滴答答的小雨。。。不知道又浇灌在谁的心间。。。。。。诗和远方很美啊,奈何门票很贵。。。。。
来,话题扯远了,咋们继续openblt之旅
Openblt 的上位机软件在包的Host目录
协议
移植的同学在写用户应用程序的时候,需要知道上位机发什么指令下来,单片机复位进入bootloader,
协议为:
长度 +0xFF +数据
我目前的版本openblt_v011101,真实捕获到的数据也为 02 0xff 0x00
官方例子中的解析代码为
/* Check for bootloader activation request. */
BootComCheckActivationRequest();
/* store the next packet byte */
if (Rs232ReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1)
{
/* increment the packet data count */
xcpCtoRxLength++;
/* check to see if the entire packet was received */
if (xcpCtoRxLength == xcpCtoReqPacket[0])
{
/* done with cto packet reception */
xcpCtoRxInProgress = 0;
/* check if this was an XCP CONNECT command */
if ((xcpCtoReqPacket[1] == 0xff) && (xcpCtoRxLength == 2))
{
/* connection request received so start the bootloader */
BootActivate();
}
}
1.Windows系统
咋们windows底下最常用的是MicroBoot.exe
串口配置
2.linux系统
有时候生活/工作中 平台是ubuntu或者其他linux系统的话,则需要进行编译,然后以命令行BootCommander的形式去使用
要记住一点,要想编译BootCommander,则需要先编译LibOpenBLT代码
步骤为
进入LibOpenBLT/build目录
1.sudo apt-get install cmake
2.sudo apt-get install build-essential libusb-1.0-0 libusb-1.0-0-dev
3.cmake ..
4.make
等待完毕,然后再去BootCommander/build目录
1.sudo apt-get install build-essential
2.cmake ..
3.make
然后我们才会在Host目录看到命令出来,这样编译大事搞定
使用的话
./BootCommander -t=xcp_rs232 -d=/dev/ttyUSB0 -b=115200 APP.srec
// -d=相应的设备串口号 找不到的话可以用ls /dev | grep tty*找一下
// -b=相应的波特率
// APP.srec 用户的应用程序
这样,完事!!!!
好了,Openblt旅程到此结束,小伙伴们,欢迎下次光临此航班