Browse Source

* moved heap manager on embedded systems into a separate unit
* moved console io on embedded systems into a seperate unit, this unit might setup input/output e.g. to be redirected to a serial port
* cleanup of the embedded system unit

git-svn-id: trunk@19168 -

florian 14 năm trước cách đây
mục cha
commit
375f83c874

+ 2 - 0
.gitattributes

@@ -7033,7 +7033,9 @@ rtl/embedded/avr/start.inc svneol=native#text/plain
 rtl/embedded/buildrtl.lpi svneol=native#text/plain
 rtl/embedded/buildrtl.pp svneol=native#text/plain
 rtl/embedded/check.inc svneol=native#text/plain
+rtl/embedded/consoleio.pp svneol=native#text/pascal
 rtl/embedded/empty.cfg svneol=native#text/plain
+rtl/embedded/heapmgr.pp svneol=native#text/pascal
 rtl/embedded/rtl.cfg svneol=native#text/plain
 rtl/embedded/sysdir.inc svneol=native#text/plain
 rtl/embedded/sysfile.inc svneol=native#text/plain

+ 65 - 65
rtl/embedded/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/08/28]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/09/05]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
@@ -315,7 +315,7 @@ CPU_UNITS=
 SYSINIT_UNITS=
 ifeq ($(ARCH),arm)
 ifeq ($(SUBARCH),armv7m)
-CPU_UNITS=lm3fury lm3tempest stm32f103 lpc1768 # thumb2_bare 
+CPU_UNITS=lm3fury lm3tempest stm32f103 lpc1768 # thumb2_bare
 endif
 ifeq ($(SUBARCH),armv4t)
 CPU_UNITS=lpc21x4 at91sam7x256
@@ -333,193 +333,193 @@ endif
 OBJPASDIR=$(RTL)/objpas
 GRAPHDIR=$(INC)/graph
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-nativent)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),powerpc-wii)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings
+override TARGET_UNITS+=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings
 endif
 override INSTALL_FPCPACKAGE=y
 ifeq ($(FULL_TARGET),i386-linux)

+ 2 - 2
rtl/embedded/Makefile.fpc

@@ -7,7 +7,7 @@ main=rtl
 
 [target]
 loaders=
-units=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings \
+units=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings \
 #      dos \
 #       sysutils \
 #       classes math typinfo varutils fmtbcd \
@@ -49,7 +49,7 @@ SYSINIT_UNITS=
 
 ifeq ($(ARCH),arm)
 ifeq ($(SUBARCH),armv7m)
-CPU_UNITS=lm3fury lm3tempest stm32f103 lpc1768 # thumb2_bare 
+CPU_UNITS=lm3fury lm3tempest stm32f103 lpc1768 # thumb2_bare
 endif
 ifeq ($(SUBARCH),armv4t)
 CPU_UNITS=lpc21x4 at91sam7x256

+ 67 - 0
rtl/embedded/consoleio.pp

@@ -0,0 +1,67 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2011 by the Free Pascal development team.
+
+    Console i/o for the FPC embedded target
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$mode objfpc}
+Unit consoleio;
+
+  interface
+
+  implementation
+
+    procedure SysInitStdIO;
+      begin
+        // OpenStdIO(Input,fmInput,0);
+        // OpenStdIO(Output,fmOutput,0);
+        // OpenStdIO(ErrOutput,fmOutput,0);
+        // OpenStdIO(StdOut,fmOutput,0);
+        // OpenStdIO(StdErr,fmOutput,0);
+      end;
+
+   procedure SysFlushStdIO;
+     begin
+       { Make sure that all output is written to the redirected file }
+{!!!!!!!!       if Textrec(Output).Mode=fmOutput then
+         Flush(Output);
+       if Textrec(ErrOutput).Mode=fmOutput then
+         Flush(ErrOutput);
+       if Textrec(stdout).Mode=fmOutput then
+         Flush(stdout);
+       if Textrec(StdErr).Mode=fmOutput then
+         Flush(StdErr);  }
+     end;
+
+var
+  ErrorBase : Pointer;external name 'FPC_ERRORBASE';
+
+var
+  pstdout : ^Text;
+
+initialization
+  { Setup stdin, stdout and stderr }
+  SysInitStdIO;
+finalization
+  { Show runtime error and exit }
+  pstdout:=@stdout;
+  If erroraddr<>nil Then
+   Begin
+     Writeln(pstdout^,'Runtime error ',Errorcode,' at $',hexstr(erroraddr));
+     { to get a nice symify }
+     Writeln(pstdout^,BackTraceStrFunc(Erroraddr));
+     dump_stack(pstdout^,ErrorBase);
+     Writeln(pstdout^,'');
+   End;
+  SysFlushStdIO;
+end.
+
+

