9
0
Fork 0

Fixes for build CodeSourcery toolchain

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@1868 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2009-06-10 02:05:05 +00:00
parent f59b97a4c1
commit 010f6e51ee
11 changed files with 122 additions and 42 deletions

View File

@ -767,5 +767,6 @@
specific directories.
* config/olimex-strp711/src/up_nsh.c: Add an NSH board specific directory for
for the Olimex STR7P11 board.
* Fixed build of LM3X6918 using the CodeSourcery Windows native toolchain. There
were lots of issues with Cygwin paths and Cygwin symbolic links. These changes
may work with the devarmKIT as well, but that remains untested.

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: June 08, 2009</p>
<p>Last Updated: June 09, 2009</p>
</td>
</tr>
</table>
@ -1437,6 +1437,9 @@ nuttx-0.4.8 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
specific directories.
* config/olimex-strp711/src/up_nsh.c: Add an NSH board specific directory for
for the Olimex STR7P11 board.
* Fixed build of LM3X6918 using the CodeSourcery Windows native toolchain. There
were lots of issues with Cygwin paths and Cygwin symbolic links. These changes
may work with the devarmKIT as well, but that remains untested.
pascal-0.1.3 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;

View File

@ -44,6 +44,14 @@ DIRLINK = $(TOPDIR)/tools/link.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
endif
# This is the final executable
ifeq ($(WINTOOL),y)
NUTTX = "${shell cygpath -w $(TOPDIR)/nuttx}"
else
NUTTX = $(TOPDIR)/nuttx
endif
# Process architecture and board-specific directories
ARCH_DIR = arch/$(CONFIG_ARCH)
@ -245,13 +253,13 @@ ifeq ($(CONFIG_RRLOAD_BINARY),y)
fi
endif
ifeq ($(CONFIG_INTELHEX_BINARY),y)
@$(OBJCOPY) $(OBJCOPYARGS) -O ihex $(TOPDIR)/$@ $(TOPDIR)/$@.ihx
@$(OBJCOPY) $(OBJCOPYARGS) -O ihex $(NUTTX)$(EXEEXT) $(NUTTX)$(EXEEXT).ihx
endif
ifeq ($(CONFIG_MOTOROLA_SREC),y)
@$(OBJCOPY) $(OBJCOPYARGS) -O srec $(TOPDIR)/$@ $(TOPDIR)/$@.srec
@$(OBJCOPY) $(OBJCOPYARGS) -O srec $(NUTTX)$(EXEEXT) $(NUTTX)$(EXEEXT).srec
endif
ifeq ($(CONFIG_RAW_BINARY),y)
@$(OBJCOPY) $(OBJCOPYARGS) -O binary $(TOPDIR)/$@ $(TOPDIR)/$@.bin
@$(OBJCOPY) $(OBJCOPYARGS) -O binary $(NUTTX)$(EXEEXT) $(NUTTX)$(EXEEXT).bin
endif
depend:

View File

