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.

INFOA section not being initialized correctly

Other Parts Discussed in Thread: MSP430F5310, MSP430F5438A

Hello,

  I am using CCS v5.5.  In the code I have a variable assigned to a section which looks like the following:

#pragma DATA_SECTION (MSPVpdMemory,  ".infoA");
MspData_t MSPVpdMemory =
{
    {
        0x1234,         /* Major Version */
        0x5678,         /* Minor Version */
        0x9ABD          /* Build Info    */
    }
};

   In the linker directives the following is defined:

MEMORY
{
....
INFOA : origin = 0x1980, length = 0x0080
INFOB : origin = 0x1900, length = 0x0080
INFOC : origin = 0x1880, length = 0x0080
INFOD : origin = 0x1800, length = 0x0080
...
}

SECTIONS
{
... 
.infoA : {} > INFOA /* MSP430 INFO FLASH MEMORY SEGMENTS */
.infoB : {} > INFOB
.infoC : {} > INFOC
.infoD : {} > INFOD
...
}

When I look in the map file I see the following entries:

.infoA 0 00001980 00000006 UNINITIALIZED
00001980 00000006 vpdData.obj (.infoA)

00001980   MSPVpdMemory

When I look at the generate TI-TXT file, the data is located within the the FLASH section of @8000.  When I start a debug session and the code is downloaded to the MSP430 then using the Memory Browser to look at address 0x001980 all I see are FFs from addresses 0x1980-0x19FF.  The Memory Browser shows the variable MSPVpdMemory should be at that location.  

Why is the INFOA section not being populated correctly?  Perhaps I am setting something up incorrectly?

Regards,

