z80sim/ostest now builds okay under Linux with SDCC 3.2.1

git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5414 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-12-05 16:28:33 +00:00
parent ccae1c4fb2
commit 4c98d2e732
3 changed files with 83 additions and 96 deletions

View File

@ -33,14 +33,12 @@
#
############################################################################
############################################################################
# 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)
@ -81,7 +79,6 @@ LIBGCC = ${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}
#
HEAP_BASE = ${shell ./mkhpbase.sh}
############################################################################
# Targets
all: $(HEAD_OBJ) libarch$(LIBEXT)
@ -96,40 +93,39 @@ $(COBJS): %$(OBJEXT): %.c
# This is a kludge to work around some conflicting symbols in libsdcc.lib
$(SDCC_LIBDIR)/myz80.lib: $(SDCC_LIBDIR)/$(SDCCLIB)
$(TOPDIR)/lib/myz80.lib: $(SDCC_LIBDIR)/$(SDCCLIB)
ifeq ($(CONFIG_SDCC_OLD),y)
$(Q) cat $(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 $(SDCC_LIBDIR)\myz80.lib
> $(TOPDIR)/lib/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
$(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
# Create a header file that contains addressing information needed by the code
@ -173,10 +169,10 @@ board/libboard$(LIBEXT):
# This target builds the final executable
pass1.lnk:
@echo "LD: pass1.hex"
@echo "LD: pass1.ihx"
@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 "-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 ;\
@ -184,24 +180,25 @@ pass1.lnk:
@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
else
@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
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.hex" >>pass1.lnk # Path to head object
@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.hex: up_mem.h asm_mem.h $(SDCC_LIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT) pass1.lnk
@echo "LD: pass1.hex"
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)
@ -211,7 +208,7 @@ pass1.hex: up_mem.h asm_mem.h $(SDCC_LIBDIR)/myz80.lib $(HEAD_OBJ) board/libboar
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 "-k $(TOPDIR)/lib" >>nuttx.lnk # Path to top-level lib directory
@echo "-l libboard$(LIBEXT)" >>nuttx.lnk # Name of board library
$(Q) for LIB in $(LINKLIBS); do \
echo "-l $(TOPDIR)/lib/$$LIB" >> nuttx.lnk ;\
@ -219,13 +216,14 @@ nuttx.lnk:
@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
else
@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
else
@echo "-b _CODE=256" >>nuttx.lnk # Start of _CODE area
endif
ifneq ($(CONFIG_LINKER_DATA_AREA),)
@echo "-b _CODE=$(CONFIG_LINKER_DATA_AREA)" >>nuttx.lnk
endif
@echo "-i" >>nuttx.lnk # Intel hex format
@echo "-x" >>nuttx.lnk # Hexadecimal
@ -235,7 +233,7 @@ endif
@echo "$(HEAD_OBJ)" >>nuttx.lnk # Path to head object
@echo "-e" >>nuttx.lnk # End of script
nuttx$(EXEEXT): pass1.hex up_mem.h asm_mem.h $(SDCC_LIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT) nuttx.lnk
nuttx$(EXEEXT): pass1.ihx up_mem.h asm_mem.h $(TOPDIR)/lib/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT) nuttx.lnk
@echo "LD: nuttx.ihx"
$(Q) $(LD) -f nuttx.lnk
$(Q) rm -f pass1.*
@ -288,3 +286,4 @@ distclean: clean
$(call DELFILE, .depend)
-include Make.dep

View File

@ -96,40 +96,39 @@ $(COBJS): %$(OBJEXT): %.c
# This is a kludge to work around some conflicting symbols in the SDCC libraries
$(SDCC_LIBDIR)\myz80.lib: $(SDCC_LIBDIR)\$(SDCCLIB)
$(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 \
> myz80.lib
$(Q) mv -f myz80.lib $(SDCC_LIBDIR)\myz80.lib
> $(TOPDIR)\lib\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
$(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
# Create a header file that contains addressing information needed by the code
@ -173,7 +172,7 @@ pass1.lnk:
@echo LD: pass1.lnk
@echo -->pass1.lnk
@echo -k $(BOARDDIR)>>pass1.lnk
@echo -k $(SDCC_LIBDIR)>>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
@ -186,17 +185,20 @@ 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.hex>>pass1.lnk
@echo pass1.ihx>>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
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)
@ -207,7 +209,7 @@ nuttx.lnk:
@echo LD: nuttx.lnk
@echo -->nuttx.lnk
@echo -k $(BOARDDIR)>>nuttx.lnk
@echo -k $(SDCC_LIBDIR)>>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
@ -220,6 +222,9 @@ ifneq ($(CONFIG_LINKER_CODE_AREA),)
@echo -b _CODE=$(CONFIG_LINKER_CODE_AREA)>>nuttx.lnk
else
@echo -b _CODE=256>>nuttx.lnk
endif
ifneq ($(CONFIG_LINKER_DATA_AREA),)
@echo -b _CODE=$(CONFIG_LINKER_DATA_AREA)>>nuttx.lnk
endif
@echo -i>>nuttx.lnk
@echo -x>>nuttx.lnk
@ -229,7 +234,7 @@ endif
@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
nuttx$(EXEEXT): pass1.ihx up_mem.h asm_mem.h $(TOPDIR)\lib\myz80.lib $(HEAD_OBJ) board\libboard$(LIBEXT) nuttx.lnk
@echo LD: nuttx.ihx
$(Q) $(LD) -f nuttx.lnk
$(call DELFILE, pass1.*)

View File

@ -42,12 +42,6 @@ Configuring NuttX
reconfiguration process.
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 longer 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 Nov 23,
2012 (3.2.1) did not have this problem.
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
@ -70,17 +64,6 @@ Configuring NuttX
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 ***
I believe that this is related to the sdcclib error also reported under
windows for SDCC 3.2.0. It may be avoided by updating to a more recent
snapshot. However, a Dec 4, 2012 still shows a similar error:
*** glibc detected *** sdcclib: free(): invalid next size (fast): 0x0000000001aaaab0 ***
nsh
This configuration file builds NSH (examples/nsh). This