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.

TMS320F28379D: location of Pragma CODE_SECTION(".TI.ramfunc")

Part Number: TMS320F28379D

Tool/software:

Hi,

The program structure I am testing involves multiple functions that get called from a one or two ISRs.

The program is loaded to the flash memory and to allow execution from RAM I included  #pragma CODE_SECTION(".TI.ramfunc"); . Do I need to do this for all the functions that get called inside the ISRs or are the functions automatically executed from RAM? . I also have some global variables. Do I need to change the way they are defined?

Thank you,

Aditya

  • Hi Aditya, 

    You need to include the #pragma CODE_SECTION(".TI.ramfunc") for all the functions that is loaded to flash and executed from RAM.

    Please have a look at similar thread - (+) CCSTUDIO-C2000: issue about the CODE_SECTION Pragma - C2000 microcontrollers forum - C2000Tm︎ microcontrollers - TI E2E support forums

    Thanks

    Aswin

  • Hi Aswin,

    Thanks for the link to the thread. I did not understand the effect of optimization.

    Basically if I have 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    interrupt void ISR1()
    {
    function1();
    }
    void function1()
    {
    Statements...;
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Do I need to include it just as 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    #pragma CODE_SECTION(".TI.ramfunc")·
    interrupt void ISR1()
    {
    function1();
    }
    void function1()
    {
    Statements...;
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    OR 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    #pragma CODE_SECTION(".TI.ramfunc")·
    interrupt void ISR1()
    {
    function1();
    }
    #pragma CODE_SECTION(".TI.ramfunc")·
    void function1()
    {
    Statements...;
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    And if we need to include it before every function, is there an easier way to do that if there are a large number of functions? If the function to be executed does not need to be fast, but is called relatively frequently, is there any problem with executing it without loading it to RAM first? 

    Thanks,

    -Aditya

  • Hi Aditya,

    You need to follow the second approach. You need to add it before the function that is to be executed from RAM.

    Please take reference from driverlib code from flash.h/.c files for these #pragma defines.

    We need to add it individually for all the fiunctions.

    Thanks

    Aswin

  • Thanks for the clarification. Other than reduced performance, would it have any problems if I do not include this for all functions that are being called by ISR1() ?

    Thank you,

    Aditya

  • Hi Aditya,

    If you need to execute from RAM, it should be having the Pragma format.

    There will not be other problems if you do not include all the functions. 

    I am closing this ticket for now, let me know if you need further help.

    Thanks

    Aswin