From: johanknol Date: Thu, 7 Feb 2002 18:29:25 +0000 (+0000) Subject: work in progress X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=2578c513da0fcaed975fd43cfd36a7458b7895a5;p=fw%2Fsdcc work in progress git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1903 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/as/xa51/Makefile b/as/xa51/Makefile index eab05d71..0b092d59 100644 --- a/as/xa51/Makefile +++ b/as/xa51/Makefile @@ -4,6 +4,8 @@ YACC = bison -y -d LEX = flex -i LEXLIB = +all: xa_rasm xa_link + xa_rasm: xa_main.o xa_rasm.tab.o xa_rasm.lex.o $(CC) -o xa_rasm xa_main.o xa_rasm.tab.o xa_rasm.lex.o $(LEXLIB) #strip xa_rasm @@ -30,5 +32,5 @@ all: xa_rasm clean: rm -f *.tab.c *.tab.h *.lex.c *.o *.bak y.output *.hex *.lst *.obj - rm -f xa_rasm core *~ + rm -f xa_rasm xa_link core *~ diff --git a/as/xa51/xa_link.c b/as/xa51/xa_link.c new file mode 100644 index 00000000..64d89e5d --- /dev/null +++ b/as/xa51/xa_link.c @@ -0,0 +1,112 @@ +/* This is a cheap hack. The xa51 has a couple of ways to scramble + relocation info into it's opcode that the standard linker can't + handle. + + The relocatable format looks like the known one, BUT ISN'T. + + The only things that are handled now are: + + "SDCCXA rel, version %f" must be the first line + "H %d areas %d global symbols" defines the # of areas and globals + "S [Ref000 | DefXXXX]" Def's are supposed to be defined in + their own area/segment + "A size %d flags %d" switch to another segment. this can happen + multiple times and should be equal. flags is ignored + "T xx xx bb bb ..." where x is the address within the current segment + and bb are the bytes + "R xx " the relocation tag. xx is the offset within the + previous "T .." line. could be something like REL_FF, REL_FFFF, + ABS_F0FF. and symbol is the previous defined symbol it refers to + + Thats all for now. +*/ + +#include +#include +#include + +#include "xa_version.h" + +static char outFileName[PATH_MAX]; + +void baseName(char *name, char*base) { + int i, first, last; + + // find the last path seperator in name + for (first=strlen(name)-1; + (name[first]!='/' && name[first]!='\\') && first; + first--); + if (name[first]=='/' || name[first]=='\\') { + first++; + } + + // find the last ext seperator in name + for (last=strlen(name)-1; + (name[last]!='.' && last); + last--); + if (!last) { + last=strlen(name); + } + + printf ("baseName: %s %d %d\n", name, first, last); + // fill the base with the baseName + for (i=first; iisbit && !p->area) { fprintf (sym_fp, "%-5s", "SBIT"); + } else if (!p->isdef) { + fprintf (sym_fp,"EXTRN"); } else { fprintf (sym_fp, "%-5s", areaToString(p->area)); } @@ -507,12 +509,12 @@ void init_areas(void) area[AREA_HOME].start=area[AREA_HOME].alloc_position = 0; } -void addAreaSymbols() { +void relPrelude() { //char buffer[132]; int i, areas=0, globals=0; struct symbol *p; - fprintf (frel, "XH\n"); + fprintf (frel, "SDCCXA rel, version %1.1f\n", version); for (i=0; i