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.

TMS320F28377D: IDDK_PM_Servo_F2837x Project (LOG_DATA)

Part Number: TMS320F28377D

Hello,

We purchased the DesignDRIVE Development Kit IDDK v2.2.1 and I have a question on the  IDDK_PM_Servo_F2837x project.

With reference to the IDDK_PM_Servo_F2837x project, the file of IDDK_Servo_F2837x_RAM_lnk_cpu1.cmd contains the following statement at Line 104 :

        LOG_DATA :  > RAMGS10_15,     PAGE = 1

It seems that LOG_DATA is associated with the variables for Datalog module: DBUFF_4CH1[200], DBUFF_4CH2[200], DBUFF_4CH3[200], and DBUFF_4CH4[200].

However I am not able to find out the file in which the relevance between  LOG_DATA and the variables for Datalog module is declared.

Please advise me.

Thank you for guidance.

With regards,

G. Kim

  • I don't see the reference you mentioned. Nevertheless, that is besides the point. Here below is the answer though.

    The example below shows how to allocate variables in a certain specific data section. I have used the same 'LOG_DATA' reference that you mentioned to create it. Hope it helps.

    #pragma DATA_SECTION(DBUFF_4CH1, "LOG_DATA")

    #pragma DATA_SECTION(DBUFF_4CH2, "LOG_DATA")

    #pragma DATA_SECTION(DBUFF_4CH3, "LOG_DATA")

    #pragma DATA_SECTION(DBUFF_4CH4, "LOG_DATA")

    #pragma DATA_SECTION(DlogCh1, "LOG_DATA")

    #pragma DATA_SECTION(DlogCh2, "LOG_DATA")

    #pragma DATA_SECTION(DlogCh3, "LOG_DATA")

    #pragma DATA_SECTION(DlogCh4, "LOG_DATA")

    #pragma DATA_SECTION(dlog_4ch1, "LOG_DATA")

    float32_t DBUFF_4CH1[200],

    DBUFF_4CH2[200],

    DBUFF_4CH3[200],

    DBUFF_4CH4[200],

    DlogCh1,

    DlogCh2,

    DlogCh3,

    DlogCh4;

  • Dear Ramesh,

    Thank you for your review.

    I have found out the following declarations in the file of IDDK_PM_Servo_F2837x.c.

    // ****************************************************************************
    // Variables for Datalog module
    // ****************************************************************************
    float DBUFF_4CH1[200],
          DBUFF_4CH2[200],
          DBUFF_4CH3[200],
          DBUFF_4CH4[200],
          DlogCh1,
          DlogCh2,
          DlogCh3,
          DlogCh4;

    However I am not able to find out any file that contains the following statements that you mentioned.

    #pragma DATA_SECTION(DBUFF_4CH1, "LOG_DATA")

    #pragma DATA_SECTION(DBUFF_4CH2, "LOG_DATA")

    #pragma DATA_SECTION(DBUFF_4CH3, "LOG_DATA")

    #pragma DATA_SECTION(DBUFF_4CH4, "LOG_DATA")

    #pragma DATA_SECTION(DlogCh1, "LOG_DATA")

    #pragma DATA_SECTION(DlogCh2, "LOG_DATA")

    #pragma DATA_SECTION(DlogCh3, "LOG_DATA")

    #pragma DATA_SECTION(DlogCh4, "LOG_DATA")

    #pragma DATA_SECTION(dlog_4ch1, "LOG_DATA")

    Thank you for your guidance.

    With regards,

    G. Kim

  • I did not mention that it was in any file. I tried to show an example of how to declare the section and assign variables in it.

  • Dear Ramesh,

    I appreciate your review.

    I have included the contents of the file of IDDK_Servo_2837x_RAM_lnk_cpu1.cmd below.

    Even though the following #pragma DATA_SECTIONs have not been declared explicitly, it seems that LOG_DATA is associated with the variables for Datalog module by some ways: DBUFF_4CH1[200], DBUFF_4CH2[200], DBUFF_4CH3[200], and DBUFF_4CH4[200].

    Please advise me how the variables for Datalog module are related to the "LOG_DATA" in this ccs project.

    You are not reaching to the point what I am concerned about.

    Please hand over this issue to another TI expert if you do not know well.

    Thank you for your guidance.

    With regards,

    G. Kim

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    #pragma DATA_SECTION(DBUFF_4CH1, "LOG_DATA")

    #pragma DATA_SECTION(DBUFF_4CH2, "LOG_DATA")

    #pragma DATA_SECTION(DBUFF_4CH3, "LOG_DATA")

    #pragma DATA_SECTION(DBUFF_4CH4, "LOG_DATA")

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------

    /*CLA_SCRATCHPAD_SIZE = 0x30;
    --undef_sym=__cla_scratchpad_end
    --undef_sym=__cla_scratchpad_start
    */
    MEMORY
    {
    PAGE 0 :
       /* BEGIN is used for the "boot to SARAM" bootloader mode   */

       BEGIN            : origin = 0x000000, length = 0x000002
       RAMM0            : origin = 0x000002, length = 0x0003FE
       RAMLS0LS1LS2LS3LS4LS5     : origin = 0x008000, length = 0x003000
       RAMGS456789  : origin = 0x010000, length = 0x006000

       RESET            : origin = 0x3FFFC0, length = 0x000002

    PAGE 1 :

       BOOT_RSVD       : origin = 0x000002, length = 0x000120     /* Part of M0, BOOT rom will use this for stack */
       RAMM1           : origin = 0x000400, length = 0x000400     /* on-chip RAM block M1 */
       //RAMD1           : origin = 0x00B800, length = 0x000800
       //RAMLS3          : origin = 0x009800, length = 0x000800
       CLA1_MSGRAMLOW  : origin = 0x001480, length = 0x000080
       CLA1_MSGRAMHIGH : origin = 0x001500, length = 0x000080

       RAMD0D1     : origin = 0x00B000, length = 0x001000

       RAMGS0GS1      : origin = 0x00C000, length = 0x002000

       RAMGS2      : origin = 0x00E000, length = 0x001000
       RAMGS3      : origin = 0x00F000, length = 0x001000
    /*   RAMGS4      : origin = 0x010000, length = 0x001000
       RAMGS5      : origin = 0x011000, length = 0x001000
       RAMGS6      : origin = 0x012000, length = 0x001000
       RAMGS7      : origin = 0x013000, length = 0x001000
       RAMGS8      : origin = 0x014000, length = 0x001000
       RAMGS9      : origin = 0x015000, length = 0x001000 */
       RAMGS10_15  : origin = 0x016000, length = 0x006000
    /*
       RAMGS10     : origin = 0x016000, length = 0x001000
       RAMGS11     : origin = 0x017000, length = 0x001000
       RAMGS12     : origin = 0x018000, length = 0x001000
       RAMGS13     : origin = 0x019000, length = 0x001000
       RAMGS14     : origin = 0x01A000, length = 0x001000
       RAMGS15     : origin = 0x01B000, length = 0x001000
    */
       CPU2TOCPU1RAM   : origin = 0x03F800, length = 0x000400
       CPU1TOCPU2RAM   : origin = 0x03FC00, length = 0x000400
    }


    SECTIONS
    {
       codestart        : > BEGIN,     PAGE = 0
       //ramfuncs         : > RAMM0      PAGE = 0
       .text            : >>RAMM0 | RAMLS0LS1LS2LS3LS4LS5 | RAMGS456789,   PAGE = 0
       .cinit           : > RAMM0 | RAMLS0LS1LS2LS3LS4LS5,     PAGE = 0
       .pinit           : > RAMM0,     PAGE = 0
       .switch          : > RAMM0,     PAGE = 0
       .reset           : > RESET,     PAGE = 0, TYPE = DSECT /* not used, */

       .stack           : > RAMM1,     PAGE = 1
       .ebss            : > RAMD0D1|RAMGS0GS1,     PAGE = 1
       .econst          : > RAMD0D1|RAMGS2,     PAGE = 1
       .esysmem         : > RAMD0D1,     PAGE = 1
       Filter_RegsFile  : > RAMGS0GS1,    PAGE = 1

    #ifdef __TI_COMPILER_VERSION__
       #if __TI_COMPILER_VERSION__ >= 15009000
        .TI.ramfunc : {} > RAMM0,      PAGE = 0
       #else
        ramfuncs    : > RAMM0      PAGE = 0
       #endif
    #endif

       //warn this is not right!
       Cla1Prog         : > RAMLS0LS1LS2LS3LS4LS5, PAGE=0
       /*ClaData         : > RAMLS5, PAGE=1*/
       Cla1ToCpuMsgRAM  : > CLA1_MSGRAMLOW,   PAGE = 1
       CpuToCla1MsgRAM  : > CLA1_MSGRAMHIGH,  PAGE = 1
    /*   CLAscratch       :
                           { *.obj(CLAscratch)
                            . += CLA_SCRATCHPAD_SIZE;
                            *.obj(CLAscratch_end) } >  RAMLS5,  PAGE = 1

       .bss_cla      : > RAMLS5,   PAGE = 1
       .const_cla     : > RAMLS5,   PAGE = 1
    */
       /* The following section definitions are required when using the IPC API Drivers */
        GROUP : > CPU1TOCPU2RAM, PAGE = 1
        {
            PUTBUFFER
            PUTWRITEIDX
            GETREADIDX
        }
       
        GROUP : > CPU2TOCPU1RAM, PAGE = 1
        {
            GETBUFFER :    TYPE = DSECT
            GETWRITEIDX :  TYPE = DSECT
            PUTREADIDX :   TYPE = DSECT
        }

        LOG_DATA :  > RAMGS10_15,     PAGE = 1
    }

    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */

  • Geon,

    I looked at the native installed files in the IDDK as well and also did not see these variable declarations in the files you mention.  Perhaps as part of a lab these sections were added isntructionally.

    In any case the section name, you see defined in the .cmd file.  So "LOG_DATA" is a data section that will be inside RAMGS10_15 in data space(PAGE = 1)

    If we look back up in the .cmd file we see that RAMGS10_15 is defined with origin 0x16000 and length = 0x6000.  Here we see that the previous definition of each RAM block indivisually (RAMGS10, RAMGS11, etc) has been commented out.

    Now, in the .c file you have the arrays for the data log defined here:

    float DBUFF_4CH1[200],
    
         DBUFF_4CH2[200],
    
         DBUFF_4CH3[200],
    
         DBUFF_4CH4[200],
    
         DlogCh1,
    
         DlogCh2,
    
         DlogCh3,
    
         DlogCh4;

    At this point if we did not add the #pragma staments in the same .c file the linker would place all of these vairable in any free memory location it had available.  It could also choose to break up the order and put in different blocks, etc.  This could potentially make the datalog storage or fetching un-optimal as well as make the main code more fragmented then previously, especially keeping in mind this is for debug and would likely not be in the final code for production.

    So, with the use the #pragma statements we now tell the linker to put all the datalog arrays in the LOG_DATA section we defined int the linker which are in a contiguous space from 0x16000 - 0x1C000, as well as knowing there is no other main code variables or program code in this region.

    Best,

    Matthew