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.

C2000-DIGITAL-CONTROL-LIBRARY: How to know what memory is available for use as an array when using the Data Logger functions

Part Number: C2000-DIGITAL-CONTROL-LIBRARY

Hi all,

In the digital control examples that TI provides, the code stores the controller efforts and coefficients into arrays, using data logger function as below:

#define DATA_LENGTH 1601

// input data
#pragma DATA_SECTION(e_array, "PDataLogSection")
float e_array[DATA_LENGTH];
FDLOG eBuf = FDLOG_DEFAULTS;

// full controller results
#pragma DATA_SECTION(u1_array, "QDataLogSection")
float u1_array[DATA_LENGTH];
FDLOG u1Buf = FDLOG_DEFAULTS;

// pre-computed controller results
#pragma DATA_SECTION(u2_array, "RDataLogSection")
float u2_array[DATA_LENGTH];
FDLOG u2Buf = FDLOG_DEFAULTS;

// controller difference data
#pragma DATA_SECTION(d_array, "SDataLogSection")
float d_array[DATA_LENGTH];
FDLOG dBuf = FDLOG_DEFAULTS;

How does one know what the different sections are on their particular processor, and do they change across each processor?

How do we know whether the sections are already in use to store other parts of the code, and how do we know it is otherwise safe to set these sections as array storage?

Best,
Joel

  • In addition, the linker file must be changed, to assign these sections to the arrays.

    /* data buffers */
    PDataLogSection : > RAML5, PAGE = 1 align(2)
    QDataLogSection : > RAML6, PAGE = 1 align(2)
    RDataLogSection : > RAML7, PAGE = 1 align(2)
    SDataLogSection : > RAML8, PAGE = 1 align(2)

    If I use the default linker file for the F2837xD processors, is it as simple as just pasting these lines into my linker command file SECTION region, to dedicate the memory to them, or is it more complicated?

    I assume that the compiler would tell me if I have not enough space in the linker command file, or whether a piece of memory already contains code/info?

  • Hi Joel,

    You can verify the placement of array in memory in the map file generated during linking of the build process. By default, the tool chain will generate a map file with name of ${ProjName}.map in the output folder. The map file output can be configured as below.

    Hope this helps.

    Han

  • Hi Han,

    Is it true that I can just insert the additional lines of code for my data buffers into the original F2837xD linker file, or will I need to create another one?

    Maybe my question was confused - how do I know what sections of memory are free, so that I can assign them to an array?

  • Joel,

    You are correct. If the section you specified in linker command file is not large enough for the data, linker will report error and will not generate image successfully. If you specify a section that is not defined in linker command file, linker will give a warning and put the data in default section. Thanks.

    Han