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.

MSP430G2553 write Info memory at flash time

I want to write some values in information memory when microcontroller is programmed. Tried

#pragma DATA_SECTION (var, ".infoD")
const int var = 0;

and 

#pragma location=0x1000
const int var = 0;

but I did not succed. Any ideas?

I am using CCS v6 and TI compiler v4.4.2

Thanks in advance.

  • Flash memory (including the Info Flash) is somewhat like ROM. Normally you cannot write into it. You have to setup the Flash Controller registers before you can Erase or Write Flash memory. This is described in the User's Guide. And there are code examples.
  • Yes, I am aware of this.

    But if I manually edit the generated TI-TXT file and place for example 

    @1000
    01 02 03

    at the top of the file, data are actually written at that specific memory location.

    So is there a way to do that in another way instead of manually editing the TXT file?

  • When you use PC to generate that TI-TXT file, the MSP430G2552 on your LP is totally unaware of it. Subsequently, you have to use some MSP430 development tool, such as CCS, to read that PC file, understand what it means, and write those bytes into the Flash memory of the MSP430 chip. CCS is designed to do so and will utilize the Flash Controller on the MSP430 to accomplish that task.
    On the other hand, when you write your own source code, CCS will translate that into object code, put the object code into the MSP430, and run it. Your code is on the driver’s seat. If your code does not utilize the Flash Controller, it will not be able to change the Flash memory.
  • The CCS compiler treated 'DATA_SECTION' as a normal Read/Write RAM segment and will during boot try to write the '0' to InfoD, in what it will not succeed.
    Change DATA_SECTION into CODE_SECTION.
  • Chris,

    I misunderstood you. I thought you want to write code to do it. Leo is right. CCS could do it for you at download time before your code is running.

    --OCY
  • Found the solution. 

    The very first code I wrote was correct with one change. Compiler was optimizing the code so I added volatile at variable.

    #pragma DATA_SECTION (var, ".infoD")
    volatile const int var = 0;

    Thank you both for your time. :)

**Attention** This is a public forum