Redesign z80 build so that mkhpbase.sh bash script is not needed; remove support for older SDCC toolchains; Re-verify z80 build on Linux
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5416 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
5306523bce
commit
080210ec99
21 changed files with 229 additions and 652 deletions
|
|
@ -75,15 +75,11 @@ VPATH = chip:common:board
|
|||
|
||||
LIBGCC = ${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}
|
||||
|
||||
# Supports dynamic sizing of HEAP.
|
||||
#
|
||||
HEAP_BASE = ${shell ./mkhpbase.sh}
|
||||
|
||||
# Targets
|
||||
|
||||
all: $(HEAD_OBJ) libarch$(LIBEXT)
|
||||
|
||||
.PHONY: board/libboard$(LIBEXT) pass1.lnk nuttx.lnk
|
||||
.PHONY: board/libboard$(LIBEXT) nuttx.lnk
|
||||
|
||||
$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %$(ASMEXT)
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
|
|
@ -93,72 +89,46 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
|
||||
# This is a kludge to work around some conflicting symbols in libsdcc.lib
|
||||
|
||||
$(TOPDIR)/lib/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 \
|
||||
> $(TOPDIR)/lib/myz80.lib
|
||||
else
|
||||
$(Q) cp $(SDCC_LIBDIR)/z80.lib $(TOPDIR)/lib/myz80.lib
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _calloc.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _malloc.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _realloc.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _free.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib printf_large.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib sprintf.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib vprintf.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib strcpy.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib strlen.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _strcat.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _strchr.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _strcmp.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _strcspn.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _strncat.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _strncmp.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _strncpy.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _strpbrk.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _strrchr.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _strspn.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _strstr.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _strtok.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _memchr.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _memcmp.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _memcpy.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/myz80.lib _memset.rel
|
||||
endif
|
||||
$(TOPDIR)/lib/$(SDCCLIB): $(SDCC_LIBDIR)/$(SDCCLIB)
|
||||
$(Q) cp $(SDCC_LIBDIR)/$(SDCCLIB) $(TOPDIR)/lib/$(SDCCLIB)
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _calloc.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _malloc.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _realloc.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _free.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) printf_large.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) sprintf.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) vprintf.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) strcpy.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) strlen.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strcat.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strchr.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strcmp.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strcspn.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strncat.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strncmp.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strncpy.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strpbrk.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strrchr.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strspn.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strstr.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strtok.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _memchr.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _memcmp.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _memcpy.rel
|
||||
$(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _memset.rel
|
||||
|
||||
# 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 "" >>up_mem.h
|
||||
@echo "#include <nuttx/config.h>" >>up_mem.h
|
||||
@echo "" >>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 "" >>up_mem.h
|
||||
@echo "#endif /* __UP_MEM_H */" >>up_mem.h
|
||||
# Create a header file that contains addressing information needed by the
|
||||
# assemlby language start-up code. Locate the IDLE thread stack at the
|
||||
# end of RAM. The heap then extends from s__HEAP to the bottom of the
|
||||
# IDLE thread stack
|
||||
|
||||
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)
|
||||
libarch$(LIBEXT): asm_mem.h $(OBJS)
|
||||
$(call ARCHIVE, $@, $(OBJS))
|
||||
|
||||
# This builds the libboard library in the board/ subdirectory
|
||||
|
|
@ -168,43 +138,6 @@ board/libboard$(LIBEXT):
|
|||
|
||||
# This target builds the final executable
|
||||
|
||||
pass1.lnk:
|
||||
@echo "LD: pass1.ihx"
|
||||
@echo "--" >pass1.lnk # Non-interactive
|
||||
@echo "-k $(BOARDDIR)" >>pass1.lnk # Path to board library
|
||||
@echo "-k $(TOPDIR)/lib" >>pass1.lnk # Path to top-level lib-directory
|
||||
@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
|
||||
ifneq ($(CONFIG_LINKER_START_AREA),)
|
||||
@echo "-b START=$(CONFIG_LINKER_START_AREA)" >>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
|
||||
else
|
||||
@echo "-b _CODE=256" >>pass1.lnk # Start of _CODE area
|
||||
endif
|
||||
ifneq ($(CONFIG_LINKER_DATA_AREA),)
|
||||
@echo "-b _CODE=$(CONFIG_LINKER_DATA_AREA)" >>pass1.lnk
|
||||
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.ihx" >>pass1.lnk # Path to head object
|
||||
@echo "$(HEAD_OBJ)" >>pass1.lnk # Path to head object
|
||||
@echo "-e" >>pass1.lnk # End of script
|
||||
|
||||
pass1.ihx: up_mem.h asm_mem.h $(TOPDIR)/lib/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT) pass1.lnk
|
||||
@echo "LD: pass1.ihx"
|
||||
$(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 "--" >nuttx.lnk # Non-interactive
|
||||
@echo "-k $(BOARDDIR)" >>nuttx.lnk # Path to board library
|
||||
|
|
@ -213,7 +146,18 @@ nuttx.lnk:
|
|||
$(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 $(SDCCLIB)" >>nuttx.lnk # Name of SDCC z80 library
|
||||
ifneq ($(CONFIG_LINKER_CODE_AREA),)
|
||||
@echo "-b _CODE=$(CONFIG_LINKER_CODE_AREA)" >>nuttx.lnk # Start of _CODE area
|
||||
else
|
||||
@echo "-b _CODE=0x0200" >>nuttx.lnk # Start of _CODE area
|
||||
endif
|
||||
ifneq ($(CONFIG_LINKER_DATA_AREA),)
|
||||
@echo "-b _CODE=$(CONFIG_LINKER_DATA_AREA)" >>nuttx.lnk
|
||||
else
|
||||
@echo "-b _DATA=0x8000" >>nuttx.lnk # Start of _DATA area
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_LINKER_START_AREA),)
|
||||
@echo "-b START=$(CONFIG_LINKER_START_AREA)" >>nuttx.lnk # Start of START area
|
||||
endif
|
||||
|
|
@ -233,10 +177,9 @@ endif
|
|||
@echo "$(HEAD_OBJ)" >>nuttx.lnk # Path to head object
|
||||
@echo "-e" >>nuttx.lnk # End of script
|
||||
|
||||
nuttx$(EXEEXT): pass1.ihx up_mem.h asm_mem.h $(TOPDIR)/lib/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT) nuttx.lnk
|
||||
nuttx$(EXEEXT): asm_mem.h $(TOPDIR)/lib/$(SDCCLIB) $(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.ihx | \
|
||||
|
|
@ -257,7 +200,7 @@ export_head: board/libboard$(LIBEXT) $(HEAD_OBJ)
|
|||
|
||||
# Build dependencies
|
||||
|
||||
.depend: Makefile up_mem.h asm_mem.h chip/Make.defs $(DEPSRCS)
|
||||
.depend: Makefile asm_mem.h chip/Make.defs $(DEPSRCS)
|
||||
$(Q) if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \
|
||||
fi
|
||||
|
|
@ -270,9 +213,7 @@ clean:
|
|||
$(Q) if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR="$(TOPDIR)" clean ; \
|
||||
fi
|
||||
$(call DELFILE, up_mem.h)
|
||||
$(call DELFILE, asm_mem.h)
|
||||
$(call DELFILE, pass1.*)
|
||||
$(call DELFILE, nuttx.*)
|
||||
$(call DELFILE, libarch$(LIBEXT))
|
||||
$(call CLEAN)
|
||||
|
|
|
|||
|
|
@ -33,16 +33,13 @@
|
|||
#
|
||||
############################################################################
|
||||
|
||||
############################################################################
|
||||
# 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))
|
||||
|
|
@ -77,16 +74,11 @@ VPATH = chip:common:board
|
|||
|
||||
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
|
||||
.PHONY: board\libboard$(LIBEXT) nuttx.lnk
|
||||
|
||||
$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %$(ASMEXT)
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
|
|
@ -96,69 +88,46 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
|
||||
# This is a kludge to work around some conflicting symbols in the SDCC libraries
|
||||
|
||||
$(TOPDIR)\lib\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 \
|
||||
> $(TOPDIR)\lib\myz80.lib
|
||||
else
|
||||
$(Q) cp $(SDCC_LIBDIR)\z80.lib $(TOPDIR)\lib\myz80.lib
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _calloc.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _malloc.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _realloc.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _free.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib printf_large.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib sprintf.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib vprintf.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib strcpy.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib strlen.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _strcat.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _strchr.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _strcmp.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _strcspn.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _strncat.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _strncmp.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _strncpy.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _strpbrk.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _strrchr.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _strspn.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _strstr.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _strtok.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _memchr.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _memcmp.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _memcpy.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\myz80.lib _memset.rel
|
||||
endif
|
||||
$(TOPDIR)\lib\$(SDCCLIB): $(SDCC_LIBDIR)\$(SDCCLIB)
|
||||
$(Q) cp $(SDCC_LIBDIR)\$(SDCCLIB) $(TOPDIR)\lib\$(SDCCLIB)
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _calloc.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _malloc.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _realloc.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _free.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) printf_large.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) sprintf.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) vprintf.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) strcpy.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) strlen.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _strcat.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _strchr.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _strcmp.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _strcspn.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _strncat.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _strncmp.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _strncpy.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _strpbrk.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _strrchr.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _strspn.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _strstr.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _strtok.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _memchr.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _memcmp.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _memcpy.rel
|
||||
$(Q) sdar d $(TOPDIR)\lib\$(SDCCLIB) _memset.rel
|
||||
|
||||
# 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 ^<nuttx/config.h^>>>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
|
||||
# Create a header file that contains addressing information needed by the
|
||||
# assemlby language start-up code. Locate the IDLE thread stack at the
|
||||
# end of RAM. The heap then extends from s__HEAP to the bottom of the
|
||||
# IDLE thread stack
|
||||
|
||||
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)
|
||||
libarch$(LIBEXT): asm_mem.h $(OBJS)
|
||||
$(call ARCHIVE, $@, $(OBJS))
|
||||
|
||||
# This builds the libboard library in the board\ subdirectory
|
||||
|
|
@ -168,43 +137,6 @@ board\libboard$(LIBEXT):
|
|||
|
||||
# This target builds the final executable
|
||||
|
||||
pass1.lnk:
|
||||
@echo LD: pass1.lnk
|
||||
@echo -->pass1.lnk
|
||||
@echo -k $(BOARDDIR)>>pass1.lnk
|
||||
@echo -k $(TOPDIR)\lib>>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
|
||||
ifneq ($(CONFIG_LINKER_DATA_AREA),)
|
||||
@echo -b _CODE=$(CONFIG_LINKER_DATA_AREA)>>pass1.lnk
|
||||
endif
|
||||
@echo -i>>pass1.lnk
|
||||
@echo -x>>pass1.lnk
|
||||
@echo -m>>pass1.lnk
|
||||
@echo -j>>pass1.lnk
|
||||
@echo pass1.ihx>>pass1.lnk
|
||||
@echo $(HEAD_OBJ)>>pass1.lnk
|
||||
@echo -e>>pass1.lnk
|
||||
|
||||
pass1.ihx: up_mem.h asm_mem.h $(TOPDIR)\lib\myz80.lib $(HEAD_OBJ) board\libboard$(LIBEXT) pass1.lnk
|
||||
@echo LD: pass1.ihx
|
||||
$(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
|
||||
|
|
@ -212,7 +144,7 @@ nuttx.lnk:
|
|||
@echo -k $(TOPDIR)\lib>>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
|
||||
@echo -l $(SDCCLIB)>>nuttx.lnk
|
||||
ifneq ($(CONFIG_LINKER_START_AREA),)
|
||||
@echo -b START=$(CONFIG_LINKER_START_AREA)>>nuttx.lnk
|
||||
else
|
||||
|
|
@ -234,10 +166,9 @@ endif
|
|||
@echo $(HEAD_OBJ)>>nuttx.lnk
|
||||
@echo -e>>nuttx.lnk
|
||||
|
||||
nuttx$(EXEEXT): pass1.ihx up_mem.h asm_mem.h $(TOPDIR)\lib\myz80.lib $(HEAD_OBJ) board\libboard$(LIBEXT) nuttx.lnk
|
||||
nuttx$(EXEEXT): asm_mem.h $(TOPDIR)\lib\$(SDCCLIB) $(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 | \
|
||||
|
|
@ -254,7 +185,7 @@ export_head: board\libboard$(LIBEXT) $(HEAD_OBJ)
|
|||
|
||||
# Build dependencies
|
||||
|
||||
.depend: Makefile up_mem.h asm_mem.h chip\Make.defs $(DEPSRCS)
|
||||
.depend: Makefile 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 $@
|
||||
|
|
@ -263,14 +194,11 @@ 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)
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __UP_ARCH_H
|
||||
#define __UP_ARCH_H
|
||||
#ifndef __ARCH_Z80_SRC_COMMON_UP_ARCH_H
|
||||
#define __ARCH_Z80_SRC_COMMON_UP_ARCH_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
|
|
@ -49,4 +49,4 @@
|
|||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
#endif /* __UP_ARCH_H */
|
||||
#endif /* __ARCH_Z80_SRC_COMMON_UP_ARCH_H */
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __UP_INTERNAL_H
|
||||
#define __UP_INTERNAL_H
|
||||
#ifndef __ARCH_Z80_SRC_COMMON_UP_INTERNAL_H
|
||||
#define __ARCH_Z80_SRC_COMMON_UP_INTERNAL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Conditional Compilation
|
||||
|
|
@ -209,4 +209,4 @@ EXTERN void up_stackdump(void);
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __UP_INTERNAL_H */
|
||||
#endif /* __ARCH_Z80_SRC_COMMON_UP_INTERNAL_H */
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
@echo off
|
||||
|
||||
rem arch/z80/src/mkhpbase.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
|
||||
|
||||
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)
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
#/bin/sh
|
||||
############################################################################
|
||||
# arch/z80/src/mkhpbase.sh
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
# This script supports dynamic sizing of HEAP when building with the SDCC
|
||||
# toolchain. This script adds up the size of each section of the program.
|
||||
# This does not account for the alignment of the _CODE area to 0x0100 (hence
|
||||
# the fudge factor 196 is added).
|
||||
#
|
||||
# -- There must be a better way! ---
|
||||
#
|
||||
#set -x
|
||||
|
||||
MAPFILE=pass1.map
|
||||
|
||||
# Verify that pass1.map exists
|
||||
|
||||
if [ -e ${MAPFILE} ]; then
|
||||
|
||||
# The map file exists, get a list of the sizes of each section
|
||||
# This works for SDCC 2.7.0
|
||||
|
||||
list=`cat ${MAPFILE} | grep "bytes" | sed -e 's/[ \t][ \t]*/ /g' | cut -d' ' -f3`
|
||||
|
||||
# If this is SDCC version 2.6.0, then the list will be empty
|
||||
|
||||
if [ -z "${list}" ]; then
|
||||
|
||||
# This works for SDCC 2.6.0
|
||||
|
||||
list=`cat ${MAPFILE} | grep "SIZE" | sed -e 's/[ \t][ \t]*/ /g' | cut -d' ' -f3`
|
||||
fi
|
||||
|
||||
# Did we successfully create the list of section sizes?
|
||||
|
||||
if [ ! -z "${list}" ]; then
|
||||
unset result
|
||||
first=yes
|
||||
|
||||
# Examine each size in the list
|
||||
|
||||
for size in ${list}; do
|
||||
|
||||
# Skip over zero-length sizes
|
||||
|
||||
if [ "${size}" != "0000" ]; then
|
||||
|
||||
# Each hex size must be prefixed with "0x". The
|
||||
# First size must also include a left parenthesis
|
||||
|
||||
if [ -z "$first" ]; then
|
||||
result="${result} + 0x${size}"
|
||||
else
|
||||
result="(0x${size}"
|
||||
unset first
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Add a fudge factor to guarantee no overlap between the code and
|
||||
# the heap and close the expression with a left parenthesis
|
||||
|
||||
echo "${result} + 196)"
|
||||
else
|
||||
|
||||
# We could not parse the map file. Try to generate some meaningful error
|
||||
|
||||
echo "#\"Makefile: Could not parse map file\""
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# pass1.map does not yet exist. In this case, just output a valid, default heap size
|
||||
|
||||
echo "(CONFIG_HEAP1_END - 8192)"
|
||||
fi
|
||||
|
||||
|
||||
75
arch/z80/src/z80/up_mem.h
Normal file
75
arch/z80/src/z80/up_mem.h
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/************************************************************************************
|
||||
* common/sdcc.h
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef nuttx.lnk__ARCH_Z80_SRC_COMMON_UP_MEM_H
|
||||
#define nuttx.lnk__ARCH_Z80_SRC_COMMON_UP_MEM_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Locate the IDLE thread stack at the end of RAM. */
|
||||
|
||||
#define CONFIG_STACK_END CONFIG_DRAM_SIZE
|
||||
#define CONFIG_STACK_BASE (CONFIG_STACK_END - CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/* The heap then extends from the linker determined beginning of the heap (s__HEAP).
|
||||
* to the bottom of the IDLE thread stack. NOTE: The symbol s__HEAP is not
|
||||
* accessible from C because it does not begin with the _ character. g_heapbase
|
||||
* is defined in z80_head.asm to provide that value to the C code.
|
||||
*/
|
||||
|
||||
#define CONFIG_HEAP1_END CONFIG_STACK_BASE
|
||||
#define CONFIG_HEAP1_BASE g_heapbase
|
||||
|
||||
/************************************************************************************
|
||||
* Public variables
|
||||
************************************************************************************/
|
||||
|
||||
/* This is the bottom of the heap as provided by the linker symbol s__HEAP. NOTE:
|
||||
* The symbol s__HEAP is not accessible from C because it does not begin with the _
|
||||
* character. g_heapbase is defined in z80_head.asm to provide that value to the C
|
||||
* code.
|
||||
*/
|
||||
|
||||
extern const uint16_t g_heapbase;
|
||||
|
||||
#endif /* nuttx.lnk__ARCH_Z80_SRC_COMMON_UP_MEM_H */
|
||||
|
|
@ -265,10 +265,13 @@ nointenable::
|
|||
|
||||
.area _HOME
|
||||
.area _CODE
|
||||
.area _INITIALIZER
|
||||
.area _GSINIT
|
||||
.area _GSFINAL
|
||||
|
||||
.area _DATA
|
||||
.area _INITIALIZED
|
||||
.area _BSEG
|
||||
.area _BSS
|
||||
.area _HEAP
|
||||
|
||||
|
|
@ -278,6 +281,24 @@ nointenable::
|
|||
|
||||
.area _GSINIT
|
||||
gsinit::
|
||||
ld bc, #l__INITIALIZER
|
||||
ld a, b
|
||||
or a, c
|
||||
jr Z, gsinit_next
|
||||
ld de, #s__INITIALIZED
|
||||
ld hl, #s__INITIALIZER
|
||||
ldir
|
||||
gsinit_next:
|
||||
|
||||
.area _GSFINAL
|
||||
ret
|
||||
|
||||
;**************************************************************************
|
||||
; The start of the heap (SDCC only). Note that is actually resides in
|
||||
; the _CODE area (which may be FLASH or ROM)
|
||||
;**************************************************************************
|
||||
|
||||
.area _CODE
|
||||
_g_heapbase::
|
||||
.dw #s__HEAP
|
||||
|
||||
|
|
|
|||
|
|
@ -47,20 +47,6 @@
|
|||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#undef ASM
|
||||
#undef ENDASM
|
||||
#undef NAKED
|
||||
|
||||
#ifdef CONFIG_SDCC_OLD
|
||||
# define ASM _asm
|
||||
# define ENDASM _endasm
|
||||
# define NAKED
|
||||
#else
|
||||
# define ASM __asm
|
||||
# define ENDASM __endasm
|
||||
# define NAKED __naked
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
|
@ -83,11 +69,11 @@
|
|||
|
||||
void outp(char p, char c)
|
||||
{
|
||||
ASM
|
||||
__asm
|
||||
ld c, 4(ix) ; port
|
||||
ld a, 5(ix) ; value
|
||||
out (c), a
|
||||
ENDASM;
|
||||
__endasm;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -99,10 +85,10 @@ void outp(char p, char c)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
char inp(char p) NAKED
|
||||
char inp(char p) __naked
|
||||
{
|
||||
ASM
|
||||
__asm
|
||||
ld c, 4(ix) ;port
|
||||
in l, (c)
|
||||
ENDASM;
|
||||
__endasm;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,14 +48,6 @@
|
|||
* Private Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SDCC_OLD
|
||||
# define ASM _asm
|
||||
# define ENDASM _endasm
|
||||
#else
|
||||
# define ASM __asm
|
||||
# define ENDASM __endasm
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
|
@ -88,13 +80,13 @@ volatile chipreg_t *current_regs;
|
|||
|
||||
irqstate_t irqsave(void) __naked
|
||||
{
|
||||
ASM
|
||||
__asm
|
||||
ld a, i ; AF Parity bit holds interrupt state
|
||||
di ; Interrupts are disabled
|
||||
push af ; Return AF in HL
|
||||
pop hl ;
|
||||
ret ;
|
||||
ENDASM;
|
||||
__endasm;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -107,7 +99,7 @@ irqstate_t irqsave(void) __naked
|
|||
|
||||
void irqrestore(irqstate_t flags) __naked
|
||||
{
|
||||
ASM
|
||||
__asm
|
||||
di ; Assume disabled
|
||||
pop hl ; HL = return address
|
||||
pop af ; AF Parity bit holds interrupt state
|
||||
|
|
@ -117,5 +109,5 @@ statedisable:
|
|||
push af ; Restore stack
|
||||
push hl ;
|
||||
ret ; and return
|
||||
ENDASM;
|
||||
__endasm;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ selected with:
|
|||
CONFIG_Z80_TOOLCHAIN_SDCCL=y : SDCC for Linux, MAC OSX or Cygwin (see below)
|
||||
CONFIG_Z80_TOOLCHAIN_SDCCW=y : SDCC for Win32
|
||||
|
||||
SDCC versions 3.2.0 or higher are recommended.
|
||||
|
||||
Building the SDCC toolchain
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
@ -128,62 +130,3 @@ and install SDCC:
|
|||
|
||||
sudo make install
|
||||
|
||||
SDCC Update
|
||||
^^^^^^^^^^^
|
||||
|
||||
I have had some problems building sdcc-2.6.0 on my current UBUNTU
|
||||
release (9.10). I had other problems building sdcc-2.9.0 on UBUNTU 9.10.
|
||||
I suspect that the newer gcc toolchains are causing problems for these
|
||||
older SDCC releases.
|
||||
|
||||
A 20091106 snapshot did build with no major problems on UBUNTU 9.10, but
|
||||
has some compatibilty problems with the older SDCC compiler. For one, you
|
||||
will need to change the Z80 assember name and options in the Make.defs
|
||||
files as follows:
|
||||
|
||||
-AS = as-z80
|
||||
+AS = sdasz80
|
||||
|
||||
- @$(AS) $(ASFLAGS) $2 $1
|
||||
+ $(AS) $(ASFLAGS) $1
|
||||
|
||||
For another, I had other problems building with that 20091106 that look
|
||||
like compiler bugs. If you are using UBUNTU 9.10, you may have to either
|
||||
(1) downgrade your GCC compiler to a version 3.x compiler and use one of
|
||||
the older stable releases, or (2) wait for the next stable SDCC release
|
||||
after 2.9.0.
|
||||
|
||||
See below: If you wish to continue using the older SDCC toolchain, you
|
||||
must now also add CONFIG_SDCC_OLD=y to your configuration file.
|
||||
|
||||
Newer SDCC Versions
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This is the text of bug 3468951 reported on the SourceForge website:
|
||||
|
||||
"Some obsolete stuff in z80sim port," (submitted by Philipp Klaus Krause):
|
||||
|
||||
The simz80 port needs a few updates to work well with current sdcc versions,
|
||||
and has some unecessary stuff:
|
||||
|
||||
* The linker name for Make.defs should be sdldz80
|
||||
* The assembler name for Make.defs should be sdasz80
|
||||
* _asm and _endasm in z80_io.c and z80_irq.c should be replaced by __asm
|
||||
and __endasm
|
||||
* The --stack-auto --int-long-reent --float-reent options or Make.defs should
|
||||
be removed, as they have no effect on sdcc's z80 port
|
||||
* The current assembler AFAIK can handle long symbol names, so the
|
||||
sdcc-2.6.0-asz80-symlen.patch is unnecessary, and it and the corresponding
|
||||
section from the README can be removed.
|
||||
|
||||
These changes *have* been incorporated but only partially verified. In order
|
||||
to get a successful compilation, I had to copy stdarg.h out of the SDCC source
|
||||
(at sdcc/device/include/stdarg.h) to include/nuttx/stdarg.h.
|
||||
|
||||
There are also some library related issues when you get to the final build
|
||||
that I have not looked into yet.
|
||||
|
||||
If you want to back out these change and continue to use the older toolchain
|
||||
in your build, simpy define the following in your configuration file:
|
||||
|
||||
CONFIG_SDCC_OLD=y
|
||||
|
|
|
|||
|
|
@ -58,18 +58,10 @@ endif
|
|||
CROSSDEV =
|
||||
CC = sdcc
|
||||
CPP = sdcpp
|
||||
|
||||
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
|
||||
LD = sdldz80
|
||||
AS = sdasz80
|
||||
AR = sdar -r
|
||||
ARCHCPUFLAGS = -mz80
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = --debug
|
||||
|
|
@ -84,7 +76,7 @@ ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
|
|||
|
||||
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = -x -a -l -o -s
|
||||
AFLAGS = -x -a -l -o -s -g
|
||||
|
||||
SDCCLIB = z80.lib
|
||||
|
||||
|
|
|
|||
|
|
@ -58,18 +58,10 @@ endif
|
|||
CROSSDEV =
|
||||
CC = sdcc
|
||||
CPP = sdcpp
|
||||
|
||||
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
|
||||
LD = sdldz80
|
||||
AS = sdasz80
|
||||
AR = sdar -r
|
||||
ARCHCPUFLAGS = -mz80
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = --debug
|
||||
|
|
@ -84,7 +76,7 @@ ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
|
|||
|
||||
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = -x -a -l -o -s
|
||||
AFLAGS = -x -a -l -o -s -g
|
||||
|
||||
SDCCLIB = z80.lib
|
||||
|
||||
|
|
|
|||
|
|
@ -58,18 +58,10 @@ endif
|
|||
CROSSDEV =
|
||||
CC = sdcc
|
||||
CPP = sdcpp
|
||||
|
||||
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
|
||||
LD = sdldz80
|
||||
AS = sdasz80
|
||||
AR = sdar -r
|
||||
ARCHCPUFLAGS = -mz80
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = --debug
|
||||
|
|
@ -84,7 +76,7 @@ ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
|
|||
|
||||
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = -x -a -l -o -s
|
||||
AFLAGS = -x -a -l -o -s -g
|
||||
|
||||
SDCCLIB = z80.lib
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
--- sdcc/as/z80/asm.h 2007-12-30 16:49:53.000000000 -0600
|
||||
+++ sdcc.orig/as/z80/asm.h 2007-12-30 16:49:14.000000000 -0600
|
||||
@@ -65,7 +65,7 @@
|
||||
#define RTTERM ')' /* Right expression delimeter */
|
||||
|
||||
#ifdef SDK
|
||||
-#define NCPS 80 /* characters per symbol */
|
||||
+#define NCPS 32 /* characters per symbol */
|
||||
#else /* SDK */
|
||||
#define NCPS 8 /* Chars. per symbol */
|
||||
#endif /* SDK */
|
||||
|
|
@ -42,10 +42,7 @@ Configuring NuttX
|
|||
reconfiguration process.
|
||||
|
||||
2. The default setup for this configuration uses a windows native build.
|
||||
As of this writing, the native Windows build still does not work. This
|
||||
is due to issues in arch/z80/src/Makefile and in the Bash script
|
||||
arch/z80/src/mkhpbase.sh which, of course, cannot be used in a Windows
|
||||
CMD.exe shell. These configuration is broken for the time being.
|
||||
As of this writing, the native Windows build still does not work.
|
||||
|
||||
This configuration was last verified sucessfully prior to the
|
||||
the configure to Kconfig/mconf tool using SDCC 2.6.0 built to run
|
||||
|
|
@ -104,6 +101,8 @@ selected with:
|
|||
CONFIG_Z80_TOOLCHAIN_SDCCL=y : SDCC for Linux, MAC OSX or Cygwin (see below)
|
||||
CONFIG_Z80_TOOLCHAIN_SDCCW=y : SDCC for Win32
|
||||
|
||||
SDCC versions 3.2.0 or higher are recommended.
|
||||
|
||||
Building the SDCC toolchain
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
@ -120,12 +119,6 @@ compatible with this build. First start with the usual steps
|
|||
cd sdcc
|
||||
./configure
|
||||
|
||||
But before making, we need to apply a patch to the SDCC 2.6.0 source
|
||||
so that the z80 assembler can handle long symbol names
|
||||
|
||||
Apply sdcc-2.6.0-asz80-symlen.patch
|
||||
cd sdcc/device/lib
|
||||
|
||||
Then make the SDCC binaries
|
||||
|
||||
cd sdcc
|
||||
|
|
@ -135,62 +128,3 @@ and install SDCC:
|
|||
|
||||
sudo make install
|
||||
|
||||
SDCC Update
|
||||
^^^^^^^^^^^
|
||||
|
||||
I have had some problems building sdcc-2.6.0 on my current UBUNTU
|
||||
release (9.10). I had other problems building sdcc-2.9.0 on UBUNTU 9.10.
|
||||
I suspect that the newer gcc toolchains are causing problems for these
|
||||
older SDCC releases.
|
||||
|
||||
A 20091106 snapshot did build with no major problems on UBUNTU 9.10, but
|
||||
has some compatibilty problems with the older SDCC compiler. For one, you
|
||||
will need to change the Z80 assember name and options in the Make.defs
|
||||
files as follows:
|
||||
|
||||
-AS = as-z80
|
||||
+AS = sdasz80
|
||||
|
||||
- @$(AS) $(ASFLAGS) $2 $1
|
||||
+ $(AS) $(ASFLAGS) $1
|
||||
|
||||
For another, I had other problems building with that 20091106 that look
|
||||
like compiler bugs. If you are using UBUNTU 9.10, you may have to either
|
||||
(1) downgrade your GCC compiler to a version 3.x compiler and use one of
|
||||
the older stable releases, or (2) wait for the next stable SDCC release
|
||||
after 2.9.0.
|
||||
|
||||
See below: If you wish to continue using the older SDCC toolchain, you
|
||||
must now also add CONFIG_SDCC_OLD=y to your configuration file.
|
||||
|
||||
Newer SDCC Versions
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This is the text of bug 3468951 reported on the SourceForge website:
|
||||
|
||||
"Some obsolete stuff in z80sim port," (submitted by Philipp Klaus Krause):
|
||||
|
||||
The simz80 port needs a few updates to work well with current sdcc versions,
|
||||
and has some unecessary stuff:
|
||||
|
||||
* The linker name for Make.defs should be sdldz80
|
||||
* The assembler name for Make.defs should be sdasz80
|
||||
* _asm and _endasm in z80_io.c and z80_irq.c should be replaced by __asm
|
||||
and __endasm
|
||||
* The --stack-auto --int-long-reent --float-reent options or Make.defs should
|
||||
be removed, as they have no effect on sdcc's z80 port
|
||||
* The current assembler AFAIK can handle long symbol names, so the
|
||||
sdcc-2.6.0-asz80-symlen.patch is unnecessary, and it and the corresponding
|
||||
section from the README can be removed.
|
||||
|
||||
These changes *have* been incorporated but only partially verified. In order
|
||||
to get a successful compilation, I had to copy stdarg.h out of the SDCC source
|
||||
(at sdcc/device/include/stdarg.h) to include/nuttx/stdarg.h.
|
||||
|
||||
There are also some library related issues when you get to the final build
|
||||
that I have not looked into yet.
|
||||
|
||||
If you want to back out these change and continue to use the older toolchain
|
||||
in your build, simpy define the following in your configuration file:
|
||||
|
||||
CONFIG_SDCC_OLD=y
|
||||
|
|
|
|||
|
|
@ -58,18 +58,10 @@ endif
|
|||
CROSSDEV =
|
||||
CC = sdcc
|
||||
CPP = sdcpp
|
||||
|
||||
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
|
||||
LD = sdldz80
|
||||
AS = sdasz80
|
||||
AR = sdar -r
|
||||
ARCHCPUFLAGS = -mz80
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = --debug
|
||||
|
|
@ -84,7 +76,7 @@ ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
|
|||
|
||||
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = -x -a -l -o -s
|
||||
AFLAGS = -x -a -l -o -s -g
|
||||
|
||||
SDCCLIB = z80.lib
|
||||
|
||||
|
|
|
|||
|
|
@ -58,18 +58,10 @@ endif
|
|||
CROSSDEV =
|
||||
CC = sdcc
|
||||
CPP = sdcpp
|
||||
|
||||
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
|
||||
LD = sdldz80
|
||||
AS = sdasz80
|
||||
AR = sdar -r
|
||||
ARCHCPUFLAGS = -mz80
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = --debug
|
||||
|
|
@ -84,7 +76,7 @@ ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
|
|||
|
||||
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = -x -a -l -o -s
|
||||
AFLAGS = -x -a -l -o -s -g
|
||||
|
||||
SDCCLIB = z80.lib
|
||||
|
||||
|
|
|
|||
|
|
@ -58,18 +58,10 @@ endif
|
|||
CROSSDEV =
|
||||
CC = sdcc
|
||||
CPP = sdcpp
|
||||
|
||||
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
|
||||
LD = sdldz80
|
||||
AS = sdasz80
|
||||
AR = sdar -r
|
||||
ARCHCPUFLAGS = -mz80
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = --debug
|
||||
|
|
@ -84,7 +76,7 @@ ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
|
|||
|
||||
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = -x -a -l -o -s
|
||||
AFLAGS = -x -a -l -o -s -g
|
||||
|
||||
SDCCLIB = z80.lib
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
--- sdcc/as/z80/asm.h 2007-12-30 16:49:53.000000000 -0600
|
||||
+++ sdcc.orig/as/z80/asm.h 2007-12-30 16:49:14.000000000 -0600
|
||||
@@ -65,7 +65,7 @@
|
||||
#define RTTERM ')' /* Right expression delimeter */
|
||||
|
||||
#ifdef SDK
|
||||
-#define NCPS 80 /* characters per symbol */
|
||||
+#define NCPS 32 /* characters per symbol */
|
||||
#else /* SDK */
|
||||
#define NCPS 8 /* Chars. per symbol */
|
||||
#endif /* SDK */
|
||||
|
|
@ -76,15 +76,6 @@
|
|||
|
||||
void z80_lowputc(char ch) __naked
|
||||
{
|
||||
#ifdef CONFIG_SDCC_OLD
|
||||
_asm
|
||||
ld hl, #2
|
||||
add hl, sp
|
||||
ld a, (hl)
|
||||
out (0xbe), a
|
||||
ret
|
||||
_endasm;
|
||||
#else
|
||||
__asm__ (
|
||||
"\tld hl, #2\n"
|
||||
"\tadd hl, sp\n"
|
||||
|
|
@ -92,7 +83,6 @@ void z80_lowputc(char ch) __naked
|
|||
"\tout (0xbe), a\n"
|
||||
"\tret\n"
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
|
|
@ -104,19 +94,10 @@ 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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue