在学习OAD例程时,才真正明白CC1350 project0的用处。对一个待增加OAD的工程,需要学习它的操作方法。另外我还结合自己淌过的几个坑,总结了这个操作记录。希望能对一些做CC1310 OAD的朋友们有所帮助。
本文作者twowinter,转载请注明作者:http://blog.csdn.net/iotisan/
In project option -> ARM Compiler -> Advanced Options -> predefined symbols add ‘USE_BIM’ define
// 我在例程中没看到有使用这个宏,貌似没关系
In project option -> ARM Hex Utility -> check Enable ARM Hex Utility
感觉这样还不够,我找到了个帖子,在e2e论坛还发了个帖子。
http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/562492
我在帖子中问CC1310应该怎么做:–intel and –memwidth=8, and – romwidth=8.
CC1310_LAUNCHXL_TIRTOS.cmd 和 CC1310_LAUNCHXL_TIRTOS-bim.cmd 的主要区别在这里:
/* The starting address of the application. Normally the interrupt vectors */
/* must be located at the beginning of the application. */
#define FLASH_BASE 0x0
#define FLASH_SIZE 0x20000
/* The starting address of the application. For a Boot Image Manager */
/* compatible image the Applicaion need to start in the first page. */
#define FLASH_BASE 0x1000
#define FLASH_SIZE 0x1EFF0
照这样来看,增加了BIM之后,应用程序从4K开始。在第一步中还使能了USE_BIM的宏。
#define FLASH_OAD_IMG_HDR_SIZE 0x10
#define FLASH_OAD_IMG_START FLASH_APP_BASE + FLASH_OAD_IMG_HDR_SIZE
#define FLASH_OAD_IMG_MAX_LEN FLASH_LEN - (2 * FLASH_PAGE_LEN) - FLASH_OAD_IMG_HDR_SIZE
研究了下CC1350的两个boot程序,一个是片内的,一个是片外的,分别研究了下他们的跳转地址。目前这个APP工程是跳转到了0x1010,采用的是extflash的工程。为什么片外OAD的BIM要4K的flash,大概是片内的判断比较简单,片外则要加入SPI,所以代码量大一些。
this is on chip:
asm(" MOV R0, #0x00D0 ");
asm(" LDR R1, [R0, #0x4] ");
// Reset the stack pointer,
asm(" LDR SP, [R0, #0x0] ");
// And jump.
asm(" BX R1 ");
this is extflash:
asm(" MOV R0, #0x1010 ");
asm(" LDR R1, [R0, #0x4] ");
// Reset the stack pointer,
asm(" LDR SP, [R0, #0x0] ");
// And jump.
asm(" BX R1 ");
RTOS子工程中还有一个cfg文件。
rfDmExamples-bim.cfg 比 例程的 release.cfg ,默认多了如下两个设置:
/*
* Assign an address for the reset vector.
*
* Default is 0x0, which is the start of Flash. Ordinarily this setting should
* not be changed.
*/
m3Hwi.resetVectorAddress = 0x1010;
/*
* Assign an address for the vector table in RAM.
*
* The default is the start of RAM. This table is placed in RAM so interrupts
* can be added at runtime.
*
* Note: To change, verify address in the device specific datasheets'
* memory map.
*/
m3Hwi.vectorTableAddress = 0x20000000;
指南中没体现,自己摸索了出来。
从CC13X0-SDK开始,每个工程都会带一个RTOS的子工程。
这块就直接替换rtos的工程。
右键工程 -> Show Build Settings -> CCS Build -> Dependencies
Remove tirtos_builds_CC1310_LAUNCHXL_release_ccs
Add tirtos-bim_builds_CC1310_LAUNCHXL_release_ccs
指南中没体现,自己摸索了出来。
因为实际生成的hex,仍保留CCFG区域。我之前深深吃了这个亏。如果瞎搞的话,CC1310可是会brick哦,这样只能返厂了。
hexmerge.py将应用层hex和BIM的hex合成一个文件,这个是在intelhex-2.1中。
python /usr/bin/hexmerge.py -o bin/rfWsnNodeOadClient_CC1310_LAUNCHXL_tirtos_ccs_all-v3_01.hex "--overlap=error" bin/rfWsnNodeOadClient_CC1310_LAUNCHXL_tirtos_ccs-v3_01.hex bin/bim_extflash_cc1350lp_bim.hex
rfWsnNodeOadClient_CC1310_LAUNCHXL_tirtos_ccs_all-v3_01.hex
rfWsnNodeOadClient_CC1310_LAUNCHXL_tirtos_ccs-v3_01.hex
bim_extflash_cc1350lp_bim.hex
oad_image_tool.py 将应用层hex处理成bin
python tools/oad_image_tool.py -v 0x0302 -i remoteapp bin/rfWsnNodeOadClient_CC1310_LAUNCHXL_tirtos_ccs-v3_02.hex -ob bin/rfWsnNodeOadClient_CC1310_LAUNCHXL_tirtos_ccs_app-v3_02.bin -m 0x1000
rfWsnNodeOadClient_CC1310_LAUNCHXL_tirtos_ccs-v3_02.hex
rfWsnNodeOadClient_CC1310_LAUNCHXL_tirtos_ccs_app-v3_02.bin