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.

Code composer 3.3 Memory

Hi,

In my code i have an array as below and i want to place the array in flash at location SECT1

#pragma DATA_SECTION(Array,"SECT1");

int16_T Array128] = { -14848, -14848, -14848, -21760, -23040,
  -23040, -23040, -23040, -14336, -14336, -14336, -20736, -23040, -23040, -23040,
  -23040, -13824, -13824, -13824, -19456, -21760, -23040, -23040, -23040, -13056,
  -13056, -13056, -17920, -20992, -21760, -23040, -23040, -12032, -12032, -12032,
  -16128, -19456, -21248, -23040, -23040, -10752, -10752, -10752, -13824, -17664,
  -20224, -21760, -23040, -8960, -8960, -8960, -8960, -14592, -18688, -20480,
  -23040, -5632, -5632, -5632, -5632, -8704, -14336, -18944, -23040, 3840, 3840,
  3840, 3840, 3840, 7680, 9216, 23040, 5632, 5632, 5632, 5632, 9472, 11008,
  12800, 23040, 7168, 7168, 7168, 9728, 12288, 13056, 14336, 23040, 8960, 8960,
  8960, 12288, 13824, 14592, 15616, 23040, 10240, 10240, 10240, 14080, 15360,
  15872, 23040, 23040, 10752, 10752, 12288, 15616, 16896, 17664, 23040, 23040,
  11520, 11520, 14080, 17152, 18688, 23040, 23040, 23040, 11520, 11520, 15104,
  23040, 23040, 23040, 23040, 23040 } ;

SECT1 allocation in my cmd file looks as below

MEM_SECT1 : origin = 0x3D804C, length = 0x80

SECT1      :   > MEM_SECT1         ,PAGE = 0 

The array size is 128(Hex:80) so i have allocated the section(SECT1) as 0x80 but i am getting following linker error

>>   error: can't allocate SECT1, size 00000080 (page 0) in
            MEM_SECT1 (avail: 00000080)

It looks like the size required and allocated are same but i am not aware why i am getting this linker error.

Any any one suggest me how to resolve this error

 

  • Have you tried aligning a little more? Like using:

    MEM_SECT1 : origin = 0x3D8040, length = 0x80

  • The size of your array is 128 shorts which are 2 bytes each, or 256 bytes total. You will need to allocate 0x100 bytes to accomodate this array.

  • It sounds like you are using a F28xx device. All uninitialized sections created by the compiler are "blocked", and when a section is blocked the linker needs to place it either within a page or at a page boundary. Blocking ensures that each variable is fully contained in a page if it is smaller than the page size. If the variable is bigger than the page size, blocking guarantees that it starts at the page boundary. The compiler uses this information to optimize the DP load. For example, compiler can safely load DP for an array once and access all its elements (or the first 64-bytes) without reloading DP. If blocking is not enabled the compiler has to load DP for accessing each element leading to much more inefficiencies in terms of code size and performance.

    You can confirm that a particular section is "blocked" by looking at the .bss and .usect directives in the assembly listing file and checking that the blocking flag is set. The blocking flag is documented in the C28x Assembly Language Tools Users Guide, Section 2.2.1 "Uninitialized Sections", http://www-s.ti.com/sc/techlit/spru513

    In this case you would need to move the origin of the memory segment to 0x3D8040 if you want to keep the length at 0x80.