This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Imediate addressing of constant global varibales

Other Parts Discussed in Thread: MSP430F2471, MSP430F2274

Hi,

I am working in Code Composer Studio 4.1.1.

I am facing problem to give immediate addressing to few of my global variables. I want to place three arrays in memory location 0x1080, array should be placed continuously on this memory location. For this I have used following statements,

#pragma DATA_SECTION(HVersionArray, ".infoB")
#pragma DATA_SECTION(Serial_number, ".infoB")
#pragma DATA_SECTION(ModelNumber, ".infoB")
const unsigned char HVersionArray[3] ={Some data};
const unsigned char Serial_number[15] ={Some data};
const unsigned char ModelNumber[64] ={Some data};

This is giving error message

"../lnk_msp430f2471.cmd", line 84: error: placement fails for object ".infoB",
   size 0x54 (page 0).  Available ranges:
   INFOB        size: 0x40         unused: 0x40         max hole: 0x40     
error: errors encountered during linking; "DongleX.out" not built

How to achieve continuous addressing of this varibales.

As this is very easily possible in IAR using following statements

//IAR code

__root const unsigned char HVersionArray[3] @ 0x1080 ={Some data};
__root const unsigned char Serial_number[15] @ 0x1084 ={Some data};
__root const unsigned char ModelNumber[64] @ 0x1094 ={Some data};

Is there any syntax available in CCS to achieve same?

 

Vishal N

  • Hi Vishal,

    you're trying to place 82bytes of data into a segment which is only 64bytes large (INFOB). This works fine for IAR because you place code a absolute locations and not into named segments (as with your example). Refer to CCS V4.x Users Guide for MSP430 for details (http://www.ti.com/litv/pdf/slau157m).

    To solve this problem I would recommend editing the linker control file and create a new segment out ouf INFOB and INFOC. Pls note that you will have to take care if your application is allowed to flash new data to this lokations. If not, this will be the easiest solution.

    Find an example below how it could be done (your placement/definitions remains unchanged; although I would recommend to initialize the array at this point).

    Rgds
    aBUGSworstnightmare

    (MSP430F2274 for this example):

    /****************************************************************************/
    /* SPECIFY THE SYSTEM MEMORY MAP                                            */
    /****************************************************************************/

    MEMORY
    {
        ...
        INFOA                   : origin = 0x10C0, length = 0x0040

        /* old lines
        INFOB                   : origin = 0x1080, length = 0x0040
        INFOC                   : origin = 0x1040, length = 0x0040
        */

        /* new line */
        INFOB                   : origin = 0x1080, length = 0x0080
        INFOD                   : origin = 0x1000, length = 0x0040
        ...
    }

    /****************************************************************************/
    /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY                              */
    /****************************************************************************/

    SECTIONS
    {
    ...

        .infoA     : {} > INFOA              /* MSP430 INFO FLASH MEMORY SEGMENTS */
        .infoB     : {} > INFOB

        /* old line - no longer needed
        .infoC     : {} > INFOC
        */

        .infoD     : {} > INFOD
       
    ...
    }

  • Hi,

     

    Thanks for the reply.

    I did those changes and my compilation is successful. Thanks.

    But I encountered a new issue while loading firmware into processor. Following is the error message,

     

    Exception occurred during launch.

    Reason:

    Failed to load program on target 'TI MSP430 LPT1_0/MSP430'.

    Reason:

    Error found during data varification.

    Ensure the linker command file matches the memory map.

    Refer to the console view for specific address information.

     

    Console view contains:

    MSP430: File Loader: Data verification failed at address 0x000010C0 Please verify target memory and memory map.
    Error found during data verification.
    Ensure the linker command file matches the memory map.

     

    Any suggestions for this?

     

    Vishal N

  • Hi Vishal,

    pls note that CCS does not install the driver for the parallal port JTAG (TI MSP430 LPT) by default! You need to select them during the installtion process (pls refer to par. 1.1: http://focus.ti.com/lit/ug/slau157m/slau157m.pdf).

    I'm sorry since I do not know how to install them (and if it is possible to install them) later!

    Rgds
    aBUGSworstnightmare

  • On some MSPs, the InfoA segment is write-protected. And 0x10c0-0x10ff is InfoA (even if the linker script manipulation makes the linker think that is is the upper half of a larger InfoB)

    Since many MSPs hold calibration data in the InfoA segment, TI has implemented an additional protection for the InfoA segment on newer MSPs, so people won't accidentally delete the calibration values. The segment is still writable, but requires a special handling that isn't implemented in the programmer. So if you don't need the calibration data (or there is none like in the 54xx series which has an FLL circuit that does a better job), you can still write to the InfoA segment, but only from your application software.

    There are some 3rd party programmers which hae a separate flag 'unprotect InfoA' or such. Maybe there is something similar in CCE, I don't know.

    I'm not sure whether your MSP has a protected InfoA at all, but since code is usually programmed bottom-up and there is no error message complaining about 0x1080, it is likely.
    There is, however, the possibility that the CCE programming algorithm does not know how to handle an 'enlarged' InfoB segment and forgets to erase InfoA before programming.There are MSPs with 128 or even 256 bytes info segment size, so it is possible that the programming algorithm thinks it has already erased a 128 byte segment when it has just erased the 64 bytes of InfoB but not the 64 bytes of InfoA.
    If this is the reason, the trick with the linker script won't work and you cannot place a structure into Info memory that is larger than a single info segment.

**Attention** This is a public forum