Add support for CodeSourcery Linux toolchain

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2834 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2010-08-10 03:22:43 +00:00
parent 7fbd5b0a4a
commit 1ef5d9ae5a
4 changed files with 119 additions and 69 deletions

View File

@ -40,26 +40,57 @@
include ${TOPDIR}/.config
# The default value for CROSSDEV can be overridden from the make command line:
# make -- Will build for the NuttX buildroot toolchain
# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
# Setup for the selected toolchain
CROSSDEV = arm-elf-
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
ifeq ($(CONFIG_OLIMEX_LPC2378_CODESOURCERYW),y)
# CodeSourcery under Windows
CROSSDEV = arm-none-eabi-
WINTOOL = y
MAXOPTIMIZATION = -O2
endif
ifeq ($(CONFIG_OLIMEX_LPC2378_CODESOURCERYL),y)
# CodeSourcery under Linux
CROSSDEV = arm-none-eabi-
MAXOPTIMIZATION = -O2
endif
ifeq ($(CONFIG_OLIMEX_LPC2378_DEVKITARM),y)
# devkitARM under Windows
CROSSDEV = arm-eabi-
WINTOOL = y
endif
ifeq ($(CONFIG_OLIMEX_LPC2378_BUILDROOT),y)
# NuttX buildroot under Linux or Cygwin
CROSSDEV = arm-elf-
MAXOPTIMIZATION = -Os
endif
HOSTOS = ${shell uname -o}
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/winlink.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
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}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
endif
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
ifeq ($(ARCHCCMAJOR),4)
ifneq ($(HOSTOS),Cygwin)
@ -67,23 +98,6 @@ OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
endif
endif
ifeq ($(CROSSDEV),arm-elf-)
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
MAXOPTIMIZATION = -Os
else
WINTOOL = y
DIRLINK = $(TOPDIR)/tools/winlink.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
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}"
MAXOPTIMIZATION = -O2
endif
ifeq ("${CONFIG_DEBUG}","y")
ARCHOPTIMIZATION = -g
else
@ -98,18 +112,26 @@ endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHPICFLAGS = -fpic
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
-T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
-no-check-sections
LDNXFLATFLAGS = -e main -s 2048
OBJEXT = .o
LIBEXT = .a
EXEEXT =

View File

@ -81,6 +81,13 @@ CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
CONFIG_ARCH_INTERRUPTSTACK=
CONFIG_ARCH_STACKDUMP=y
# Identify toolchain and linker options
#
CONFIG_OLIMEX_LPC2378_CODESOURCERYW=n
CONFIG_OLIMEX_LPC2378_CODESOURCERYL=y
CONFIG_OLIMEX_LPC2378_DEVKITARM=n
CONFIG_OLIMEX_LPC2378_BUILDROOT=n
#
# LPC2378 specific chip initialization
#CONFIG_PLL_CLKSRC - identifies the clock source to use

View File

@ -40,26 +40,57 @@
include ${TOPDIR}/.config
# The default value for CROSSDEV can be overridden from the make command line:
# make -- Will build for the NuttX buildroot toolchain
# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
# Setup for the selected toolchain
CROSSDEV = arm-elf-
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
ifeq ($(CONFIG_OLIMEX_LPC2378_CODESOURCERYW),y)
# CodeSourcery under Windows
CROSSDEV = arm-none-eabi-
WINTOOL = y
MAXOPTIMIZATION = -O2
endif
ifeq ($(CONFIG_OLIMEX_LPC2378_CODESOURCERYL),y)
# CodeSourcery under Linux
CROSSDEV = arm-none-eabi-
MAXOPTIMIZATION = -O2
endif
ifeq ($(CONFIG_OLIMEX_LPC2378_DEVKITARM),y)
# devkitARM under Windows
CROSSDEV = arm-eabi-
WINTOOL = y
endif
ifeq ($(CONFIG_OLIMEX_LPC2378_BUILDROOT),y)
# NuttX buildroot under Linux or Cygwin
CROSSDEV = arm-elf-
MAXOPTIMIZATION = -Os
endif
HOSTOS = ${shell uname -o}
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/winlink.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
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}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
endif
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
ifeq ($(ARCHCCMAJOR),4)
ifneq ($(HOSTOS),Cygwin)
@ -67,23 +98,6 @@ OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
endif
endif
ifeq ($(CROSSDEV),arm-elf-)
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
MAXOPTIMIZATION = -Os
else
WINTOOL = y
DIRLINK = $(TOPDIR)/tools/winlink.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
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}"
MAXOPTIMIZATION = -O2
endif
ifeq ("${CONFIG_DEBUG}","y")
ARCHOPTIMIZATION = -g
else

View File

@ -81,6 +81,13 @@ CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
CONFIG_ARCH_INTERRUPTSTACK=
CONFIG_ARCH_STACKDUMP=y
# Identify toolchain and linker options
#
CONFIG_OLIMEX_LPC2378_CODESOURCERYW=n
CONFIG_OLIMEX_LPC2378_CODESOURCERYL=y
CONFIG_OLIMEX_LPC2378_DEVKITARM=n
CONFIG_OLIMEX_LPC2378_BUILDROOT=n
#
# LPC2378 specific chip initialization
#CONFIG_PLL_CLKSRC - identifies the clock source to use