+ 66 - 0
rtl/embedded/heapmgr.pp

@@ -0,0 +1,66 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2011 by the Free Pascal development team.
+
+    Heap manager for the FPC embedded target
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$mode objfpc}
+Unit heapmgr;
+
+interface
+
+implementation
+
+  var
+    Memorymanager: TMemoryManager;external name 'FPC_SYSTEM_MEMORYMANAGER';
+
+  Procedure HandleError (Errno : longint);external name 'FPC_HANDLEERROR';
+
+  {*****************************************************************************
+        OS Memory allocation / deallocation
+   ****************************************************************************}
+  function SysOSAlloc(size: ptruint): pointer;
+  begin
+    result:=nil; // pointer($02000000);
+  end;
+
+
+  procedure SysOSFree(p: pointer; size: ptruint);
+  begin
+  end;
+
+  {$define FPC_IN_HEAPMGR}
+  {$i heap.inc}
+
+  const
+    MyMemoryManager: TMemoryManager = (
+      NeedLock: false;  // Obsolete
+      GetMem: @SysGetMem;
+      FreeMem: @SysFreeMem;
+      FreeMemSize: @SysFreeMemSize;
+      AllocMem: @SysAllocMem;
+      ReAllocMem: @SysReAllocMem;
+      MemSize: @SysMemSize;
+      InitThread: nil;
+      DoneThread: nil;
+      RelocateHeap: nil;
+      GetHeapStatus: @SysGetHeapStatus;
+      GetFPCHeapStatus: @SysGetFPCHeapStatus;
+    );
+
+
+initialization
+  SetMemoryManager(MyMemoryManager);
+  InitHeap;
+finalization
+  FinalizeHeap;
+end.
+

+ 0 - 15
rtl/embedded/sysheap.inc

@@ -13,18 +13,3 @@
 
  **********************************************************************}
 
-{*****************************************************************************
-      OS Memory allocation / deallocation
- ****************************************************************************}
-
-
-function SysOSAlloc(size: ptruint): pointer;
-begin
-  result:=nil; // pointer($02000000);
-end;
-
-{ $define HAS_SYSOSFREE}
-
-procedure SysOSFree(p: pointer; size: ptruint);
-begin
-end;

+ 22 - 139
rtl/embedded/system.pp

@@ -24,6 +24,9 @@ Unit System;
 {$define HAS_CMDLINE}
 {$define USE_NOTHREADMANAGER}
 
+{ Do not use standard memory manager }
+{$define HAS_MEMORYMANAGER}
+
 {$I check.inc}
 
 {$I systemh.inc}
@@ -66,17 +69,12 @@ const
   DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
 {$endif FPC_HAS_FEATURE_TEXTIO}
 
-{
-var
-  argc:longint;external name 'operatingsystem_parameter_argc';
-  argv:PPchar;external name 'operatingsystem_parameter_argv';
-  envp:PPchar;external name 'operatingsystem_parameter_envp';
-}
-
-
 {$ifdef FPC_HAS_FEATURE_COMMANDARGS}
-function get_cmdline:Pchar;
-property cmdline:Pchar read get_cmdline;
+var
+  argc: LongInt = 0;
+  argv: PPChar = nil;
+  envp: PPChar = nil;
+  cmdline: PChar = nil;
 {$endif FPC_HAS_FEATURE_COMMANDARGS}
 
 {$ifndef FPUNONE}
@@ -138,11 +136,19 @@ begin
 End;
 
 
