Sign in Join

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

Mailing lists / fpc-devel / 2013-03

ppcrossarm dies when trying to build embedded rtl (svn 23683)

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Michael Ring

I am running on a mac, building svn 23683

svn 23681 (one before implementation of armv6m) compiles fine.

commandline for building was:

make clean buildbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7m CROSSOPT="-gw2 -O-" BINUTILSPREFIX=arm-none-eabi-

make -C rtl all
make -C embedded all
/bin/mkdir -p /Users/ring/devel/fpc/rtl/units/arm-embedded /Users/ring/devel/fpc/compiler/ppcrossarm -Cparmv7m @rtl.cfg -Ur -Tembedded -Parm -XParm-none-eabi- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../arm -FE. -FU/Users/ring/devel/fpc/rtl/units/arm-embedded -darm -dRELEASE -gw2 -O- -Us -Sg system.pp
Fatal: Compilation aborted
An unhandled exception occurred at $00000000:
EAccessViolation: Access violation
$00000000
$00142333
$00144647
$00144B00
$001AF725
$001970A5
$0003295E

make[3]: *** [system.ppu] Error 217
make[2]: *** [embedded_all] Error 2
make[1]: *** [rtl_all] Error 2
make: *** [base.build-stamp.arm-embedded] Error 2
[

Reply by email

Michael Ring
to Michael Ring

I have created a new patch, this time it uses the values of the two commandline parameters -Ch and -Cs to set the size of Stack and Heap. I am not sure if those params were for this use case but in my opinion it makes sense.

Florian, could I ask you to apply the patch to trunk if what I am doing is is ok?

Index: rtl/embedded/heapmgr.pp
=================================================================== --- rtl/embedded/heapmgr.pp (revision 23681)
+++ rtl/embedded/heapmgr.pp (working copy)
@@ -34,7 +34,13 @@

      var
        Blocks: PHeapBlock = nil;
+      _heap_start : pointer;
+      _heapsize: longWord; external name '__heapsize';
+      _stklen: longword; external name '__stklen';
+      _bss_end: record end; external name '_bss_end';
+      _stack_top: record end; external name '_stack_top';
+
      procedure InternalFreeMem(Addr: Pointer; Size: ptruint); forward;
      function FindSize(p: pointer): ptruint;
@@ -242,6 +248,11 @@
  initialization
    SetMemoryManager(MyMemoryManager);
+  _heap_start := @_stack_top - _heapsize - _stklen;
+  // Only initialize Heap when there is enough space available
+  if _heap_start >= @_bss_end then
+    RegisterHeapBlock(_heap_start,_heapsize);
+
  finalization
    //FinalizeHeap;
  end.
Michael Ring wrote 37 lines
I am running on a mac, building svn 23683 svn 23681 (one before implementation of armv6m) compiles fine. commandline for building was: make clean buildbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7m CROSSOPT="-gw2 -O-" BINUTILSPREFIX=arm-none-eabi- make -C rtl all make -C embedded all /bin/mkdir -p /Users/ring/devel/fpc/rtl/units/arm-embedded /Users/ring/devel/fpc/compiler/ppcrossarm -Cparmv7m @rtl.cfg -Ur -Tembedded -Parm -XParm-none-eabi- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../arm -FE. -FU/Users/ring/devel/fpc/rtl/units/arm-embedded -darm -dRELEASE -gw2 -O- -Us -Sg system.pp Fatal: Compilation aborted An unhandled exception occurred at $00000000: EAccessViolation: Access violation $00000000 $00142333 $00144647 $00144B00 $001AF725 $001970A5 $0003295E make[3]: *** [system.ppu] Error 217 make[2]: *** [embedded_all] Error 2 make[1]: *** [rtl_all] Error 2 make: *** [base.build-stamp.arm-embedded] Error 2 [ _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Florian Klämpfl
to Michael Ring
Michael Ring wrote 7 lines
I have created a new patch, this time it uses the values of the two commandline parameters -Ch and -Cs to set the size of Stack and Heap. I am not sure if those params were for this use case but in my opinion it makes sense. Florian, could I ask you to apply the patch to trunk if what I am doing is is ok?

It looks reasonable, but after some thinking I came to the conclusion that maybe the heap should be already allocated during linking, i.e. so heapmgr does not need to calculate an _heap_start.

Show quoted text 80 lines
Index: rtl/embedded/heapmgr.pp =================================================================== --- rtl/embedded/heapmgr.pp (revision 23681) +++ rtl/embedded/heapmgr.pp (working copy) @@ -34,7 +34,13 @@ var Blocks: PHeapBlock = nil; + _heap_start : pointer; + _heapsize: longWord; external name '__heapsize'; + _stklen: longword; external name '__stklen'; + _bss_end: record end; external name '_bss_end'; + _stack_top: record end; external name '_stack_top'; + procedure InternalFreeMem(Addr: Pointer; Size: ptruint); forward; function FindSize(p: pointer): ptruint; @@ -242,6 +248,11 @@ initialization SetMemoryManager(MyMemoryManager); + _heap_start := @_stack_top - _heapsize - _stklen; + // Only initialize Heap when there is enough space available + if _heap_start >= @_bss_end then + RegisterHeapBlock(_heap_start,_heapsize); + finalization //FinalizeHeap; end. Am 03.03.13 20:09, schrieb Michael Ring: > I am running on a mac, building svn 23683 > > svn 23681 (one before implementation of armv6m) compiles fine. > > commandline for building was: > > make clean buildbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm > SUBARCH=armv7m CROSSOPT="-gw2 -O-" BINUTILSPREFIX=arm-none-eabi- > > > make -C rtl all > make -C embedded all > /bin/mkdir -p /Users/ring/devel/fpc/rtl/units/arm-embedded > /Users/ring/devel/fpc/compiler/ppcrossarm -Cparmv7m @rtl.cfg -Ur > -Tembedded -Parm -XParm-none-eabi- -Xr -Ur -Xs -O2 -n -Fi../inc > -Fi../arm -FE. -FU/Users/ring/devel/fpc/rtl/units/arm-embedded -darm > -dRELEASE -gw2 -O- -Us -Sg system.pp > Fatal: Compilation aborted > An unhandled exception occurred at $00000000: > EAccessViolation: Access violation > $00000000 > $00142333 > $00144647 > $00144B00 > $001AF725 > $001970A5 > $0003295E > > make[3]: *** [system.ppu] Error 217 > make[2]: *** [embedded_all] Error 2 > make[1]: *** [rtl_all] Error 2 > make: *** [base.build-stamp.arm-embedded] Error 2 > [ > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-devel > _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Michel Catudal
to Michael Ring: I am running on a mac, building svn 23683 svn 23681 (one before implementation of armv6m)…
Michael Ring wrote 37 lines
I am running on a mac, building svn 23683 svn 23681 (one before implementation of armv6m) compiles fine. commandline for building was: make clean buildbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7m CROSSOPT="-gw2 -O-" BINUTILSPREFIX=arm-none-eabi- make -C rtl all make -C embedded all /bin/mkdir -p /Users/ring/devel/fpc/rtl/units/arm-embedded /Users/ring/devel/fpc/compiler/ppcrossarm -Cparmv7m @rtl.cfg -Ur -Tembedded -Parm -XParm-none-eabi- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../arm -FE. -FU/Users/ring/devel/fpc/rtl/units/arm-embedded -darm -dRELEASE -gw2 -O- -Us -Sg system.pp Fatal: Compilation aborted An unhandled exception occurred at $00000000: EAccessViolation: Access violation $00000000 $00142333 $00144647 $00144B00 $001AF725 $001970A5 $0003295E make[3]: *** [system.ppu] Error 217 make[2]: *** [embedded_all] Error 2 make[1]: *** [rtl_all] Error 2 make: *** [base.build-stamp.arm-embedded] Error 2 [ _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Interesting, I have a similar problem with AVR32.

For Linux Software visit http://home.comcast.net/~mcatudal

Reply by email

Michael Ring
to Florian Klämpfl

Verified, works again on my mac, TnX!

Michael

Florian Klämpfl wrote 19 lines
Am 03.03.2013 20:09, schrieb Michael Ring: > $00000000 > $00142333 > $00144647 > $00144B00 > $001AF725 > $001970A5 > $0003295E > > make[3]: *** [system.ppu] Error 217 > make[2]: *** [embedded_all] Error 2 > make[1]: *** [rtl_all] Error 2 > make: *** [base.build-stamp.arm-embedded] Error 2 Fixed. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Michael Schnell
to Michael Ring: I am running on a mac, building svn 23683 svn 23681 (one before implementation of armv6m)…

I, too, am unable to do "make crossinstall" for ARM using a 64 bit ppc on a 64 bit Debian.

The arm cross ppc is built (and when I start it without parameter outputs the correct information).

But when trying to crosscompile system.pp (seemingly the first RTL source file "make crossinstall" tries to cross-compile). (when doing so as root I get an "out of memory" from the OS, when doing so as normal user I get an "timeout" from make).

OTOH, Andy (from the German forum) was able to do "make crossinstall" on a 32 bit Debian.

Either this is a "works only on Linux 32 Bit" issue, or in my environment something is wrong that I did not see yet.

-Michael

Reply by email