summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/ChangeLog3
-rw-r--r--nuttx/arch/z80/src/Makefile.sdcc14
-rw-r--r--nuttx/arch/z80/src/z80/Kconfig1
-rw-r--r--nuttx/configs/pjrc-8051/Make.defs2
-rw-r--r--nuttx/configs/xtrs/nsh/Make.defs143
-rw-r--r--nuttx/configs/xtrs/ostest/Make.defs143
-rw-r--r--nuttx/configs/xtrs/pashello/Make.defs143
-rw-r--r--nuttx/configs/z80sim/README.txt35
-rw-r--r--nuttx/configs/z80sim/nsh/Make.defs143
-rw-r--r--nuttx/configs/z80sim/ostest/Make.defs143
-rw-r--r--nuttx/configs/z80sim/ostest/defconfig14
-rw-r--r--nuttx/configs/z80sim/ostest/setenv.bat50
-rw-r--r--nuttx/configs/z80sim/pashello/Make.defs143
-rw-r--r--nuttx/configs/z80sim/scripts/setenv.bat50
-rwxr-xr-xnuttx/configs/z80sim/scripts/setenv.sh (renamed from nuttx/configs/z80sim/ostest/setenv.sh)31
-rw-r--r--nuttx/tools/Config.mk11
16 files changed, 835 insertions, 234 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 1401792ba..cd46b5a2e 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -3731,4 +3731,7 @@
* configs/z80sim/ostest: Converted to build with the Kconfig/mconf tool.
Current configuration failed to build for me (Ubuntu 12.10, SDCC 3.2.0
pre-built for Linux) due to a glibc memory corruptionerror in SDCC.
+ * configs/z80sim/ostest: Default is now the Windows native build. See
+ configs/z80sim/README.txt for instructions to convert back to a Linux or
+ or Cygwin build.
diff --git a/nuttx/arch/z80/src/Makefile.sdcc b/nuttx/arch/z80/src/Makefile.sdcc
index a8a63c111..91f99d0cf 100644
--- a/nuttx/arch/z80/src/Makefile.sdcc
+++ b/nuttx/arch/z80/src/Makefile.sdcc
@@ -96,12 +96,12 @@ $(COBJS): %$(OBJEXT): %.c
# This is a kludge to work around some conflicting symbols in libsdcc.lib
-$(SDCCLIBDIR)/myz80.lib: $(SDCCLIBDIR)/$(SDCCLIB)
- $(Q) cat $(SDCCLIBDIR)/$(SDCCLIB) | \
+$(SDCC_LIBDIR)/myz80.lib: $(SDCC_LIBDIR)/$(SDCCLIB)
+ $(Q) cat $(SDCC_LIBDIR)/$(SDCCLIB) | \
grep -v alloc | grep -v free | grep -v printf | \
grep -v _str | grep -v _mem | grep -v crt0\.o \
> myz80.lib
- $(Q) mv -f myz80.lib $(SDCCLIBDIR)/myz80.lib
+ $(Q) mv -f myz80.lib $(SDCC_LIBDIR)/myz80.lib
# Create a header file that contains addressing information needed by the code
@@ -143,11 +143,11 @@ board/libboard$(LIBEXT):
# This target builds the final executable
-pass1.hex: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT)
+pass1.hex: up_mem.h asm_mem.h $(SDCC_LIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: pass1.hex"
@echo "--" >pass1.lnk # Non-interactive
@echo "-k $(BOARDDIR)" >>pass1.lnk # Path to board library
- @echo "-k $(SDCCLIBDIR)" >>pass1.lnk # Path to SDCC z80 library
+ @echo "-k $(SDCC_LIBDIR)" >>pass1.lnk # Path to SDCC z80 library
@echo "-l libboard$(LIBEXT)" >>pass1.lnk # Name of board library
$(Q) for LIB in $(LINKLIBS); do \
echo "-l $(TOPDIR)/lib/$$LIB" >> pass1.lnk ;\
@@ -176,11 +176,11 @@ endif
$(Q) $(MAKE) TOPDIR="$(TOPDIR)" libarch$(LIBEXT)
$(Q) $(MAKE) TOPDIR="$(TOPDIR)" $(HEAD_OBJ)
-nuttx.hex: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT)
+nuttx.hex: up_mem.h asm_mem.h $(SDCC_LIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx.hex"
@echo "--" >nuttx.lnk # Non-interactive
@echo "-k $(BOARDDIR)" >>nuttx.lnk # Path to board library
- @echo "-k $(SDCCLIBDIR)" >>nuttx.lnk # Path to SDCC z80 library
+ @echo "-k $(SDCC_LIBDIR)" >>nuttx.lnk # Path to SDCC z80 library
@echo "-l libboard$(LIBEXT)" >>nuttx.lnk # Name of board library
$(Q) for LIB in $(LINKLIBS); do \
echo "-l $(TOPDIR)/lib/$$LIB" >> nuttx.lnk ;\
diff --git a/nuttx/arch/z80/src/z80/Kconfig b/nuttx/arch/z80/src/z80/Kconfig
index 99c12ae06..233b6ec90 100644
--- a/nuttx/arch/z80/src/z80/Kconfig
+++ b/nuttx/arch/z80/src/z80/Kconfig
@@ -12,6 +12,7 @@ choice
config Z80_TOOLCHAIN_SDCCL
bool "SDCC for Linux, MAC OSX, or Cygwin"
+ depends on !WINDOWS_NATIVE
config Z80_TOOLCHAIN_SDCCW
bool "SDCC for Windows"
diff --git a/nuttx/configs/pjrc-8051/Make.defs b/nuttx/configs/pjrc-8051/Make.defs
index 154d36556..8dd552990 100644
--- a/nuttx/configs/pjrc-8051/Make.defs
+++ b/nuttx/configs/pjrc-8051/Make.defs
@@ -66,7 +66,7 @@ EXEEXT = .hex
define ASSEMBLE
@echo "AS: $1"
- @$(AS) $(ASFLAGS) $1
+ @$(AS) $(AFLAGS) $1
endef
define CLEAN
diff --git a/nuttx/configs/xtrs/nsh/Make.defs b/nuttx/configs/xtrs/nsh/Make.defs
index 0eac402ab..749b69315 100644
--- a/nuttx/configs/xtrs/nsh/Make.defs
+++ b/nuttx/configs/xtrs/nsh/Make.defs
@@ -36,56 +36,129 @@
include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
-CROSSDEV =
-CC = sdcc
-CPP = sdcpp
-AR = sdcclib -a
-
-ifeq ($(CONFIG_SDCC_OLD),y)
-
-LD = link-z80
-AS = as-z80
-ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+# These are the directories where the SDCC toolchain is installed. NOTE
+# that short 8.3 path names are used in order to avoid spaces. On my machine
+# I have:
+#
+# C:\PROGRA~1\ = C:\Profram Files\
+# C:\PROGRA~2\ = C:\Program Files (x86)\
+#
+# Your PC may be configured differently.
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ SDCC_INSTALLDIR = C:\PROGRA~2\SDCC
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)\bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)\lib\z80
else
+ SDCC_INSTALLDIR = /usr/local
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)/bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)/share/sdcc/lib/z80
+endif
-LD = sdldz80
-AS = sdasz80
-ARCHCPUFLAGS = -mz80
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+AR = sdcclib -a
+ifeq ($(CONFIG_SDCC_OLD),y)
+ LD = link-z80
+ AS = as-z80
+ ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+else
+ LD = sdldz80
+ AS = sdasz80
+ ARCHCPUFLAGS = -mz80
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
- ARCHOPTIMIZATION = --debug
+ ARCHOPTIMIZATION = --debug
else
- ARCHOPTIMIZATION =
+ ARCHOPTIMIZATION =
endif
-ARCHPICFLAGS =
-ARCHWARNINGS =
-ARCHDEFINES =
-ARCHINCLUDES = -I. -I$(TOPDIR)/include
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = -x -a -l -o -s
-CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
- $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
-CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
-ASFLAGS = -x -a -l -o -s
+SDCCLIB = z80.lib
-SDCCLIBDIR = /usr/local/share/sdcc/lib/z80
-SDCCLIB = z80.lib
+ASMEXT = .asm
+OBJEXT = .o
+LIBEXT = .lib
+EXEEXT = .cmd
-ASMEXT = .asm
-OBJEXT = .o
-LIBEXT = .lib
-EXEEXT = .cmd
+# Custom ASSEMBLE definition. The most common toolchain, GCC, uses the
+# compiler to assemble files because this has the advantage of running the C
+# Pre-Processor against. This is not possible with other SDCC; we need to
+# define AS and over-ride the common definition in order to use the assembler
+# directly.
+
+define ASSEMBLE
+ @echo "AS: $1"
+ $(Q) $(AS) $(AFLAGS) $2 $1
+endef
+# Custom CLEAN definition
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+define CLEAN
+ $(Q) if exist *.o (del /f /q *.o)
+ $(Q) if exist *.asm (del /f /q *.asm)
+ $(Q) if exist *.rel (del /f /q *.rel)
+ $(Q) if exist *.lst (del /f /q *.lst)
+ $(Q) if exist *.rst (del /f /q *.rst)
+ $(Q) if exist *.sym (del /f /q *.sym)
+ $(Q) if exist *.adb (del /f /q *.adb)
+ $(Q) if exist *.lnk (del /f /q *.lnk)
+ $(Q) if exist *.map (del /f /q *.map)
+ $(Q) if exist *.mem (del /f /q *.mem)
+ $(Q) if exist *.hex (del /f /q *.hex)
+ $(Q) if exist *.cmd (del /f /q *.cmd)
+endef
+else
define CLEAN
- @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+ $(Q) rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex *.cmd
endef
+endif
+
+# Windows native host tool definitions
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ HOSTCC = mingw32-gcc.exe
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+ HOSTEXEEXT = .exe
+
+ # Windows-native host tools
+
+ MKDEP = $(TOPDIR)\tools\mkdeps.exe --winnative
+else
-MKDEP = $(TOPDIR)/tools/mkdeps.sh
+# Linux/Cygwin host tool definitions
-HOSTCC = gcc
-HOSTINCLUDES = -I.
-HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
-HOSTLDFLAGS =
+ HOSTCC = gcc
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+
+ # This is the tool to use for dependencies (i.e., none)
+
+ MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh
+
+ # SDCC for Linux, OSX, or Cygwin understands symbolic links. Windows SDCC
+ # running under Cygwin does not
+
+ifeq ($(WINTOOL),y)
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)winlink.sh
+ DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+else
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.sh
+ DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+endif
+endif
diff --git a/nuttx/configs/xtrs/ostest/Make.defs b/nuttx/configs/xtrs/ostest/Make.defs
index ae26822d5..550c70d3c 100644
--- a/nuttx/configs/xtrs/ostest/Make.defs
+++ b/nuttx/configs/xtrs/ostest/Make.defs
@@ -36,56 +36,129 @@
include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
-CROSSDEV =
-CC = sdcc
-CPP = sdcpp
-AR = sdcclib -a
-
-ifeq ($(CONFIG_SDCC_OLD),y)
-
-LD = link-z80
-AS = as-z80
-ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+# These are the directories where the SDCC toolchain is installed. NOTE
+# that short 8.3 path names are used in order to avoid spaces. On my machine
+# I have:
+#
+# C:\PROGRA~1\ = C:\Profram Files\
+# C:\PROGRA~2\ = C:\Program Files (x86)\
+#
+# Your PC may be configured differently.
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ SDCC_INSTALLDIR = C:\PROGRA~2\SDCC
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)\bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)\lib\z80
else
+ SDCC_INSTALLDIR = /usr/local
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)/bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)/share/sdcc/lib/z80
+endif
-LD = sdldz80
-AS = sdasz80
-ARCHCPUFLAGS = -mz80
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+AR = sdcclib -a
+ifeq ($(CONFIG_SDCC_OLD),y)
+ LD = link-z80
+ AS = as-z80
+ ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+else
+ LD = sdldz80
+ AS = sdasz80
+ ARCHCPUFLAGS = -mz80
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
- ARCHOPTIMIZATION = --debug
+ ARCHOPTIMIZATION = --debug
else
- ARCHOPTIMIZATION =
+ ARCHOPTIMIZATION =
endif
-ARCHPICFLAGS =
-ARCHWARNINGS =
-ARCHDEFINES =
-ARCHINCLUDES = -I. -I$(TOPDIR)/include
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = -x -a -l -o -s
-CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
- $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
-CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
-ASFLAGS = -x -a -l -o -s
+SDCCLIB = z80.lib
-SDCCLIBDIR = /usr/local/share/sdcc/lib/z80
-SDCCLIB = z80.lib
+ASMEXT = .asm
+OBJEXT = .o
+LIBEXT = .lib
+EXEEXT = .cmd
-ASMEXT = .asm
-OBJEXT = .o
-LIBEXT = .lib
-EXEEXT = .cmd
+# Custom ASSEMBLE definition. The most common toolchain, GCC, uses the
+# compiler to assemble files because this has the advantage of running the C
+# Pre-Processor against. This is not possible with other SDCC; we need to
+# define AS and over-ride the common definition in order to use the assembler
+# directly.
+
+define ASSEMBLE
+ @echo "AS: $1"
+ $(Q) $(AS) $(AFLAGS) $2 $1
+endef
+# Custom CLEAN definition
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+define CLEAN
+ $(Q) if exist *.o (del /f /q *.o)
+ $(Q) if exist *.asm (del /f /q *.asm)
+ $(Q) if exist *.rel (del /f /q *.rel)
+ $(Q) if exist *.lst (del /f /q *.lst)
+ $(Q) if exist *.rst (del /f /q *.rst)
+ $(Q) if exist *.sym (del /f /q *.sym)
+ $(Q) if exist *.adb (del /f /q *.adb)
+ $(Q) if exist *.lnk (del /f /q *.lnk)
+ $(Q) if exist *.map (del /f /q *.map)
+ $(Q) if exist *.mem (del /f /q *.mem)
+ $(Q) if exist *.hex (del /f /q *.hex)
+ $(Q) if exist *.cmd (del /f /q *.cmd)
+endef
+else
define CLEAN
- @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+ $(Q) rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex *.cmd
endef
+endif
+
+# Windows native host tool definitions
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ HOSTCC = mingw32-gcc.exe
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+ HOSTEXEEXT = .exe
+
+ # Windows-native host tools
+
+ MKDEP = $(TOPDIR)\tools\mkdeps.exe --winnative
+else
-MKDEP = $(TOPDIR)/tools/mkdeps.sh
+# Linux/Cygwin host tool definitions
-HOSTCC = gcc
-HOSTINCLUDES = -I.
-HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
-HOSTLDFLAGS =
+ HOSTCC = gcc
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+
+ # This is the tool to use for dependencies (i.e., none)
+
+ MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh
+
+ # SDCC for Linux, OSX, or Cygwin understands symbolic links. Windows SDCC
+ # running under Cygwin does not
+
+ifeq ($(WINTOOL),y)
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)winlink.sh
+ DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+else
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.sh
+ DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+endif
+endif
diff --git a/nuttx/configs/xtrs/pashello/Make.defs b/nuttx/configs/xtrs/pashello/Make.defs
index 30caae7fd..409e303c1 100644
--- a/nuttx/configs/xtrs/pashello/Make.defs
+++ b/nuttx/configs/xtrs/pashello/Make.defs
@@ -36,56 +36,129 @@
include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
-CROSSDEV =
-CC = sdcc
-CPP = sdcpp
-AR = sdcclib -a
-
-ifeq ($(CONFIG_SDCC_OLD),y)
-
-LD = link-z80
-AS = as-z80
-ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+# These are the directories where the SDCC toolchain is installed. NOTE
+# that short 8.3 path names are used in order to avoid spaces. On my machine
+# I have:
+#
+# C:\PROGRA~1\ = C:\Profram Files\
+# C:\PROGRA~2\ = C:\Program Files (x86)\
+#
+# Your PC may be configured differently.
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ SDCC_INSTALLDIR = C:\PROGRA~2\SDCC
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)\bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)\lib\z80
else
+ SDCC_INSTALLDIR = /usr/local
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)/bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)/share/sdcc/lib/z80
+endif
-LD = sdldz80
-AS = sdasz80
-ARCHCPUFLAGS = -mz80
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+AR = sdcclib -a
+ifeq ($(CONFIG_SDCC_OLD),y)
+ LD = link-z80
+ AS = as-z80
+ ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+else
+ LD = sdldz80
+ AS = sdasz80
+ ARCHCPUFLAGS = -mz80
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
- ARCHOPTIMIZATION = --debug
+ ARCHOPTIMIZATION = --debug
else
- ARCHOPTIMIZATION =
+ ARCHOPTIMIZATION =
endif
-ARCHPICFLAGS =
-ARCHWARNINGS =
-ARCHDEFINES =
-ARCHINCLUDES = -I. -I$(TOPDIR)/include
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = -x -a -l -o -s
-CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
- $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
-CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
-ASFLAGS = -x -a -l -o -s
+SDCCLIB = z80.lib
-SDCCLIBDIR = /usr/local/share/sdcc/lib/z80
-SDCCLIB = z80.lib
+ASMEXT = .asm
+OBJEXT = .o
+LIBEXT = .lib
+EXEEXT = .cmd
-ASMEXT = .asm
-OBJEXT = .o
-LIBEXT = .lib
-EXEEXT = .cmd
+# Custom ASSEMBLE definition. The most common toolchain, GCC, uses the
+# compiler to assemble files because this has the advantage of running the C
+# Pre-Processor against. This is not possible with other SDCC; we need to
+# define AS and over-ride the common definition in order to use the assembler
+# directly.
+
+define ASSEMBLE
+ @echo "AS: $1"
+ $(Q) $(AS) $(AFLAGS) $2 $1
+endef
+# Custom CLEAN definition
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+define CLEAN
+ $(Q) if exist *.o (del /f /q *.o)
+ $(Q) if exist *.asm (del /f /q *.asm)
+ $(Q) if exist *.rel (del /f /q *.rel)
+ $(Q) if exist *.lst (del /f /q *.lst)
+ $(Q) if exist *.rst (del /f /q *.rst)
+ $(Q) if exist *.sym (del /f /q *.sym)
+ $(Q) if exist *.adb (del /f /q *.adb)
+ $(Q) if exist *.lnk (del /f /q *.lnk)
+ $(Q) if exist *.map (del /f /q *.map)
+ $(Q) if exist *.mem (del /f /q *.mem)
+ $(Q) if exist *.hex (del /f /q *.hex)
+ $(Q) if exist *.cmd (del /f /q *.cmd)
+endef
+else
define CLEAN
- @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+ $(Q) rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex *.cmd
endef
+endif
+
+# Windows native host tool definitions
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ HOSTCC = mingw32-gcc.exe
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+ HOSTEXEEXT = .exe
+
+ # Windows-native host tools
+
+ MKDEP = $(TOPDIR)\tools\mkdeps.exe --winnative
+else
-MKDEP = $(TOPDIR)/tools/mkdeps.sh
+# Linux/Cygwin host tool definitions
-HOSTCC = gcc
-HOSTINCLUDES = -I.
-HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
-HOSTLDFLAGS =
+ HOSTCC = gcc
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+
+ # This is the tool to use for dependencies (i.e., none)
+
+ MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh
+
+ # SDCC for Linux, OSX, or Cygwin understands symbolic links. Windows SDCC
+ # running under Cygwin does not
+
+ifeq ($(WINTOOL),y)
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)winlink.sh
+ DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+else
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.sh
+ DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+endif
+endif
diff --git a/nuttx/configs/z80sim/README.txt b/nuttx/configs/z80sim/README.txt
index f8bca5b19..c371cdaff 100644
--- a/nuttx/configs/z80sim/README.txt
+++ b/nuttx/configs/z80sim/README.txt
@@ -41,11 +41,38 @@ Configuring NuttX
b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process.
- 2. The current configuration is untested. When last attempted
- on Ubuntu 12.10 with SDCC 3.2.0, the build failed with the
- following internal error:
+ 2. The default setup for this configuration uses a windows native build.
+ NOTE that build does *NOT* work build successfully using SDCC 3.2.0:
+ Windows halts claiming that sdcclib is no long responding. 3.2.0 is
+ the latest released version as of this writing. This problem has,
+ apparently been corrected in the repository; a snapshot data 11-23-2012
+ (3.2.1) did not have this problem.
+
+ This configuration was last verified sucessfully prior to the
+ the configure to Kconfig/mconf tool using SDCC 2.6.0 built to run
+ natively under Cygwin.
+
+ 3. This configuration can be converted to run under Linux (or Cygwin or
+ OSX), by modifying the configuration file as follows:
+
+ -CONFIG_HOST_WINDOWS=y
+ -CONFIG_WINDOWS_NATIVE=y
+ +CONFIG_HOST_LINUX=y
+
+ -CONFIG_Z80_TOOLCHAIN_SDCCW=y
+ +CONFIG_Z80_TOOLCHAIN_SDCCL=y
+
+ You make also have to change the value of CONFIG_APPS_DIR. You cannot
+ use the default setenv.bat. Use configs/z80sim/script/setenv.sh instead.
+
+ When last attempted on Ubuntu 12.10 with SDCC 3.2.0 for Linux, the build
+ failed with the following internal error:
+
+ *** glibc detected *** sdcclib: malloc(): memory corruption: 0x09f09768 ***
- *** glibc detected *** sdcclib: malloc(): memory corruption: 0x09f09768 ***
+ I believe that this is related to the sdcclib error also reported under
+ windows for SDCC 3.2.0. It can probably also be avoided by updating to
+ a more recent snapshot.
nsh
diff --git a/nuttx/configs/z80sim/nsh/Make.defs b/nuttx/configs/z80sim/nsh/Make.defs
index 11253020e..a5b325e79 100644
--- a/nuttx/configs/z80sim/nsh/Make.defs
+++ b/nuttx/configs/z80sim/nsh/Make.defs
@@ -36,56 +36,129 @@
include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
-CROSSDEV =
-CC = sdcc
-CPP = sdcpp
-AR = sdcclib -a
-
-ifeq ($(CONFIG_SDCC_OLD),y)
-
-LD = link-z80
-AS = as-z80
-ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+# These are the directories where the SDCC toolchain is installed. NOTE
+# that short 8.3 path names are used in order to avoid spaces. On my machine
+# I have:
+#
+# C:\PROGRA~1\ = C:\Profram Files\
+# C:\PROGRA~2\ = C:\Program Files (x86)\
+#
+# Your PC may be configured differently.
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ SDCC_INSTALLDIR = C:\PROGRA~2\SDCC
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)\bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)\lib\z80
else
+ SDCC_INSTALLDIR = /usr/local
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)/bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)/share/sdcc/lib/z80
+endif
-LD = sdldz80
-AS = sdasz80
-ARCHCPUFLAGS = -mz80
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+AR = sdcclib -a
+ifeq ($(CONFIG_SDCC_OLD),y)
+ LD = link-z80
+ AS = as-z80
+ ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+else
+ LD = sdldz80
+ AS = sdasz80
+ ARCHCPUFLAGS = -mz80
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
- ARCHOPTIMIZATION = --debug
+ ARCHOPTIMIZATION = --debug
else
- ARCHOPTIMIZATION =
+ ARCHOPTIMIZATION =
endif
-ARCHPICFLAGS =
-ARCHWARNINGS =
-ARCHDEFINES =
-ARCHINCLUDES = -I. -I$(TOPDIR)/include
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = -x -a -l -o -s
-CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
- $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
-CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
-ASFLAGS = -x -a -l -o -s
+SDCCLIB = z80.lib
-SDCCLIBDIR = /usr/local/share/sdcc/lib/z80
-SDCCLIB = z80.lib
+ASMEXT = .asm
+OBJEXT = .o
+LIBEXT = .lib
+EXEEXT = .hex
-ASMEXT = .asm
-OBJEXT = .o
-LIBEXT = .lib
-EXEEXT = .hex
+# Custom ASSEMBLE definition. The most common toolchain, GCC, uses the
+# compiler to assemble files because this has the advantage of running the C
+# Pre-Processor against. This is not possible with other SDCC; we need to
+# define AS and over-ride the common definition in order to use the assembler
+# directly.
+
+define ASSEMBLE
+ @echo "AS: $1"
+ $(Q) $(AS) $(AFLAGS) $2 $1
+endef
+# Custom CLEAN definition
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+define CLEAN
+ $(Q) if exist *.o (del /f /q *.o)
+ $(Q) if exist *.asm (del /f /q *.asm)
+ $(Q) if exist *.rel (del /f /q *.rel)
+ $(Q) if exist *.lst (del /f /q *.lst)
+ $(Q) if exist *.rst (del /f /q *.rst)
+ $(Q) if exist *.sym (del /f /q *.sym)
+ $(Q) if exist *.adb (del /f /q *.adb)
+ $(Q) if exist *.lnk (del /f /q *.lnk)
+ $(Q) if exist *.map (del /f /q *.map)
+ $(Q) if exist *.mem (del /f /q *.mem)
+ $(Q) if exist *.hex (del /f /q *.hex)
+ $(Q) if exist *.cmd (del /f /q *.cmd)
+endef
+else
define CLEAN
- @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+ $(Q) rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex *.cmd
endef
+endif
+
+# Windows native host tool definitions
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ HOSTCC = mingw32-gcc.exe
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+ HOSTEXEEXT = .exe
+
+ # Windows-native host tools
+
+ MKDEP = $(TOPDIR)\tools\mkdeps.exe --winnative
+else
-MKDEP = $(TOPDIR)/tools/mkdeps.sh
+# Linux/Cygwin host tool definitions
-HOSTCC = gcc
-HOSTINCLUDES = -I.
-HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
-HOSTLDFLAGS =
+ HOSTCC = gcc
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+
+ # This is the tool to use for dependencies (i.e., none)
+
+ MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh
+
+ # SDCC for Linux, OSX, or Cygwin understands symbolic links. Windows SDCC
+ # running under Cygwin does not
+
+ifeq ($(WINTOOL),y)
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)winlink.sh
+ DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+else
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.sh
+ DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+endif
+endif
diff --git a/nuttx/configs/z80sim/ostest/Make.defs b/nuttx/configs/z80sim/ostest/Make.defs
index d0185b4f9..54b6d8c45 100644
--- a/nuttx/configs/z80sim/ostest/Make.defs
+++ b/nuttx/configs/z80sim/ostest/Make.defs
@@ -36,56 +36,129 @@
include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
-CROSSDEV =
-CC = sdcc
-CPP = sdcpp
-AR = sdcclib -a
-
-ifeq ($(CONFIG_SDCC_OLD),y)
-
-LD = link-z80
-AS = as-z80
-ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+# These are the directories where the SDCC toolchain is installed. NOTE
+# that short 8.3 path names are used in order to avoid spaces. On my machine
+# I have:
+#
+# C:\PROGRA~1\ = C:\Profram Files\
+# C:\PROGRA~2\ = C:\Program Files (x86)\
+#
+# Your PC may be configured differently.
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ SDCC_INSTALLDIR = C:\PROGRA~2\SDCC
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)\bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)\lib\z80
else
+ SDCC_INSTALLDIR = /usr/local
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)/bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)/share/sdcc/lib/z80
+endif
-LD = sdldz80
-AS = sdasz80
-ARCHCPUFLAGS = -mz80
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+AR = sdcclib -a
+ifeq ($(CONFIG_SDCC_OLD),y)
+ LD = link-z80
+ AS = as-z80
+ ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+else
+ LD = sdldz80
+ AS = sdasz80
+ ARCHCPUFLAGS = -mz80
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
- ARCHOPTIMIZATION = --debug
+ ARCHOPTIMIZATION = --debug
else
- ARCHOPTIMIZATION =
+ ARCHOPTIMIZATION =
endif
-ARCHPICFLAGS =
-ARCHWARNINGS =
-ARCHDEFINES =
-ARCHINCLUDES = -I. -I$(TOPDIR)/include
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = -x -a -l -o -s
-CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
- $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
-CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
-ASFLAGS = -x -a -l -o -s
+SDCCLIB = z80.lib
-SDCCLIBDIR = /usr/local/share/sdcc/lib/z80
-SDCCLIB = z80.lib
+ASMEXT = .asm
+OBJEXT = .o
+LIBEXT = .lib
+EXEEXT = .hex
-ASMEXT = .asm
-OBJEXT = .o
-LIBEXT = .lib
-EXEEXT = .hex
+# Custom ASSEMBLE definition. The most common toolchain, GCC, uses the
+# compiler to assemble files because this has the advantage of running the C
+# Pre-Processor against. This is not possible with other SDCC; we need to
+# define AS and over-ride the common definition in order to use the assembler
+# directly.
+
+define ASSEMBLE
+ @echo "AS: $1"
+ $(Q) $(AS) $(AFLAGS) $2 $1
+endef
+# Custom CLEAN definition
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+define CLEAN
+ $(Q) if exist *.o (del /f /q *.o)
+ $(Q) if exist *.asm (del /f /q *.asm)
+ $(Q) if exist *.rel (del /f /q *.rel)
+ $(Q) if exist *.lst (del /f /q *.lst)
+ $(Q) if exist *.rst (del /f /q *.rst)
+ $(Q) if exist *.sym (del /f /q *.sym)
+ $(Q) if exist *.adb (del /f /q *.adb)
+ $(Q) if exist *.lnk (del /f /q *.lnk)
+ $(Q) if exist *.map (del /f /q *.map)
+ $(Q) if exist *.mem (del /f /q *.mem)
+ $(Q) if exist *.hex (del /f /q *.hex)
+ $(Q) if exist *.cmd (del /f /q *.cmd)
+endef
+else
define CLEAN
- @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+ $(Q) rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex *.cmd
endef
+endif
+
+# Windows native host tool definitions
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ HOSTCC = mingw32-gcc.exe
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+ HOSTEXEEXT = .exe
+
+ # Windows-native host tools
+
+ MKDEP = $(TOPDIR)\tools\mkdeps.exe --winnative
+else
-MKDEP = $(TOPDIR)/tools/mkdeps.sh
+# Linux/Cygwin host tool definitions
-HOSTCC = gcc
-HOSTINCLUDES = -I.
-HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
-HOSTLDFLAGS =
+ HOSTCC = gcc
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+
+ # This is the tool to use for dependencies (i.e., none)
+
+ MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh
+
+ # SDCC for Linux, OSX, or Cygwin understands symbolic links. Windows SDCC
+ # running under Cygwin does not
+
+ifeq ($(WINTOOL),y)
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)winlink.sh
+ DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+else
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.sh
+ DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+endif
+endif
diff --git a/nuttx/configs/z80sim/ostest/defconfig b/nuttx/configs/z80sim/ostest/defconfig
index 8c2da3614..fa79acd30 100644
--- a/nuttx/configs/z80sim/ostest/defconfig
+++ b/nuttx/configs/z80sim/ostest/defconfig
@@ -8,15 +8,20 @@ CONFIG_NUTTX_NEWCONFIG=y
# Build Setup
#
# CONFIG_EXPERIMENTAL is not set
-CONFIG_HOST_LINUX=y
+# CONFIG_HOST_LINUX is not set
# CONFIG_HOST_OSX is not set
-# CONFIG_HOST_WINDOWS is not set
+CONFIG_HOST_WINDOWS=y
# CONFIG_HOST_OTHER is not set
+CONFIG_WINDOWS_NATIVE=y
+# CONFIG_WINDOWS_CYGWIN is not set
+# CONFIG_WINDOWS_MSYS is not set
+# CONFIG_WINDOWS_OTHER is not set
+# CONFIG_WINDOWS_MKLINK is not set
#
# Build Configuration
#
-# CONFIG_APPS_DIR="../apps"
+# CONFIG_APPS_DIR="..\apps"
# CONFIG_BUILD_2PASS is not set
#
@@ -64,7 +69,8 @@ CONFIG_ARCH_CHIP_Z80=y
# CONFIG_ARCH_CHIP_EZ80F91 is not set
# CONFIG_ARCH_CHIP_EZ80F92 is not set
# CONFIG_ARCH_CHIP_EZ80F93 is not set
-CONFIG_Z80_TOOLCHAIN_SDCCL=y
+# CONFIG_Z80_TOOLCHAIN_SDCCL is not set
+CONFIG_Z80_TOOLCHAIN_SDCCW=y
#
# Architecture Options
diff --git a/nuttx/configs/z80sim/ostest/setenv.bat b/nuttx/configs/z80sim/ostest/setenv.bat
new file mode 100644
index 000000000..e5c7ff5bf
--- /dev/null
+++ b/nuttx/configs/z80sim/ostest/setenv.bat
@@ -0,0 +1,50 @@
+@echo off
+
+rem configs/z80sim/ostest/setenv.bat
+rem
+rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
+rem Author: Gregory Nutt <gnutt@nuttx.org>
+rem
+rem Redistribution and use in source and binary forms, with or without
+rem modification, are permitted provided that the following conditions
+rem are met:
+rem
+rem 1. Redistributions of source code must retain the above copyright
+rem notice, this list of conditions and the following disclaimer.
+rem 2. Redistributions in binary form must reproduce the above copyright
+rem notice, this list of conditions and the following disclaimer in
+rem the documentation and/or other materials provided with the
+rem distribution.
+rem 3. Neither the name NuttX nor the names of its contributors may be
+rem used to endorse or promote products derived from this software
+rem without specific prior written permission.
+rem
+rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+rem POSSIBILITY OF SUCH DAMAGE.
+
+rem This is the location where I installed in the MinGW compiler. With
+rem this configuration, it is recommended that you do NOT install the
+rem MSYS tools; they conflict with the GNUWin32 tools. See
+rem http://www.mingw.org/ for further info.
+
+set PATH=C:\MinGW\bin;%PATH%
+
+rem This is the location where I installed the SDCC toolchain for windows.
+
+set PATH=C:\Program Files (x86)\SDCC/bin;%PATH%
+
+rem This is the location where I installed the GNUWin32 tools. See
+rem http://gnuwin32.sourceforge.net/.
+
+set PATH=C:\gnuwin32\bin;%PATH%
+echo %PATH%
diff --git a/nuttx/configs/z80sim/pashello/Make.defs b/nuttx/configs/z80sim/pashello/Make.defs
index 16d3ff342..076aad7ed 100644
--- a/nuttx/configs/z80sim/pashello/Make.defs
+++ b/nuttx/configs/z80sim/pashello/Make.defs
@@ -36,56 +36,129 @@
include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
-CROSSDEV =
-CC = sdcc
-CPP = sdcpp
-AR = sdcclib -a
-
-ifeq ($(CONFIG_SDCC_OLD),y)
-
-LD = link-z80
-AS = as-z80
-ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+# These are the directories where the SDCC toolchain is installed. NOTE
+# that short 8.3 path names are used in order to avoid spaces. On my machine
+# I have:
+#
+# C:\PROGRA~1\ = C:\Profram Files\
+# C:\PROGRA~2\ = C:\Program Files (x86)\
+#
+# Your PC may be configured differently.
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ SDCC_INSTALLDIR = C:\PROGRA~2\SDCC
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)\bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)\lib\z80
else
+ SDCC_INSTALLDIR = /usr/local
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)/bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)/share/sdcc/lib/z80
+endif
-LD = sdldz80
-AS = sdasz80
-ARCHCPUFLAGS = -mz80
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+AR = sdcclib -a
+ifeq ($(CONFIG_SDCC_OLD),y)
+ LD = link-z80
+ AS = as-z80
+ ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+else
+ LD = sdldz80
+ AS = sdasz80
+ ARCHCPUFLAGS = -mz80
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
- ARCHOPTIMIZATION = --debug
+ ARCHOPTIMIZATION = --debug
else
- ARCHOPTIMIZATION =
+ ARCHOPTIMIZATION =
endif
-ARCHPICFLAGS =
-ARCHWARNINGS =
-ARCHDEFINES =
-ARCHINCLUDES = -I. -I$(TOPDIR)/include
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = -x -a -l -o -s
-CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
- $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
-CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
-ASFLAGS = -x -a -l -o -s
+SDCCLIB = z80.lib
-SDCCLIBDIR = /usr/local/share/sdcc/lib/z80
-SDCCLIB = z80.lib
+ASMEXT = .asm
+OBJEXT = .o
+LIBEXT = .lib
+EXEEXT = .hex
-ASMEXT = .asm
-OBJEXT = .o
-LIBEXT = .lib
-EXEEXT = .hex
+# Custom ASSEMBLE definition. The most common toolchain, GCC, uses the
+# compiler to assemble files because this has the advantage of running the C
+# Pre-Processor against. This is not possible with other SDCC; we need to
+# define AS and over-ride the common definition in order to use the assembler
+# directly.
+
+define ASSEMBLE
+ @echo "AS: $1"
+ $(Q) $(AS) $(AFLAGS) $2 $1
+endef
+# Custom CLEAN definition
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+define CLEAN
+ $(Q) if exist *.o (del /f /q *.o)
+ $(Q) if exist *.asm (del /f /q *.asm)
+ $(Q) if exist *.rel (del /f /q *.rel)
+ $(Q) if exist *.lst (del /f /q *.lst)
+ $(Q) if exist *.rst (del /f /q *.rst)
+ $(Q) if exist *.sym (del /f /q *.sym)
+ $(Q) if exist *.adb (del /f /q *.adb)
+ $(Q) if exist *.lnk (del /f /q *.lnk)
+ $(Q) if exist *.map (del /f /q *.map)
+ $(Q) if exist *.mem (del /f /q *.mem)
+ $(Q) if exist *.hex (del /f /q *.hex)
+ $(Q) if exist *.cmd (del /f /q *.cmd)
+endef
+else
define CLEAN
- @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+ $(Q) rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex *.cmd
endef
+endif
+
+# Windows native host tool definitions
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ HOSTCC = mingw32-gcc.exe
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+ HOSTEXEEXT = .exe
+
+ # Windows-native host tools
+
+ MKDEP = $(TOPDIR)\tools\mkdeps.exe --winnative
+else
-MKDEP = $(TOPDIR)/tools/mkdeps.sh
+# Linux/Cygwin host tool definitions
-HOSTCC = gcc
-HOSTINCLUDES = -I.
-HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
-HOSTLDFLAGS =
+ HOSTCC = gcc
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+
+ # This is the tool to use for dependencies (i.e., none)
+
+ MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh
+
+ # SDCC for Linux, OSX, or Cygwin understands symbolic links. Windows SDCC
+ # running under Cygwin does not
+
+ifeq ($(WINTOOL),y)
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)winlink.sh
+ DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+else
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.sh
+ DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+endif
+endif
diff --git a/nuttx/configs/z80sim/scripts/setenv.bat b/nuttx/configs/z80sim/scripts/setenv.bat
new file mode 100644
index 000000000..c266d1e81
--- /dev/null
+++ b/nuttx/configs/z80sim/scripts/setenv.bat
@@ -0,0 +1,50 @@
+@echo off
+
+rem configs/z80sim/scripts/setenv.bat
+rem
+rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
+rem Author: Gregory Nutt <gnutt@nuttx.org>
+rem
+rem Redistribution and use in source and binary forms, with or without
+rem modification, are permitted provided that the following conditions
+rem are met:
+rem
+rem 1. Redistributions of source code must retain the above copyright
+rem notice, this list of conditions and the following disclaimer.
+rem 2. Redistributions in binary form must reproduce the above copyright
+rem notice, this list of conditions and the following disclaimer in
+rem the documentation and/or other materials provided with the
+rem distribution.
+rem 3. Neither the name NuttX nor the names of its contributors may be
+rem used to endorse or promote products derived from this software
+rem without specific prior written permission.
+rem
+rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+rem POSSIBILITY OF SUCH DAMAGE.
+
+rem This is the location where I installed in the MinGW compiler. With
+rem this configuration, it is recommended that you do NOT install the
+rem MSYS tools; they conflict with the GNUWin32 tools. See
+rem http://www.mingw.org/ for further info.
+
+set PATH=C:\MinGW\bin;%PATH%
+
+rem This is the location where I installed the SDCC toolchain for windows.
+
+set PATH=C:\Program Files (x86)\SDCC/bin;%PATH%
+
+rem This is the location where I installed the GNUWin32 tools. See
+rem http://gnuwin32.sourceforge.net/.
+
+set PATH=C:\gnuwin32\bin;%PATH%
+echo %PATH%
diff --git a/nuttx/configs/z80sim/ostest/setenv.sh b/nuttx/configs/z80sim/scripts/setenv.sh
index 239e35286..ead1e1f5f 100755
--- a/nuttx/configs/z80sim/ostest/setenv.sh
+++ b/nuttx/configs/z80sim/scripts/setenv.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# configs/z80sim/ostest/setenv.sh
#
-# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -32,14 +32,35 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-if [ "$(basename $0)" = "setenv.sh" ] ; then
+if [ "$_" = "$0" ] ; then
echo "You must source this script, not run it!" 1>&2
exit 1
fi
-if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+#
+# This is the normal installation directory for SDCC under Linux, OSX
+# or Linux:
+#
+export TOOLCHAIN_BIN=/usr/local/bin
+
+#
+# This is the normal installation directory for SDCC under Windows
+#
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/SDCC/bin"
-export SDCC_BIN=/usr/local/bin
-export PATH=${SDCC_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+#
+# Add the path to the toolchain to the PATH varialble
+#
+export PATH="${TOOLCHAIN_BIN}":/sbin:/usr/sbin:${PATH_ORIG}
echo "PATH : ${PATH}"
diff --git a/nuttx/tools/Config.mk b/nuttx/tools/Config.mk
index 300df7a6a..9ac93e7d0 100644
--- a/nuttx/tools/Config.mk
+++ b/nuttx/tools/Config.mk
@@ -134,10 +134,16 @@ endef
# ASSEMBLE - Default macro to assemble one assembly language file
# Example: $(call ASSEMBLE, in-file, out-file)
#
+# NOTE that the most common toolchain, GCC, uses the compiler to assemble
+# files because this has the advantage of running the C Pre-Processor against
+# the assembly language files. This is not possible with other toolchains;
+# platforms using those other tools should define AS and over-ride this
+# definition in order to use the assembler directly.
+#
# Depends on these settings defined in board-specific Make.defs file
# installed at $(TOPDIR)/Make.defs:
#
-# CC - By default, the C compiler is used to compile assembly lagnuage
+# CC - By default, the C compiler is used to compile assembly language
# files
# AFLAGS - Options to pass to the C+compiler
@@ -164,8 +170,7 @@ endef
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
define ARCHIVE
- @echo "AR: $2"
- $(AR) $1
+ @echo AR: $2
$(Q) $(AR) $1 $(2)
endef
else