+{$ifdef FPC_HAS_FEATURE_PROCESSES}
+function GetProcessID: SizeUInt;
+begin
+  GetProcessID := 0;
+end;
+{$endif}
+
+
 {$ifdef FPC_HAS_FEATURE_RANDOM}
 
 Procedure Randomize;
 Begin
-  randseed:=longint(Fptime(nil));
+  RandSeed := 63458; 
 End;
 
 {$endif FPC_HAS_FEATURE_RANDOM}
@@ -156,95 +162,16 @@ Begin
 End;
 
 
- { variable where full path and filename and executable is stored }
- { is setup by the startup of the system unit.                    }
-var
- execpathstr : shortstring;
-
 function paramstr(l: longint) : string;
  begin
-   { stricly conforming POSIX applications  }
-   { have the executing filename as argv[0] }
    if l=0 then
      begin
-       paramstr := execpathstr;
+       paramstr := '';
      end
    else
      paramstr:=strpas(argv[l]);
  end;
 
-{*****************************************************************************
-                                    cmdline
-*****************************************************************************}
-
-procedure SetupCmdLine;
-var
-  bufsize,
-  len,j,
-  size,i : longint;
-  found  : boolean;
-  buf    : pchar;
-
-  procedure AddBuf;
-  begin
-    reallocmem(calculated_cmdline,size+bufsize);
-    move(buf^,calculated_cmdline[size],bufsize);
-    inc(size,bufsize);
-    bufsize:=0;
-  end;
-
-begin
-  if argc<=0 then
-    exit;
-  GetMem(buf,ARG_MAX);
-  size:=0;
-  bufsize:=0;
-  i:=0;
-  while (i<argc) do
-   begin
-     len:=strlen(argv[i]);
-     if len>ARG_MAX-2 then
-      len:=ARG_MAX-2;
-     found:=false;
-     for j:=1 to len do
-      if argv[i][j]=' ' then
-       begin
-         found:=true;
-         break;
-       end;
-     if bufsize+len>=ARG_MAX-2 then
-      AddBuf;
-     if found then
-      begin
-        buf[bufsize]:='"';
-        inc(bufsize);
-      end;
-     move(argv[i]^,buf[bufsize],len);
-     inc(bufsize,len);
-     if found then
-      begin
-        buf[bufsize]:='"';
-        inc(bufsize);
-      end;
-     if i<argc then
-      buf[bufsize]:=' '
-     else
-      buf[bufsize]:=#0;
-     inc(bufsize);
-     inc(i);
-   end;
-  AddBuf;
-  FreeMem(buf,ARG_MAX);
-end;
-
-function get_cmdline:Pchar;
-
-begin
-  if calculated_cmdline=nil then
-    setupcmdline;
-  get_cmdline:=calculated_cmdline;
-end;
-
 {$endif FPC_HAS_FEATURE_COMMANDARGS}
 
 
@@ -254,42 +181,15 @@ end;
 
 {$ifdef FPC_HAS_FEATURE_STACKCHECK}
 
-function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
-var
-  limits : TRLimit;
-  success : boolean;
+function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;inline;
 begin
-  success := false;
-  fillchar(limits, sizeof(limits), 0);
-  {$ifdef has_ugetrlimit}
-  success := fpugetrlimit(RLIMIT_STACK, @limits)=0;
-  {$endif}
-  if (not success) then
-    success := fpgetrlimit(RLIMIT_STACK, @limits)=0;
-  if (success) and (limits.rlim_cur < stklen) then
-    result := limits.rlim_cur
-  else
-    result := stklen;
+  result := stklen;
 end;
 
-
 var
-  initialstkptr : Pointer;external name '__stkptr';
-
+  initialstkptr : Pointer; // external name '__stkptr';
 {$endif FPC_HAS_FEATURE_STACKCHECK}
 
-{$ifdef FPC_HAS_FEATURE_CONSOLEIO}
-procedure SysInitStdIO;
-begin
-  OpenStdIO(Input,fmInput,0);
-  OpenStdIO(Output,fmOutput,0);
-  OpenStdIO(ErrOutput,fmOutput,0);
-  OpenStdIO(StdOut,fmOutput,0);
-  OpenStdIO(StdErr,fmOutput,0);
-end;
-{$endif FPC_HAS_FEATURE_CONSOLEIO}
-
-
 begin
 {$ifdef FPC_HAS_FEATURE_FPU}
   SysResetFPU;
