Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2009-09

Arm embedded

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Carsten Bager

Hi
I am trying to move from FPC 205 to 251 my target is arm7 embedded I have used the 205 compiler for several years, and it is working fine, but I would like to use some of the new facilitates
When I compile my test program (Begin End. ) the new linker misplace the segments. Something must be wrong (maybe in my linker script), but I cannot figure out what. Do anybody have a hint.

Carsten

Output from the compiler/linker J:\Fpc\Pas\Test\Led_test>\Fpc\ArmBin\ppcrossarm-251 -al -XX -Tembedded -Parm -XParm- embedded- -d led.pas Hint: End of reading config file J:\Fpc\ArmBin\fpc.cfg Free Pascal Compiler version 2.5.1 [2009/09/24] for arm Copyright (c) 1993-2009 by Florian Klaempfl Target OS: Embedded Compiling led.pas Assembling led Linking led J:\Fpc\ArmBin\arm-embedded-ld.exe: led.elf: warning: allocated section `.data' not in segment 13 lines compiled, 1.0 sec 1 warning(s) issued 1 hint(s) issued ---- Map file ---------------------------------------------------------------------- Discarded input sections .text 0x00000000 0x0 led.o .data 0x00000000 0x0 led.o .bss 0x00000000 0x0 led.o .text.n_main 0x00000000 0x0 led.o .bss.n_u_p$led_i 0x00000000 0x0 led.o .bss.n_u_p$led_p 0x00000000 0x0 led.o .bss.n_u_p$led_q 0x00000000 0x0 led.o .bss.n_u_p$led_w 0x00000000 0x0 led.o .data.n_THREADVARLIST_P$LED 0x00000000 0x0 led.o .data.n_INITFINAL 0x00000000 0x0 led.o .data.n_FPC_THREADVARTABLES 0x00000000 0x0 led.o .data.n_FPC_RESOURCESTRINGTABLES 0x00000000 0x0 led.o .data.n___stklen 0x00000000 0x0 led.o .data.n___heapsize 0x00000000 0x0 led.o .data.n___fpc_valgrind 0x00000000 0x0 led.o .text 0x00000000 0x0 system.o .data 0x00000000 0x0 system.o .bss 0x00000000 0x0 system.o .text.n_system_roundandpackint32$byte$qword$$longint -- -- -- -- Memory Configuration Name Origin Length Attributes flash 0x00000000 0x00080000 ram 0x40000000 0x00008000 *default* 0x00000000 0xffffffff Linker script and memory map 0x40007c00 __stack_end__ = 0x40007c00 0x40007ffc __ram_end__ = 0x40007ffc 0x00000000 . = 0x0 startup *(.startup) prog 0x00000000 0x0 *(.text) *(.rodata) *(.rodata*) *(.glue_7) .glue_7 0x00000000 0x0 led.o .glue_7 0x00000000 0x0 system.o *(.glue_7t) .glue_7t 0x00000000 0x0 led.o .glue_7t 0x00000000 0x0 system.o 0x00000000 __end_of_text__ = . .data 0x40000000 0x2c load address 0x00000000 0x40000000 __data_beg__ = . 0x00000000 __data_beg_src__ = __end_of_text__ *(.data) 0x40000000 __data_end__ = . 0x40000000 _data = . *(.data, .data.*) *(.fpc .fpc.n_version .fpc.n_links) .fpc.n_version 0x40000000 0x2c led.o 0x4000002c _edata = . .bss 0x4000002c 0x0 0x4000002c __bss_beg__ = . *(.bss) 0x4000002c _bss_start = . *(.bss, .bss.*) *(COMMON) 0x4000002c . = ALIGN (0x4) 0x4000002c . = ALIGN (0x4) 0x4000002c _end = . 0x4000002c _bss_end__ = . 0x4000002c __bss_end__ = . 0x4000002c __end__ = . 0x4000002c PROVIDE (end, .) LOAD led.o LOAD system.o .text 0x0000002c 0x0 *(.init, .init.*) *(.text, .text.*) *(.strings) *(.rodata, .rodata.*) *(.comment) 0x0000002c _etext = . .vfp11_veneer 0x4000002c 0x0 .vfp11_veneer 0x4000002c 0x0 led.o .vfp11_veneer 0x4000002c 0x0 system.o 0x4000002c . = ALIGN (0x4) 0x4000002c _bss_end = . 0x4000002c _end = . OUTPUT(led.elf elf32-littlearm) .ARM.attributes 0x00000000 0x14 .ARM.attributes 0x00000000 0x14 led.o .ARM.attributes 0x00000014 0x14 system.o Med venlig hilsen Carsten Bager BEAS A/S Brørupvænget 10 DK-7650 Bøvlingbjerg Tlf. : +45 9788 5222 Fax : +45 9788 5434 www.beas.dk

Reply by email

Florian Klaempfl
to Carsten Bager
Show quoted text 7 lines
Hi I am trying to move from FPC 205 to 251 my target is arm7 embedded I have used the 205 compiler for several years, and it is working fine, but I would like to use some of the new facilitates When I compile my test program (Begin End. ) the new linker misplace the segments. Something must be wrong (maybe in my linker script), but I cannot figure out what. Do anybody have a hint.

How does the linker script look like?

Show quoted text 156 lines
Carsten -- Output from the compiler/linker J:\Fpc\Pas\Test\Led_test>\Fpc\ArmBin\ppcrossarm-251 -al -XX -Tembedded -Parm -XParm- embedded- -d led.pas Hint: End of reading config file J:\Fpc\ArmBin\fpc.cfg Free Pascal Compiler version 2.5.1 [2009/09/24] for arm Copyright (c) 1993-2009 by Florian Klaempfl Target OS: Embedded Compiling led.pas Assembling led Linking led J:\Fpc\ArmBin\arm-embedded-ld.exe: led.elf: warning: allocated section `.data' not in segment 13 lines compiled, 1.0 sec 1 warning(s) issued 1 hint(s) issued ---- Map file ---------------------------------------------------------------------- Discarded input sections .text 0x00000000 0x0 led.o .data 0x00000000 0x0 led.o .bss 0x00000000 0x0 led.o .text.n_main 0x00000000 0x0 led.o .bss.n_u_p$led_i 0x00000000 0x0 led.o .bss.n_u_p$led_p 0x00000000 0x0 led.o .bss.n_u_p$led_q 0x00000000 0x0 led.o .bss.n_u_p$led_w 0x00000000 0x0 led.o .data.n_THREADVARLIST_P$LED 0x00000000 0x0 led.o .data.n_INITFINAL 0x00000000 0x0 led.o .data.n_FPC_THREADVARTABLES 0x00000000 0x0 led.o .data.n_FPC_RESOURCESTRINGTABLES 0x00000000 0x0 led.o .data.n___stklen 0x00000000 0x0 led.o .data.n___heapsize 0x00000000 0x0 led.o .data.n___fpc_valgrind 0x00000000 0x0 led.o .text 0x00000000 0x0 system.o .data 0x00000000 0x0 system.o .bss 0x00000000 0x0 system.o .text.n_system_roundandpackint32$byte$qword$$longint -- -- -- -- Memory Configuration Name Origin Length Attributes flash 0x00000000 0x00080000 ram 0x40000000 0x00008000 *default* 0x00000000 0xffffffff Linker script and memory map 0x40007c00 __stack_end__ = 0x40007c00 0x40007ffc __ram_end__ = 0x40007ffc 0x00000000 . = 0x0 startup *(.startup) prog 0x00000000 0x0 *(.text) *(.rodata) *(.rodata*) *(.glue_7) .glue_7 0x00000000 0x0 led.o .glue_7 0x00000000 0x0 system.o *(.glue_7t) .glue_7t 0x00000000 0x0 led.o .glue_7t 0x00000000 0x0 system.o 0x00000000 __end_of_text__ = . .data 0x40000000 0x2c load address 0x00000000 0x40000000 __data_beg__ = . 0x00000000 __data_beg_src__ = __end_of_text__ *(.data) 0x40000000 __data_end__ = . 0x40000000 _data = . *(.data, .data.*) *(.fpc .fpc.n_version .fpc.n_links) .fpc.n_version 0x40000000 0x2c led.o 0x4000002c _edata = . .bss 0x4000002c 0x0 0x4000002c __bss_beg__ = . *(.bss) 0x4000002c _bss_start = . *(.bss, .bss.*) *(COMMON) 0x4000002c . = ALIGN (0x4) 0x4000002c . = ALIGN (0x4) 0x4000002c _end = . 0x4000002c _bss_end__ = . 0x4000002c __bss_end__ = . 0x4000002c __end__ = . 0x4000002c PROVIDE (end, .) LOAD led.o LOAD system.o .text 0x0000002c 0x0 *(.init, .init.*) *(.text, .text.*) *(.strings) *(.rodata, .rodata.*) *(.comment) 0x0000002c _etext = . .vfp11_veneer 0x4000002c 0x0 .vfp11_veneer 0x4000002c 0x0 led.o .vfp11_veneer 0x4000002c 0x0 system.o 0x4000002c . = ALIGN (0x4) 0x4000002c _bss_end = . 0x4000002c _end = . OUTPUT(led.elf elf32-littlearm) .ARM.attributes 0x00000000 0x14 .ARM.attributes 0x00000000 0x14 led.o .ARM.attributes 0x00000014 0x14 system.o Med venlig hilsen Carsten Bager BEAS A/S Brørupvænget 10 DK-7650 Bøvlingbjerg Tlf. : +45 9788 5222 Fax : +45 9788 5434 www.beas.dk _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Carsten Bager
to Florian Klaempfl
How does the linker script look like?

