OpenCores

16 Bit Microcontroller

Issue List
Need to support mingw32 with gcc4.5.0 #1
Closed buaa.byl opened this issue over 12 years ago
buaa.byl commented over 12 years ago

I modify the source of asm and compiler, let them build under win32.

buaa.byl@gmail.com

This is patch "mingw32-gcc4.5.0-bison2.4.1-flex2.5.4.diff": diff -uNr original\asm\assembler.bison modify\asm\assembler.bison --- original\asm\assembler.bison Wed Oct 01 01:58:06 2003 +++ modify\asm\assembler.bison Tue Jul 31 17:18:34 2012 @@ -2,6 +2,7 @@ %{

#include <stdio.h> +#include <string.h> #include <assert.h>

extern int yylex(); diff -uNr original\asm\assembler.flex modify\asm\assembler.flex --- original\asm\assembler.flex Wed Oct 01 01:58:06 2003 +++ modify\asm\assembler.flex Tue Jul 31 17:19:20 2012 @@ -7,13 +7,14 @@

%{ #include <stdio.h> +#include <string.h> #include <assert.h>

class Opcode; class Operand; class Expression;

-#include "assembler_bison.cc.h" +#include "assembler_bison.hh"

void count(); int show_token(int op, const char * txt, YYSTYPE & lval); diff -uNr original\asm\Makefile modify\asm\Makefile --- original\asm\Makefile Sat Oct 04 22:40:54 2003 +++ modify\asm\Makefile Tue Jul 31 17:23:16 2012 @@ -2,7 +2,7 @@ HDR := assembler_bison.cc.h Node.hh Backend.hh Name.hh OBJ := assembler.o assembler_bison.o assembler_flex.o

-all: test +all: assembler.exe

loader: assembler.exe assembler ../loader.asm ../loader.bin @@ -17,19 +17,22 @@ assembler ../rtos.asm ../rtos.bin

assembler.exe: $(OBJ)

  • gcc -o $@ $(OBJ)
  • g++ -o $@ $(OBJ)

    %.o: %.cc $(HDR)

  • gcc -c -o $@ $<
  • g++ -c -o $@ $<

+assembler_bison.hh: assembler_bison.cc assembler_bison.cc: assembler.bison bison -d -v -o $@ $<

-assembler_bison.cc.h: assembler.bison

  • bison -d -v -o ansi_bison.cc $<

-assembler_flex.cc: assembler.flex assembler_bison.cc.h +assembler_flex.cc: assembler.flex assembler_bison.hh flex -o$@ $<

clean:

  • rm -rf .exe .o *.output
  • rm -rf assembler_bison.cc
  • rm -rf assembler_bison.hh
  • rm -rf assembler_flex.cc

diff -uNr original\compiler\ansic.bison modify\compiler\ansic.bison --- original\compiler\ansic.bison Wed Oct 01 01:58:06 2003 +++ modify\compiler\ansic.bison Tue Jul 31 17:33:02 2012 @@ -2,6 +2,8 @@ %{

#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "Node.hh" #include "Name.hh"

diff -uNr original\compiler\ansic.flex modify\compiler\ansic.flex --- original\compiler\ansic.flex Wed Oct 01 01:58:06 2003 +++ modify\compiler\ansic.flex Tue Jul 31 17:33:46 2012 @@ -12,9 +12,11 @@

%{ #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "Node.hh" #include "Name.hh" -#include "ansic_bison.cc.h" +#include "ansic_bison.hh"

extern FILE * out;

diff -uNr original\compiler\cc80.cc modify\compiler\cc80.cc --- original\compiler\cc80.cc Wed Oct 01 01:58:06 2003 +++ modify\compiler\cc80.cc Tue Jul 31 17:31:58 2012 @@ -2,6 +2,7 @@ #include <stdio.h> #include <stdlib.h> #include <assert.h> +#include <string.h> #include "List.hh" #include "Backend.hh"

diff -uNr original\compiler\Expression.cc modify\compiler\Expression.cc --- original\compiler\Expression.cc Sun Oct 05 21:56:38 2003 +++ modify\compiler\Expression.cc Wed Aug 01 15:49:44 2012 @@ -1,6 +1,8 @@ // Expression.cc

#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <assert.h> #include "Node.hh" #include "Name.hh" diff -uNr original\compiler\List.hh modify\compiler\List.hh --- original\compiler\List.hh Wed Oct 01 01:58:06 2003 +++ modify\compiler\List.hh Wed Aug 01 15:45:40 2012 @@ -55,7 +55,7 @@ return ret; };

  • void List<C>::EmitList(FILE * out)
  • void EmitList(FILE out) { EmitStart(out); for (List<C> l = this; l; l = l->tail) @@ -63,7 +63,7 @@ EmitEnd(out); };
  • List<C> List<C>::SetHead(C hd)
  • List<C> SetHead(C hd) { assert(head == 0); head = hd; diff -uNr original\compiler\Makefile modify\compiler\Makefile --- original\compiler\Makefile Sat Oct 04 22:40:54 2003 +++ modify\compiler\Makefile Wed Aug 01 15:58:06 2012 @@ -2,26 +2,26 @@ ZAS := C:/sdcc/bin/as-z80 ZLD := C:/sdcc/bin/aslink

-HDR := ansic_bison.cc.h Node.hh Backend.hh Name.hh +HDR := ansic_bison.hh Node.hh Backend.hh Name.hh OBJ := cc80.o ansic_bison.o ansic_flex.o Node.o Name.o Expression.o \ Statement.o Backend.o MEMTOP := 0x2000

-all: test +CFLAGS = -enable-auto-import

-cc80.exe: $(OBJ)

  • gcc -g -o $@ $(OBJ) +all: cc80.exe

-%.o: %.cc $(HDR)

  • gcc -g -c -o $@ $< +cc80.exe:$(HDR) $(OBJ)
  • g++ $(CFLAGS) -o $@ $(OBJ)

+%.o:%.cc

  • g++ $(CFLAGS) -c -o $@ $<

+ansic_bison.hh: ansic_bison.cc ansic_bison.cc: ansic.bison bison -d -v -o $@ $<

-ansic_bison.cc.h: ansic.bison

  • bison -d -v -o ansi_bison.cc $<

-ansic_flex.cc: ansic.flex ansic_bison.cc.h +ansic_flex.cc: ansic.flex ansic_bison.hh flex -o$@ $<

loader: cc80.exe @@ -37,4 +37,8 @@ cc80 $(MEMTOP) ..\rtos.c ..\rtos.asm

clean:

  • rm -rf .exe .o *.output
  • rm -rf ansic_bison.cc
  • rm -rf ansic_bison.hh
  • rm -rf ansic_flex.cc

diff -uNr original\compiler\Name.cc modify\compiler\Name.cc --- original\compiler\Name.cc Sat Oct 04 22:40:54 2003 +++ modify\compiler\Name.cc Wed Aug 01 15:49:08 2012 @@ -1,6 +1,8 @@ // Name.cc

#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "Name.hh" #include "Node.hh"

diff -uNr original\compiler\Node.cc modify\compiler\Node.cc --- original\compiler\Node.cc Sun Oct 05 21:56:38 2003 +++ modify\compiler\Node.cc Wed Aug 01 15:48:48 2012 @@ -1,6 +1,9 @@

#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <assert.h> +#include "List.hh" #include "Node.hh" #include "Name.hh" #include "Backend.hh" @@ -67,17 +70,17 @@ fprintf(out, "} %d %s\n", indent, node_type); } //----------------------------------------------------------------------------- -void StatementList ::Emit(FILE out) { EmitList(out); } -void DeclarationList ::Emit(FILE out) { EmitList(out); } -void InitializerList ::Emit(FILE out) { EmitList(out); } -void ParameterDeclarationList::Emit(FILE out) { EmitList(out); } -void IdentifierList ::Emit(FILE out) { EmitList(out); } -void StructDeclaratorList ::Emit(FILE out) { assert(0); } -void StructDeclarationList ::Emit(FILE out) { assert(0); } -void InitDeclaratorList ::Emit(FILE out) { EmitList(out); } -void TypeSpecifierList ::Emit(FILE out) { EmitList(out); } -void Declarator ::Emit(FILE out) { EmitList(out); } -void Pointer ::Emit(FILE out) { EmitList(out); } +template<> void StatementList ::Emit(FILE out) { EmitList(out); } +template<> void DeclarationList ::Emit(FILE out) { EmitList(out); } +template<> void InitializerList ::Emit(FILE out) { EmitList(out); } +template<> void ParameterDeclarationList::Emit(FILE out) { EmitList(out); } +template<> void IdentifierList ::Emit(FILE out) { EmitList(out); } +template<> void StructDeclaratorList ::Emit(FILE out) { assert(0); } +template<> void StructDeclarationList ::Emit(FILE out) { assert(0); } +template<> void InitDeclaratorList ::Emit(FILE out) { EmitList(out); } +template<> void TypeSpecifierList ::Emit(FILE out) { EmitList(out); } +template<> void Declarator ::Emit(FILE out) { EmitList(out); } +template<> void Pointer ::Emit(FILE out) { EmitList(out); } //----------------------------------------------------------------------------- void StructDeclarator::Emit(FILE out) { @@ -115,7 +118,7 @@ return tspec->GetSize(declarator); } //----------------------------------------------------------------------------- -void EnumeratorList::Emit(FILE out) +template<> void EnumeratorList::Emit(FILE * out) { Enumerator::current = 0;

buaa.byl commented over 12 years ago
jsauermann was assigned over 12 years ago
jsauermann commented over 12 years ago

I made some changes according to the diffs posted in https://www.box.com/s/401181783b6aea2c11fc.

In linux it compiles ok now with gcc 4.4.3 and 2.4.1.

Since I have given up on windows a few years ago, I can't verify this on mingw32.

Please let me know if there are still problems and issue another bug report if neccessary.

I'll close this bug for the time being.

jsauermann commented over 12 years ago

Type your text here

jsauermann closed this over 12 years ago

Assignee
jsauermann
Labels
Request