code-composer

Understanding of #pragma CODE_SECTION


I use ubuntu 20.04, code composer studio 12.00. Can you please explain for me what does it do:

#ifdef FLASH
#pragma CODE_SECTION(motor1_ISR, "ramfuncs");
#pragma CODE_SECTION(motor2_ISR, "ramfuncs");
#pragma CODE_SECTION(xint1_ISR, "ramfuncs");
#pragma CODE_SECTION(spi_ISR, "ramfuncs");
#endif

I found file F28069M_ram_lnk.cmd with this lines, but I also don't understand what does it mean:

   ramfuncs         : > RAMM0,
                        LOAD_START(_RamfuncsLoadStart),
                        LOAD_END(_RamfuncsLoadEnd),
                        RUN_START(_RamfuncsRunStart),
                        LOAD_SIZE(_RamfuncsLoadSize),

Solution

  • This helped me: What is the use of pragma code section and data section?

    In short:

    Source (contains examples): https://web.archive.org/web/20080803190119/http://hi.baidu.com/jevidyang/blog/item/6d4dc436d87e3a300b55a918.html

    Note: #pragma is compiler specific, so syntax may vary for your compiler.

    The DATA_SECTION pragma allocates space for the symbol in a section called section name. The syntax for the pragma in C could be:

    #pragma DATA_SECTION (symbol, "section name");
    

    The syntax for the pragma in C++ could be:

    #pragma DATA_SECTION ("section name");
    

    The DATA_SECTION pragma is useful if you have data objects that you want to link into an area separate from the .bss section.