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_SECTION pragma don't works well in CCS33

Hello, folks.

Recently, I'm  start to using CCS33,  a source code that  contains  CODE_SECTION  pragma don't run well.

(the project runs well in CCS22)

I'm awered that the compiler generated  ASM code is well described .sect, .global  pseudo mnemonic assembly language.

but, after linking, it seems that pseudo mnemonic is not affected well, not appears in  section list of MAP file !

so, after all, placing into aimed section is missing. final generated code is not works.

I wander, there is some hidden option limitation with using CODE_SECTION pragma using.

please someone tell me any hint with this phenomena !

thanks.

 

  • I've use the CODE_SECTION in CCS3.3. I'm sure it can works well. CODE_SECTION(function_name, section_name); put the section_name into the .cmd file
  • The problem is solved.

    in CCS3.3, program level optimization  makes the function removed.

    --- from doc.

    the compiler uses program-level optimization. When
    you use this type of optimization, the compiler removes any function that is not called, directly or indirectly,
    by main

    --- from doc end

    what I wanted to placed into specified section is BOOT LOADER, so nobody called it.

    the optimization don't works in CCS22, but CCS33 is it works in default ?

    with FUNC_EXT_CALLED pragma, the problem is solved.

    thanks

     

  • Hi,

    as Jessie already pointed out you need to put the section_name in the command file (xxx.cmd). Maybe this thread is of good use for you:

    http://e2e.ti.com/forums/p/6966/26928.aspx#26928

    Rgds
    aBUGSworstnightmare

  • OOPS !

    FUNC_EXT_CALLED pragma , don't works well.

    the functilon (no called from C code) vanishs even with this pragma !

    when it testing call from main(), the function placed to aimed section. 

    the riddle is fall deep...

     

  •  

    here is my testing project contents.

    please anyone try them  ...

     

    /*
     linker.cmd
     for C6410
    */

    MEMORY
    {

     BOOT_SECT : origin = 0x00000, len = 0x00400
     VECTOR  : origin = 0x00400, len = 0x00200
     INT_MEM  : origin = 0x00600, len = 0x1fa00

    }

    SECTIONS
    {

     .boot_load > BOOT_SECT  /* code_section  boot loader */
     .vectors > VECTOR  /* code_dection vector */

        .text  > INT_MEM  /* code_section code */
        .switch   > INT_MEM  /* switch-case table */
     .const  > INT_MEM  /* const var val */
        .cinit   > INT_MEM  /* runtime initialized var init val */

        .bss     > INT_MEM  /* global & static var */
     .sysmem   > INT_MEM  /* dynamic var */
     .data   > INT_MEM  /*  asm gen default */
        .cio      > INT_MEM  /* ??? */

        .far      > INT_MEM  /* far global & static var */
        .stack    > INT_MEM  /* system stack & local var */

    }

    //---------------------------

    /*  -------------------------------------
     BOOT.C
    */
    extern cregister volatile unsigned int CSR;
    extern cregister volatile unsigned int ICR;
    extern cregister volatile unsigned int IER;

    #define EMIF_GBLCTL  (*(volatile unsigned int*)0x01800000)
    #define EMIF_CECTL1  (*(volatile unsigned int*)0x01800004)

    #define CIPR  (*(volatile unsigned int*)0x01a0ffe4)

    #define CREG(x)(*(volatile unsigned int*)(x))
    #define QDMA_SRC  CREG(0x02000004)
    #define QDMA_CNT  CREG(0x02000008)
    #define QDMA_DST  CREG(0x0200000C)
    #define QDMA_IDX  CREG(0x02000010)
    #define QDMA_S_OPT  CREG(0x02000020)
    #define QDMA_OPTCFG  0; // dmy

    #pragma FUNC_EXT_CALLED ( c_boot );  // not works well this line ?
    #pragma CODE_SECTION ( c_boot, ".boot_load" ); // not works well this line

    void c_boot( void )
    {

    #if 1

     asm(" .ref _c_int00");
     asm(" mvkl _c_int00, B3"); // override return address as entry point
     asm(" mvkh _c_int00, B3");

     CSR &= ~1;      // di()
     IER = 3;      // Set NMIE  makes all interrupt acceptable
     ICR = 0xFFFF;     // clear all interrupt queue
     EMIF_GBLCTL = 0x3300;   //
     EMIF_CECTL1 = 0xffffff03;  // async8

     CIPR = 0xffff;
     QDMA_SRC = (unsigned int)0x90000400;
     QDMA_CNT = 0x1fc00>>2;
     QDMA_DST = (unsigned int)0x0400;
     QDMA_IDX = 0;
     QDMA_S_OPT = QDMA_OPTCFG; // start

    #endif

     while(1){
      if( CIPR != 0 ) break;
     }

    }
    //-------------------------------------

    /*
     main.c

    */
    //void c_boot( void );  // comment this line then vanishes c_boot();

    void main( void )
    {

     while(1){
     asm(" nop");
     asm(" nop");
     asm(" nop");
     asm(" nop");
    // c_boot();   // commen this line  then vanishs c_boot()
     }


    }

     

  • Try adding the Linker option "--disable_clink" in your build options. Right click on the project and select Build options. Click on the Linker tab and add the following in the box: --disable_clink.

  • Thanks Mariana ! The project works WELL !

    I have some additional question.  

    Is it same with -j option ?

    why in CCS22 is working with no -j option ?

    I think that making optimisation be improved with CCS33, option default was changed...

    I wish that the FUNC_EXT_CALLED  pragma makes it's info pass to linker with some mechanism.   

     

  • hmmm......total finally...

    I think a function that added FUNC_EXT_CALLED is should not to be added .clink directive in compile.

    It should not to be omitted automatically.

     

  • Yep, it is the -j option, please see page 26 of the  TMS320C6000 Optimizing Compiler v 6.1 User's Guide.

    For older version of code generation tools, the default would be equivalent of having the -j selected, that is why it works for CC2.2.