@@ -306,27 +206,10 @@ begin
   StackBottom := initialstkptr - StackLength;
 {$endif FPC_HAS_FEATURE_STACKCHECK}
 
-{$ifdef FPC_HAS_FEATURE_HEAP}
-  { Setup heap }
-  InitHeap;
-{$endif FPC_HAS_FEATURE_HEAP}
-
 {$ifdef FPC_HAS_FEATURE_EXCEPTIONS}
   SysInitExceptions;
 {$endif FPC_HAS_FEATURE_EXCEPTIONS}
 
-
-{$ifdef FPC_HAS_FEATURE_CONSOLEIO}
-  { Setup stdin, stdout and stderr }
-  SysInitStdIO;
-{$endif FPC_HAS_FEATURE_CONSOLEIO}
-
-{$ifdef FPC_HAS_FEATURE_COMMANDARGS}
-  { Arguments }
-  SysInitExecPath;
-  SetupCmdLine;
-{$endif FPC_HAS_FEATURE_COMMANDARGS}
-
 {$ifdef FPC_HAS_FEATURE_CONSOLEIO}
   { Reset IO Error }
   InOutRes:=0;
@@ -342,6 +225,6 @@ begin
 {$endif FPC_HAS_FEATURE_VARIANTS}
 
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
-  initwidestringmanager;
+//  initunicodestringmanager;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 end.

+ 47 - 22
rtl/inc/heap.inc

@@ -14,9 +14,46 @@
  **********************************************************************}
 
 {****************************************************************************}
-
 { Do not use standard memory manager }
-{ define HAS_MEMORYMANAGER}
+{ $define HAS_MEMORYMANAGER}
+
+{ Memory manager }
+{$ifndef EMBEDDED}
+const
+  MemoryManager: TMemoryManager = (
+    NeedLock: false;  // Obsolete
+    GetMem: @SysGetMem;
+    FreeMem: @SysFreeMem;
+    FreeMemSize: @SysFreeMemSize;
+    AllocMem: @SysAllocMem;
+    ReAllocMem: @SysReAllocMem;
+    MemSize: @SysMemSize;
+    InitThread: nil;
+    DoneThread: nil;
+    RelocateHeap: nil;
+    GetHeapStatus: @SysGetHeapStatus;
+    GetFPCHeapStatus: @SysGetFPCHeapStatus;
+  );
+{$else}
+{$ifndef FPC_IN_HEAPMGR}
+const
+  MemoryManager: TMemoryManager = (
+    NeedLock: false;  // Obsolete
+    GetMem: nil;
+    FreeMem: nil;
+    FreeMemSize: nil;
+    AllocMem: nil;
+    ReAllocMem: nil;
+    MemSize: nil;
+    InitThread: nil;
+    DoneThread: nil;
+    RelocateHeap: nil;
+    GetHeapStatus: nil;
+    GetFPCHeapStatus: nil;
+  );public name 'FPC_SYSTEM_MEMORYMANAGER';
+{$endif FPC_IN_HEAPMGR}
+{$endif EMBEDDED}
+
 
 { Try to find the best matching block in general freelist }
 { define BESTMATCH}
@@ -33,6 +70,7 @@
   {$define SHOW_MEM_USAGE}
 {$endif}
 
+{$ifndef HAS_MEMORYMANAGER}
 const
 {$ifdef CPU64}
   blocksize    = 32;  { at least size of freerecord }
@@ -72,26 +110,7 @@ const
   {$define DUMPBLOCKS}
 {$endif}
 
