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.

TMS320F280041C: ramfunc attribute

Part Number: TMS320F280041C

Hello,

The --ramfunc=on option is equivalent to specifying the attribute on all functions in translations units compiled with the option, with no source modification required.

Does "all functions" include the "main" function ,as my understanding ,we need to use the memcpy function to copy the functions in the TI.ramfunc. from flash to RAM in the main function, so main function will be executed in flash, right?

So does it mean "all functions except main function"?

On flash-based devices, the BINIT functionality may be used to automatically copy the code to RAM for execution at boot:

 .TI.ramfunc : {} load=FLASH, run=RAM, table(BINIT)

what does this mean? Does it mean we do not need to use memcpy function to copy the function from flash to ram and it will finish it automatically?

  • If --ramfunc=on is used when building the source file which contains the function main, then main is placed in the section .TI.ramfunc.

    huijin Wang said:
    as my understanding ,we need to use the memcpy function to copy the functions in the TI.ramfunc. from flash to RAM

    That is one way to do it.  But it is not the only way.

    huijin Wang said:
    in the main function, so main function will be executed in flash, right?

    You are correct to point out that all of the code which executes, from power on until the functions in the section .TI.ramfunc are copied from flash to RAM, must be in flash.  If main performs that copy, then it must be in flash to do it.

    As to this line of code from a linker command file ...

    huijin Wang said:
    .TI.ramfunc : {} load=FLASH, run=RAM, table(BINIT)

    This forms an output section named .TI.ramfunc.  It is made up of all the input sections named .TI.ramfunc.  It is allocated a load address in FLASH, and a run address in RAM table(BINIT)creates a copy table.  This copy table is located in the .binit section.  The system startup code provided in the RTS library that comes with the C28x compiler automatically detects when there is one or more copy tables in the .binit section.  When present, they are used to copy the associated code or data as needed.  In this particular case, this means the startup code automatically detects the copy table entry for .TI.ramfunc, and uses it to copy the section from FLASH to RAM.  For further details, please search the C28x assembly tools manual for the sub-chapter titled Generating Copy Tables With the table() Operator.  The details on BINIT are in the sub-chapter titled Boot-Time Copy Tables.

    Thanks and regards,

    -George