微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > CC2541空中升级,官方demo无法生成bin文件。

CC2541空中升级,官方demo无法生成bin文件。

时间:10-02 整理:3721RD 点击:

   使用1.3.2协议栈的SimpleBLEPeripheral 工程做空中升级测试,选择CC2541-OAD-ImgB,进行编译,工程编译成功后,弹出cc254x_ubl_pp.js文件。可以生成hex、sim文件 但无法生成bin文件!

  电脑系统是win7 64bit。

cc254x_ubl_pp.js文件代码如下:

var ForReading = 1;
var ForWriting = 2;

// void main(void)
{
var ppType = WScript.Arguments(0);
var fso = new ActiveXObject("Scripting.FileSystemObject");
var ppPath = WScript.Arguments(1);
var fin, fout;

switch (ppType) {
case "ProdUBL":
fin = ppPath + ".sim"
fout = ppPath + ".bin"
fso.CopyFile(fin, "tmp.sim", true);
var WshShell = new ActiveXObject("WScript.Shell");
// Invoke and wait for the binary file conversion tool to finish.
WshShell.Run("cc254x_sim2bin.exe tmp.sim tmp.bin", 8, true);
fso.CopyFile("tmp.bin", fout, true);
fso.DeleteFile("tmp.bin");
fso.DeleteFile("tmp.sim");
break;

case "ProdHex":
var ublFile = WScript.Arguments(2);
var rootCnt = WScript.Arguments(3);
var fubl = fso.OpenTextFile(ublFile, ForReading);
fout = fso.CreateTextFile(ppPath + ".hex", true);

// UBL is split between root (intercepting IVEC's) and the last or lock-bits page.
while (rootCnt != 0)
{
var s = fubl.ReadLine();
fout.WriteLine(s);
rootCnt--;
}

fin = fso.OpenTextFile(ppPath + ".a51", ForReading)
fin.ReadLine(); // Throw away the first line since appending to a valid .hex file.

// Throw away the last two lines since a valid .hex file will be appended.
var line = new Array(3);
var rIdx = 2;
var wIdx = 0;
line[0] = fin.ReadLine();
line[1] = fin.ReadLine();
while (1)
{
fout.WriteLine(line[wIdx]);
line[rIdx] = fin.ReadLine();
if (fin.AtEndOfStream)
{
break;
}
rIdx = (rIdx+1) % 3;
wIdx = (wIdx+1) % 3;
}
fin.Close();

// Look to throw away the header line to the banked area of the UBL image.
var s = fubl.ReadLine();
if (s.substr(1,1) != "0")
{
fout.WriteLine(s);
}

while (!fubl.AtEndOfStream)
{
var s = fubl.ReadLine();
fout.WriteLine(s);
}

fout.Close();
fubl.Close();
break;
}
}

在options->linker ->output->other选中->output里选择raw-binary,module-local里选择Include all,其余默认, 试下,应该可以生成.bin文件

另外也可以参考论坛之前的讨论帖 

http://www.deyisupport.com/question_answer/wireless_connectivity/bluetooth/f/103/t/77190.aspx

您好!

按照你给的方法,可以生成正确的bin文件,还是有点疑惑,为什么有点电脑不需要修改也可以生存正确的bin文件呢?

刚刚进行空中升级的时候发现,按照你说的配置生成的bin文件,升级失败,对比正确的bin文件,发现文件大1倍。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top