-{ Memory manager }
-const
-  MemoryManager: TMemoryManager = (
-    NeedLock: false;  // Obsolete
-    GetMem: @SysGetMem;
-    FreeMem: @SysFreeMem;
-    FreeMemSize: @SysFreeMemSize;
-    AllocMem: @SysAllocMem;
-    ReAllocMem: @SysReAllocMem;
-    MemSize: @SysMemSize;
-    InitThread: nil;
-    DoneThread: nil;
-    RelocateHeap: nil;
-    GetHeapStatus: @SysGetHeapStatus;
-    GetFPCHeapStatus: @SysGetFPCHeapStatus;
-  );
-
-{$ifndef HAS_MEMORYMANAGER}
-
-{ 
+{
   We use 'fixed' size chunks for small allocations,
   and os chunks with variable sized blocks for big
   allocations.
@@ -229,6 +248,7 @@ threadvar
                              Memory Manager
 *****************************************************************************}
 
+{$ifndef FPC_IN_HEAPMGR}
 procedure GetMemoryManager(var MemMgr:TMemoryManager);
 begin
   MemMgr := MemoryManager;
@@ -242,8 +262,12 @@ end;
 
 function IsMemoryManagerSet:Boolean;
 begin
+{$ifdef HAS_MEMORYMANAGER}
+  Result:=false;
+{$else HAS_MEMORYMANAGER}
   IsMemoryManagerSet := (MemoryManager.GetMem<>@SysGetMem) 
     or (MemoryManager.FreeMem<>@SysFreeMem);
+{$endif HAS_MEMORYMANAGER}
 end;
 
 procedure GetMem(Out p:pointer;Size:ptruint);
@@ -333,6 +357,7 @@ procedure fpc_freemem(p:pointer);compilerproc;[public,alias:'FPC_FREEMEM'];
 begin
   MemoryManager.FreeMem(p);
 end;
+{$endif FPC_IN_HEAPMGR}
 
 {$ifndef HAS_MEMORYMANAGER}
 {*****************************************************************************

+ 2 - 0
rtl/inc/heaph.inc

@@ -65,6 +65,7 @@ const
 var
   ReturnNilIfGrowHeapFails : boolean;
 
+{$ifndef HAS_MEMORYMANAGER}
 { Default MemoryManager functions }
 Function  SysGetmem(Size:ptruint):Pointer;
 Function  SysFreemem(p:pointer):ptruint;
@@ -75,6 +76,7 @@ function  SysTryResizeMem(var p:pointer;size:ptruint):boolean;
 Function  SysReAllocMem(var p:pointer;size:ptruint):Pointer;
 function  SysGetHeapStatus:THeapStatus;
 function  SysGetFPCHeapStatus:TFPCHeapStatus;
+{$endif HAS_MEMORYMANAGER}
 
 { Tp7 functions }
 Procedure Getmem(Out p:pointer;Size:ptruint);

+ 6 - 1
rtl/inc/system.inc

@@ -93,7 +93,7 @@ const
   OldRandSeed : Cardinal = 0;
 
 { For Error Handling.}
-  ErrorBase : Pointer = nil;
+  ErrorBase : Pointer = nil;public name 'FPC_ERRORBASE';
 
 { Used by the ansi/widestrings and maybe also other things in the future }
 var
@@ -888,6 +888,10 @@ Begin
   FinalizeUnits;
 
 {$ifdef FPC_HAS_FEATURE_CONSOLEIO}
+  { the embedded system unit itself contains no routines for console i/o
+    console i/o is done by the Consoleio unit which can do things like
+    redirection to seriell i/o }
+{$ifndef EMBEDDED}
   { Show runtime error and exit }
   pstdout:=@stdout;
   If erroraddr<>nil Then
@@ -899,6 +903,7 @@ Begin
      Writeln(pstdout^,'');
    End;
   SysFlushStdIO;
+{$endif EMBEDDED}
 {$endif FPC_HAS_FEATURE_CONSOLEIO}
 
 {$if defined(MSWINDOWS) or defined(OS2)}

+ 2 - 0
rtl/inc/systemh.inc

@@ -1125,8 +1125,10 @@ Procedure halt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Procedure SysInitExceptions;
 {$endif FPC_HAS_FEATURE_EXCEPTIONS}
 {$ifdef FPC_HAS_FEATURE_CONSOLEIO}
+{$ifndef EMBEDDED}
 procedure SysInitStdIO;
 procedure SysFlushStdIO;
+{$endif EMBEDDED}
 {$endif FPC_HAS_FEATURE_CONSOLEIO}
 {$ifndef FPUNONE}
 Procedure SysResetFPU;