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.





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  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to