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 To a Named Sections when assembled

Hello everyone,

I read in the user manual the following instructions:

"Suppose there is a portion of executable code(perhaps an initialization routine) that you don't want allocated with .text. If you assembly this segment of code into a named section, it is assembled separately from .text, and you can allocate it into memory separately."

I understand what it means and I know we use .CMD to configure different sections.

But how should I assemble my code into separate sections. Say I have a program which has a subroutine, I want to put this subroutine in another section instead of .text(main program is in this section).

What should I do ?

Seems I need to do something in the process of assembly, but everything is done by the CCS, is there anywhere I can configure? the address of subroutine need to be given as the main program need to jump to that address.

 

Thank you very much.

-da

 

  • In C, you can use the CODE_SECTION #pragma to place functions in a particular output section:

    #pragma CODE_SECTION(myFxnName, ".myFxnSection");

     

    In assembly, you can use the .sect assembler directive to specify that the following assembly code will be placed in a particular section:

    .sect ".mySection"

     

    In either case the linker command file then must place the code to the correct memory using MEMORY and SECTIONS commands.

    Refer to the Compiler User's Guide and then Assembly Language Tools User's Guide for your compiler revisions.

     

    Regards, Daniel