Get start address and size of a defined linker section

Hi,

i need the start, end and the size of a section defined in linkerfile.

I use e2studio with gcc and rx630 µC.

How i can access this information?

For example i have defined a section ".mysection" and want to know the start, end address and the size of this section in my c code.

thx.

  • In reply to O. R.:

    When you have a look at the Section settings in the linker options ...

    ... you will see that the sections like bss have defined start and end symbols.

    Now you could use these symbols like external variable definitions ...

    extern unsigned char bss, ebss;

    ... and assign their addresses to pointers to char

    unsigned char* startaddress;
    unsigned char* endaddress;

    startaddress = (unsigned char*) &bss;
    endaddress = (unsigned char*) &ebss;

  • In reply to FrankL:

    Hi,

    thank you for this information.

    But if i created a section manually i have no start and end label.

    I don't know how to create this labels to define that this are on the start and the end of

    this section.

    For example i defined a section for my extarnal ram and use it for my flashing functions.

    This function are linked with  __attribute__ ((section(".extram")));

    In this section i have no labels for start and end of it.

    Any idea?

  • In reply to Georg.Georg:

    If you create the sections, you can also create the labels. In the linker section dialog, select the section name, push the right mouse button and select "Add Label"-"Add Expression"-"Add Label". This adds the 2 labels and creates an expression that tells the linker one label is at the beginning and the other that it is at the end of the section.

         

  • In reply to FrankL:

    Hi,

    Thank you.

    Now i understand but in my case the first label and the last label has

    the same address.

    How i can define a constant size of this section?

  • In reply to Georg.Georg:

    Usually you don't define a size of a section but the size of the section is defined by the data placed in it.

    Do you have the labels separated by the expression as it is shown in my example? If you don't have the expression, then both labels will be placed at the same address (either beginning or end of section).

    Have you checked in the linker map file that the section is being used?

  • In reply to FrankL:

    Hi,

    yes i have separedet the labels by the expression. In my case this section is used by my application not by the linker directly. So the linker don't link anything in this area. So it is empty for the compiler and linker.

  • In reply to Georg.Georg:

    Sorry, I don't understand what a section used by the application but not by the linker means. If the section does not have any contents the linker does not reserve. So you have to adjust the start address of the following section manually. This means you know the size of the section.

    If you don't do this the application will overwrite the following sections once it writes data to the 0-sized section. This likely crashes the application.

  • In reply to FrankL:

    This thread will be archived due to inactivity.

    Mike Clements
    RenesasRulz Moderator