浏览代码

Fix compilation of i386-embedded target.

git-svn-id: trunk@29610 -
Jeppe Johansen 10 年之前
父节点
当前提交
7a826cc481
共有 6 个文件被更改,包括 109 次插入2 次删除
  1. 1 0
      .gitattributes
  2. 1 0
      compiler/systems/t_embed.pas
  3. 3 2
      rtl/embedded/Makefile
  4. 1 0
      rtl/embedded/Makefile.fpc
  5. 85 0
      rtl/embedded/i386/multiboot.pp
  6. 18 0
      rtl/embedded/rtl.cfg

+ 1 - 0
.gitattributes

@@ -8145,6 +8145,7 @@ rtl/embedded/check.inc svneol=native#text/plain
 rtl/embedded/consoleio.pp svneol=native#text/pascal
 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/heapmgr.pp svneol=native#text/pascal
+rtl/embedded/i386/multiboot.pp svneol=native#text/plain
 rtl/embedded/rtl.cfg svneol=native#text/plain
 rtl/embedded/rtl.cfg svneol=native#text/plain
 rtl/embedded/rtldefs.inc svneol=native#text/plain
 rtl/embedded/rtldefs.inc svneol=native#text/plain
 rtl/embedded/sysdir.inc svneol=native#text/plain
 rtl/embedded/sysdir.inc svneol=native#text/plain

+ 1 - 0
compiler/systems/t_embed.pas

@@ -581,6 +581,7 @@ begin
       Add('     . = 0x100000;');
       Add('     . = 0x100000;');
       Add('     .text ALIGN (0x1000) :');
       Add('     .text ALIGN (0x1000) :');
       Add('    {');
       Add('    {');
+      Add('    _text = .;');
       Add('    KEEP(*(.init, .init.*))');
       Add('    KEEP(*(.init, .init.*))');
       Add('    *(.text, .text.*)');
       Add('    *(.text, .text.*)');
       Add('    *(.strings)');
       Add('    *(.strings)');

+ 3 - 2
rtl/embedded/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2014-12-07 rev 29213]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2015-01-04 rev 29399]
 #
 #
 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 i386-android i386-aros 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 powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-dragonfly arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android jvm-java jvm-android i8086-msdos
 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 i386-android i386-aros 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 powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-dragonfly arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android jvm-java jvm-android i8086-msdos
@@ -369,6 +369,7 @@ ifeq ($(ARCH),avr)
 CPU_UNITS=atmega128
 CPU_UNITS=atmega128
 endif
 endif
 ifeq ($(ARCH),i386)
 ifeq ($(ARCH),i386)
+CPU_SPECIFIC_COMMON_UNITS=sysutils sysconst
 CPU_UNITS=multiboot
 CPU_UNITS=multiboot
 endif
 endif
 ifeq ($(ARCH),mipsel)
 ifeq ($(ARCH),mipsel)
@@ -2066,7 +2067,7 @@ ifdef CREATESHARED
 override FPCOPT+=-Cg
 override FPCOPT+=-Cg
 endif
 endif
 ifneq ($(findstring $(OS_TARGET),dragonfly freebsd openbsd netbsd linux solaris),)
 ifneq ($(findstring $(OS_TARGET),dragonfly freebsd openbsd netbsd linux solaris),)
-ifeq ($(CPU_TARGET),x86_64)
+ifneq ($(findstring $(CPU_TARGET),x86_64 mips mipsel),)
 override FPCOPT+=-Cg
 override FPCOPT+=-Cg
 endif
 endif
 endif
 endif

+ 1 - 0
rtl/embedded/Makefile.fpc

@@ -85,6 +85,7 @@ CPU_UNITS=atmega128
 endif
 endif
 
 
 ifeq ($(ARCH),i386)
 ifeq ($(ARCH),i386)
+CPU_SPECIFIC_COMMON_UNITS=sysutils sysconst
 CPU_UNITS=multiboot
 CPU_UNITS=multiboot
 endif
 endif
 
 

+ 85 - 0
rtl/embedded/i386/multiboot.pp