MEMORY {
flash : ORIGIN = 0, LENGTH = 512K
ram : ORIGIN = 0x40000000, LENGTH = 32K
}

__stack_end__ = 0x40000000 + 31K;
__ram_end__ = 0x40000000 + 32K-4;
SECTIONS {

  . = 0;
  startup : { *(.startup)} >flash
  prog : {
         *(.text)
         *(.rodata)
         *(.rodata*)
         *(.glue_7)
         *(.glue_7t)
         } >flash
  __end_of_text__ = .;
  .data : {
         __data_beg__ = .;
         __data_beg_src__ = __end_of_text__;
         *(.data)
         __data_end__ = .;
         } >ram AT>flash
  .bss : {
         __bss_beg__ = .;
         *(.bss)
         } >ram
    /* Align here to ensure that the .bss section occupies space up to
       _end.  Align after .bss to ensure correct alignment even if the
       .bss section disappears because there are no input sections.  */
    . = ALIGN(32 / 8);
   }
   . = ALIGN(32 / 8);
   _end = .;
   _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
   PROVIDE (end = .);

Reply by email

Carsten Bager
to Carsten Bager

I have tried to find the reason fore my linker problems. It looks like it comes from the generated assembler file, when compiling to the embedded platform.

If i compile to Linux it works OK

