Forum: Compiler & IDEs Linkerskript Fragen


von M. Н. (Gast)


Lesenswert?

Hallo ich beschäftige mich momentan mit den Linkerskripten von ARMs

Habe momentan ein Problem:

Im Linkerskript aus LPCxpresso für den LPC1788 steht:
1
MEMORY
2
{
3
  /* Define each memory region */
4
  MFlash512 (rx) : ORIGIN = 0x0, LENGTH = 0x80000 /* 512K bytes */
5
  RamLoc64 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x10000 /* 64K bytes */
6
  RamPeriph32 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 /* 32K bytes */
7
8
9
}
10
  /* Define a symbol for the top of each memory region */
11
  __top_MFlash512 = 0x0 + 0x80000;
12
  __top_RamLoc64 = 0x10000000 + 0x10000;
13
  __top_RamPeriph32 = 0x20000000 + 0x8000;
Ist das nicht falsch?
Wenn ich die Top-Adresse haben will muss ich doch eigentlich schreiben:
TOP = START + LENGTH - 1;
dieses -1 fehlt hier. Ist das falsch und stört bloß nicht, da nur ein 
Byte?

Zweite Frage:
1
        /* Global Section Table */
2
        . = ALIGN(4) ;
3
        __section_table_start = .;
4
        __data_section_table = .;
5
        LONG(LOADADDR(.data));
6
        LONG(    ADDR(.data));
7
        LONG(  SIZEOF(.data));
8
        LONG(LOADADDR(.data_RAM2));
9
        LONG(    ADDR(.data_RAM2));
10
        LONG(  SIZEOF(.data_RAM2));
11
        __data_section_table_end = .;
12
        __bss_section_table = .;
13
        LONG(    ADDR(.bss));
14
        LONG(  SIZEOF(.bss));
15
        LONG(    ADDR(.bss_RAM2));
16
        LONG(  SIZEOF(.bss_RAM2));
17
        __bss_section_table_end = .;
18
        __section_table_end = . ;
19
        /* End of Global Section Table */
__section_table_start = .; und  __data_section_table = .; auf das selbe?
LONG(  SIZEOF(.data_RAM2));
__data_section_table_end = .;
__bss_section_table = .;
LONG(    ADDR(.bss));

zeigen __data_section_table_end = .;und __bss_section_table = .; nicht 
auf das selbe?

Wie verhät es sich mit:
1
*(section1)
2
var = .;
3
*(section2)
wo liegt nun var?
Auf der letzten Adresse von section1?
Auf der ersten von section2?
Oder auf einer dazwischen?

Wäre froh wenn mir jemand diese Dinge kurz erklären kann

von M. Н. (Gast)


Lesenswert?

OK.

Mit dem MapFile konnte ich dem Problem auf den Grund gehen:
1
 .isr_vector    0x00000000       0xe4 ./src/cr_startup_lpc177x_8x.o
2
                0x00000000                g_pfnVectors
3
                0x000000e4                . = ALIGN (0x4)
4
                0x000000e4                __section_table_start = .
5
                0x000000e4                __data_section_table = .
6
                0x000000e4        0x4 LONG 0x3e8 LOADADDR (.data)
7
                0x000000e8        0x4 LONG 0x10000000 ADDR (.data)
8
                0x000000ec        0x4 LONG 0x0 SIZEOF (.data)
9
                0x000000f0        0x4 LONG 0x3e8 LOADADDR (.data_RAM2)
10
                0x000000f4        0x4 LONG 0x20000000 ADDR (.data_RAM2)
11
                0x000000f8        0x4 LONG 0x0 SIZEOF (.data_RAM2)
12
                0x000000fc                __data_section_table_end = .
13
                0x000000fc                __bss_section_table = .
14
                0x000000fc        0x4 LONG 0x10000000 ADDR (.bss)
15
                0x00000100        0x4 LONG 0x0 SIZEOF (.bss)
16
                0x00000104        0x4 LONG 0x20000000 ADDR (.bss_RAM2)
17
                0x00000108        0x4 LONG 0x0 SIZEOF (.bss_RAM2)
18
                0x0000010c                __bss_section_table_end = .
19
                0x0000010c                __section_table_end = .

von mper (Gast)


Lesenswert?

>Ist das nicht falsch?
>Wenn ich die Top-Adresse haben will muss ich doch
>eigentlich schreiben:
TOP = START + LENGTH - 1;
>dieses -1 fehlt hier. Ist das falsch und stört bloß nicht, da nur ein
>Byte?

Falsch oder nicht, hängt nur von der Interpretation dieser Werte ab, 
d.h.
was man unter "top" genau versteht.

Mich würde eher stören, dass die Konstanten 0x8000, 0x10000 usw an 
mehreren
Stellen auftauchen. Das lässt sich sicher vermeiden.

von M. Н. (Gast)


Lesenswert?

Ja. Du hast recht. es hängt von der Interpretation ab. Das harmoniert 
mit dem Startup-Code.

Das mit den Konstanten ist natürlich auch richtig. Werde das vllt mal 
schöner machen :D

Danke

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.