@@ -0,0 +1,85 @@
+unit multiboot;
+
+interface
+
+type
+ PMBModule = ^TMBModule;
+ TMBModule = packed record
+  mod_start,
+  mod_end: PtrUInt;
+  name: pchar;
+  reserved: DWord;
+ end;
+
+ PMemoryMap = ^TMemoryMap;
+ TMemoryMap = packed record
+  size,
+  base_lower,
+  base_upper,
+  length_lower,
+  length_upper,
+  mtype: DWord;
+ end;
+
+ PElfSectionHeaderTable = ^TElfSectionHeaderTable;
+ TElfSectionHeaderTable = packed record
+  num,
+  size,
+  addr,
+  shndx: DWord;
+ end;
+
+ PMultibootinfo = ^TMultibootinfo;
+ TMultiBootInfo = packed record
+  Flags,
+  MemLower, MemUpper,
+  BootDevice,
+  CmdLine,
+  ModuleCount: DWord;
+  ModuleAddress: PMBModule;
+  ElfSection: TElfSectionHeaderTable;
+  MMapLength: longint;
+  MMapAddress: PMemoryMap;
+ end;
+
+var MultibootTable: PMultibootinfo;
+
+implementation
+
+{$asmmode att}
+
+procedure MultibootHeader; nostackframe; assembler;
+const
+ MULTIBOOT_PAGE_ALIGN = 1; // Align modules on a 4kB boundary
+ MULTIBOOT_MEMORY_INFO = 2; // Memory info table is valid
+ MULTIBOOT_AOUT_KLUDGE = 1 shl 16; // A.OUT kludge follows the header
+ 
+ MultibootSig = $1BADB002;
+ MultibootFlags = MULTIBOOT_MEMORY_INFO;
+ MultibootChksum = -(MultibootSig + MultibootFlags);
+asm
+   .init
+   .long MultibootSig
+   .long MultibootFlags
+   .long MultibootChksum
+   .text
+end;
+
+procedure haltproc; assembler; nostackframe; public name '_haltproc';
+asm
+.Lloop:
+   jmp .Lloop
+end;
+
+procedure PASCALMAIN; external name 'PASCALMAIN';
+
+procedure Start; assembler; nostackframe; public name '_START';
+asm
+   cli
+   
+   movl %ebx, MultibootTable
+   
+   jmp PASCALMAIN
+end;
+
+end.

+ 18 - 0
rtl/embedded/rtl.cfg

@@ -34,6 +34,22 @@
 # include exit code support
 # include exit code support
 -SfEXITCODE
 -SfEXITCODE
 
 
+# i386 is powerful enough to handle most object pascal constructs
+# it is only a matter of size
+#ifdef CPUI386
+-SfSOFTFPU
+-SfCLASSES
+-SfEXCEPTIONS
+-SfANSISTRINGS
+-SfRTTI
+-SfWIDESTRINGS
+-SfDYNARRAYS
+-SfVARIANTS
+-SfOBJECTS
+-SfCOMMANDARGS
+-SfRANDOM
+#endif CPUI386
+
 # arm is powerful enough to handle most object pascal constructs
 # arm is powerful enough to handle most object pascal constructs
 # it is only a matter of size
 # it is only a matter of size
 #ifdef CPUARM
 #ifdef CPUARM
@@ -45,6 +61,7 @@
 -SfWIDESTRINGS
 -SfWIDESTRINGS
 -SfDYNARRAYS
 -SfDYNARRAYS
 -SfVARIANTS
 -SfVARIANTS
+-SfOBJECTS
 -SfCOMMANDARGS
 -SfCOMMANDARGS
 -SfRANDOM
 -SfRANDOM
 #endif CPUARM
 #endif CPUARM
@@ -60,6 +77,7 @@
 -SfWIDESTRINGS
 -SfWIDESTRINGS
 -SfDYNARRAYS
 -SfDYNARRAYS
 -SfVARIANTS
 -SfVARIANTS
+-SfOBJECTS
 -SfCOMMANDARGS
 -SfCOMMANDARGS
 -SfRANDOM
 -SfRANDOM
 #endif CPUMIPSEL
 #endif CPUMIPSEL