Here is a patch to get the current development Beta4 emulator version to compile under linux. It should work under either Linux 386/i686 or Win/Cygwin - you just need to uncomment/edit the three lines noted at the top for your platform.
Apply this to tools/emulator directory (or do it manually, it isn't very long).
Code: Select all
Index: avr8.cpp
===================================================================
--- avr8.cpp (revision 77)
+++ avr8.cpp (working copy)
@@ -1882,18 +1882,20 @@
case SPI_READ_SINGLE_BLOCK:
SPDR = SDReadByte();
#ifdef USE_SPI_DEBUG
+ {
// output a nice display to see sector data
int i = 512-spiByteCount;
int ofs = i&0x000F;
static unsigned char buf[16];
if(i > 0 && (ofs == 0)){
- printf("%0.4X: ",i-16);
- for(int j=0; j<16; j++) printf("%0.2X ",buf[j]);
+ printf("%.4X: ",i-16);
+ for(int j=0; j<16; j++) printf("%.2X ",buf[j]);
printf("| ");
for(int j=0; j<16; j++) printf("%c",ascii(buf[j]));
SPI_DEBUG("\n");
}
buf[ofs] = SPDR;
+ }
#endif
spiByteCount--;
if(spiByteCount == 0){
Index: uzem.cpp
===================================================================
--- uzem.cpp (revision 77)
+++ uzem.cpp (working copy)
@@ -184,7 +184,12 @@
return 1;
}
else if(sddrive){
+#if defined(__WIN32__)
uzebox.SDMapDrive(sddrive);
+#else
+ printerr("Error: -sddrive is only supported under Windows. Sorry Penguins.");
+ return 1;
+#endif
}
else if(sdimage){
uzebox.SDLoadImage(sdimage);
Index: avr8.h
===================================================================
--- avr8.h (revision 77)
+++ avr8.h (working copy)
@@ -33,7 +33,7 @@
#include <windows.h> // win32 memory mapped I/O
#include <winioctl.h>
#else
- #include <sys/mmap.h> // unix memory mapped I/O
+ #include <sys/mman.h> // unix memory mapped I/O
#endif
#ifndef GUI
Index: makefile
===================================================================
--- makefile (revision 77)
+++ makefile (working copy)
@@ -2,18 +2,31 @@
# Public Domain - use at your own risk
# Note: targets Win32 environment
-TARGET = uzem.exe
-DEBUG_TARGET = uzemdbg.exe
-GCCBASE = c:\minGW
-MTOOLS = utils/mtools.exe
+### UNCOMMENT THIS SECTION FOR LINUX
+EXE_EXT = # Use under linux
+GCCBASE = # For Linux
+CLIBS =
+
+### UNCOMMENT THIS SECTION FOR CYGWIN
+#EXE_EXT = .exe # For windows
+#GCCBASE = c:\minGW # For windows
+#CLIBS = -lmingw32
+
+TARGET = uzem$(EXE_EXT)
+DEBUG_TARGET = uzemdbg$(EXE_EXT)
+MTOOLS = utils/mtools$(EXE_EXT)
SDCARDDRIVE = g
-CPPFLAGS = -O3 -I$(GCCBASE)\include -march=i686
-CPPFLAGS += -I$(GCCBASE)/include/SDL -D_GNU_SOURCE=1 -DGUI=1
-LFLAGS += -L$(GCCBASE)/lib -lmingw32 -lSDLmain -lSDL
+SDL_INCLUDE=/usr/include/SDL
+CPPFLAGS = -ggdb -O1 -I$(GCCBASE)/include -I$(SDL_INCLUDE) -march=x86-64
+CPPFLAGS += -I$(GCCBASE)/include/SDL -D_GNU_SOURCE=1 -DGUI=1 #-DUSE_SPI_DEBUG=1
+LFLAGS += -L$(GCCBASE)/lib $(CLIBS) -lSDLmain -lSDL
+
UZEMOBJECTS = uzem.o avr8.o uzerom.o
+all: release
+
$(UZEMOBJECTS): %.o: %.cpp %.h
g++ -c $< -o $@ $(CPPFLAGS) $(UZEMFLAGS)
@@ -25,8 +38,6 @@
debug: clean-obj $(UZEMOBJECTS)
g++ $(UZEMOBJECTS) -o $(DEBUG_TARGET) $(LFLAGS) $(UZEMFLAGS)
-all: release
-
SDCardDemo:
make -C ../demos/SDCardDemo all
cp ../demos/SDCardDemo/SDCardDemo.hex .
@@ -38,4 +49,4 @@
-@rm $(UZEMOBJECTS)
clean: clean-obj
- -@rm $(TARGET) $(DEBUG_TARGET)
\ No newline at end of file
+ -@rm $(TARGET) $(DEBUG_TARGET)