2671 views|2 replies

6555

Posts

0

Resources
The OP
 

How to expand the BIM code space of CC2640 SDK sample code [Copy link]

Usually in the process of implementing the OAD (on-air-download) function, TI will provide a standard sample BIM (Boot Image Manager) code for image verification and downloading. In the sample code provided by TI, the BIM code is generally located in the internal flash page31, adjacent to CCFG. If the user needs to add more functions to the BIM code area according to their own function definition (such as custom UART / SPI boot, custom security verification function, etc.), the BIM code after the custom function exceeds 4k byte. Since the BIM area is adjacent to CCFG and NV Storage Area, it cannot be expanded in the original position, and the only option is to consider re-demarcating the address space for BIM to meet the needs.

This article is based on the LAUNCHXL-CC2650 evaluation board ( http://www.ti.com.cn/tool/cn/launchxl-cc2650 ) and the BLE-STACK-2-2-1 SDK. It describes in detail how to change the BIM start address contained in the original OAD sample code from 0x1F000 to 0x1000, and expand the BIM address range from 4k to 8k .

Note: All different versions of the BLE SDK can be found at: http://www.ti.com/tool/BLE-STACK-ARCHIVE

In addition, this article will discuss the following problems and solutions encountered during BIM relocation:

  • Avoiding TI RTOS-related Flash region conflicts
  • Generation of a new target Image valid header
  • How to modify the python tool script to generate a new Image

*****************************************************************************************************************

First, regarding the modification of the BIM starting address, there are several steps:

  • Step 1: Modify the flash start address of simple_peripheral project -> cc2650lp_app project
  • Step 2: Reassign address space to the BIM code of bim_extflash project
  • Step 3: Use the new BIM allocation method to implement OAD function

Step 1 : Modify the flash start address of simple_peripheral project -> cc2650lp_app project

Import the projects in the folder C:\ti\simplelink\ble_sdk_2_02_01_18\examples\cc2650lp\simple_peripheral in IAR7.70/IAR7.8 as follows

1) Modify APP_IMAGE_START

Open the option--linker--config of the cc2650lp_app-FlashOnly_OAD_ExtFlash project and change APP_IMAGE_START from 0x1000 to 0x3000

2) Modify the RTOS operation mode

Open CC2640 .cfg from the project, or find this file directly in the following address: ble_sdk_2_02_01_18\src\common\cc26xx\kernel\ cc2640 \config)

Comment out the code shown in the following figure:

Reason: When "use BIOS in ROM" is selected, the ROM pointer of RTOS will be fixed in the 0x1500 area. This conflicts with the BIM code space we want to customize. Selecting "use BIOS in Flash" allows TI-RTOS to boot from FLASH to avoid this problem. Of course, "use BIOS in Flash" will occupy a little more of the user's flash area.

3) Modify the address of the reset vector

Continuing from the previous step, in CC2640 .cfg, change m3Hwi.resetVectorAddress from 0x1010 to 0x3010.

Reason: This is the address of the reset vector, which should follow the header.

Step 2 : Reassign address space to the BIM code of bim_extflash project

Import the projects in the C:\ti\simplelink\ble_sdk_2_02_01_18\examples\util\bim_extflash\ cc2640 folder in IAR7.70/IAR7.8 as follows

Open the cc26xx_bim_extflash.icf file shown in the figure above, redefine a FLASHPAGE1, define its range as 8k, define region BIM as the area of PAGE1, and change BIM_START from 0x1F000 to 0x1000.

After the compilation is successful, check the generated bim_extflash.map to confirm whether the previous changes are effective.

Step 3 : Use the new BIM allocation method to implement OAD function

Based on the operation in step 2, open the bim_main.c file in the same project as shown below.

Make the following changes:

Reopen the project under C:\ti\simplelink\ble_sdk_2_02_01_18\examples\cc2650lp\simple_peripheral that was modified in STEP1, and find

Find oad_target_external_flash.c as shown in the figure and make the following changes

After completing the above three steps, each recompilation is successful, and all changes required for the project are completed.

*************************************************************************************

Secondly, in order to implement OAD with the new address allocation, we need to generate a new target Hex file to be burned. We still use the relevant Python tools (Python 2.7.10 is used here) to generate the required new hex file (the new file contains the correct metadata Header).

Note: Here we focus on how to modify the Python script after the BIM address is changed. For downloading and using the Python tool mentioned above, please refer to the following chapters in the CC2640 BLE OAD User's Guide.pdf document included in the BLE SDK. We will not elaborate on this here.

  • 10.1 Installing Python
  • 10.2 TI OAD Image Tool (Python)

According to our previous modification, the code start address of simple_peripheral project -> cc2650lp_app project has been changed to 0x3000, but the hex file generated by the original python tool script is configured to change the header's imgAddr to 0x1000, which does not meet our requirement of changing the start code to 0x3000. Therefore, we need to modify the original python tool script and related operations, which is divided into the following two steps:

1) Modify the oad image script file (oad_image_tool.py)

The script file is located in the folder C:\ti\simplelink\ble_examples-ble_examples-2.2\tools\scripts\oad

Open the file with PythonGUI and assign startAddr to 0x3000, as follows:

2) Modify the script of Python tool

Here we will use two Python arguments: -m –r, to modify the metadata header address of the target Image.

Enter the following command in the command line interface:

> set PATH=%PATH%;C:\python27\

> Python C:\ti\simplelink\ble_examples-ble_examples-2.2\tools\scripts\oad\oad_image_tool.py C:\Users\x0269290\Downloads\Desktop\ble_sdk_2_02_01_18\examples\cc2650lp\simple_peripheral\iar\app\FlashOnly_OAD_ExtFlash\Exe\simple_peripheral_cc2650lp_app.hex -o C:\Users\x0269290\Downloads\Desktop\ble_sdk_2_02_01_18\examples\cc2650lp\simple_peripheral\iar\app\FlashOnly_OAD_ExtFlash\Exe\Simple_peripheral_cc2650lp_app.hex -m 0x3000 -r :0xD000

( Note: The command needs to be changed accordingly depending on the location and name of the python script, target hex, and output hex.)

As shown in the figure:

The results are as follows:

Note: "-m" in the above example is used to assign a value to metaAddr. However, because metaAddr (0x3000) is greater than imgStartAddr (0x1000), an error occurs. Therefore, modify the corresponding code in the python script in 1).

After completing the above steps, use the flash program2 tool to flash the modified APP image into the launchpad (note: the flash program2 ...

This post is from Wireless Connectivity

Latest reply

What a classic sharing, it is written so clearly.   Details Published on 2019-10-24 15:15
 

2w

Posts

341

Resources
2
 

I like it. The steps for modifying the BIM start address are very detailed.

This post is from Wireless Connectivity
 
 
 

2618

Posts

0

Resources
3
 

What a classic sharing, it is written so clearly.

This post is from Wireless Connectivity
 
 
 

Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list