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.

Issue understanding the pragma directive

Other Parts Discussed in Thread: CCSTUDIO

Hello fellow forum friends.

I am having some difficulty allocating a block of data using a pragma directive.

The issue is the block seems to be being allocated in two places.
The first, incorrectly, is in the .cinit section,
and the second is in the section I call out in the pragma.

The .cinit section is actually larger then the 5120 words of data I want to store, because there is other constant data in the C program. If it did not include the erroneous data, it would be small enough to fit properly.

I am using Code Composer 3.3MCU. I know it is an older version, but it came with the evaluation unit I purchased.

=========================================
Following are the relevant code and CCS output snippits:

-----------------------------------------
In a routine I am writing for communication with the ADAU...

// FIle: ReadWriteADAUCode.c

#include "(some stuff)"
#pragma DATA_SECTION(adau_prog, "adauprog");
    char adau_prog[] =
    {
#include "adau_program_data.dat"
    };

-----------------------------------------
The first few lines of adau_program_data.dat (please note this file contains 5120 bytes (or 0x1400) of info) of course, Code Composer will allocate this many 16 bit words, and I will consider packing the data to reduce storage later....

0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x18, 0x00, 0xE8, 0x01,
0xFF, 0xF2, 0x00, 0x20, 0x01,

-----------------------------------------
The relevant parts of the CMD file for the linker:

MEMORY
{
PAGE 0 :
    /* Program Memory */
    RAMM0        : origin = 0x000050, length = 0x0003B0
    progRAM        : origin = 0x008000, length = 0x000800

PAGE 1 :
    /* Data Memory */
    dataRAM        : origin = 0x008800, length = 0x000800
    FLASHCD        : origin = 0x3F4000, length = 0x002000
}
SECTIONS
{
    /* Allocate program areas: */

    .cinit            : > RAMM0,    PAGE = 0
    adauprog        : > FLASHCD,    PAGE = 1, type = NOLOAD
}


-----------------------------------------
Now the linker error message...

[Linking...] "C:\CCStudio_v3.3MCU\C2000\cgtools\bin\cl2000" -@"Debug.lkf"
<Linking>
"M:\\Standalone_EQ\\Piccolo\\CMD\\F28022_RAM_StandAlone.CMD", line 119: error:
   placement fails for object ".cinit", size 0x1419 (page 0).  Available ranges:
   RAMM0        size: 0x3b0        unused: 0x3b0        max hole: 0x3b0     
    .cinit            : > RAMM0,        PAGE = 0
error: errors encountered during linking; "./Debug/StandAlone.out" not built


-----------------------------------------
And the relevant parts of the MAP file

******************************************************************************
  TMS320C2000 Evaluation Linker PC v5.2.1                      
******************************************************************************
ENTRY POINT SYMBOL: "_c_int00"  address: 00008346

MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
PAGE 0:
  RAMM0                 00000050   000003b0  00000000  000003b0  RWIX
  progRAM               00008000   00001000  00000456  00000baa  RWIX

PAGE 1:
  dataRAM               00008800   00000800  00000012  000007ee  RWIX
  FLASHCD               003f4000   00002000  00001400  00000c00  RWIX

SECTION ALLOCATION MAP

 output                                  attributes/
section   page    origin      length       input sections
--------  ----  ----------  ----------   ----------------

.cinit     0    00000000    00001419     FAILED TO ALLOCATE

adauprog   1    003f4000    00001400     NOLOAD SECTION
                  003f4000    00001400     ReadWriteADAU.obj (adauprog)


GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name

address    name
--------   ----
0000838a   _AdauTransfer
03f4000   _adau_prog

[85 symbols]
=========================================