From 571565a1e059129b8967ffe227f3791c4b6f6507 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 5 Dec 2012 15:01:11 +0000 Subject: [PATCH] Progress toward natvie z80 SDCC build -- still issues git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5413 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 3 + arch/z80/src/Makefile | 37 ++- .../z80/src/{Makefile.sdcc => Makefile.sdccl} | 110 ++++--- arch/z80/src/Makefile.sdccw | 274 ++++++++++++++++++ .../src/{Makefile.zdsii => Makefile.zdsiil} | 56 +--- arch/z80/src/Makefile.zdsiiw | 156 ++++++++++ arch/z80/src/mkhpbase.bat | 45 +++ configs/pjrc-8051/Make.defs | 1 + configs/xtrs/nsh/Make.defs | 3 +- configs/xtrs/ostest/Make.defs | 3 +- configs/xtrs/pashello/Make.defs | 3 +- configs/z80sim/nsh/Make.defs | 3 +- configs/z80sim/ostest/Make.defs | 3 +- configs/z80sim/pashello/Make.defs | 3 +- configs/z80sim/src/z80_lowputc.c | 19 ++ 15 files changed, 616 insertions(+), 103 deletions(-) rename arch/z80/src/{Makefile.sdcc => Makefile.sdccl} (66%) create mode 100644 arch/z80/src/Makefile.sdccw rename arch/z80/src/{Makefile.zdsii => Makefile.zdsiil} (74%) create mode 100644 arch/z80/src/Makefile.zdsiiw create mode 100755 arch/z80/src/mkhpbase.bat diff --git a/ChangeLog b/ChangeLog index cd46b5a2ef..ab1412ae2f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3734,4 +3734,7 @@ * 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. + * arch/z80/src/Makefile.sdccw: Renamed makefiles with extensions zdiil, + zdiiw, sdccl, and sdccw for the ZDS-II vs SDCC compilers and for the + POSIX vs Windows native builds. diff --git a/arch/z80/src/Makefile b/arch/z80/src/Makefile index 4b02b1f0b9..c3e2caea77 100644 --- a/arch/z80/src/Makefile +++ b/arch/z80/src/Makefile @@ -33,18 +33,43 @@ # ############################################################################ -############################################################################ # Makefile fragments -include $(TOPDIR)/Make.defs -include chip/Make.defs -include board/Make.defs -############################################################################ -# Compiler-Dependent Make -COMPILER = ${shell basename "$(CC)"} +# Compiler-Dependent Make: SDCC or ZiLOG ZDS-II + +COMPILER = ${shell basename "$(CC)"} ifeq ($(COMPILER),sdcc) -include Makefile.sdcc + + # Check for SDCC native windows build + + ifeq ($(CONFIG_WINDOWS_NATIVE),y) + + # SDCC Windows native build + + include Makefile.sdccw + else + + # SDCC in a POSIX environment (Linux, OSX, or Cygwin/MSYS) + + include Makefile.sdccl + endif else -include Makefile.zdsii + + # Check for ZDSII native windows build + + ifeq ($(CONFIG_WINDOWS_NATIVE),y) + + # ZDSII Windows native build + + include Makefile.zdsiiw + else + + # ZDSII in a POSIX environment (Cygwin/MSYS) + + include Makefile.zdsiil + endif endif diff --git a/arch/z80/src/Makefile.sdcc b/arch/z80/src/Makefile.sdccl similarity index 66% rename from arch/z80/src/Makefile.sdcc rename to arch/z80/src/Makefile.sdccl index 91f99d0cfb..531fbedf96 100644 --- a/arch/z80/src/Makefile.sdcc +++ b/arch/z80/src/Makefile.sdccl @@ -1,5 +1,5 @@ ############################################################################ -# arch/z80/src/Makefile.sdcc +# arch/z80/src/Makefile.sdccl # # Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -86,7 +86,7 @@ HEAP_BASE = ${shell ./mkhpbase.sh} all: $(HEAD_OBJ) libarch$(LIBEXT) -.PHONY: board/libboard$(LIBEXT) +.PHONY: board/libboard$(LIBEXT) pass1.lnk nuttx.lnk $(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %$(ASMEXT) $(call ASSEMBLE, $<, $@) @@ -97,11 +97,40 @@ $(COBJS): %$(OBJEXT): %.c # This is a kludge to work around some conflicting symbols in libsdcc.lib $(SDCC_LIBDIR)/myz80.lib: $(SDCC_LIBDIR)/$(SDCCLIB) - $(Q) cat $(SDCC_LIBDIR)/$(SDCCLIB) | \ +ifeq ($(CONFIG_SDCC_OLD),y) + $(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 $(SDCC_LIBDIR)/myz80.lib + $(Q) mv -f myz80.lib $(SDCC_LIBDIR)\myz80.lib +else + $(Q) cp $(SDCC_LIBDIR)\z80.lib $(SDCC_LIBDIR)\myz80.lib + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _calloc.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _malloc.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _realloc.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _free.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib printf_large.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib sprintf.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib vprintf.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib strcpy.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib strlen.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strcat.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strchr.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strcmp.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strcspn.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strncat.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strncmp.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strncpy.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strpbrk.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strrchr.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strspn.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strstr.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strtok.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _memchr.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _memcmp.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _memcpy.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _memset.rel +endif # Create a header file that contains addressing information needed by the code @@ -143,76 +172,79 @@ board/libboard$(LIBEXT): # This target builds the final executable -pass1.hex: up_mem.h asm_mem.h $(SDCC_LIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT) +pass1.lnk: @echo "LD: pass1.hex" - @echo "--" >pass1.lnk # Non-interactive - @echo "-k $(BOARDDIR)" >>pass1.lnk # Path to board library + @echo "--" >pass1.lnk # Non-interactive + @echo "-k $(BOARDDIR)" >>pass1.lnk # Path to board 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 ;\ done - @echo "-l myz80.lib" >>pass1.lnk # Name of SDCC z80 library + @echo "-l myz80.lib" >>pass1.lnk # Name of SDCC z80 library ifneq ($(CONFIG_LINKER_START_AREA),) - @echo "-b START=$(CONFIG_LINKER_START_AREA)" >>pass1.lnk # Start of START area + @echo "-b START=$(CONFIG_LINKER_START_AREA)" >>pass1.lnk # Start of START area else - @echo "-b START=0" >>pass1.lnk # Start of START area + @echo "-b START=0" >>pass1.lnk # Start of START area endif ifneq ($(CONFIG_LINKER_CODE_AREA),) - @echo "-b _CODE=$(CONFIG_LINKER_CODE_AREA)" >>pass1.lnk # Start of _CODE area + @echo "-b _CODE=$(CONFIG_LINKER_CODE_AREA)" >>pass1.lnk # Start of _CODE area else - @echo "-b _CODE=256" >>pass1.lnk # Start of _CODE area + @echo "-b _CODE=256" >>pass1.lnk # Start of _CODE area endif - @echo "-i" >>pass1.lnk # Intel hex format - @echo "-x" >>pass1.lnk # Hexadecimal - @echo "-m" >>pass1.lnk # Generate a map file - @echo "-j" >>pass1.lnk # Generate a symbol file - @echo "pass1.hex" >>pass1.lnk # Path to head object - @echo "$(HEAD_OBJ)" >>pass1.lnk # Path to head object - @echo "-e" >>pass1.lnk # End of script + @echo "-i" >>pass1.lnk # Intel hex format + @echo "-x" >>pass1.lnk # Hexadecimal + @echo "-m" >>pass1.lnk # Generate a map file + @echo "-j" >>pass1.lnk # Generate a symbol file + @echo "pass1.hex" >>pass1.lnk # Path to head object + @echo "$(HEAD_OBJ)" >>pass1.lnk # Path to head object + @echo "-e" >>pass1.lnk # End of script + +pass1.hex: up_mem.h asm_mem.h $(SDCC_LIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT) pass1.lnk + @echo "LD: pass1.hex" $(Q) $(LD) -f pass1.lnk $(Q) rm -f up_mem.h asm_mem.h $(Q) rm -f up_allocateheap$(OBJEXT) $(HEAD_OBJ) libarch$(LIBEXT) $(Q) $(MAKE) TOPDIR="$(TOPDIR)" libarch$(LIBEXT) $(Q) $(MAKE) TOPDIR="$(TOPDIR)" $(HEAD_OBJ) -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 +nuttx.lnk: + @echo "--" >nuttx.lnk # Non-interactive + @echo "-k $(BOARDDIR)" >>nuttx.lnk # Path to board 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 ;\ done - @echo "-l myz80.lib" >>nuttx.lnk # Name of SDCC z80 library + @echo "-l myz80.lib" >>nuttx.lnk # Name of SDCC z80 library ifneq ($(CONFIG_LINKER_START_AREA),) - @echo "-b START=$(CONFIG_LINKER_START_AREA)" >>nuttx.lnk # Start of START area + @echo "-b START=$(CONFIG_LINKER_START_AREA)" >>nuttx.lnk # Start of START area else - @echo "-b START=0" >>nuttx.lnk # Start of START area + @echo "-b START=0" >>nuttx.lnk # Start of START area endif ifneq ($(CONFIG_LINKER_CODE_AREA),) - @echo "-b _CODE=$(CONFIG_LINKER_CODE_AREA)" >>nuttx.lnk # Start of _CODE area + @echo "-b _CODE=$(CONFIG_LINKER_CODE_AREA)" >>nuttx.lnk # Start of _CODE area else - @echo "-b _CODE=256" >>nuttx.lnk # Start of _CODE area + @echo "-b _CODE=256" >>nuttx.lnk # Start of _CODE area endif - @echo "-i" >>nuttx.lnk # Intel hex format - @echo "-x" >>nuttx.lnk # Hexadecimal - @echo "-m" >>nuttx.lnk # Generate a map file - @echo "-j" >>nuttx.lnk # Generate a symbol file - @echo "nuttx.hex" >>nuttx.lnk # Path to head object - @echo "$(HEAD_OBJ)" >>nuttx.lnk # Path to head object - @echo "-e" >>nuttx.lnk # End of script - $(Q) $(LD) -f nuttx.lnk + @echo "-i" >>nuttx.lnk # Intel hex format + @echo "-x" >>nuttx.lnk # Hexadecimal + @echo "-m" >>nuttx.lnk # Generate a map file + @echo "-j" >>nuttx.lnk # Generate a symbol file + @echo "nuttx.ihx" >>nuttx.lnk # Path to head object + @echo "$(HEAD_OBJ)" >>nuttx.lnk # Path to head object + @echo "-e" >>nuttx.lnk # End of script -nuttx$(EXEEXT): pass1.hex nuttx.hex +nuttx$(EXEEXT): pass1.hex up_mem.h asm_mem.h $(SDCC_LIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT) nuttx.lnk + @echo "LD: nuttx.ihx" + $(Q) $(LD) -f nuttx.lnk $(Q) rm -f pass1.* $(Q) cp -f nuttx.map $(TOPDIR)/. ifeq ($(EXEEXT),.cmd) - sed s/:00000001FF/:00520001AD/ nuttx.hex | \ + sed s/:00000001FF/:00520001AD/ nuttx.ihx | \ hex2cmd > $(TOPDIR)/nuttx.cmd else - $(Q) packihx nuttx.hex > $(TOPDIR)/nuttx$(EXEEXT) + $(Q) packihx nuttx.ihx > $(TOPDIR)/nuttx$(EXEEXT) endif # This is part of the top-level export target diff --git a/arch/z80/src/Makefile.sdccw b/arch/z80/src/Makefile.sdccw new file mode 100644 index 0000000000..5841136ebf --- /dev/null +++ b/arch/z80/src/Makefile.sdccw @@ -0,0 +1,274 @@ +############################################################################ +# arch/z80/src/Makefile.sdccw +# +# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +############################################################################ +# Tools +# CFLAGS, CPPFLAGS, ASFLAGS, LDFLAGS are set in $(TOPDIR)\Make.defs + +CFLAGS += -I$(ARCH_SRCDIR)\chip -I$(ARCH_SRCDIR)\common -I$(TOPDIR)\sched +CPPFLAGS += -D__ASSEMBLY__ + +############################################################################ +# Files and directories + +# There should be one head source (.asm file) + +HEAD_OBJ = $(HEAD_ASRC:$(ASMEXT)=$(OBJEXT)) + +# Assembly sources and objects + +ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS) +AOBJS = $(ASRCS:$(ASMEXT)=$(OBJEXT)) + +# C sources and objects + +CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +# All sources and objcts + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +# Sources that can have dependencies (no .asm files) + +DEPSRCS = $(CSRCS) + +# Directories + +ARCH_SRCDIR = $(TOPDIR)\arch\$(CONFIG_ARCH)\src +BOARDDIR = $(TOPDIR)\arch\$(CONFIG_ARCH)\src\board + +VPATH = chip:common:board + +# Libraries + +LIBGCC = ${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name} + +# Supports dynamic sizing of HEAP. +# +HEAP_BASE = ${shell .\mkhpbase.bat} + +############################################################################ +# Targets + +all: $(HEAD_OBJ) libarch$(LIBEXT) + +.PHONY: board\libboard$(LIBEXT) pass1.lnk nuttx.lnk + +$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %$(ASMEXT) + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +# This is a kludge to work around some conflicting symbols in the SDCC libraries + +$(SDCC_LIBDIR)\myz80.lib: $(SDCC_LIBDIR)\$(SDCCLIB) +ifeq ($(CONFIG_SDCC_OLD),y) + $(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 $(SDCC_LIBDIR)\myz80.lib +else + $(Q) cp $(SDCC_LIBDIR)\z80.lib $(SDCC_LIBDIR)\myz80.lib + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _calloc.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _malloc.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _realloc.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _free.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib printf_large.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib sprintf.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib vprintf.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib strcpy.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib strlen.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strcat.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strchr.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strcmp.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strcspn.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strncat.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strncmp.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strncpy.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strpbrk.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strrchr.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strspn.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strstr.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _strtok.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _memchr.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _memcmp.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _memcpy.rel + $(Q) sdar d $(SDCC_LIBDIR)\myz80.lib _memset.rel +endif + +# Create a header file that contains addressing information needed by the code + +up_mem.h: + @echo #ifndef __UP_MEM_H>up_mem.h + @echo #define __UP_MEM_H>>up_mem.h + @echo #include ^>>up_mem.h + @echo #define CONFIG_STACK_END $(CONFIG_DRAM_SIZE)>> up_mem.h + @echo #define CONFIG_STACK_BASE (CONFIG_STACK_END - $(CONFIG_IDLETHREAD_STACKSIZE))>> up_mem.h + @echo #define CONFIG_HEAP1_END CONFIG_STACK_BASE>> up_mem.h + @echo #define CONFIG_HEAP1_BASE $(HEAP_BASE)>> up_mem.h + @echo #endif /* __UP_MEM_H */>>up_mem.h + +asm_mem.h: + @echo CONFIG_COMPILER_OTHER == ^0>asm_mem.h + @echo CONFIG_COMPILER_SDCC == ^1>>asm_mem.h +ifeq ($(CC),sdcc) + @echo CONFIG_COMPILER == ^1>>asm_mem.h +else + @echo CONFIG_COMPILER == ^0>>asm_mem.h +endif + @echo CONFIG_STACK_END == ($(CONFIG_DRAM_SIZE) - 1)>>asm_mem.h + @echo CONFIG_STACK_BASE == (CONFIG_STACK_END - $(CONFIG_IDLETHREAD_STACKSIZE))>>asm_mem.h + @echo CONFIG_HEAP1_END == (CONFIG_STACK_END - $(CONFIG_IDLETHREAD_STACKSIZE) - 1)>>asm_mem.h + @echo CONFIG_HEAP1_BASE == $(HEAP_BASE)>>asm_mem.h + +# Combine all objects in this directory into a library + +libarch$(LIBEXT): up_mem.h asm_mem.h $(OBJS) + $(call ARCHIVE, $@, $(OBJS)) + +# This builds the libboard library in the board\ subdirectory + +board\libboard$(LIBEXT): + $(Q) $(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES) + +# This target builds the final executable + +pass1.lnk: + @echo LD: pass1.lnk + @echo -->pass1.lnk + @echo -k $(BOARDDIR)>>pass1.lnk + @echo -k $(SDCC_LIBDIR)>>pass1.lnk + @echo -l libboard$(LIBEXT)>>pass1.lnk + $(Q) for %%G in ($(LINKLIBS)) do ( echo -l $(TOPDIR)\lib\%%G>> pass1.lnk ) + @echo -l myz80.lib>>pass1.lnk +ifneq ($(CONFIG_LINKER_START_AREA),) + @echo -b START=$(CONFIG_LINKER_START_AREA)>>pass1.lnk +else + @echo -b START=0>>pass1.lnk +endif +ifneq ($(CONFIG_LINKER_CODE_AREA),) + @echo -b _CODE=$(CONFIG_LINKER_CODE_AREA)>>pass1.lnk +else + @echo -b _CODE=256>>pass1.lnk +endif + @echo -i>>pass1.lnk + @echo -x>>pass1.lnk + @echo -m>>pass1.lnk + @echo -j>>pass1.lnk + @echo pass1.hex>>pass1.lnk + @echo $(HEAD_OBJ)>>pass1.lnk + @echo -e>>pass1.lnk + +pass1.hex: up_mem.h asm_mem.h $(SDCC_LIBDIR)\myz80.lib $(HEAD_OBJ) board\libboard$(LIBEXT) pass1.lnk + @echo LD: pass1.hex + $(Q) $(LD) -f pass1.lnk + $(Q) rm -f up_mem.h asm_mem.h + $(Q) rm -f up_allocateheap$(OBJEXT) $(HEAD_OBJ) libarch$(LIBEXT) + $(Q) $(MAKE) TOPDIR="$(TOPDIR)" libarch$(LIBEXT) + $(Q) $(MAKE) TOPDIR="$(TOPDIR)" $(HEAD_OBJ) + +nuttx.lnk: + @echo LD: nuttx.lnk + @echo -->nuttx.lnk + @echo -k $(BOARDDIR)>>nuttx.lnk + @echo -k $(SDCC_LIBDIR)>>nuttx.lnk + @echo -l libboard$(LIBEXT)>>nuttx.lnk + $(Q) for %%G in ($(LINKLIBS)) do ( echo -l $(TOPDIR)\lib\%%G>> nuttx.lnk ) + @echo -l myz80.lib>>nuttx.lnk +ifneq ($(CONFIG_LINKER_START_AREA),) + @echo -b START=$(CONFIG_LINKER_START_AREA)>>nuttx.lnk +else + @echo -b START=0>>nuttx.lnk +endif +ifneq ($(CONFIG_LINKER_CODE_AREA),) + @echo -b _CODE=$(CONFIG_LINKER_CODE_AREA)>>nuttx.lnk +else + @echo -b _CODE=256>>nuttx.lnk +endif + @echo -i>>nuttx.lnk + @echo -x>>nuttx.lnk + @echo -m>>nuttx.lnk + @echo -j>>nuttx.lnk + @echo nuttx.ihx>>nuttx.lnk + @echo $(HEAD_OBJ)>>nuttx.lnk + @echo -e>>nuttx.lnk + +nuttx$(EXEEXT): pass1.hex up_mem.h asm_mem.h $(SDCC_LIBDIR)\myz80.lib $(HEAD_OBJ) board\libboard$(LIBEXT) nuttx.lnk + @echo LD: nuttx.ihx + $(Q) $(LD) -f nuttx.lnk + $(call DELFILE, pass1.*) + $(Q) cp -f nuttx.map $(TOPDIR)\. +ifeq ($(EXEEXT),.cmd) + sed s/:00000001FF/:00520001AD/ nuttx.ihx | \ + hex2cmd > $(TOPDIR)\nuttx.cmd +else + $(Q) packihx nuttx.ihx > $(TOPDIR)\nuttx$(EXEEXT) +endif + +# This is part of the top-level export target + +export_head: board\libboard$(LIBEXT) $(HEAD_OBJ) + $(Q) if not exist board\Makefile ( echo $(EXPORT_DIR)\startup does not exist ) + $(Q) if exist board\Makefile ( cp -f $(HEAD_OBJ) "$(EXPORT_DIR)\startup" ) + +# Build dependencies + +.depend: Makefile up_mem.h asm_mem.h chip\Make.defs $(DEPSRCS) + $(Q) if exist board\Makefile ( $(MAKE) -C board TOPDIR="$(TOPDIR)" depend ) + $(Q) $(MKDEP) --dep-path chip --dep-path common "$(CC)" -- $(CFLAGS) -- $(DEPSRCS) >Make.dep + $(Q) touch $@ + +depend: .depend + +clean: + $(Q) if exist board\Makefile ( $(MAKE) -C board TOPDIR="$(TOPDIR)" clean ) + $(call DELFILE, up_mem.h) + $(call DELFILE, asm_mem.h) + $(call DELFILE, pass1.*) + $(call DELFILE, nuttx.*) + $(call DELFILE, libarch$(LIBEXT)) + $(call CLEAN) + + +distclean: clean + $(Q) if exist board\Makefile ( $(MAKE) -C board TOPDIR="$(TOPDIR)" distclean ) + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) + +-include Make.dep diff --git a/arch/z80/src/Makefile.zdsii b/arch/z80/src/Makefile.zdsiil similarity index 74% rename from arch/z80/src/Makefile.zdsii rename to arch/z80/src/Makefile.zdsiil index 1615763d1a..87ada571fc 100644 --- a/arch/z80/src/Makefile.zdsii +++ b/arch/z80/src/Makefile.zdsiil @@ -1,5 +1,5 @@ ############################################################################ -# arch/z80/src/Makefile.zdsii +# arch/z80/src/Makefile.zdsiil # # Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -40,13 +40,9 @@ SCHEDSRCDIR = $(TOPDIR)$(DELIM)sched ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - USRINCLUDES = -usrinc:".;$(SCHEDSRCDIR);$(ARCHSRCDIR);$(ARCHSRCDIR)\common" -else - WSCHEDSRCDIR = ${shell cygpath -w $(SCHEDSRCDIR)} - WARCHSRCDIR = ${shell cygpath -w $(ARCHSRCDIR)} - USRINCLUDES = -usrinc:'.;$(WSCHEDSRCDIR);$(WARCHSRCDIR);$(WARCHSRCDIR)\common' -endif +WSCHEDSRCDIR = ${shell cygpath -w $(SCHEDSRCDIR)} +WARCHSRCDIR = ${shell cygpath -w $(ARCHSRCDIR)} +USRINCLUDES = -usrinc:'.;$(WSCHEDSRCDIR);$(WARCHSRCDIR);$(WARCHSRCDIR)\common' INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES) CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) @@ -103,33 +99,6 @@ board$(DELIM)libboard$(LIBEXT): nuttx.linkcmd: $(LINKCMDTEMPLATE) $(Q) cp -f $(LINKCMDTEMPLATE) nuttx.linkcmd -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - @echo "$(TOPDIR)\nuttx"= \>>nuttx.linkcmd - @echo "$(ARCHSRCDIR)\$(HEAD_OBJ)", \>>nuttx.linkcmd - $(Q) for %%G in ($(LINKLIBS)) do ( echo "$(TOPDIR)\lib\%%G", \>>nuttx.linkcmd ) - @echo "$(ARCHSRCDIR)\board\libboard$(LIBEXT)", \>>nuttx.linkcmd -ifeq ($(CONFIG_ARCH_CHIP_Z8F640X),y) - @echo "$(ZDSSTDLIBDIR)\chelprevaaD$(LIBEXT)", \>>nuttx.linkcmd - @echo "$(ZDSSTDLIBDIR)\crtrevaaLDD$(LIBEXT)", \>>nuttx.linkcmd - @echo "$(ZDSSTDLIBDIR)\fprevaaLDD$(LIBEXT)", \>>nuttx.linkcmd - @echo "$(ZDSZILOGLIBDIR)\csiorevaaLDD$(LIBEXT)", \>>nuttx.linkcmd - @echo "$(ZDSZILOGLIBDIR)\zsldevinitdummy$(LIBEXT)">>nuttx.linkcmd -endif -ifeq ($(CONFIG_ARCH_CHIP_Z8F642X),y) - @echo "$(ZDSSTDLIBDIR)\chelpD$(LIBEXT)", \>>nuttx.linkcmd - @echo "$(ZDSSTDLIBDIR)\crtLDD$(LIBEXT)", \>>nuttx.linkcmd - @echo "$(ZDSSTDLIBDIR)\fpdumyLD$(LIBEXT)", \>>nuttx.linkcmd - @echo "$(ZDSZILOGLIBDIR)\csioLDD$(LIBEXT)", \>>nuttx.linkcmd - @echo "$(ZDSZILOGLIBDIR)\zsldevinitdummy$(LIBEXT)">>nuttx.linkcmd -endif -ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y) - @echo "$(ZDSSTDLIBDIR)\chelp$(LIBEXT)", \>>nuttx.linkcmd - @echo "$(ZDSSTDLIBDIR)\crt$(LIBEXT)", \>>nuttx.linkcmd - @echo "$(ZDSSTDLIBDIR)\fplib$(LIBEXT)", \>>nuttx.linkcmd - @echo "$(ZDSZILOGLIBDIR)\gpio$(LIBEXT)", \>>nuttx.linkcmd - @echo "$(ZDSZILOGLIBDIR)\uartf91$(LIBEXT)">>nuttx.linkcmd -endif -else @echo "\"${shell cygpath -w "$(TOPDIR)/nuttx"}\"= \\" >>nuttx.linkcmd @echo " \"${shell cygpath -w "$(ARCHSRCDIR)/$(HEAD_OBJ)"}\", \\" >>nuttx.linkcmd $(Q) ( for lib in $(LINKLIBS); do \ @@ -157,49 +126,36 @@ ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y) @echo " \"${shell cygpath -w "$(ZDSZILOGLIBDIR)/gpio$(LIBEXT)"}\", \\" >>nuttx.linkcmd @echo " \"${shell cygpath -w "$(ZDSZILOGLIBDIR)/uartf91$(LIBEXT)"}\"" >>nuttx.linkcmd endif -endif nuttx$(EXEEXT): $(HEAD_OBJ) board$(DELIM)libboard$(LIBEXT) nuttx.linkcmd @echo "LD: nuttx$(EXEEXT)" $(Q) "$(LD)" $(LDFLAGS) .depend: Makefile chip$(DELIM)Make.defs $(DEPSRCS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - $(Q) if exist board$(DELIM)Makefile ( $(MAKE) -C board TOPDIR="$(TOPDIR)" depend ) -else $(Q) if [ -e board$(DELIM)Makefile ]; then \ $(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \ fi -endif $(Q) $(MKDEP) --dep-path chip --dep-path common "$(CC)" -- $(CFLAGS) -- $(DEPSRCS) >Make.dep $(Q) touch $@ # This is part of the top-level export target export_head: board$(DELIM)libboard$(LIBEXT) $(HEAD_OBJ) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - $(Q) if exist "$(EXPORT_DIR)$(DELIM)startup" ( copy $(HEAD_OBJ) "$(EXPORT_DIR)$(DELIM)startup$(DELIM)." /b /y) -else $(Q) if [ -d "$(EXPORT_DIR)$(DELIM)startup" ]; then \ cp -f $(HEAD_OBJ) "$(EXPORT_DIR)$(DELIM)startup"; \ else \ echo "$(EXPORT_DIR)$(DELIM)startup does not exist"; \ exit 1; \ fi -endif # Dependencies depend: .depend clean: -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - $(Q) if exist board$(DELIM)Makefile ( $(MAKE) -C board TOPDIR="$(TOPDIR)" clean ) -else $(Q) if [ -e board$(DELIM)Makefile ]; then \ $(MAKE) -C board TOPDIR="$(TOPDIR)" clean ; \ fi -endif $(call DELFILE, nuttx.linkcmd) $(call DELFILE, *.asm) $(call DELFILE, *.tmp) @@ -208,13 +164,9 @@ endif $(call CLEAN) distclean: clean -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - $(Q) if exist board$(DELIM)Makefile ( $(MAKE) -C board TOPDIR="$(TOPDIR)" distclean ) -else $(Q) if [ -e board$(DELIM)Makefile ]; then \ $(MAKE) -C board TOPDIR="$(TOPDIR)" distclean ; \ fi -endif $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/arch/z80/src/Makefile.zdsiiw b/arch/z80/src/Makefile.zdsiiw new file mode 100644 index 0000000000..bf599ecaea --- /dev/null +++ b/arch/z80/src/Makefile.zdsiiw @@ -0,0 +1,156 @@ +############################################################################ +# arch/z80/src/Makefile.zdsiiw +# +# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)\Make.defs + +# Tools + +SCHEDSRCDIR = $(TOPDIR)$(DELIM)sched +ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src +USRINCLUDES = -usrinc:".;$(SCHEDSRCDIR);$(ARCHSRCDIR);$(ARCHSRCDIR)\common" + +INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES) +CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) +CPPFLAGS += -I$(ARCHSRCDIR) -I$(ZDSSTDINCDIR) -I$(ZDSZILOGINCDIR) +LDFLAGS += @nuttx.linkcmd + +# Files and directories + +ifneq ($(HEAD_SSRC),) +HEAD_GENSRC = $(HEAD_SSRC:.S=$(ASMEXT)) +HEAD_OBJ = $(HEAD_SSRC:.S=$(OBJEXT)) +else +HEAD_OBJ = $(HEAD_ASRC:$(ASMEXT)=$(OBJEXT)) +endif + +SSRCS = $(CHIP_SSRCS) $(CMN_SSRCS) +ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS) +GENSRCS = $(SSRCS:.S=$(ASMEXT)) +AOBJS = $(SSRCS:.S=$(OBJEXT)) $(ASRCS:$(ASMEXT)=$(OBJEXT)) + +CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +DEPSRCS = $(SSRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +BOARDDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board + +VPATH = chip:common + +# Targets + +all: $(HEAD_OBJ) libarch$(LIBEXT) + +.PHONY: board$(DELIM)libboard$(LIBEXT) + +$(HEAD_GENSRC) $(GENSRCS) : %$(ASMEXT): %.S + $(Q) $(CPP) $(CPPFLAGS) $< -o $@.tmp + $(Q) cat $@.tmp | sed -e "s/^#/;/g" > $@ + $(Q) rm $@.tmp + +$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %$(ASMEXT) + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +libarch$(LIBEXT): $(OBJS) + $(call ARCHIVE, $@, $(OBJS)) + +board$(DELIM)libboard$(LIBEXT): + $(Q) $(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES) + +nuttx.linkcmd: $(LINKCMDTEMPLATE) + $(Q) cp -f $(LINKCMDTEMPLATE) nuttx.linkcmd + @echo "$(TOPDIR)\nuttx"= \>>nuttx.linkcmd + @echo "$(ARCHSRCDIR)\$(HEAD_OBJ)", \>>nuttx.linkcmd + $(Q) for %%G in ($(LINKLIBS)) do ( echo "$(TOPDIR)\lib\%%G", \>>nuttx.linkcmd ) + @echo "$(ARCHSRCDIR)\board\libboard$(LIBEXT)", \>>nuttx.linkcmd +ifeq ($(CONFIG_ARCH_CHIP_Z8F640X),y) + @echo "$(ZDSSTDLIBDIR)\chelprevaaD$(LIBEXT)", \>>nuttx.linkcmd + @echo "$(ZDSSTDLIBDIR)\crtrevaaLDD$(LIBEXT)", \>>nuttx.linkcmd + @echo "$(ZDSSTDLIBDIR)\fprevaaLDD$(LIBEXT)", \>>nuttx.linkcmd + @echo "$(ZDSZILOGLIBDIR)\csiorevaaLDD$(LIBEXT)", \>>nuttx.linkcmd + @echo "$(ZDSZILOGLIBDIR)\zsldevinitdummy$(LIBEXT)">>nuttx.linkcmd +endif +ifeq ($(CONFIG_ARCH_CHIP_Z8F642X),y) + @echo "$(ZDSSTDLIBDIR)\chelpD$(LIBEXT)", \>>nuttx.linkcmd + @echo "$(ZDSSTDLIBDIR)\crtLDD$(LIBEXT)", \>>nuttx.linkcmd + @echo "$(ZDSSTDLIBDIR)\fpdumyLD$(LIBEXT)", \>>nuttx.linkcmd + @echo "$(ZDSZILOGLIBDIR)\csioLDD$(LIBEXT)", \>>nuttx.linkcmd + @echo "$(ZDSZILOGLIBDIR)\zsldevinitdummy$(LIBEXT)">>nuttx.linkcmd +endif +ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y) + @echo "$(ZDSSTDLIBDIR)\chelp$(LIBEXT)", \>>nuttx.linkcmd + @echo "$(ZDSSTDLIBDIR)\crt$(LIBEXT)", \>>nuttx.linkcmd + @echo "$(ZDSSTDLIBDIR)\fplib$(LIBEXT)", \>>nuttx.linkcmd + @echo "$(ZDSZILOGLIBDIR)\gpio$(LIBEXT)", \>>nuttx.linkcmd + @echo "$(ZDSZILOGLIBDIR)\uartf91$(LIBEXT)">>nuttx.linkcmd +endif + +nuttx$(EXEEXT): $(HEAD_OBJ) board$(DELIM)libboard$(LIBEXT) nuttx.linkcmd + @echo "LD: nuttx$(EXEEXT)" + $(Q) "$(LD)" $(LDFLAGS) + +.depend: Makefile chip$(DELIM)Make.defs $(DEPSRCS) + $(Q) if exist board$(DELIM)Makefile ( $(MAKE) -C board TOPDIR="$(TOPDIR)" depend ) + $(Q) $(MKDEP) --dep-path chip --dep-path common "$(CC)" -- $(CFLAGS) -- $(DEPSRCS) >Make.dep + $(Q) touch $@ + +# This is part of the top-level export target + +export_head: board$(DELIM)libboard$(LIBEXT) $(HEAD_OBJ) + $(Q) if exist "$(EXPORT_DIR)$(DELIM)startup" ( copy $(HEAD_OBJ) "$(EXPORT_DIR)$(DELIM)startup$(DELIM)." /b /y) + +# Dependencies + +depend: .depend + +clean: + $(Q) if exist board$(DELIM)Makefile ( $(MAKE) -C board TOPDIR="$(TOPDIR)" clean ) + $(call DELFILE, nuttx.linkcmd) + $(call DELFILE, *.asm) + $(call DELFILE, *.tmp) + $(call DELFILE, *.map) + $(call DELFILE, libarch$(LIBEXT)) + $(call CLEAN) + +distclean: clean + $(Q) if exist board$(DELIM)Makefile ( $(MAKE) -C board TOPDIR="$(TOPDIR)" distclean ) + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) + +-include Make.dep diff --git a/arch/z80/src/mkhpbase.bat b/arch/z80/src/mkhpbase.bat new file mode 100755 index 0000000000..8792f73a4e --- /dev/null +++ b/arch/z80/src/mkhpbase.bat @@ -0,0 +1,45 @@ +@echo off + +rem arch/z80/src/mkhpbase.bat +rem +rem Copyright (C) 2012 Gregory Nutt. All rights reserved. +rem Author: Gregory Nutt +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 + +rem +rem This script supports dynamic sizing of HEAP when building with the SDCC +rem toolchain. This script adds up the size of each section of the program. +rem This does not account for the alignment of the _CODE area to 0x0100 (hence +rem the fudge factor 196 is added). +rem +rem -- There must be a better way! --- +rem + +echo (CONFIG_HEAP1_END - 8192) diff --git a/configs/pjrc-8051/Make.defs b/configs/pjrc-8051/Make.defs index 8dd552990f..8034555222 100644 --- a/configs/pjrc-8051/Make.defs +++ b/configs/pjrc-8051/Make.defs @@ -53,6 +53,7 @@ CC = sdcc CPP = sdcpp LD = aslink AS = asx8051 +#AR = sdar -r AR = sdcclib -a CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ diff --git a/configs/xtrs/nsh/Make.defs b/configs/xtrs/nsh/Make.defs index 749b693154..db67b931cb 100644 --- a/configs/xtrs/nsh/Make.defs +++ b/configs/xtrs/nsh/Make.defs @@ -58,15 +58,16 @@ endif CROSSDEV = CC = sdcc CPP = sdcpp -AR = sdcclib -a ifeq ($(CONFIG_SDCC_OLD),y) LD = link-z80 AS = as-z80 + AR = sdcclib -a ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent else LD = sdldz80 AS = sdasz80 + AR = sdar -r ARCHCPUFLAGS = -mz80 endif diff --git a/configs/xtrs/ostest/Make.defs b/configs/xtrs/ostest/Make.defs index 550c70d3c8..3555017377 100644 --- a/configs/xtrs/ostest/Make.defs +++ b/configs/xtrs/ostest/Make.defs @@ -58,15 +58,16 @@ endif CROSSDEV = CC = sdcc CPP = sdcpp -AR = sdcclib -a ifeq ($(CONFIG_SDCC_OLD),y) LD = link-z80 AS = as-z80 + AR = sdcclib -a ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent else LD = sdldz80 AS = sdasz80 + AR = sdar -r ARCHCPUFLAGS = -mz80 endif diff --git a/configs/xtrs/pashello/Make.defs b/configs/xtrs/pashello/Make.defs index 409e303c10..641b9426d6 100644 --- a/configs/xtrs/pashello/Make.defs +++ b/configs/xtrs/pashello/Make.defs @@ -58,15 +58,16 @@ endif CROSSDEV = CC = sdcc CPP = sdcpp -AR = sdcclib -a ifeq ($(CONFIG_SDCC_OLD),y) LD = link-z80 AS = as-z80 + AR = sdcclib -a ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent else LD = sdldz80 AS = sdasz80 + AR = sdar -r ARCHCPUFLAGS = -mz80 endif diff --git a/configs/z80sim/nsh/Make.defs b/configs/z80sim/nsh/Make.defs index a5b325e79d..1edd5fdcf8 100644 --- a/configs/z80sim/nsh/Make.defs +++ b/configs/z80sim/nsh/Make.defs @@ -58,15 +58,16 @@ endif CROSSDEV = CC = sdcc CPP = sdcpp -AR = sdcclib -a ifeq ($(CONFIG_SDCC_OLD),y) LD = link-z80 AS = as-z80 + AR = sdcclib -a ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent else LD = sdldz80 AS = sdasz80 + AR = sdar -r ARCHCPUFLAGS = -mz80 endif diff --git a/configs/z80sim/ostest/Make.defs b/configs/z80sim/ostest/Make.defs index 54b6d8c45d..91d30a061b 100644 --- a/configs/z80sim/ostest/Make.defs +++ b/configs/z80sim/ostest/Make.defs @@ -58,15 +58,16 @@ endif CROSSDEV = CC = sdcc CPP = sdcpp -AR = sdcclib -a ifeq ($(CONFIG_SDCC_OLD),y) LD = link-z80 AS = as-z80 + AR = sdcclib -a ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent else LD = sdldz80 AS = sdasz80 + AR = sdar -r ARCHCPUFLAGS = -mz80 endif diff --git a/configs/z80sim/pashello/Make.defs b/configs/z80sim/pashello/Make.defs index 076aad7ed7..2dca56a0eb 100644 --- a/configs/z80sim/pashello/Make.defs +++ b/configs/z80sim/pashello/Make.defs @@ -58,15 +58,16 @@ endif CROSSDEV = CC = sdcc CPP = sdcpp -AR = sdcclib -a ifeq ($(CONFIG_SDCC_OLD),y) LD = link-z80 AS = as-z80 + AR = sdcclib -a ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent else LD = sdldz80 AS = sdasz80 + AR = sdar -r ARCHCPUFLAGS = -mz80 endif diff --git a/configs/z80sim/src/z80_lowputc.c b/configs/z80sim/src/z80_lowputc.c index e23caeb0f3..9b46b48801 100644 --- a/configs/z80sim/src/z80_lowputc.c +++ b/configs/z80sim/src/z80_lowputc.c @@ -76,6 +76,7 @@ void z80_lowputc(char ch) __naked { +#ifdef CONFIG_SDCC_OLD _asm ld hl, #2 add hl, sp @@ -83,6 +84,15 @@ void z80_lowputc(char ch) __naked out (0xbe), a ret _endasm; +#else + __asm__ ( + "\tld hl, #2\n" + "\tadd hl, sp\n" + "\tld a, (hl)\n" + "\tout (0xbe), a\n" + "\tret\n" + ); +#endif } /******************************************************************************** @@ -94,10 +104,19 @@ void z80_lowputc(char ch) __naked char z80_lowgetc(void) __naked { +#ifdef CONFIG_SDCC_OLD _asm in a, (0xbe) ld l, a ld h, #0 ret _endasm; +#else + __asm__ ( + "\tin a, (0xbe)\n" + "\tld l, a\n" + "\tld h, #0\n" + "\tret\n" + ); +#endif }