[fpc-pascal] Using arm-embedded-fpc

Michael Ring mail at michael-ring.org
Wed Oct 23 20:01:02 CEST 2013


This article describes what build-id does:

https://fedoraproject.org/wiki/Releases/FeatureBuildId

your fix should get applied to trunk, the gnu-build section should end 
up somewhere, best place is flash, it will not get used anyway.

Michael


Am 23.10.13 19:33, schrieb Michael Ring:
> I think I remember that we had a discussion on build-id before, it did 
> not work on linux but I thought that Florian has created a fix and I 
> think I have verified that it works after that on my linux system.
>
> Are you on Linux? And using trunk compiler? If you do not use trunk 
> then please try to use it, hopefully the fix is in there.
>
> Michael
>
>
> Am 23.10.13 17:58, schrieb Koenraad Lelong:
>> op 23-10-13 13:54, Jonas Maebe schreef:
>>>
>>> On 23 Oct 2013, at 12:05, Koenraad Lelong wrote:
>>>
>>>> fpc at linux:~/src-arm-fpc> fpc -Parm -Tembedded -Wplpc2124 -sh tled1.pp
>>>> Free Pascal Compiler version 2.7.1 [2013/10/23] for arm
>>>> Copyright (c) 1993-2013 by Florian Klaempfl and others
>>>> Target OS: Embedded
>>>> Compiling tled1.pp
>>>> tled1.pp(54,4) Fatal: Can't open executable tled1.elf
>>>> Fatal: Compilation aborted
>>>> Error: /usr/bin/ppcrossarm returned an error exitcode (normal if you
>>>> did not specify a source file to be compiled)
>>>
>>> Can you try again after applying the attached patch?
>>>
>>>
>>> Jonas
>>>
>> Thanks Jonas,
>>
>> Now I can use -sh. The resulting ppas.sh :
>>
>> #!/bin/sh
>> DoExitAsm ()
>> { echo "An error occurred while assembling $1"; exit 1; }
>> DoExitLink ()
>> { echo "An error occurred while linking $1"; exit 1; }
>> echo Assembling program
>> /usr/bin/arm-embedded-as -mfpu=softvfp -o tled1.o tled1.s
>> if [ $? != 0 ]; then DoExitAsm program; fi
>> rm tled1.s
>> echo Linking tled1
>> OFS=$IFS
>> IFS="
>> "
>> /usr/bin/arm-embedded-ld -g  --build-id   --gc-sections  -L. -o 
>> tled1.elf -T link.res
>> if [ $? != 0 ]; then DoExitLink tled1; fi
>> IFS=$OFS
>> echo Linking tled1
>> OFS=$IFS
>> IFS="
>> "
>> /usr/bin/arm-embedded-objcopy -O ihex tled1.elf tled1.hex
>> if [ $? != 0 ]; then DoExitLink tled1; fi
>> IFS=$OFS
>>
>> Tinkering with it I found --build-id gives my problem. If that is 
>> removed, there are no errors.
>> But I also analyzed link.res :
>> SEARCH_DIR("/usr/lib/fpc/2.7.1/units/arm-embedded/rtl/")
>> SEARCH_DIR("/usr/lib/fpc/2.7.1/")
>> INPUT (
>> tled1.o
>> /usr/lib/fpc/2.7.1/units/arm-embedded/rtl/system.o
>> /usr/lib/fpc/2.7.1/units/arm-embedded/rtl/lpc21x4.o
>> )
>> ENTRY(_START)
>> MEMORY
>> {
>>     flash : ORIGIN = 0x00000000, LENGTH = 0x00040000
>>     ram : ORIGIN = 0x40000000, LENGTH = 0x00004000
>> }
>> _stack_top = 0x40004000;
>> SECTIONS
>> {
>>      .text :
>>     {
>>     _text_start = .;
>>     KEEP(*(.init, .init.*))
>>     *(.text, .text.*)
>>     *(.strings)
>>     *(.rodata, .rodata.*)
>>     *(.comment)
>>     _etext = .;
>>     } >flash
>>     .note.gnu.build-id : { *(.note.gnu.build-id) }
>>     .data :
>>     {
>>     _data = .;
>>     *(.data, .data.*)
>>     KEEP (*(.fpc .fpc.n_version .fpc.n_links))
>>     _edata = .;
>>     } >ram AT >flash
>>     .bss :
>>     {
>>     _bss_start = .;
>>     *(.bss, .bss.*)
>>     *(COMMON)
>>     } >ram
>> . = ALIGN(4);
>> _bss_end = . ;
>> }
>> _end = .;
>>
>>
>> Deducing from the error-message :
>> /usr/bin/arm-embedded-ld: error: no memory region specified for 
>> loadable section `.note.gnu.build-id'
>>
>> in ppas.sh I modified the line
>>     .note.gnu.build-id : { *(.note.gnu.build-id) }
>> to
>>     .note.gnu.build-id : { *(.note.gnu.build-id) } >flash
>>
>> Then ppas.sh reports no errors.
>>
>> I modified compiler/systems/t_embed.pas to have that line, and then 
>> the compilation of tled1 without -sh produces a tled1.elf. And the 
>> disassembled tled1.elf seems to be the program when comparing with a 
>> saved tled1.s.
>>
>> So, is it safe to include that '>flash' to the linking script via the 
>> compiler ? Did I find a bug, or am I doing something wrong ?
>>
>> Thanks for your support.
>>
>> Koenraad
>>
>> _______________________________________________
>> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>




More information about the fpc-pascal mailing list