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 years ago
parent
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.lpi svneol=native#text/plain
 rtl/embedded/buildrtl.pp svneol=native#text/plain
 rtl/embedded/buildrtl.pp svneol=native#text/plain
 rtl/embedded/check.inc 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/empty.cfg svneol=native#text/plain
+rtl/embedded/heapmgr.pp svneol=native#text/pascal
 rtl/embedded/rtl.cfg svneol=native#text/plain
 rtl/embedded/rtl.cfg svneol=native#text/plain
 rtl/embedded/sysdir.inc svneol=native#text/plain
 rtl/embedded/sysdir.inc svneol=native#text/plain
 rtl/embedded/sysfile.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
 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
 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=
 SYSINIT_UNITS=
 ifeq ($(ARCH),arm)
 ifeq ($(ARCH),arm)
 ifeq ($(SUBARCH),armv7m)
 ifeq ($(SUBARCH),armv7m)
-CPU_UNITS=lm3fury lm3tempest stm32f103 lpc1768 # thumb2_bare 
+CPU_UNITS=lm3fury lm3tempest stm32f103 lpc1768 # thumb2_bare
 endif
 endif
 ifeq ($(SUBARCH),armv4t)
 ifeq ($(SUBARCH),armv4t)
 CPU_UNITS=lpc21x4 at91sam7x256
 CPU_UNITS=lpc21x4 at91sam7x256
@@ -333,193 +333,193 @@ endif
 OBJPASDIR=$(RTL)/objpas
 OBJPASDIR=$(RTL)/objpas
 GRAPHDIR=$(INC)/graph
 GRAPHDIR=$(INC)/graph
 ifeq ($(FULL_TARGET),i386-linux)
 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
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 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
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 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
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 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
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 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
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 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
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
 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
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 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
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 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
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 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
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 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
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 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
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 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
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 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
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 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
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 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
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 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
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 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
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
 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
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
 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
 endif
 ifeq ($(FULL_TARGET),i386-nativent)
 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
 endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 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
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 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
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 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
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 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
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 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
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 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
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 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
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 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
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
 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
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 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
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 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
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 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
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 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
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 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
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 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
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 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
 endif
 ifeq ($(FULL_TARGET),powerpc-wii)
 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
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 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
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 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
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 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
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 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
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 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
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 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
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
 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
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 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
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 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
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
 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
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 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
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 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
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
 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
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 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
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 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
 endif
 ifeq ($(FULL_TARGET),arm-nds)
 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
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
 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
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
 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
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 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
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 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
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 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
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
 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
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 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
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 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
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 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
 endif
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCPACKAGE=y
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)

+ 2 - 2
rtl/embedded/Makefile.fpc

@@ -7,7 +7,7 @@ main=rtl
 
 
 [target]
 [target]
 loaders=
 loaders=
-units=$(SYSTEMUNIT) $(CPU_UNITS) objpas # macpas iso7185 strings \
+units=$(SYSTEMUNIT) $(CPU_UNITS) objpas heapmgr consoleio # macpas iso7185 strings \
 #      dos \
 #      dos \
 #       sysutils \
 #       sysutils \
 #       classes math typinfo varutils fmtbcd \
 #       classes math typinfo varutils fmtbcd \
@@ -49,7 +49,7 @@ SYSINIT_UNITS=
 
 
 ifeq ($(ARCH),arm)
 ifeq ($(ARCH),arm)
 ifeq ($(SUBARCH),armv7m)
 ifeq ($(SUBARCH),armv7m)
-CPU_UNITS=lm3fury lm3tempest stm32f103 lpc1768 # thumb2_bare 
+CPU_UNITS=lm3fury lm3tempest stm32f103 lpc1768 # thumb2_bare
 endif
 endif
 ifeq ($(SUBARCH),armv4t)
 ifeq ($(SUBARCH),armv4t)
 CPU_UNITS=lpc21x4 at91sam7x256
 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 HAS_CMDLINE}
 {$define USE_NOTHREADMANAGER}
 {$define USE_NOTHREADMANAGER}
 
 
+{ Do not use standard memory manager }
+{$define HAS_MEMORYMANAGER}
+
 {$I check.inc}
 {$I check.inc}
 
 
 {$I systemh.inc}
 {$I systemh.inc}
@@ -66,17 +69,12 @@ const
   DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
   DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
 {$endif FPC_HAS_FEATURE_TEXTIO}
 {$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}
 {$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}
 {$endif FPC_HAS_FEATURE_COMMANDARGS}
 
 
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
@@ -138,11 +136,19 @@ begin
 End;
 End;
 
 
 
 
