Tool/software: TI C/C++ Compiler
We have a workspace that combines a CC2642R with an MSP430. The CC2642R has a custom bootloader that can rewrite the application code. The application code then can reprogram the MSP430 via Spy-Bi-Wire. All three code projects (MSP, CC2642 boot, CC2642 app) are built together and a single image is created with the bootloader as the master, allowing us to program a single file to the device; the application code is just an object placed in flash, and it programs the MSP with another object manually placed in flash. Both of these flash objects have sections declared in the linker command file:
SECTIONS
{
.intvecs : > BOOTLOAD_BASE
/* Allocate Sections for Flash Space */
.text : >> FLASH_LAST_PAGE
.const : >> FLASH_LAST_PAGE
.bootloader : >> FLASH_LAST_PAGE
/* Allocate Sections for CC2642 Update Image Space */
.update_image : >> UPDATE_IMAGE
/* Allocate Sections for MSP430 Update Image Space */
.msp_image : >> MSP_IMAGE
...
And both images are included in header files in the bootloader project:
// Main Application Image
#pragma DATA_SECTION(update, ".update_image") // Force this into specific section of memory
const uint8_t update[] =
{
// App Contents
0x00, 0x3C, 0x01, 0x20, 0xF5, 0x73, 0x01, 0x00,
...
// MSP430 Image
#pragma DATA_SECTION(msp_image, ".msp_image") // Force this into specific section of memory
const volatile uint16_t msp_image[] =
{
// @f000
0x40B2, 0x5A80, 0x0120, 0x93F2, 0x10FF, 0x2408, 0x43C2, 0x0056,
...
The CC2642R application image works fine, as the bootloader is repsonsible for it and references it in the code. The MSP430 image, however, is getting optimized away since the application code actually handles it, and the bootloader code never makes direct reference to it. The .msp_image section is empty in the Memory Allocation view. If we add a throwaway line of code that references msp_image[0] in an IF statement, the image is properly placed in memory, but this is kludgy and shouldn't be necessary. Is there a way to tell the compiler/linker that this data needs to be there even if the code doesn't reference it? I would have thought declaring it as volatile would do this, but that didn't help.