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.

variable size error in map file



Folks,

I need to generate a global variable list in my project, including variable name, memory address and size. What I did is compiling the project, parse the MAP file with my perl script. Everything looks just fine, then I noticed one global variable declared as "unsigned int", but its size is 32bit, which shall be 16bit. Then I go back to map file and manually check the memeory address of this variable and its adjacent variable, the difference of two address is 32bit. And I found another similar variable size error in variable list, the extreme case is one "float" variable has size of 144bit.  I am using Code Generation Tools v5.2.4, my target platform is F28335,  CCS version is 3.3.80.11. I guess this is correlated with the compiler, any ideas?

Thanks

Tim

 

  • Tim xu said:

    Folks,

    I need to generate a global variable list in my project, including variable name, memory address and size. What I did is compiling the project, parse the MAP file with my perl script. Everything looks just fine, then I noticed one global variable declared as "unsigned int", but its size is 32bit, which shall be 16bit. Then I go back to map file and manually check the memeory address of this variable and its adjacent variable, the difference of two address is 32bit. And I found another similar variable size error in variable list, the extreme case is one "float" variable has size of 144bit.  I am using Code Generation Tools v5.2.4, my target platform is F28335,  CCS version is 3.3.80.11. I guess this is correlated with the compiler, any ideas?

    Thanks

    Tim

     

    Tim,

    32-bit values are always even aligned on 28x.  So it is possible that there is a hole in the memory map between a 16-bit and a 32-bit value to preserve this alginment.

    Example:

    Address

    0x0000         int
    0x0001         hole
    0x0002         32-bit value
    0x0004         32-bit value
    0x0006         int
    0x0007         hole
    0x0008         32-bit

    Does this explain what you observe?

    Regards,
    -Lori

  • Lori,

    Thanks for you reply, I am sorry for not getting back timely. I didn't agree that the problem is caused by memory alignment, here I grab one piece from my map file

    0000c512   _variable_float_x
    0000c514   _variable_float_y
    0000c516   _variable_int_z
    0000c540   _variable_others


    first column is variable address, second column is variable name

    where you find variable_float_x, variable_float_y have correct size, whereas the size of  variable_int_z is wrong. And I don't see any memory alignment issue in this case.

    Tim

  • Tim xu said:

    Lori,

    Thanks for you reply, I am sorry for not getting back timely. I didn't agree that the problem is caused by memory alignment, here I grab one piece from my map file

    0000c512   _variable_float_x
    0000c514   _variable_float_y
    0000c516   _variable_int_z
    0000c540   _variable_others


    first column is variable address, second column is variable name

    where you find variable_float_x, variable_float_y have correct size, whereas the size of  variable_int_z is wrong. And I don't see any memory alignment issue in this case.

    Tim

    Tim,

    0xC540 is a page boundary.  Is "variable_others" an array or structure? It sounds like it is being blocked to a page boundary so the compiler can use a data page offset to access it. 

    See these links for more information:

    http://e2e.ti.com/support/development_tools/compiler/f/343/p/61913/222193.aspx

    http://e2e.ti.com/support/microcontrollers/tms320c2000_32-bit_real-time_mcus/f/171/t/21702.aspx

    This Wiki may also be useful:

    http://processors.wiki.ti.com/index.php/C28x_Compiler_-_Understanding_Linking#Q:_The_linker_says_.22placement_fails_for_object.22_but_the_available_memory_is_larger_than_the_section

    Regards,

    -Lori

     

     

     

     

  • Lori,

    Your reply has been verified as answer to my question. There are two types of memory alignment in my case. One is 32bit alignment described in your first reply and the other is page boundary. 

    Again, thank you

    Tim