Mark

 

  • Some of the MSP chips have hardware protection of Info-A Flash memory.

    In general, the MSP hardware has many "fail-safe features" that disobey your commands in order to "protect" you. The development software tools also has the features to disregard some of your code without telling you.

    Try what you did with Info-B instead. 

  • Did you in CCS Project\Properties enable Debug\MSP430 Properties\Erase main, information and protected information memory?

  • By the way, if properties are not correct you should get an error in this case.

    Mark Hicks said:
    FLASH section of @8000

    But this is not correct, you should see a @1980 section.


  • Hello old_cow_yellow,

      I tried all four (4) INFO sections and I see similar results.  It seems as you said, the tool is trying to protect me, but I rather it explicitly state an error during the build process letting me know other than compiling without issue and allowing me to think all it well, until I go to verify it.

    Regards,

    Mark

  • Leo,

      I tried this suggestion and it may work for the debugger (I tried, but it didn't seem to help), but I need it in the output file of TI-TXT as it gets post processed and transformed to a binary which is ultimately stored in a EEPROM then using downloaded to the MSP430 via the BSL.  So, I need to figure out why the build process is not creating this section.  

    Regards,

    Mark

  • See Leo Bosch's reply. Have the tool generate a TI-TXT output file. You should see a line

    @1980
    
    <ascii-hex bytes here....>
    
    @8000
    
    <rest of program's ascii-hex bytes here...>

    As mentioned, you have to tell the programming software that it is ok to erase/reprogram INFOA, as this is often used for calibration data in some MSP430 devices.

  • Brian,

      Thanks for the update, but I think that is where I am lost.  How do I tell the build process/tool that it is okay to program that section?  If I go to section in the properties and for Download Option (under Project Properties -> Debug -> MSP430 Properties -> Download Options then select either "Erase main and information memory" or "Erase main, information and protected information memory" I still don't see this section in the TI-TXT output.  Is there another place that I need to enable access to this protected field?  This configuration seems to affect the debug (which I will assume is the JTAG debugger) and not the build process.  For the final design, I am using the TI-TXT file (post processed as a store binary image) and not the debugger.  I know I am doing something wrong, but where?

    Regards,

    Mark

  • Mark Hicks said:
     I know I am doing something wrong, but where?

    I don't know.

    First, it would help others to know which exact part you are using. Different MSP430 families handle the INFO memory in slightly different ways.

    Second, I don't use CCS, only IAR. The method is different between the two tools.

    Mark Hicks said:
    I still don't see this section in the TI-TXT output.

    This part is (should) be separate from the programming setting. Something is up at the compile/link stage that is preventing that section from being created. Can you generate a map output file and see where your data structure was placed?

  • Brian,

      Oh, I apologize, I thought I had listed the part number.  I am using a MSP430F5310 part.  In the map file it does show the data structure does get placed in one of the INFOx sections that I assign it using the pragma statement as seen here:

    .infoD     0    00001800    00000006     UNINITIALIZED
                      00001800    00000006     vpdData.obj (.infoD)

    and

    00001800   MSPVpdMemory

    Perplexing...

    Regards,

    Mark

  • Your last post shows that the tools believe it is unitialized data. If it is uninitialized, then the tool doesn't need to program it.

    I think it needs to be marked as constant data. I would check the CCS tools reference documentation on how to do that.

  • Brian,

      You saw that too, eh?  I find it odd that everything in the map file is tagged as uninitialized.

    SECTION ALLOCATION MAP
    
     output                                  attributes/
    section   page    origin      length       input sections
    --------  ----  ----------  ----------   ----------------
    .init_array 
    *          0    00008000    00000000     UNINITIALIZED
    
    .infoD     0    00001800    00000006     UNINITIALIZED
                      00001800    00000006     vpdData.obj (.infoD)
    
    .bss       0    00001c00    00000114     UNINITIALIZED
                      00001c00    0000008a     (.common:RxDesc)
                      00001c8a    0000008a     (.common:TxDesc)
    
    .TI.noinit 
    *          0    00001c00    00000000     UNINITIALIZED
    
    .data      0    00001d14    000000d2     UNINITIALIZED
                      00001d14    00000080     vpdData.obj (.data:VpdMemory)
                      00001d94    00000022     exec.obj (.data)
                      00001db6    00000010     uart.obj (.data:TestTxBuffer$3)
                      00001dc6    00000006     exec.obj (.data:FGExecTable)
                      00001dcc    00000005     uart.obj (.data)
                      00001dd1    00000001     --HOLE--
                      00001dd2    00000004     exec.obj (.data:BGExecTable)
                      00001dd6    00000004     adc.obj (.data)
                      00001dda    00000004     mspvpd.obj (.data)
                      00001dde    00000004     smbus.obj (.data)
                      00001de2    00000002     timer.obj (.data)
                      00001de4    00000002     vpd.obj (.data)
    
    .TI.persistent 
    *          0    00001d14    00000000     UNINITIALIZED
    
    .stack     0    00003360    000000a0     UNINITIALIZED
                      00003360    00000002     rts430x_lc_sd_eabi.lib : boot.obj (.stack)
                      00003362    0000009e     --HOLE--

    I have really must have flipped a switch or something within CCS or the map file is wrong.  The data that is supposed to go into the INFOx section is there, but it is in section under @8000 in the TI-TXT file. Strange.  I will keep trying different things to see if I can get it to work.

    Regards,

    Mark

  • Mark Hicks said:
     The data that is supposed to go into the INFOx section is there, but it is in section under @8000 in the TI-TXT file.

    Is it trying to initialize the data at runtime? I think a const designator might need to be used to fix this.

  • Mark Hicks said:
    #pragma DATA_SECTION (MSPVpdMemory, ".infoA"); MspData_t MSPVpdMemory = { { 0x1234, /* Major Version */ 0x5678, /* Minor Version */ 0x9ABD /* Build Info */ } };

    MSPVpdMemory is here defined as RAM-data that you change the section doesn’t change the definition. The pre-initializing is stored in code-section which will be executed during start-up and writes the (code) data to MSPVpdMemory which isn’t possible while the data is in a Flash section.

    You need to declare MSPVpdMemory as const-data or put it into a CODE-segment.

  • Hello Leo/Brian,

      Thanks!  Adding the "const' did the trick.  I can see the reasoning of adding the const to make it be placed into a Flash section, but it seems that would be inferred by placing it into the INFOx to begin with.  The build tools should know that, but at the moment I am not going to fret as the TI-TXT file does contain the data I need.  Happy camper.

    @1800
    34 12 78 56 BD 9A

    Regards,
    Mark

  • Brian,

      One last question, what do you mean by "CODE-segment"?

    Regards,

    Mark

  • Memory Sections declared in the Linker Command file are just locations and doesn’t specify if RAM or FLASH the linker is also unknown of this. Default all variables are placed into a Data-section which indicates RAM and defaults to the .bss (or .data) Memory-section and code into the Code-section which indicates FLASH and defaults to the .text Memory-section. If a variable is declared const the compiler will treat this Data(-section) as constant Code placed into to the .const Memory-section.

    The pragma Data-section(memory-section) switches to Data and overrules the default .bss memory-section but still treat it as RAM. The pragma Code-section(memory-section) switches to Code and overrules the default .text memory-section and treat this as FLASH, on this way it’s possible to place Data into FLASH but as I remember this will throw some problems.

  • Hello, i have a similar problem, but in my case it dosen't even appear as UNITIALIZED.

    I'm using an msp430f5438a micro controller  and i want to write to INFOA memory region (because of the LOCKA i'm testing it on B with the same result).
    I defined a structure in a info_memory.h file like this:

    //	Defines & Data Types
    ///////////////////////////////////////////
    
    #define	INFOMEM	0x1800	/* END=0x19FF, size 512 as 4 128-byte segments */
    #define INFOA	0x1980	/* END=0x19FF, size 128 */
    #define INFOB	0x1900	/* END=0x197F, size 128 */
    #define	INFOC	0x1880	/* END=0x18FF, size 128 */
    #define	INFOD	0x1800	/* END=0x187F, size 128 */
    
    
    /////////////				INFO A				/////////////
    
    typedef struct _mrm_info_table{			// 128Byte Info-A
    	const char		info[32];	// 32Byte	|
    	const uint16_t	clk_config[9];		// 18Byte       6
    	const uint8_t	options[10];		// 10Byte       4
    	const uint32_t	app_guest_pointer;	// 4Byte	|
    /////////////////////////////////////////////
    	const uint64_t	ipv6_upper;		// 8Byte	|
    	const uint64_t	eui_64;			// 8Byte	6
    	const uint8_t	more_options[48];	// 48Byte	4
    	//							|
    } mrm_info_table;

    and in my main.c file i declare with a pragma where i want to put, and what i want to put there:

    #define MOTE_NUMBER	16
    
    //	Global Vars
    ///////////////////////////////////////////
    //Static
    //#pragma location=INFOA
    #pragma DATA_SECTION (mrm_info,  ".infoB");
    const mrm_info_table mrm_info = {
       "--MRMv03.00 - build 2016/05/19--",              //info[32]
       0x0000,	                                    //clk_config.UCSCTL0
       0x0020,	                                    //clk_config.UCSCTL1
       0x101F,	                                    //clk_config.UCSCTL2
       0x0000,	                                    //clk_config.UCSCTL3
       0x0044,	                                    //clk_config.UCSCTL4
       0x0000,	                                    //clk_config.UCSCTL5
       0xC10D,	                                    //clk_config.UCSCTL6	0xC1CD nao precisamos de drive tao alto
       0x0703,	                                    //clk_config.UCSCTL7
       0x0707,	                                    //clk_config.UCSCTL8
       "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF",	    //options[10]
       0xFFFFFFFF,		                            //app_guest_pointer Set Empty
       0xCAFE000000000000,                              //ipv6_upper
       (0x0200000000000000 | MOTE_NUMBER),              //eui_64
       ""		                                    //more_options[48]
    };

    I tried to use everything:
    Diferent declarations

    #pragma location=INFOA

    #pragma DATA_SECTION (mrm_info, ".infoB");

    I also checked and corrected the project definitions to Erase Main Memory, BSL area and protected BSL (INFOA)

    Also added the const to my structure and the result is always the same, nothing appears to be loaded into the BSL or it say it is unitializer... (am i missing some flag? or option?)

    This is my map file:

    PERIPHERALS_16BIT     00000100   00000100  00000000  00000100  RWIX
    INFOD                 00001800   00000080  00000000  00000080  RWIX
    INFOC                 00001880   00000080  00000000  00000080  RWIX
    INFOB                 00001900   00000080  00000000  00000080  RWIX
    INFOA                 00001980   00000080  00000000  00000080  RWIX
    RAM                   00001c00   00003f80  000000e6  00003e9a  RWIX
    RAM_INT               00005b80   00000080  00000000  00000080  RWIX
    FLASH                 00005c00   00001400  00001188  00000278  RWIX

    Can someone help me? Thanks -> https://www.youtube.com/watch?v=3cShYbLkhBc

**Attention** This is a public forum