diff --git a/ChangeLog b/ChangeLog index 8531c341d6a0f3ba939e457ea3870033ac4dcfa9..dfc703183b012ba96d49b59212a7c57bc0ee6bef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2374,3 +2374,5 @@ one APB2 timer. * arch/mips/src/pic32mx/pic32mx-ethernet.c: The PIC32 Ethernet driver is code complete, but still untested. + * confgs/sim/*/Make.defs and arch/sim/src/Makefile: Add support for building + a 32-bit executable on a 64-bit Linux target. diff --git a/TODO b/TODO index 29ac94ce6d7d5743c336a84ef0b70f497161b423..f4a154a23fb38be5b9b0a34bb62644f267e1c146 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated January 3, 2012) +NuttX TODO List (Last updated January 17, 2012) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -21,7 +21,7 @@ nuttx/ (1) Pascal add-on (pcode/) (1) Documentation (Documentation/) (7) Build system / Toolchains - (6) Linux/Cywgin simulation (arch/sim) + (5) Linux/Cywgin simulation (arch/sim) (4) ARM (arch/arm/) (1) ARM/C5471 (arch/arm/src/c5471/) (3) ARM/DM320 (arch/arm/src/dm320/) @@ -752,21 +752,6 @@ o Linux/Cywgin simulation (arch/sim) Status: Open Priority: Low (because the simulator is only a test/development platform) - Title: SIMULATOR BUILD ON 64-BIT MACHINES - Description: Simulator does not build correctly on 64-bit machines. Two - issues: - 1) It saves addresses in 32-bit types and these fail when cast - to pointers on a 64-bit host. - 2) up_setjmp.S does not build - Status: Open - Priority: Medium and increasing (as 32-bit hosts gradually disappear). NOTE - is it possible to work-around this limitation by building the sim - target for 32-bit operation on a 64-bit platform. Modify the - Make.defs file in the appropriate places so that -m32 is included - in the CFLAGS and -m32 and -melf_386 are included in the LDFLAGS. - See the patch 0001-Quick-hacks-to-build-sim-nsh-ostest-on-x86_64-as-32-.patch - that can be found at http://tech.groups.yahoo.com/group/nuttx/files. - Title: SIMULATOR NETWORKING SUPPORT Description: I never did get networking to work on the sim Linux target. On Linux, it tries to use the tap device (/dev/net/tun) to emulate an Ethernet diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index bf26b32a9c2f862f1d21de4fa37d6c6cea5e5e0b..9189a2165d18cd9581996f7c51959df51d16c3b2 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -1,8 +1,8 @@ ############################################################################ # arch/sim/src/Makefile # -# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt <spudmonkey@racsa.co.cr> +# Copyright (C) 2007, 2008, 2011-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 @@ -87,8 +87,6 @@ HOSTOBJS = $(HOSTSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) $(HOSTSRCS) OBJS = $(AOBJS) $(COBJS) $(HOSTOBJS) -LDFLAGS = $(ARCHSCRIPT) - # Determine which standard libraries will need to be linked in ifeq ($(CONFIG_SIM_X11FB),y) @@ -173,7 +171,7 @@ Cygwin-names.dat: nuttx-names.dat nuttx.rel : libarch$(LIBEXT) board/libboard$(LIBEXT) $(HOSTOS)-names.dat $(LINKOBJS) @echo "LD: nuttx.rel" - @$(LD) -r $(LDFLAGS) $(LDPATHS) -o $@ $(REQUIREDOBJS) --start-group $(LDLIBS) --end-group $(EXTRA_LIBS) + @$(LD) -r $(LDLINKFLAGS) $(LDPATHS) -o $@ $(REQUIREDOBJS) --start-group $(LDLIBS) --end-group $(EXTRA_LIBS) @$(OBJCOPY) --redefine-syms=$(HOSTOS)-names.dat $@ # Generate the final NuttX binary by linking the host-specific objects with the NuttX @@ -181,7 +179,7 @@ nuttx.rel : libarch$(LIBEXT) board/libboard$(LIBEXT) $(HOSTOS)-names.dat $(LINKO nuttx$(EXEEXT): cleanrel nuttx.rel $(HOSTOBJS) @echo "LD: nuttx$(EXEEXT)" - @$(CC) $(LDFLAGS) $(LDPATHS) -o $(TOPDIR)/$@ nuttx.rel $(HOSTOBJS) $(DRVLIB) $(STDLIBS) + @$(CC) $(CCLINKFLAGS) $(LDPATHS) -o $(TOPDIR)/$@ nuttx.rel $(HOSTOBJS) $(DRVLIB) $(STDLIBS) @$(NM) $(TOPDIR)/$@ | \ grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ sort > $(TOPDIR)/System.map diff --git a/configs/sim/README.txt b/configs/sim/README.txt index b5c057e05e7b7831d14da944d8003d0bc362404e..c7005271cf1eb35484d864622f78a1423dc0900a 100644 --- a/configs/sim/README.txt +++ b/configs/sim/README.txt @@ -97,10 +97,15 @@ addresses should not be retained in uint32_t types but rather in uintptr_t types to avoid issues just like this. The workaround on 64-bit machines for now is to build for a 32-bit target on the -64-bit machine. This workaround involves modifying the Make.defs file in the +64-bit machine. The workaround for this issue has been included in NuttX 6.15 and +beyond. For thoses versions, you must add CONFIG_SIM_M32=y to the .config file in +order to enable building a 32-bit image on a 64-bit platform. + +For older versions of NuttX, a patch also exists. The patch the Make.defs file in the appropriate places so that -m32 is included in the CFLAGS and -m32 and -melf_386 -are included in the LDFLAGS. See the patch 0001-Quick-hacks-to-build-sim-nsh-ostest-on-x86_64-as-32-.patch -that can be found at http://tech.groups.yahoo.com/group/nuttx/files. +are included in the LDFLAGS. See the patch +0001-Quick-hacks-to-build-sim-nsh-ostest-on-x86_64-as-32-.patch that can be found at +http://tech.groups.yahoo.com/group/nuttx/files. Stack Size Issues ----------------- diff --git a/configs/sim/mount/Make.defs b/configs/sim/mount/Make.defs index 498291077d57571ae5868864ba35bdfbe25787ec..e3e1a8576adfaf07751ee5a9ef51deaca8c73296 100644 --- a/configs/sim/mount/Make.defs +++ b/configs/sim/mount/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # configs/sim/mount/Make.defs # -# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -53,6 +53,11 @@ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx ARCHSCRIPT = +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + CROSSDEV = CC = $(CROSSDEV)gcc CXX = $(CROSSDEV)g++ @@ -79,8 +84,20 @@ else EXEEXT = endif -ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") - LDFLAGS += -g +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g +endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 endif define PREPROCESS diff --git a/configs/sim/nettest/Make.defs b/configs/sim/nettest/Make.defs index cf0134b9b001dc45af637fb31c2cf67aeb32eeb5..a1052492a4bbe3777635b84b929b596a85bb45a3 100644 --- a/configs/sim/nettest/Make.defs +++ b/configs/sim/nettest/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # configs/sim/Make.defs # -# Copyright (C) 2007-2008, 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -53,6 +53,11 @@ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx ARCHSCRIPT = +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + CROSSDEV = CC = $(CROSSDEV)gcc CXX = $(CROSSDEV)g++ @@ -79,8 +84,20 @@ else EXEEXT = endif -ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") - LDFLAGS += -g +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g +endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 endif define PREPROCESS diff --git a/configs/sim/nsh/Make.defs b/configs/sim/nsh/Make.defs index 1330ade1e0783aef37d76d42cbf9020dc87564db..83bc35d76b40acdfc0ddc1d4e697701696914ff7 100644 --- a/configs/sim/nsh/Make.defs +++ b/configs/sim/nsh/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # configs/sim/nsh/Make.defs # -# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -53,6 +53,11 @@ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx ARCHSCRIPT = +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + CROSSDEV = CC = $(CROSSDEV)gcc CXX = $(CROSSDEV)g++ @@ -79,8 +84,20 @@ else EXEEXT = endif -ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") - LDFLAGS += -g +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g +endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 endif define PREPROCESS diff --git a/configs/sim/nsh2/Make.defs b/configs/sim/nsh2/Make.defs index 39b33dc7dc97763fac77ebb5cfe7fd55c58999ce..7fba83b726ef08f1643171f1cd8cf63a06fd7b59 100644 --- a/configs/sim/nsh2/Make.defs +++ b/configs/sim/nsh2/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # configs/sim/nsh2/Make.defs # -# Copyright (C) Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -54,6 +54,11 @@ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx ARCHSCRIPT = +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + CROSSDEV = CC = $(CROSSDEV)gcc CXX = $(CROSSDEV)g++ @@ -80,8 +85,20 @@ else EXEEXT = endif -ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") - LDFLAGS += -g +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g +endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 endif define PREPROCESS diff --git a/configs/sim/nx/Make.defs b/configs/sim/nx/Make.defs index 70f6066e19794b24e86460e9ccd093339ded97b4..91e42acedfe73237d295b79a49f750c84a8d4a38 100644 --- a/configs/sim/nx/Make.defs +++ b/configs/sim/nx/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # configs/sim/nx/Make.defs # -# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -53,6 +53,11 @@ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx ARCHSCRIPT = +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + CROSSDEV = CC = $(CROSSDEV)gcc CXX = $(CROSSDEV)g++ @@ -79,8 +84,20 @@ else EXEEXT = endif -ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") - LDFLAGS += -g +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g +endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 endif define PREPROCESS diff --git a/configs/sim/nxffs/Make.defs b/configs/sim/nxffs/Make.defs index 9010d2bb4627da7a3df96929a3032f3a8d127874..e7d5b6d50f4ee4773b7a7ca2df8ef4aafe5bd87f 100644 --- a/configs/sim/nxffs/Make.defs +++ b/configs/sim/nxffs/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # configs/sim/nxffs/Make.defs # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -53,6 +53,11 @@ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx ARCHSCRIPT = +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + CROSSDEV = CC = $(CROSSDEV)gcc CXX = $(CROSSDEV)g++ @@ -79,8 +84,20 @@ else EXEEXT = endif -ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") - LDFLAGS += -g +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g +endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 endif define PREPROCESS diff --git a/configs/sim/ostest/Make.defs b/configs/sim/ostest/Make.defs index cf0134b9b001dc45af637fb31c2cf67aeb32eeb5..a1052492a4bbe3777635b84b929b596a85bb45a3 100644 --- a/configs/sim/ostest/Make.defs +++ b/configs/sim/ostest/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # configs/sim/Make.defs # -# Copyright (C) 2007-2008, 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -53,6 +53,11 @@ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx ARCHSCRIPT = +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + CROSSDEV = CC = $(CROSSDEV)gcc CXX = $(CROSSDEV)g++ @@ -79,8 +84,20 @@ else EXEEXT = endif -ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") - LDFLAGS += -g +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g +endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 endif define PREPROCESS diff --git a/configs/sim/pashello/Make.defs b/configs/sim/pashello/Make.defs index 40dc5acb153e319af47bed3295b9a1f52a43a486..6f662adc0326813f6c01c3e087daa5e120fd6052 100644 --- a/configs/sim/pashello/Make.defs +++ b/configs/sim/pashello/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # configs/sim/pashello/Make.defs # -# Copyright (C) 2007-2008, 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -53,6 +53,11 @@ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx ARCHSCRIPT = +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + CROSSDEV = CC = $(CROSSDEV)gcc CXX = $(CROSSDEV)g++ @@ -79,9 +84,22 @@ else EXEEXT = endif -ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") - LDFLAGS += -g +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 +endif + EXTRA_LIBS = -lm define PREPROCESS