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.

CCS/MSP430FR5994: Build step to write specific data to information memory in hex output?

Part Number: MSP430FR5994


Tool/software: Code Composer Studio

We're using CCS version 7.2 for our MSP430FR5994 project.  We have some configuration paramters in information memory (INFOA).  Since we want to make sure they don't move from build to build, we are specifically calling out the location using the LOCATION pragma like so:

#pragma LOCATION(configItem1, 0x1980)
static uint32_t configItem1 = 0;

I don't remember if there is a specific setting to do this, but the variables in INFOA do not get placed in the hex output file for the build.  The variables in INFOA then get left alone when loading new firmware on the boards, which is what we want most of the time.  However, I want to do a production hex output that sets the some of the variables to a specific non-zero value; there are certain variables that ought to be set to certain values at this point to make the boards "ready to go".  I can't figure out how to do this and I'm looking for help.

I tried setting the variable to a specific value, like the following:

#pragma LOCATION(configItem1, 0x1980)
static uint32_t configItem1 = 300;

but the variable did not end up in the hex file.  Since I know the memory location and the values, I could prepend specific data to the hex output, such as

@1980
2C 01 00 00

which would set my variable configItem1 to 300.  Is there a post-build step available with CCS to prepend data to the hex output?  Or is there another way to add set data like this to the hex output?

  • Are you willing to make the variable const?  Something like this ...

    #pragma LOCATION(configItem1, 0x1980)
    const static uint32_t configItem1 = 300;

    Or, does your program need this variable to change during execution?

    Thanks and regards,

    -George

  • We need to change the variable during execution. During development and testing we want the code to modify the value as needed, but before shipping we want to make sure it is initialized to a specific value.

  • Bryan Evenson24 said:
    We need to change the variable during execution.

    Then the only way to initialize it is during system startup.   That's how it gets initialized now.  To learn more about initialization of variables that are not const, please search the MSP430 compiler manual for the section titled Automatic Initialization of Variables.

    Thanks and regards,

    -George

  • I found what I was looking for.  Under the Project Properties->C/C++ Build->Settings, there is an option to add pre-build and post-build steps.  I've tested adding a Windows batch file as a post-build step that creates a separate copy of the hex output which is prepended with two lines that initialize INFOA as we want for production.  Now we can have one copy of the hex output that we can use as we have been during development, and another copy that will initialize INFOA the way we need to for all new hardware prior to shipping.