.section .bss
.balign 2
# [6] i,p,q,w:integer;
.globl U_P$LED_I
.type U_P$LED_I,%object
.size U_P$LED_I,2
U_P$LED_I:
.zero 2

If i compile to embedded

.section .bss.n_u_p$led_i
.balign 2
# [6] i,p,q,w:integer;
.globl U_P$LED_I
.size U_P$LED_I,2
U_P$LED_I:
.zero 2

the assembler dos not give the same obj output from the 2 files When assembling the embedded version it looks like everything is placed at address 0

Is this an compiler error when compiling to the embedded platform.

Carsten

Reply by email

Florian Klaempfl
to Carsten Bager: MEMORY { flash : ORIGIN = 0, LENGTH = 512K ram : ORIGIN = 0x40000000, LENGTH = 32K }…
Show quoted text 14 lines
> How does the linker script look like? MEMORY { flash : ORIGIN = 0, LENGTH = 512K ram : ORIGIN = 0x40000000, LENGTH = 32K } __stack_end__ = 0x40000000 + 31K; __ram_end__ = 0x40000000 + 32K-4; SECTIONS { . = 0; startup : { *(.startup)} >flash prog : { *(.text)

This should be *(.text, .text.*)

Show quoted text 10 lines
*(.rodata) *(.rodata*) *(.glue_7) *(.glue_7t) } >flash __end_of_text__ = .; .data : { __data_beg__ = .; __data_beg_src__ = __end_of_text__; *(.data)

*(.data, .data.*)

Show quoted text 5 lines
__data_end__ = .; } >ram AT>flash .bss : { __bss_beg__ = .; *(.bss)

*(.bss, .bss.*)

Show quoted text 17 lines
} >ram /* Align here to ensure that the .bss section occupies space up to _end. Align after .bss to ensure correct alignment even if the .bss section disappears because there are no input sections. */ . = ALIGN(32 / 8); } . = ALIGN(32 / 8); _end = .; _bss_end__ = . ; __bss_end__ = . ; __end__ = . ; PROVIDE (end = .); _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Carsten Bager
to Florian Klaempfl
This should be *(.text, .text.*)

I corrected this and compiled again. I could not register any deference in output.

If I view the output obj file from the assembler it looks like this

led.o: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped 00000000 t $a
0000016c t $d
00000000 d $d
00000000 d $d
00000000 d $d
00000000 d $d
00000000 d $d
00000000 d $d
00000000 d $d
U FPC_DO_EXIT
U FPC_INITIALIZEUNITS
00000000 D FPC_RESOURCESTRINGTABLES
00000000 D FPC_THREADVARTABLES
U INIT$_SYSTEM
00000000 D INITFINAL
00000000 T PASCALMAIN
00000000 D THREADVARLIST_P$LED
U THREADVARLIST_SYSTEM
00000000 B U_P$LED_I
00000000 B U_P$LED_P
00000000 B U_P$LED_Q
00000000 B U_P$LED_W
00000000 D __fpc_valgrind
00000000 D __heapsize
00000000 D __stklen
U fpc_div_longint
00000000 T main

If I compile to Linux it looks like this

led.o: ELF 32-bit LSB relocatable, ARM, version 1, not stripped 00000000 t $a
0000016c t $d
00000000 d $d
00000000 d $d
00000000 d $d
00000000 d $d
00000000 d $d
00000000 d $d
00000000 d $d
00000000 d $d
U FPC_DO_EXIT
U FPC_INITIALIZEUNITS
00000000 D FPC_RESLOCATION
00000000 D FPC_RESOURCESTRINGTABLES
00000000 D FPC_THREADVARTABLES
U INIT$_SYSTEM
00000000 D INITFINAL
00000000 T PASCALMAIN
00000000 D THREADVARLIST_P$LED
U THREADVARLIST_SYSTEM
00000000 B U_P$LED_I
00000002 B U_P$LED_P
00000004 B U_P$LED_Q
00000006 B U_P$LED_W
00000000 D __fpc_valgrind
00000000 D __heapsize
00000000 D __stklen
U fpc_div_longint
00000000 T main

Reply by email