Commit bfa2476c by Roman

Update make system, add scripts/linker script

Signed-off-by: Roman Bartosinski <roman@daiteq.com>
1 parent 06a0be67
*~ *~
*.bak *.bak
BUILD/
\ No newline at end of file
TEST?=paranoia
TESTDIR=.
LIBSRCDIR=../libs
BUILDDIR=BUILD
SIMDIR=MGSIM
# daifpu_divsqrt - daifpu with functions div and sqrt in hardware
# daifpu_divonly - daifpu with function div in hardware
# daifpu_none - daifpu without div and sqrt
# daifpu_dual_dpsp_divsqrt - DP,SP with div and sqrt functions in hardware
# daifpu_dual_dpsp_divonly - DP,SP with div function in hardware
# daifpu_dual_dpsp_none - DP,SP without div and sqrt
# daifpu_dual_sphp_divsqrt - SP,HP with div and sqrt functions in hardware
# daifpu_dual_sphp_divonly - SP,HP with div function in hardware
# daifpu_dual_sphp_none - SP,HP without div and sqrt
# daifpu_dp_divsqrt - DP with div and sqrt in FPU
# daifpu_dp_divonly - DP with div in FPU
# daifpu_dp_none - DP without div and sqrt
# daifpu_sp_divsqrt - SP with div and sqrt in FPU
# daifpu_sp_divonly - SP with div in FPU
# daifpu_sp_none - SP without div and sqrt
# daifpu_hp_divsqrt - HP with div and sqrt in FPU
# daifpu_hp_divonly - HP with div in FPU
# daifpu_hp_none - HP without div and sqrt
# daifpu_psp_divsqrt - SP,PSP with div and sqrt in FPU
# daifpu_psp_divonly - SP,PSP with div in FPU
# daifpu_psp_none - SP,PSP without div and sqrt
# daifpu_php_divsqrt - HP,PHP with div and sqrt in FPU
# daifpu_php_divonly - HP,PHP with div in FPU
# daifpu_php_none - HP,PHP without div and sqrt
# none - no FPU = all in soft-float (same as option -msoft-float)
# use llvm toolchain
TOOL?=llvm
# use default FPU
FPUCFG?=daifpu_divsqrt
# default no suffix in build directory
DSUFFIX?=
# user defines (without '-D', e.g. PREC=SINGLE WITHSIM )
USERDEFS?=
# user CFLAGS
UCFLAGS?=
# file ID
ID?=0
#TOOLCHAIN=sparc-daiteq-elf
CPUFREQ?=100000000
UARTBDR?=115200
TOP:=$(shell pwd)
DEFS=-DLEON2 -DCPUFREQ=$(CPUFREQ) -DUARTBDRATE=$(UARTBDR)
CFLAGS=$(DEFS) $(USERDEFS:%=-D%) $(UCFLAGS)
#CFLAGS=-target $(TOOLCHAIN) -Xassembler -Aleon $(DEFS)
#LDFLAGS=-T$(TOP)/scripts/$(LNKSCRIPT)
#include Makefile.fpu
#APPVER=$(subst $e ,_,$(USERDEFS:%=_%))
APPVER=-$(ID)-$(FPUCFG)
PROGS=$(TEST:%=$(BUILDDIR)/$(FPUCFG)$(DSUFFIX)/%$(APPVER).elf)
PROJECTS=$(subst $(APPVER).elf,,$(PROGS))
all: $(PROGS)
@echo "Tests are built"
$(BUILDDIR)/$(FPUCFG)$(DSUFFIX)/%$(APPVER).elf: $(TOP)/$(TESTDIR)/%
@mkdir -p $(dir $@)include $(dir $@)lib
@make -C $< -f Makefile build TOP="$(TOP)" TOOL=$(TOOL) BUILD="$(TOP)/$(dir $@)" PRJ="$(notdir $<)" TSTDIR="$(TOP)/$(TESTDIR)" APP="$(TOP)/$@" VER="$(APPVER)" CF="$(CFLAGS)" FPUCFG=$(FPUCFG)
clean: $(PROGS)
make -C tests/$(notdir $(basename $<)) -f Makefile clean TOP="$(TOP)" BUILD="$(TOP)/$(dir $<)" PRJ="$(notdir $(basename $<))" APP="$(TOP)/$<" FPUCFG=$(FPUCFG)
distclean:
rm -rf $(BUILDDIR) $(SIMDIR)
appclean:
for t in $(TEST); do \
rm -rf `find $(BUILDDIR) -mindepth 2 -maxdepth 2 -name $${t}*`; \
done
libclean:
make -C $(LIBSRCDIR)/bsp -f Makefile clean
make -C $(LIBSRCDIR)/builtins -f Makefile clean
make -C $(LIBSRCDIR)/openlibm -f Makefile clean
make -C $(LIBSRCDIR)/softfloat/build/DAITEQ-LEON-LLVM -f Makefile clean
sim: $(PROGS)
@echo "Prepare and run simulation for $<"
@mkdir -p $(SIMDIR)/$(FPUCFG)$(DSUFFIX)
@make -C tests/$(notdir $(basename $(PROJECTS))) -f Makefile sim TOP="$(TOP)" BUILD="$(TOP)/$(dir $<)" SIMDIR="$(TOP)/$(SIMDIR)/$(FPUCFG)$(DSUFFIX)" PRJ="$(notdir $(basename $(PROJECTS)))" TSTDIR="$(TOP)/$(TESTDIR)" APP="$(TOP)/$<" VER="$(APPVER)" CF="$(CFLAGS)" FPUCFG=$(FPUCFG)
inspect: $(PROGS:%.elf=%.fpi)
@echo "All inspections are generated"
$(BUILDDIR)/$(FPUCFG)$(DSUFFIX)/%.fpi:
make -C . -f Makefile.rules $(TOP)/$@ TOP="$(TOP)" BUILD="$(TOP)/$(dir $@)" PRJ="$(notdir $(basename $@))" TSTDIR="$(TOP)/$(TESTDIR)" APP="$(TOP)/$(@:%.fpi=%.elf)" CF="$(CFLAGS)" FPUCFG=$(FPUCFG)
# common part for all tests
#build
#TOP="$(TOP)"
#BUILD="$(TOP)/$(basename $@)"
#PRJ="$(notdir $(basename $@))"
#APP="$(TOP)/$@"
#CFLAGS="$(CFLAGS)"
#FPUCFG=$(FPUCFG)
# the TOP directory as absolute path
ifndef TOP
$(error TOP is not set)
endif
# building directory (for specific project)
ifndef BUILD
$(error BUILD is not set)
endif
# project directory (where files with the source code are)
ifndef PRJ
$(error PRJ is not set)
endif
# ELF file for the project
ifndef APP
$(error APP is not set)
endif
# type of FPU (also subdirectory in building directory)
ifndef FPUCFG
$(error FPUCFG is not set)
endif
ifndef LIBSRCDIR
LIBSRCDIR=../libs
endif
#LNKSCRIPT=$(TOP)/scripts/linkleon
ifdef LDSCRIPT
LNKSCRIPT=$(TOP)/scripts/$(LDSCRIPT)
else
LNKSCRIPT=$(TOP)/scripts/linkram2
endif
#LASTTEXTSECTION=.bss
#LASTTEXTSECTION=.data
SIMCFG_SCRIPT=$(TOP)/scripts/makemgsimini.py
SIMCFG_TMP=$(TOP)/scripts/config-simple-uartlite.ini-template
LIBDIR=$(BUILD)lib
INCDIR=$(BUILD)include
# LLVM toolchain
ifeq ($(TOOL),llvm)
TOOLCHAIN=sparc-daiteq-elf
CC=clang
LC=llc
CFLAGS=$(CF) -mcpu=leon2 -DUSEDBSP=BSP_AT697
CFLAGS+=-ggdb -target $(TOOLCHAIN) -Xassembler -Aleon -Xassembler --has-swar -Xassembler --has-fhalf -Xassembler --has-fpack
#CFLAGS+=-Xlinker -debug-pass=Structure -Xlinker -debug -Xlinker --asm-verbose
#CFLAGS+=-Xlinker --print-after-all
#CFLAGS+=-Xlinker --view-legalize-types-dags
#CFLAGS+=-save-temps
endif
# GCC toolchain - BCC 2.0.2
ifeq ($(TOOL),gcc)
TOOLCHAIN=sparc-gaisler-elf
CC=$(TOOLCHAIN)-gcc
CFLAGS=$(CF) -mcpu=leon -qbsp=leon2 -mfix-at697f
CFLAGS+=-ggdb
endif
CFLAGS+=$(APPFLAGS)
INCLUDE+=-I. -I$(INCDIR)
# no libraries
LDFLAGS=-N -nostdlib -nostartfiles -T $(LNKSCRIPT) -e _hardreset
LDFLAGS+=--gc-sections
# --print-gc-sections
DATSECS=.text .data
APP_OBJS=$(SOURCES:%.c=$(BUILD)$(PRJ)$(VER)/%.o)
APP_DIS=$(APP:%.elf=%.dis)
APP_MGINI=$(APP:%.elf=%.ini)
APP_AST=$(APP:%.elf=%.ast)
APP_LL=$(APP:%.elf=%.ll)
APP_FPI=$(APP:%.elf=%-compile-fpu.log)
APP_CAL=$(APP:%.elf=%-compile-sfcalls.log)
APP_MCAL=$(APP:%.elf=%-compile-mcalls.log)
APP_DAT=$(APP:%.elf=%.dat)
STRIP_APP=$(APP:%.elf=%-strip.elf)
STRIP_APP_DAT=$(APP:%.elf=%-strip.dat)
BOOTOBJ=$(BUILD)bsplib/locore1.o
#The following include is workaround if clang option 'daiteq-fpu-type' does not work
#include $(TOP)/Makefile.fpu
$(info >>> APP <<< T=$(TOP) , B=$(BUILD) , P=$(PRJ) , A=$(APP) , VER=$(VER), CF=$(CFLAGS) , F=$(FPUCFG))
.SUFFIXES:
.PHONY: clean all withsim build sim
#all:
#@for t in $(LISTOFTESTS); \
#do \
#echo Build $$t ;\
#make -f Makefile build APPDIR=$$t; \
#done
#withsim:
#@for t in $(LISTOFTESTS); \
#do \
#echo Build $$t ;\
#make -f Makefile build APPDIR=$$t; \
#make -f Makefile sim APPDIR=$$t; \
#done
#$(APP_MGINI) $(APP_ASTS) $(APP_IRS) $(STRIP_APP) $(STRIP_APP_DAT)
build: $(LIBDIR) $(INCDIR) $(LIBS:%=$(LIBDIR)/lib%.a) $(BUILD)$(PRJ)$(VER) $(APP) $(APP_DIS) $(APP_DAT) $(APP_FPI) $(APP_CAL) $(APP_MCAL) $(APP_MGINI)
@echo "Compiled"
$(BLDDIR):
@mkdir -p $@
$(LIBDIR):
@mkdir -p $@
$(INCDIR):
@mkdir -p $@
$(BUILD)$(PRJ)$(VER):
@mkdir -p $@
#### Libraries ####
$(LIBDIR)/libbsp.a: $(TOP)/$(LIBSRCDIR)/bsp
@echo "BSP in $<"
@make -C $< -f Makefile export TOP="$(TOP)" TOOL=$(TOOL) DSTPATH="$(LIBDIR)" INCPATH="$(INCDIR)" BLDPATH="$(BUILD)bsplib" CFLAGS="$(CFLAGS)" FPUCFG=$(FPUCFG)
$(LIBDIR)/libm.a: $(TOP)/$(LIBSRCDIR)/openlibm
@echo "openlibm in $<"
@make -C $< -f Makefile export TOP="$(TOP)" TOOL=$(TOOL) DSTPATH="$(LIBDIR)" INCPATH="$(INCDIR)" BLDPATH="$(BUILD)openlibm" CF="$(CFLAGS)" FPUCFG=$(FPUCFG)
$(LIBDIR)/libins.a: $(TOP)/$(LIBSRCDIR)/builtins
@echo "builtins in $<"
@make -C $< -f Makefile export TOP="$(TOP)" TOOL=$(TOOL) DSTPATH="$(LIBDIR)" INCPATH="$(INCDIR)" BLDPATH="$(BUILD)inslib" APPCFLAGS="$(CFLAGS)" FPUCFG=$(FPUCFG)
# soft-float library is only one for all daifpu configurations
$(LIBDIR)/libsoftfloat.a: $(TOP)/$(LIBSRCDIR)/softfloat/build/DAITEQ-LEON-LLVM
@echo "softfloat in $<"
@make -C $< -f Makefile export TOP="$(TOP)" TOOL=$(TOOL) DSTPATH="$(LIBDIR)" INCPATH="$(INCDIR)" CFLAGS="$(CFLAGS)"
# test-float library
$(LIBDIR)/libtestfloat.a: $(TOP)/$(LIBSRCDIR)/testfloat
@echo "testfloat in $<"
@make -C $< -f Makefile export TOP="$(TOP)" TOOL=$(TOOL) DSTPATH="$(LIBDIR)" INCPATH="$(INCDIR)" BLDPATH="$(BUILD)testfloat" CFLAGS="$(CFLAGS)" FPUCFG=$(FPUCFG)
#### Apps ####
$(APP_DIS): $(APP)
$(TOOLCHAIN)-objdump -S --visualize-jumps $< > $@
$(STRIP_APP): $(APP)
cp $(APP) $(STRIP_APP)
$(TOOLCHAIN)-strip $(STRIP_APP)
$(STRIP_APP_DAT): $(STRIP_APP)
$(TOOLCHAIN)-objdump -s $(DATSECS:%=-j %) $< > $@
$(APP_DAT): $(APP)
$(TOOLCHAIN)-objdump -s $(DATSECS:%=-j %) $< > $@
$(APP_MGINI): $(APP)
$(TOOLCHAIN)-size -A -d -t $< > /tmp/sectable.txt; \
$(SIMCFG_SCRIPT) /tmp/sectable.txt $(SIMCFG_TMP) $@; \
rm -f /tmp/sectable.txt
$(BUILD)$(PRJ)$(VER)/%.o:$(TSTDIR)/$(PRJ)/%.c $(DEPFILES:%=$(TSTDIR)/$(PRJ)/%)
@echo " o Compile '$^' -> $@"
@echo " > $(CC) -daiteq-fpu-type=$(FPUCFG) -DTESTID=$(ID) $(CFLAGS) $(INCLUDE) -c $< -o $@ <"
@$(CC) -daiteq-fpu-type=$(FPUCFG) -DTESTID=$(ID) $(CFLAGS) $(INCLUDE) -c $< -o $@
# the first function in BSP library should be a _hardreset function or directly use some object file (bootmain.o)
$(APP): $(APP_OBJS) $(DEPFILES:%=$(TSTDIR)/$(PRJ)/%)
$(TOOLCHAIN)-ld $(LDFLAGS) -L $(LIBDIR) -o $@ $(BOOTOBJ) $(APP_OBJS) $(LIBS:%=-l%)
#$(BUILDDIR)/$(COMMONDIR)/bootmini.o:$(COMMONDIR)/boot_mini.S
# @$(CC) $(CFLAGS) -c $< -o $@
#
#$(BUILDDIR)/$(COMMONDIR)/my_printf.o:$(COMMONDIR)/my_printf.c
# @$(CC) $(CFLAGS) -c $< -o $@
#
#$(BUILDDIR)/$(COMMONDIR)/leon-myuart.o:$(COMMONDIR)/leon-myuart.c
# @$(CC) $(CFLAGS) -c $< -o $@
#
$(APP_AST):$(PRJ)/%.c
@$(CC) -Xclang -ast-dump -fno-color-diagnostics -S $(CFLAGS) $< >$@ 2>$@_err
$(APP_LL):$(PRJ)/%.c
@$(CC) -emit-llvm $(CFLAGS) $< -S -o $@ 2>$@_err
$(APP_FPI):$(APP_DIS)
@$(TOP)/scripts/inspectfp.py $< >$@
NOSFLIBS=$(filter-out softfloat,$(LIBS))
NOMLIBS=$(filter-out m,$(LIBS))
$(APP_CAL):$(APP_OBJS)
@echo " ~ Check linking $(APP) without softfloat library"
@( $(TOOLCHAIN)-ld $(LDFLAGS) -L $(LIBDIR) -o /tmp/$(notdir $@).toremove $^ $(NOSFLIBS:%=-l%) 2>&1 >/dev/null | grep -E "undefined reference to" | sed -e 's/undefined reference to/library call/g' | tee $@; (exit 0); )
$(APP_MCAL):$(APP_OBJS)
@echo " ~ Check linking $(APP) without m library"
@( $(TOOLCHAIN)-ld $(LDFLAGS) -L $(LIBDIR) -o /tmp/$(notdir $@).toremove $^ $(NOMLIBS:%=-l%) 2>&1 >/dev/null | grep -E "undefined reference to" | sed -e 's/undefined reference to/library call/g' | tee $@; (exit 0); )
# ------------------------------------------------------------------------------
# clean generated files
clean:
rm -f $(APP) $(APP_OBJS) $(APP) $(APP_MGINI)
# ------------------------------------------------------------------------------
# run simulation
ifeq ($(NOLOG),y)
SIM_LOGOUT=/dev/null
else
SIM_LOGFILE=$(notdir $(APP:%.elf=%-sim-stderr.log))
SIM_LOGOUT=$(SIM_LOGFILE:%=$(SIMDIR)/%)
endif
SIM_OUTFILE=$(notdir $(APP:%.elf=%-sim-stdout.log))
SIM_OUTPUT=$(SIM_OUTFILE:%=$(SIMDIR)/%)
sim: $(SIM_OUTPUT)
@echo "Simulation done"
$(SIM_OUTPUT): $(APP) $(APP_MGINI)
mgsim -c $(APP_MGINI) -t --no-edge-properties $(APP) 2>$(SIM_LOGOUT) | tee $(SIM_OUTPUT)
@echo '~EoS~'
#!/usr/bin/python
# Script for parsing source code file and extracting compile flags and options
# 2020 Roman Bartosinski, daiteq s.r.o.
#
# Line begins with:
# //A: assembler flags
# //C: C compiler flags
# //D: selection of data types for specific testing framework
import sys
meta={}
#print(sys.argv)
if len(sys.argv)>2:
onlytype = sys.argv[2]
else:
onlytype = None
try:
if len(sys.argv)<2:
raise Exception('no arg')
with open(sys.argv[1]) as f:
content = f.readlines()
# print(content)
for ln in content:
# skip unsupported lines
if not ln.startswith('//'):
continue
if (len(ln)<5) or (ln[3]!=':'):
continue
ctp = ln[2]
if (onlytype is not None) and (ctp!=onlytype[0]):
continue
# get data types
if ctp=='D':
if 'D' not in meta:
meta['D'] = ""
f = ln.find("'")
i = ln.find("=")
if f<0:
f = 3
l = len(ln)
else:
l = ln.rfind("'")
if i<0:
i = l
args = ln[f+1:i]
if i<l:
res = ln[i+1:l]
else:
res = ''
#print(args)
i = args.find(',')
if i<0:
a1 = args.strip()
a2 = "none"
else:
a1 = args[0:i].strip()
a2 = args[i+1:].strip()
if a1=='half':
meta['D'] += " -DPAR_A_HALF=1"
elif a1=='float':
meta['D'] += " -DPAR_A_SINGLE=1"
elif a1=='double':
meta['D'] += " -DPAR_A_DOUBLE=1"
elif a1=='int32':
meta['D'] += " -DPAR_A_INT32=1"
elif a1=='packhalf':
meta['D'] += " -DPAR_A_PACKHALF=1"
else:
meta['D'] += " -DPAR_A_NONE=1"
if a2=='none':
meta['D'] += " -DPAR_B_NONE=1"
elif a2=='half':
meta['D'] += " -DPAR_B_HALF=1"
elif a2=='float':
meta['D'] += " -DPAR_B_SINGLE=1"
elif a2=='double':
meta['D'] += " -DPAR_B_DOUBLE=1"
elif a2=='int32':
meta['D'] += " -DPAR_B_INT32=1"
elif a2=='packhalf':
meta['D'] += " -DPAR_B_PACKHALF=1"
res = res.strip()
if res=='half':
meta['D'] += " -DRES_HALF=1"
elif res=='float':
meta['D'] += " -DRES_SINGLE=1"
elif res=='double':
meta['D'] += " -DRES_DOUBLE=1"
elif res=='int32':
meta['D'] += " -DRES_INT32=1"
elif res=='packhalf':
meta['D'] += " -DRES_PACKHALF=1"
else:
meta['D'] += " -DRES_NONE=1"
# get list of compilator flags
if ctp=='C':
if 'C' not in meta:
meta['C'] = []
f = ln.find("'")
if f<0:
f = 4
l = len(ln)
else:
l = ln.rfind("'")
meta['C'].append(ln[f+1:l].strip())
# get assembler flags
if ctp=='A':
if 'A' not in meta:
meta['A'] = ""
f = ln.find("'")
if f<0:
f = 4
l = len(ln)
else:
l = ln.rfind("'")
meta['A'] += " " + ln[f+1:l].strip()
except:
if 'D' not in meta:
meta['D'] = ""
meta['D'] += " -DNOTREADY"
sys.exit
if onlytype is not None:
if onlytype in meta:
if isinstance(meta[onlytype], str):
print(meta[onlytype])
else:
print("\n".join(meta[onlytype]))
else:
print(meta)
#!/usr/bin/python
# inspectfp.py <input_file>
import os
import sys
# search the following instructions in the input file
tab = {"double" : ["faddd", "fsubd", "fmuld", "fdivd", "fsqrtd", "fcmdd", "fcmped","fitod","fdtoi","fdtos"],
"single" : ["fadds", "fsubs", "fmuls", "fdivs", "fsqrts", "fcmps", "fcmpes","fitos","fstoi","fstod","fsmuld","fabss","fnegs","fmovs"],
"half" : ["faddh", "fsubh", "fmulh", "fdivh", "fsqrth", "fcmph", "fcmpeh","fitoh","fhtoi","fhtos","fhmuls","fabsh","fmovh"],
"packhalf" : ["faddph","fsubph","fmulph","fdivph","fsqrtph","fcmpph","fcmpeph","fswaph","fmovhu","fmovhl","fmovhul","fmovhlu","fmovhzu","fmovhzl"],
"packsingle" : ["faddps","fsubps","fmulps","fdivps","fsqrtps","fcmpps","fcmpeps"],
"others" : ["ldh","sth"],
}
if len(sys.argv)<2:
print("E: Missing argument. Script needs one argument - input file.")
print("E: The optional second argument contains format ('tab'/'list')")
sys.exit(1)
ctab = []
taby = 0
tabx = 0
for p in tab:
if len(tab[p])>tabx:
tabx = len(tab[p])
ctab.append([0] * len(tab[p]))
taby += 1
with open(sys.argv[1], 'r') as fi:
ctx = fi.readlines()
for ln in ctx:
ty = 0
for p in tab:
for i in range(0,len(tab[p])):
# instructions are placed after <tab> and separated with <dpace> in disassembler
if ln.find("\t"+tab[p][i]+" ")>0:
ctab[ty][i] += 1
ty += 1
fmt = 'tab'
if len(sys.argv)>2:
fmt = sys.argv[2]
if fmt=='tab':
ty=0
print("===== Table of FP instructions ==========================================")
if tabx>6:
for p in tab:
ln = "{:10} ".format(p)
for i in range(0,6):
if (i<len(tab[p])):
ln += "| {:7}: {:4}".format(tab[p][i], ctab[ty][i])
print(ln)
ty += 1
print("-------------------------------------------------------------------------")
ty = 0
for p in tab:
ln = "{:10} ".format(p)
for i in range(6,len(tab[p])):
if (i<len(tab[p])):
ln += "| {:7}: {:4}".format(tab[p][i], ctab[ty][i])
print(ln)
ty += 1
else:
for p in tab:
ln = "{:10} ".format(p)
for i in range(0,len(tab[p])):
ln += "| {:7}: {:4}".format(tab[p][i], ctab[ty][i])
if i==6:
print(ln)
ln = "{:20}".format(" ->")
print(ln)
ty += 1
print("=========================================================================")
elif fmt=='list':
ty = 0;
print("~~~~~ List of FP instructions ~~~~~")
for p in tab:
print("|> {:10} ".format(p))
for i in range(0,len(tab[p])):
ln = "| {:7}: {:4}".format(tab[p][i], ctab[ty][i])
print(ln)
ty += 1
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
/*
*uncomment this if you want the linker to output srecords.
OUTPUT_FORMAT(srec)
*
*/
OUTPUT_ARCH(sparc)
SEARCH_DIR(/usr/local/erc32/sparc-erc32-aout/lib)
SEARCH_DIR(/usr/local/erc32/lib/gcc-lib/sparc-aout/2.7.2)
__DYNAMIC = 0;
ENTRY(start)
/*
* The memory map looks like this:
* +--------------------+ <- low memory
* | .text |
* | etext |
* | ctor list | the ctor and dtor lists are for
* | dtor list | C++ support
* | _endtext |
* +--------------------+
* | .data | initialized data goes here
* | _sdata |
* | _edata |
* +--------------------+
* | .bss |
* | __bss_start | start of bss, cleared by crt0
* | _end | start of heap, used by sbrk()
* +--------------------+
* | heap space |
* | _ENDHEAP |
* | stack space |
* | __stack | top of stack
* +--------------------+ <- high memory
*/
/*
* User modifiable values:
*
* _CLOCK_SPEED in Mhz (used to program the counter/timers)
*
* _PROM_SIZE size of PROM (permissible values are 4K, 8K, 16K
* 32K, 64K, 128K, 256K, and 512K)
* _RAM_SIZE size of RAM (permissible values are 256K, 512K,
* 1MB, 2Mb, 4Mb, 8Mb, 16Mb, and 32Mb)
*
* MAKE SURE THESE MATCH THE MEMORY DESCRIPTION SECTION!!!
*/
MEMORY
{
rom : ORIGIN = 0x40000000, LENGTH = 256K
ram : ORIGIN = 0x40040000, LENGTH = 64M /* paranoia-dp: c580 testfpu-meiko: 6ba0 testfpu-sp:6660 whetstone:CB20 */
}
/*
* stick everything in ram (of course)
*/
SECTIONS
{
.text :
SUBALIGN(0x20)
{
CREATE_OBJECT_SYMBOLS
text_start = .;
_text_start = .;
*(.text .text.*)
. = ALIGN(0x20);
*(.eh_frame)
. = ALIGN(0x20);
*(.gnu.linkonce.t*)
/*
* C++ constructors
*/
__CTOR_LIST__ = .;
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
*(.ctors)
LONG(0)
__CTOR_END__ = .;
__DTOR_LIST__ = .;
LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
*(.dtors)
LONG(0)
__DTOR_END__ = .;
_rodata_start = .;
*(.rodata)
*(.rodata*)
*(.gnu.linkonce.r*)
. = ALIGN(0x20);
_erodata = .;
etext = .;
_etext = .;
*(.init)
*(.fini)
*(.lit)
*(.shdata)
. = ALIGN(0x20);
_endtext = .;
} > rom
.dynamic : { *(.dynamic) } >ram
.got : { *(.got) } >ram
.plt : { *(.plt) } >ram
.hash : { *(.hash) } >ram
.dynrel : { *(.dynrel) } >ram
.dynsym : { *(.dynsym) } >ram
.dynstr : { *(.dynstr) } >ram
.hash : { *(.hash) } >ram
.data :
{
data_start = .;
_data_start = .;
_sdata = .;
*(.data)
*(.gnu.linkonce.d*)
*(.gcc_except_table)
. = ALIGN(0x20);
edata = .;
_edata = .;
} > ram
.shbss :
{
*(.shbss)
} > ram
.bss :
{
. = ALIGN(0x20);
__bss_start = .;
_bss_start = .;
bss_start = .;
*(.bss)
*(COMMON)
. = ALIGN(0x20);
_ebss = .;
end = .;
_end = .;
__end = .;
} > ram
.stab . (NOLOAD) :
{
[ .stab ]
}
.stabstr . (NOLOAD) :
{
[ .stabstr ]
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!