mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-06 02:47:48 +01:00
Removed old stuff and updated lnkscript
git-svn-id: trunk@3718 -
This commit is contained in:
parent
94634b404f
commit
ca68b19414
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -3779,15 +3779,12 @@ rtl/gba/Makefile svneol=native#text/plain
|
||||
rtl/gba/Makefile.fpc svneol=native#text/plain
|
||||
rtl/gba/classes.pp svneol=native#text/plain
|
||||
rtl/gba/dos.pp svneol=native#text/plain
|
||||
rtl/gba/fpc4gba.txt svneol=native#text/plain
|
||||
rtl/gba/gbabios.inc svneol=native#text/plain
|
||||
rtl/gba/gbabiosh.inc svneol=native#text/plain
|
||||
rtl/gba/lnkscript -text
|
||||
rtl/gba/prt0.as svneol=native#text/plain
|
||||
rtl/gba/prt0.s -text
|
||||
rtl/gba/sysdir.inc svneol=native#text/plain
|
||||
rtl/gba/sysfile.inc svneol=native#text/plain
|
||||
rtl/gba/sysgba.pp svneol=native#text/plain
|
||||
rtl/gba/sysheap.inc svneol=native#text/plain
|
||||
rtl/gba/sysos.inc svneol=native#text/plain
|
||||
rtl/gba/sysosh.inc svneol=native#text/plain
|
||||
@ -3795,7 +3792,6 @@ rtl/gba/system.pp svneol=native#text/plain
|
||||
rtl/gba/systhrd.inc svneol=native#text/plain
|
||||
rtl/gba/sysutils.pp svneol=native#text/plain
|
||||
rtl/gba/tthread.inc svneol=native#text/plain
|
||||
rtl/gba/unix.pp svneol=native#text/plain
|
||||
rtl/gba/varutils.pp svneol=native#text/plain
|
||||
rtl/go32v2/Makefile svneol=native#text/plain
|
||||
rtl/go32v2/Makefile.fpc svneol=native#text/plain
|
||||
|
||||
@ -1,159 +0,0 @@
|
||||
+-------------------------------------+
|
||||
| Let's build a gba compiler with fpc |
|
||||
+-------------------------------------+
|
||||
| Author: Francesco Lombardi |
|
||||
| Release date: 2005.08.09 |
|
||||
+-------------------------------------+
|
||||
|
||||
|
||||
Tools needed
|
||||
------------
|
||||
-FPC compiler for your platform, ver 2.0.0 (http://www.freepascal.org/)
|
||||
-FPC sources, ver 2.0.0 (http://www.freepascal.org/)
|
||||
-MSYS (http://www.mingw.org/msys.shtml)
|
||||
-An emulator with integrated debugger or, at least, a memory viewer, like
|
||||
Boycott Advance (http://www.ngemu.com/gba/bca.php main site does not work)
|
||||
or Visual Boy Advance Development version (http://vba.ngemu.com/)
|
||||
|
||||
|
||||
Foreword
|
||||
--------
|
||||
I'l use MSYS, because I'm confortable with POSIX-like ambient. It is a fork of
|
||||
cygwin, but more friendly for win32 users. However, feel free to use dos prompt
|
||||
if you like it. Remember that MSYS includes GNU Make utility, that is needed in
|
||||
order to build freepascal.
|
||||
In the source files provided with this package, you can find occasionally some
|
||||
comments, that explain the changes made.
|
||||
|
||||
|
||||
Preparing all things
|
||||
--------------------
|
||||
Install fpc compiler as usual in a directory of your choice (eg. c:\fpc);
|
||||
extract fpc sources in fpc binaries directory (eg. c:\fpc\source). If you
|
||||
decided for MSYS, install it.
|
||||
|
||||
|
||||
Compiler modification
|
||||
---------------------
|
||||
Copy the files you found in "Compiler" directory of this package, following this
|
||||
scheme:
|
||||
- t_gba.pas in %FreePascal%\source\compiler\systems
|
||||
- i_gba.pas in %FreePascal%\source\compiler\systems
|
||||
- cputarg.pas in %FreePascal%\source\compiler\arm
|
||||
- compiler.pas in %FreePascal%\source\compiler
|
||||
- systems.pas in %FreePascal%\source\compiler
|
||||
Now open msys (or a dos prompt), go to %FreePascal%\source\compiler and run
|
||||
"make PPC_TARGET=arm".
|
||||
Go to %FreePascal%\bin\i386-win32, make a new directory 'arm-gba' and copy here
|
||||
the new generated file ppcarm.exe. Extract and copy here the files in
|
||||
win32_arm_binutils.zip (ls.exe, ld.exe, objcopy.exe and cygwin1.dll). Now add
|
||||
'%FreePascal%\bin\i386-win32\arm-gba' in the search path.
|
||||
|
||||
|
||||
FPCMake modification
|
||||
--------------------
|
||||
Copy the files you found in "FPCMake" directory of this package in the directory
|
||||
|
||||
%FreePascal%\source\utils\fpcm
|
||||
|
||||
In msys (or a dos prompt), go to %FreePascal%\source\utils\fpcm and run
|
||||
"make". Go to %FreePascal%\bin\i386-win32 and copy here the new generated file
|
||||
fpcmake.exe. This utility is useful when you try to build the rtl, because it
|
||||
generates all makefiles starting from a smuch more simple makefile.fpc.
|
||||
|
||||
|
||||
RTL Modification
|
||||
----------------
|
||||
Go in %FreePascal%\source\rtl, make a copy of 'linux' directory and rename it
|
||||
'gba'. Go in the new created 'gba' and delete all subdirectories, except 'arm'.
|
||||
Delete the files system.pp, syslinux.pp, makefile and makefile.fpc. Go in 'arm'
|
||||
subdirectory and delete all .as files.
|
||||
Copy the files you found in "RTL" directory of this package, following this
|
||||
scheme:
|
||||
- system.pp in %FreePascal%\source\rtl\gba
|
||||
- sysgba.pp in %FreePascal%\source\rtl\gba
|
||||
- makefile.fpc in %FreePascal%\source\rtl\gba
|
||||
- prt0.as in %FreePascal%\source\rtl\gba\arm
|
||||
- unix.pp in %FreePascal%\source\rtl\unix
|
||||
|
||||
Go to %FreePascal%\source\rtl, open makefile.fpc and add a new target:
|
||||
|
||||
...
|
||||
...
|
||||
[target]
|
||||
...
|
||||
dirs_gba=gba
|
||||
|
||||
In msys (or a dos prompt), go to %FreePascal%\source\rtl and run
|
||||
"fpcmake -Tall -r -w": this command rebuild all makefiles. Now do a "make
|
||||
distclean", then run 'make CPU_TARGET=arm OS_TARGET=gba PP=ppcarm OPT="-Tgba"'
|
||||
At the end of the compiling, you can find a new directory:
|
||||
|
||||
%FreePascal%\source\rtl\units\arm-gba
|
||||
|
||||
Copy the directory 'arm-gba' and all its content in
|
||||
|
||||
%FreePascal%\units
|
||||
|
||||
|
||||
Ending
|
||||
------
|
||||
Now you can try to compile some pascal code, like the examples in the package:
|
||||
|
||||
ppcarm -Tgba -n -Fuc:\fpc\units\arm-gba gba.pp
|
||||
|
||||
Look at compile.bat. It produces a gba.gba file, but if you try to run on a gba
|
||||
emu, it does not work (you must see if 0x04000000 address contains 0x0403).
|
||||
|
||||
At this point you can try a trick: remove from gba.s the following lines:
|
||||
|
||||
line Asm Code
|
||||
---- --------
|
||||
...
|
||||
[22] bl FPC_INITIALIZEUNITS
|
||||
...
|
||||
[40] bl FPC_DO_EXIT
|
||||
...
|
||||
[57] .globl THREADVARLIST_P$GBA
|
||||
[58] THREADVARLIST_P$GBA:
|
||||
[59] .long 0
|
||||
[60] .Le1:
|
||||
[61] .size THREADVARLIST_P$GBA, .Le1 - THREADVARLIST_P$GBA
|
||||
[62] .balign 4
|
||||
[63] .globl FPC_THREADVARTABLES
|
||||
[64] FPC_THREADVARTABLES:
|
||||
[65] .long 2
|
||||
[66] .long THREADVARLIST_SYSTEM
|
||||
[67] .long THREADVARLIST_P$GBA
|
||||
[68] .Le2:
|
||||
[69] .size FPC_THREADVARTABLES, .Le2 - FPC_THREADVARTABLES
|
||||
[70] .balign 4
|
||||
[71] .globl FPC_RESOURCESTRINGTABLES
|
||||
[72] FPC_RESOURCESTRINGTABLES:
|
||||
[73] .long 0
|
||||
[74] .Le3:
|
||||
[75] .size FPC_RESOURCESTRINGTABLES, .Le3 - FPC_RESOURCESTRINGTABLES
|
||||
[76] .balign 4
|
||||
[77] .globl INITFINAL
|
||||
[78] INITFINAL:
|
||||
[79] .long 1,0
|
||||
[80] .long INIT$_SYSTEM
|
||||
[81] .long FINALIZE$_SYSTEM
|
||||
[82] .Le4:
|
||||
[83] .size INITFINAL, .Le4 - INITFINAL
|
||||
[84] .balign 4
|
||||
|
||||
This 'garbage' (sorry fpk ^_^) is initialization code added from fpc compiler,
|
||||
but interferes with our initialization code.
|
||||
Now run compile2.bat; the gba.gba file runs fine in the emu (flags correctly
|
||||
set, rom header good).
|
||||
|
||||
|
||||
Next steps?
|
||||
-----------
|
||||
Well, we need some further rtl hacking to handle fpc initialization code, that's
|
||||
beyond my knowledge. You can try to download a pdf with fpc internals
|
||||
(comparch.pdf) for more infos, but I think that an help from fpk & friends could
|
||||
be better ^_^
|
||||
About prt0.s: the file provided works fine for our initial purposes, but someday
|
||||
we must use a startup file more advanced for handle all gba capabilities.
|
||||
@ -1,271 +1,300 @@
|
||||
/* (c) 2006 by devkitPro (http://www.devkitpro.org) */
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
|
||||
|
||||
|
||||
|
||||
MEMORY {
|
||||
rom : ORIGIN = 0x08000000, LENGTH = 32M
|
||||
iwram : ORIGIN = 0x03000000, LENGTH = 32K
|
||||
ewram : ORIGIN = 0x02000000, LENGTH = 256K
|
||||
}
|
||||
|
||||
__text_start = 0x8000000;
|
||||
__eheap_end = 0x2040000;
|
||||
__iwram_start = 0x3000000;
|
||||
__iwram_end = 0x3008000;
|
||||
|
||||
__sp_irq = __iwram_end - 0x100;
|
||||
__sp_usr = __sp_irq - 0x100;
|
||||
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
. = __text_start;
|
||||
.init :
|
||||
{
|
||||
KEEP (*(.init))
|
||||
. = ALIGN(4);
|
||||
} >rom =0xff
|
||||
|
||||
.plt :
|
||||
{
|
||||
*(.plt)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom
|
||||
|
||||
.text : /* ALIGN (4): */
|
||||
{
|
||||
*(EXCLUDE_FILE (*.iwram*) .text)
|
||||
*(.text.*)
|
||||
*(.stub)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.gnu.linkonce.t*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom = 0xff
|
||||
|
||||
__text_end = .;
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(.fini))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom =0
|
||||
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*all.rodata*(*)
|
||||
*(.roda)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r*)
|
||||
SORT(CONSTRUCTORS)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom = 0xff
|
||||
|
||||
.ctors :
|
||||
{
|
||||
/* gcc uses crtbegin.o to find the start of the constructors, so
|
||||
we make sure it is first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not actually link against
|
||||
crtbegin.o; the linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it doesn't matter which
|
||||
directory crtbegin.o is in. */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom = 0
|
||||
|
||||
.dtors :
|
||||
{
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom = 0
|
||||
|
||||
.jcr : { KEEP (*(.jcr)) } >rom
|
||||
|
||||
.eh_frame :
|
||||
{
|
||||
KEEP (*(.eh_frame))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom = 0
|
||||
|
||||
.gcc_except_table :
|
||||
{
|
||||
*(.gcc_except_table)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom = 0
|
||||
|
||||
|
||||
|
||||
|
||||
__iwram_lma = .;
|
||||
|
||||
.iwram __iwram_start : AT (__iwram_lma)
|
||||
{
|
||||
__iwram_start = ABSOLUTE(.) ;
|
||||
*(.iwram)
|
||||
*iwram.*(.text)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >iwram = 0xff
|
||||
|
||||
__iwram_end = . ;
|
||||
|
||||
.bss ALIGN(4) :
|
||||
{
|
||||
__bss_start = ABSOLUTE(.);
|
||||
__bss_start__ = ABSOLUTE(.);
|
||||
*(.dynbss)
|
||||
*(.gnu.linkonce.b*)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >iwram
|
||||
|
||||
__bss_end = . ;
|
||||
__bss_end__ = . ;
|
||||
|
||||
|
||||
__iwram_overlay_lma = __iwram_lma + SIZEOF(.iwram);
|
||||
|
||||
__iwram_overlay_start = . ;
|
||||
|
||||
OVERLAY ALIGN(4) : NOCROSSREFS AT (__iwram_overlay_lma)
|
||||
{
|
||||
.iwram0 { *(.iwram0) . = ALIGN(4);}
|
||||
.iwram1 { *(.iwram1) . = ALIGN(4);}
|
||||
.iwram2 { *(.iwram2) . = ALIGN(4);}
|
||||
.iwram3 { *(.iwram3) . = ALIGN(4);}
|
||||
.iwram4 { *(.iwram4) . = ALIGN(4);}
|
||||
.iwram5 { *(.iwram5) . = ALIGN(4);}
|
||||
.iwram6 { *(.iwram6) . = ALIGN(4);}
|
||||
.iwram7 { *(.iwram7) . = ALIGN(4);}
|
||||
.iwram8 { *(.iwram8) . = ALIGN(4);}
|
||||
.iwram9 { *(.iwram9) . = ALIGN(4);}
|
||||
}>iwram = 0xff
|
||||
|
||||
|
||||
|
||||
|
||||
__ewram_lma = LOADADDR(.iwram0) + SIZEOF(.iwram0)+SIZEOF(.iwram1)+SIZEOF(.iwram2)+SIZEOF(.iwram3)+SIZEOF(.iwram4)+SIZEOF(.iwram5)+SIZEOF(.iwram6)+SIZEOF(.iwram7)+SIZEOF(.iwram8)+SIZEOF(.iwram9);
|
||||
|
||||
__iwram_overlay_end = . ;
|
||||
__iheap_start = . ;
|
||||
|
||||
__ewram_start = 0x2000000;
|
||||
.ewram __ewram_start : AT (__ewram_lma)
|
||||
{
|
||||
*(.ewram)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
}>ewram = 0xff
|
||||
|
||||
__data_lma = __ewram_lma + SIZEOF(.ewram) ;
|
||||
|
||||
.data ALIGN(4) : AT (__data_lma)
|
||||
{
|
||||
__data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
} >ewram = 0xff
|
||||
|
||||
__data_end = .;
|
||||
|
||||
__ewram_overlay_lma = __data_lma + SIZEOF(.data);
|
||||
|
||||
.sbss ALIGN(4):
|
||||
{
|
||||
__sbss_start = ABSOLUTE(.);
|
||||
*(.sbss)
|
||||
. = ALIGN(4);
|
||||
} >ewram
|
||||
|
||||
__sbss_end = .;
|
||||
|
||||
__ewram_end = . ;
|
||||
__ewram_overlay_start = . ;
|
||||
|
||||
OVERLAY ALIGN(4): NOCROSSREFS AT (__ewram_overlay_lma)
|
||||
{
|
||||
.ewram0 { *(.ewram0) . = ALIGN(4);}
|
||||
.ewram1 { *(.ewram1) . = ALIGN(4);}
|
||||
.ewram2 { *(.ewram2) . = ALIGN(4);}
|
||||
.ewram3 { *(.ewram3) . = ALIGN(4);}
|
||||
.ewram4 { *(.ewram4) . = ALIGN(4);}
|
||||
.ewram5 { *(.ewram5) . = ALIGN(4);}
|
||||
.ewram6 { *(.ewram6) . = ALIGN(4);}
|
||||
.ewram7 { *(.ewram7) . = ALIGN(4);}
|
||||
.ewram8 { *(.ewram8) . = ALIGN(4);}
|
||||
.ewram9 { *(.ewram9) . = ALIGN(4);}
|
||||
}>ewram = 0xff
|
||||
|
||||
__pad_lma = LOADADDR(.ewram0) + SIZEOF(.ewram0)+SIZEOF(.ewram1)+SIZEOF(.ewram2)+SIZEOF(.ewram3)+SIZEOF(.ewram4)+SIZEOF(.ewram5)+SIZEOF(.ewram6)+SIZEOF(.ewram7)+SIZEOF(.ewram8)+SIZEOF(.ewram9);
|
||||
|
||||
/* EZF Advance strips trailing 0xff bytes, add a pad section so nothing important is removed */
|
||||
.pad ALIGN(4) : AT (__pad_lma)
|
||||
{
|
||||
LONG(0x52416b64)
|
||||
LONG(0x4d)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} = 0xff
|
||||
|
||||
__ewram_overlay_end = . ;
|
||||
__eheap_start = . ;
|
||||
|
||||
_end = .;
|
||||
__end__ = _end ; /* v1.3 */
|
||||
PROVIDE (end = _end); /* v1.3 */
|
||||
|
||||
|
||||
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
.stack 0x80000 : { _stack = .; *(.stack) }
|
||||
/* These must appear regardless of . */
|
||||
}
|
||||
/* (c) 2006 by devkitPro (http://www.devkitpro.org) */
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
|
||||
|
||||
|
||||
|
||||
MEMORY {
|
||||
rom : ORIGIN = 0x08000000, LENGTH = 32M
|
||||
iwram : ORIGIN = 0x03000000, LENGTH = 32K
|
||||
ewram : ORIGIN = 0x02000000, LENGTH = 256K
|
||||
}
|
||||
|
||||
__text_start = 0x8000000;
|
||||
__eheap_end = 0x2040000;
|
||||
__iwram_start = 0x3000000;
|
||||
__iwram_end = 0x3008000;
|
||||
|
||||
__sp_irq = __iwram_end - 0x100;
|
||||
__sp_usr = __sp_irq - 0x100;
|
||||
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
. = __text_start;
|
||||
.init :
|
||||
{
|
||||
KEEP (*(.init))
|
||||
. = ALIGN(4);
|
||||
} >rom =0xff
|
||||
|
||||
.plt :
|
||||
{
|
||||
*(.plt)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom
|
||||
|
||||
.text : /* ALIGN (4): */
|
||||
{
|
||||
*(EXCLUDE_FILE (*.iwram*) .text)
|
||||
*(.text.*)
|
||||
*(.stub)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.gnu.linkonce.t*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom = 0xff
|
||||
|
||||
__text_end = .;
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(.fini))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom =0
|
||||
|
||||
|
||||
|
||||
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*all.rodata*(*)
|
||||
*(.roda)
|
||||
*(.rodata.*)
|
||||
/************************************************************ FL: Attempt n.2 */
|
||||
/* *(.data.*) Moved here from EWRAM because size matters */
|
||||
*(.gnu.linkonce.r*)
|
||||
SORT(CONSTRUCTORS)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom = 0xff
|
||||
|
||||
.ctors :
|
||||
{
|
||||
/* gcc uses crtbegin.o to find the start of the constructors, so
|
||||
we make sure it is first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not actually link against
|
||||
crtbegin.o; the linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it doesn't matter which
|
||||
directory crtbegin.o is in. */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom = 0
|
||||
|
||||
.dtors :
|
||||
{
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom = 0
|
||||
|
||||
.jcr : { KEEP (*(.jcr)) } >rom
|
||||
|
||||
.eh_frame :
|
||||
{
|
||||
KEEP (*(.eh_frame))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom = 0
|
||||
|
||||
.gcc_except_table :
|
||||
{
|
||||
*(.gcc_except_table)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >rom = 0
|
||||
|
||||
|
||||
|
||||
/************************************************************* FL: Attempt n.2
|
||||
__data_lma = . + SIZEOF(.gcc_except_table) ;
|
||||
|
||||
.data ALIGN(4) : AT (__data_lma)
|
||||
{
|
||||
__data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
} >rom = 0xff
|
||||
|
||||
__data_end = .;
|
||||
*********************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
__iwram_lma = .;
|
||||
|
||||
.iwram __iwram_start : AT (__iwram_lma)
|
||||
{
|
||||
__iwram_start = ABSOLUTE(.) ;
|
||||
*(.iwram)
|
||||
*iwram.*(.text)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >iwram = 0xff
|
||||
|
||||
__iwram_end = . ;
|
||||
|
||||
.bss ALIGN(4) :
|
||||
{
|
||||
__bss_start = ABSOLUTE(.);
|
||||
__bss_start__ = ABSOLUTE(.);
|
||||
*(.dynbss)
|
||||
*(.gnu.linkonce.b*)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >iwram
|
||||
|
||||
__bss_end = . ;
|
||||
__bss_end__ = . ;
|
||||
|
||||
|
||||
__iwram_overlay_lma = __iwram_lma + SIZEOF(.iwram);
|
||||
|
||||
__iwram_overlay_start = . ;
|
||||
|
||||
OVERLAY ALIGN(4) : NOCROSSREFS AT (__iwram_overlay_lma)
|
||||
{
|
||||
.iwram0 { *(.iwram0) . = ALIGN(4);}
|
||||
.iwram1 { *(.iwram1) . = ALIGN(4);}
|
||||
.iwram2 { *(.iwram2) . = ALIGN(4);}
|
||||
.iwram3 { *(.iwram3) . = ALIGN(4);}
|
||||
.iwram4 { *(.iwram4) . = ALIGN(4);}
|
||||
.iwram5 { *(.iwram5) . = ALIGN(4);}
|
||||
.iwram6 { *(.iwram6) . = ALIGN(4);}
|
||||
.iwram7 { *(.iwram7) . = ALIGN(4);}
|
||||
.iwram8 { *(.iwram8) . = ALIGN(4);}
|
||||
.iwram9 { *(.iwram9) . = ALIGN(4);}
|
||||
}>iwram = 0xff
|
||||
|
||||
|
||||
|
||||
|
||||
__ewram_lma = LOADADDR(.iwram0) + SIZEOF(.iwram0)+SIZEOF(.iwram1)+SIZEOF(.iwram2)+SIZEOF(.iwram3)+SIZEOF(.iwram4)+SIZEOF(.iwram5)+SIZEOF(.iwram6)+SIZEOF(.iwram7)+SIZEOF(.iwram8)+SIZEOF(.iwram9);
|
||||
|
||||
__iwram_overlay_end = . ;
|
||||
__iheap_start = . ;
|
||||
|
||||
__ewram_start = 0x2000000;
|
||||
.ewram __ewram_start : AT (__ewram_lma)
|
||||
{
|
||||
*(.ewram)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
}>ewram = 0xff
|
||||
|
||||
|
||||
|
||||
__data_lma = __ewram_lma + SIZEOF(.ewram) ;
|
||||
|
||||
.data ALIGN(4) : AT (__data_lma)
|
||||
{
|
||||
__data_start = ABSOLUTE(.);
|
||||
*(.data) /****************************************** FL: Attempt n.2 */
|
||||
*(.data.*) /* Moved to RODATA for size matters */
|
||||
*(.gnu.linkonce.d*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
} >ewram = 0xff
|
||||
|
||||
__data_end = .;
|
||||
|
||||
__ewram_overlay_lma = __data_lma + SIZEOF(.data);
|
||||
|
||||
|
||||
|
||||
.sbss ALIGN(4):
|
||||
{
|
||||
__sbss_start = ABSOLUTE(.);
|
||||
*(.sbss)
|
||||
. = ALIGN(4);
|
||||
} >ewram
|
||||
|
||||
__sbss_end = .;
|
||||
|
||||
__ewram_end = . ;
|
||||
__ewram_overlay_start = . ;
|
||||
|
||||
OVERLAY ALIGN(4): NOCROSSREFS AT (__ewram_overlay_lma)
|
||||
{
|
||||
.ewram0 { *(.ewram0) . = ALIGN(4);}
|
||||
.ewram1 { *(.ewram1) . = ALIGN(4);}
|
||||
.ewram2 { *(.ewram2) . = ALIGN(4);}
|
||||
.ewram3 { *(.ewram3) . = ALIGN(4);}
|
||||
.ewram4 { *(.ewram4) . = ALIGN(4);}
|
||||
.ewram5 { *(.ewram5) . = ALIGN(4);}
|
||||
.ewram6 { *(.ewram6) . = ALIGN(4);}
|
||||
.ewram7 { *(.ewram7) . = ALIGN(4);}
|
||||
.ewram8 { *(.ewram8) . = ALIGN(4);}
|
||||
.ewram9 { *(.ewram9) . = ALIGN(4);}
|
||||
}>ewram = 0xff
|
||||
|
||||
__pad_lma = LOADADDR(.ewram0) + SIZEOF(.ewram0)+SIZEOF(.ewram1)+SIZEOF(.ewram2)+SIZEOF(.ewram3)+SIZEOF(.ewram4)+SIZEOF(.ewram5)+SIZEOF(.ewram6)+SIZEOF(.ewram7)+SIZEOF(.ewram8)+SIZEOF(.ewram9);
|
||||
|
||||
/* EZF Advance strips trailing 0xff bytes, add a pad section so nothing important is removed */
|
||||
.pad ALIGN(4) : AT (__pad_lma)
|
||||
{
|
||||
LONG(0x52416b64)
|
||||
LONG(0x4d)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} = 0xff
|
||||
|
||||
__ewram_overlay_end = . ;
|
||||
__eheap_start = . ;
|
||||
|
||||
_end = .;
|
||||
__end__ = _end ; /* v1.3 */
|
||||
PROVIDE (end = _end); /* v1.3 */
|
||||
|
||||
|
||||
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
.stack 0x80000 : { _stack = .; *(.stack) }
|
||||
/* These must appear regardless of . */
|
||||
}
|
||||
|
||||
101
rtl/gba/prt0.as
101
rtl/gba/prt0.as
@ -1,101 +0,0 @@
|
||||
@********************************************************************
|
||||
@* crt0.s *
|
||||
@ This file is a hack. It is not meant for serious work. *
|
||||
@********************************************************************
|
||||
.TEXT
|
||||
|
||||
.GLOBAL _start
|
||||
_start:
|
||||
.ALIGN
|
||||
.CODE 32
|
||||
@ Start Vector
|
||||
rom_header: b rom_header_end
|
||||
|
||||
@ Nintendo Logo Character Data (8000004h)
|
||||
.byte 0x24,0xff,0xae,0x51,0x69,0x9a,0xa2,0x21
|
||||
.byte 0x3d,0x84,0x82,0x0a,0x84,0xe4,0x09,0xad
|
||||
.byte 0x11,0x24,0x8b,0x98,0xc0,0x81,0x7f,0x21
|
||||
.byte 0xa3,0x52,0xbe,0x19,0x93,0x09,0xce,0x20
|
||||
.byte 0x10,0x46,0x4a,0x4a,0xf8,0x27,0x31,0xec
|
||||
.byte 0x58,0xc7,0xe8,0x33,0x82,0xe3,0xce,0xbf
|
||||
.byte 0x85,0xf4,0xdf,0x94,0xce,0x4b,0x09,0xc1
|
||||
.byte 0x94,0x56,0x8a,0xc0,0x13,0x72,0xa7,0xfc
|
||||
.byte 0x9f,0x84,0x4d,0x73,0xa3,0xca,0x9a,0x61
|
||||
.byte 0x58,0x97,0xa3,0x27,0xfc,0x03,0x98,0x76
|
||||
.byte 0x23,0x1d,0xc7,0x61,0x03,0x04,0xae,0x56
|
||||
.byte 0xbf,0x38,0x84,0x00,0x40,0xa7,0x0e,0xfd
|
||||
.byte 0xff,0x52,0xfe,0x03,0x6f,0x95,0x30,0xf1
|
||||
.byte 0x97,0xfb,0xc0,0x85,0x60,0xd6,0x80,0x25
|
||||
.byte 0xa9,0x63,0xbe,0x03,0x01,0x4e,0x38,0xe2
|
||||
.byte 0xf9,0xa2,0x34,0xff,0xbb,0x3e,0x03,0x44
|
||||
.byte 0x78,0x00,0x90,0xcb,0x88,0x11,0x3a,0x94
|
||||
.byte 0x65,0xc0,0x7c,0x63,0x87,0xf0,0x3c,0xaf
|
||||
.byte 0xd6,0x25,0xe4,0x8b,0x38,0x0a,0xac,0x72
|
||||
.byte 0x21,0xd4,0xf8,0x07
|
||||
|
||||
@ Software Titles (80000A0h)
|
||||
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
.byte 0x00,0x00,0x00,0x00
|
||||
|
||||
@ Initial Code (80000ACh)
|
||||
.byte 0x00,0x00,0x00,0x00
|
||||
|
||||
@ Maker Code (80000B0h)
|
||||
.byte 0x30,0x31
|
||||
|
||||
@ Fixed Value (80000B2h)
|
||||
.byte 0x96
|
||||
|
||||
@ Main Unit Code (80000B3h)
|
||||
.byte 0x00
|
||||
|
||||
@ Device Type (80000B4h)
|
||||
.byte 0x00
|
||||
|
||||
@ Unused Data (7Byte) (80000B5h)
|
||||
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
|
||||
@ Software Version No (80000BCh)
|
||||
.byte 0x00
|
||||
|
||||
@ Complement Check (80000BDh)
|
||||
.byte 0xf0
|
||||
|
||||
@ Check Sum (80000BEh)
|
||||
.byte 0x00,0x00
|
||||
|
||||
rom_header_end:
|
||||
|
||||
@--------------------------------------------------------------------
|
||||
@- Reset -
|
||||
@--------------------------------------------------------------------
|
||||
.EXTERN PASCALMAIN
|
||||
.GLOBAL start_vector
|
||||
.CODE 32
|
||||
.ALIGN
|
||||
start_vector:
|
||||
mov r0, #0x12 @ Switch to IRQ Mode
|
||||
msr cpsr, r0
|
||||
|
||||
ldr sp, sp_irq @ Set SP_irq
|
||||
|
||||
mov r0, #0x1f @ Switch to System Mode
|
||||
msr cpsr, r0
|
||||
|
||||
ldr sp, sp_usr @ Set SP_usr
|
||||
str r0, [r1]
|
||||
|
||||
ldr r1, =PASCALMAIN @ Start & Switch to 16bit Code
|
||||
mov lr, pc
|
||||
bx r1
|
||||
|
||||
b start_vector @ Reset
|
||||
|
||||
.ALIGN
|
||||
sp_usr: .word 0x3008000 - 0x100
|
||||
sp_irq: .word 0x3008000 - 0x60
|
||||
|
||||
.ALIGN
|
||||
.CODE 32
|
||||
|
||||
.END
|
||||
@ -1 +0,0 @@
|
||||
{$i system.pp}
|
||||
1250
rtl/gba/unix.pp
1250
rtl/gba/unix.pp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user