@ -24,7 +24,7 @@ NuttX TODO List (Last updated April 12, 2009)
(2) ARM/i.MX (arch/arm/src/imx/)
(8) ARM/LPC214x (arch/arm/src/lpc214x/)
(3) ARM/STR71x (arch/arm/src/str71x/)
(1) ARM/LM3S6918 (arch/arm/src/lm3s/)
(3) ARM/LM3S6918 (arch/arm/src/lm3s/)
(4) pjrc-8052 / MCS51 (arch/pjrc-8051/)
(2) Hitachi/Renesas SH-1 (arch/sh/src/sh1)
(4) Renesas M16C/26 (arch/sh/src/m16c)
@ -548,6 +548,12 @@ o ARM/LM3S6918 (arch/arm/src/lm3s/)
Priority: Medium, If the transfer is properly tuned, then there should not
be any Rx FIFO overruns.
Description: Dependency generation is currently disabled when a Windows native
toolchain is used. I think that the only issue is that all of the
Windows dependencies needed to be quoted in the Make.dep files.
Status: Open
Priority: Low -- unless some dependency-related build issues is discovered.
o pjrc-8052 / MCS51 (arch/pjrc-8051/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -43,8 +43,17 @@ else
ARCH_SUBDIR = arm
endif
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common \
ifeq ($(WINTOOL),y)
NUTTX = "${shell cygpath -w $(TOPDIR)/nuttx}"
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/$(ARCH_SUBDIR)}" \
-I "${shell cygpath -w $(TOPDIR)/sched}"
else
NUTTX = $(TOPDIR)/nuttx
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common \
-I$(ARCH_SRCDIR)/$(ARCH_SUBDIR) -I$(TOPDIR)/sched
endif
HEAD_AOBJ = $(HEAD_ASRC:.S=$(OBJEXT))
@ -61,7 +70,13 @@ LDFLAGS = $(ARCHSCRIPT)
EXTRA_LIBS =
LINKLIBS =
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
ifeq ($(WINTOOL),y)
LIBPATHS = ${shell for path in $(LINKLIBS); do dir=`dirname $(TOPDIR)/$$path`;echo "-L\"`cygpath -w $$dir`\"";done}
LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}"
else
LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
LIBPATHS += -L"$(BOARDDIR)"
endif
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
@ -88,20 +103,20 @@ board/libboard$(LIBEXT):
nuttx: $(HEAD_AOBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx"
@$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) -o $(TOPDIR)/$@ $(HEAD_AOBJ) \
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_AOBJ) \
--start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC)
ifeq ($(CONFIG_BOOT_RUNFROMFLASH),y)
@export flashloc=`$(OBJDUMP) --all-headers $(TOPDIR)/$@ | grep _eronly | cut -d' ' -f1`; \
$(OBJCOPY) $(OBJCOPYARGS) --adjust-section-vma=.data=0x$$flashloc $(TOPDIR)/$@ $(TOPDIR)/$@.flashimage
@mv $(TOPDIR)/$@.flashimage $(TOPDIR)/$@
@export flashloc=`$(OBJDUMP) --all-headers $(NUTTX)$(EXEEXT) | grep _eronly | cut -d' ' -f1`; \
$(OBJCOPY) $(OBJCOPYARGS) --adjust-section-vma=.data=0x$$flashloc $(NUTTX)$(EXEEXT) $(NUTTX).flashimage
@mv $(NUTTX).flashimage $(NUTTX)$(EXEEXT)
endif
@$(NM) $(TOPDIR)/$@ | \
@$(NM) $(NUTTX)$(EXEEXT) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > $(TOPDIR)/System.map
@export vflashstart=`$(OBJDUMP) --all-headers $(TOPDIR)/$@ | grep _vflashstart | cut -d' ' -f1`; \
@export vflashstart=`$(OBJDUMP) --all-headers $(NUTTX)$(EXEEXT) | grep _vflashstart | cut -d' ' -f1`; \
if [ ! -z "$$vflashstart" ]; then \
$(OBJCOPY) $(OBJCOPYARGS) --adjust-section-vma=.vector=0x$$vflashstart $(TOPDIR)/$@ $(TOPDIR)/$@.flashimage; \
mv $(TOPDIR)/$@.flashimage $(TOPDIR)/$@; \
$(OBJCOPY) $(OBJCOPYARGS) --adjust-section-vma=.vector=0x$$vflashstart $(NUTTX)$(EXEEXT) $(NUTTX).flashimage; \
mv $(NUTTX).flashimage $(NUTTX)$(EXEEXT); \
fi
.depend: Makefile chip/Make.defs $(SRCS)

View File

@ -38,6 +38,27 @@ GNU Toolchain Options
Of course, hard coding this CROSS_COMPILE value in Make.defs file will save
some repetitive typing.
NOTE: the CodeSourcery and devkitARM toolchains are Windows native toolchains.
The NuttX buildroot toolchain is a Cygwin toolchain. There are several limitations
to using a Windows based toolchain in a Cygwin environment. The two biggestg are:
1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
performed automatically in the Cygwin makefiles using the 'cygpath' utility
but you might easily find some new path problems. If so, check out 'cygpath -w'
2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
are used in Nuttx (e.g., include/arch). The make system works around these
problems for the Windows tools by copying directories instead of linking them.
But this can also cause some confusion for you: For example, you may edit
a file in a "linked" directory and find that your changes had not effect.
That is because you are building the copy of the file in the "fake" symbolic
directory. If you use a Windows toolchain, you should get in the habit of
making like this:
make clean_context; make CROSSDEV=arm-none-eabi-
An alias in your .bashrc file might make that less painful.
NuttX buildroot Toolchain
^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -66,17 +66,24 @@ else
endif
ifeq ($(CROSSDEV),arm-elf-)
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/httpd/ld.script
else
WINTOOL = y
DIRLINK = $(TOPDIR)/tools/winlink.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/httpd/ld.script}"
endif
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHPICFLAGS = -fpic
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/httpd/ld.script
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
@ -125,8 +132,6 @@ define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe

View File

@ -66,17 +66,24 @@ else
endif
ifeq ($(CROSSDEV),arm-elf-)
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script
else
WINTOOL = y
DIRLINK = $(TOPDIR)/tools/winlink.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script}"
endif
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHPICFLAGS = -fpic
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
@ -125,8 +132,6 @@ define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe

View File

@ -66,17 +66,24 @@ else
endif
ifeq ($(CROSSDEV),arm-elf-)
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
else
WINTOOL = y
DIRLINK = $(TOPDIR)/tools/winlink.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
endif
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHPICFLAGS = -fpic
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
@ -125,8 +132,6 @@ define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe

View File

@ -66,17 +66,24 @@ else
endif
ifeq ($(CROSSDEV),arm-elf-)
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
else
WINTOOL = y
DIRLINK = $(TOPDIR)/tools/winlink.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
endif
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHPICFLAGS = -fpic
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
@ -125,8 +132,6 @@ define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe

View File

@ -49,7 +49,13 @@ SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/cortexm3
ifeq ($(WINTOOL),y)
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/cortexm3}"
else
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/cortexm3
endif
all: libboard$(LIBEXT)