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.

Custom Code Sections - Determining Beginning and End within C source

Hello,

 

I have a question regarding the use of the CODE_SECTION pragma.

Specifically once you set-up a CODE_SECTION is there a way to access the start and end address of the section within your C source file?

The linker seems to make some nice symbols for the .text section automatically. These are __text__ and __etext__, which are the start and end addresses for the text section. But does nothing for user defined sections.

 

Anyone have some ideas?

 

Thanks and best regards,

David.

  • Ah. The MSP430 Assembly language Tools User Guide (SLAU131B.pdf) provides some useful hints.

    Section "7.13.2 Assigning the SPC to a Symbol" introduces the dot symbol which can be used when generating your sections. So for example

    SECTIONS

    {

      .bss : {} > RAM

      .mysection :

      {

        _mysection = .;

        *(.mysection)

        _emysection = .;

      } > RAM

    }

     

    There will now be two nice symbols (_mysection and _emysection) for use within your code files which will represent the start and end address of .mysection.

     

    Regards,

    David.

**Attention** This is a public forum