+{$ifdef FPC_HAS_FEATURE_PROCESSES}
+function GetProcessID: SizeUInt;
+begin
+  GetProcessID := 0;
+end;
+{$endif}
+
+
 {$ifdef FPC_HAS_FEATURE_RANDOM}
 {$ifdef FPC_HAS_FEATURE_RANDOM}
 
 
 Procedure Randomize;
 Procedure Randomize;
 Begin
 Begin
-  randseed:=longint(Fptime(nil));
+  RandSeed := 63458; 
 End;
 End;
 
 
 {$endif FPC_HAS_FEATURE_RANDOM}
 {$endif FPC_HAS_FEATURE_RANDOM}
@@ -156,95 +162,16 @@ Begin
 End;
 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;
 function paramstr(l: longint) : string;
  begin
  begin
-   { stricly conforming POSIX applications  }
-   { have the executing filename as argv[0] }
    if l=0 then
    if l=0 then
      begin
      begin
-       paramstr := execpathstr;
+       paramstr := '';
      end
      end
    else
    else
      paramstr:=strpas(argv[l]);
      paramstr:=strpas(argv[l]);
  end;
  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}
 {$endif FPC_HAS_FEATURE_COMMANDARGS}
 
 
 
 
@@ -254,42 +181,15 @@ end;
 
 
 {$ifdef FPC_HAS_FEATURE_STACKCHECK}
 {$ifdef FPC_HAS_FEATURE_STACKCHECK}
 
 
-function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
-var
-  limits : TRLimit;
-  success : boolean;
+function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;inline;
 begin
 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;
 end;
 
 
-
 var
 var
-  initialstkptr : Pointer;external name '__stkptr';
-
+  initialstkptr : Pointer; // external name '__stkptr';
 {$endif FPC_HAS_FEATURE_STACKCHECK}
 {$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
 begin
 {$ifdef FPC_HAS_FEATURE_FPU}
 {$ifdef FPC_HAS_FEATURE_FPU}
   SysResetFPU;
   SysResetFPU;
@@ -306,27 +206,10 @@ begin
   StackBottom := initialstkptr - StackLength;
   StackBottom := initialstkptr - StackLength;
 {$endif FPC_HAS_FEATURE_STACKCHECK}
 {$endif FPC_HAS_FEATURE_STACKCHECK}
 
 
-{$ifdef FPC_HAS_FEATURE_HEAP}
-  { Setup heap }
-  InitHeap;
-{$endif FPC_HAS_FEATURE_HEAP}
-
 {$ifdef FPC_HAS_FEATURE_EXCEPTIONS}
 {$ifdef FPC_HAS_FEATURE_EXCEPTIONS}
   SysInitExceptions;
   SysInitExceptions;
 {$endif FPC_HAS_FEATURE_EXCEPTIONS}
 {$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}
 {$ifdef FPC_HAS_FEATURE_CONSOLEIO}
   { Reset IO Error }
   { Reset IO Error }
   InOutRes:=0;
   InOutRes:=0;
@@ -342,6 +225,6 @@ begin
 {$endif FPC_HAS_FEATURE_VARIANTS}
 {$endif FPC_HAS_FEATURE_VARIANTS}
 
 
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
-  initwidestringmanager;
+//  initunicodestringmanager;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 end.
 end.

+ 47 - 22
rtl/inc/heap.inc

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

+ 2 - 0
rtl/inc/heaph.inc

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

+ 6 - 1
rtl/inc/system.inc

@@ -93,7 +93,7 @@ const
   OldRandSeed : Cardinal = 0;
   OldRandSeed : Cardinal = 0;
 
 
 { For Error Handling.}
 { 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 }
 { Used by the ansi/widestrings and maybe also other things in the future }
 var
 var
@@ -888,6 +888,10 @@ Begin
   FinalizeUnits;
   FinalizeUnits;
 
 
 {$ifdef FPC_HAS_FEATURE_CONSOLEIO}
 {$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 }
   { Show runtime error and exit }
   pstdout:=@stdout;
   pstdout:=@stdout;
   If erroraddr<>nil Then
   If erroraddr<>nil Then
@@ -899,6 +903,7 @@ Begin
      Writeln(pstdout^,'');
      Writeln(pstdout^,'');
    End;
    End;
   SysFlushStdIO;
   SysFlushStdIO;
+{$endif EMBEDDED}
 {$endif FPC_HAS_FEATURE_CONSOLEIO}
 {$endif FPC_HAS_FEATURE_CONSOLEIO}
 
 
 {$if defined(MSWINDOWS) or defined(OS2)}
 {$if defined(MSWINDOWS) or defined(OS2)}

+ 2 - 0
rtl/inc/systemh.inc

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