Add support for the CodeSourcery toolchain under Linux for the STM32

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2170 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-10-23 01:46:22 +00:00
parent 5154fc4fc0
commit f4fefc1c4c
8 changed files with 265 additions and 229 deletions

View File

@ -102,6 +102,9 @@ CodeSourcery on Linux
is provided in your defconfig file. 'ostest' refers to the ostest/ configuration; is provided in your defconfig file. 'ostest' refers to the ostest/ configuration;
this would be different for other configurations. this would be different for other configurations.
For an example of a CodeSourcery-under-Linux Make.defs file, see
configs/stm3210e-eval/nsh/Make.defs.
NuttX buildroot Toolchain NuttX buildroot Toolchain
^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -27,18 +27,19 @@ GNU Toolchain Options
add one of the following configuration options to your .config (or defconfig) add one of the following configuration options to your .config (or defconfig)
file: file:
CONFIG_STM32_CODESOURCERY=y CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
CONFIG_STM32_DEVKITARM=y CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
CONFIG_STM32_RAISONANCE=y CONFIG_STM32_DEVKITARM=y : devkitARM under Windows
CONFIG_STM32_BUILDROOT=y (default) CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Windows or Cygwin (default)
If you are not using CONFIG_STM32_BUILDROOT, then you may also have to modify If you are not using CONFIG_STM32_BUILDROOT, then you may also have to modify
the PATH in the setenv.h file if your make cannot find the tools. the PATH in the setenv.h file if your make cannot find the tools.
NOTE: the CodeSourcery, devkitARM, and Raisonance toolchains are Windows native NOTE: the CodeSourcery (for Windows), devkitARM, and Raisonance toolchains are
toolchains. The NuttX buildroot toolchain is a Cygwin or Linux native toolchain. Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
There are several limitations to using a Windows based toolchain in a Cygwin toolchains are Cygwin and/or Linux native toolchains. There are several limitations
environment. The three biggest are: to using a Windows based toolchain in a Cygwin environment. The three biggest are:
1. The Windows toolchain cannot follow Cygwin paths. Path conversions are 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
performed automatically in the Cygwin makefiles using the 'cygpath' utility performed automatically in the Cygwin makefiles using the 'cygpath' utility
@ -78,28 +79,6 @@ GNU Toolchain Options
the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
path or will get the wrong version of make. path or will get the wrong version of make.
CodeSourcery on Linux
^^^^^^^^^^^^^^^^^^^^^
If you select the CodeSourcery toolchain, the make system will assume that you
are running a Windows version of the toolchain. If you are running under Linux,
the the make will probably fail. The fix is to edit your Make.defs file and
use something like:
CROSSDEV = arm-none-eabi-
WINTOOL = n
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -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/$(LDSCRIPT)
MAXOPTIMIZATION = -O2
Where LDSCRIPT is defined to be either ld.script or ld.script.dfu. The values
for TOPDIR is provided by the make system; the value for CONFIG_ARCH_BOARD is
provided in your defconfig file. 'ostest' refers to the ostest/ configuration;
this would be different for other configurations.
IDEs IDEs
^^^^ ^^^^

View File

@ -37,83 +37,104 @@ include ${TOPDIR}/.config
# Setup for the selected toolchain # Setup for the selected toolchain
ifneq ($(CONFIG_STM32_BUILDROOT),y) ifeq ($(CONFIG_STM32_DFU),y)
# Windows-native toolchains LDSCRIPT = ld.script.dfu
else
LDSCRIPT = ld.script
endif
ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
# CodeSourcery under Windows
CROSSDEV = arm-none-eabi-
WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif
ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
# CodeSourcery under Linux
CROSSDEV = arm-none-eabi-
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif
ifeq ($(CONFIG_STM32_DEVKITARM),y) ifeq ($(CONFIG_STM32_DEVKITARM),y)
CROSSDEV = arm-eabi- # devkitARM under Windows
else CROSSDEV = arm-eabi-
CROSSDEV = arm-none-eabi- WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif endif
WINTOOL = y ifeq ($(CONFIG_STM32_RAISONANCE),y)
DIRLINK = $(TOPDIR)/tools/winlink.sh # Raisonance RIDE7 under Windows
DIRUNLINK = $(TOPDIR)/tools/unlink.sh CROSSDEV = arm-none-eabi-
MKDEP = $(TOPDIR)/tools/mknulldeps.sh WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" endif
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" ifeq ($(CONFIG_STM32_BUILDROOT),y)
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/RIDE/stm32-nuttx.ld}" # NuttX buildroot under Linux or Cygwin
MAXOPTIMIZATION = -O2 CROSSDEV = arm-elf-
# The NuttX buildroot toolchain ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
else
# Linux/Cygwin-native toolchain (assumed from the NuttX buildroot)
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)/RIDE/stm32-nuttx.ld
MAXOPTIMIZATION = -Os
endif endif
CC = $(CROSSDEV)gcc ifeq ($(WINTOOL),y)
CXX = $(CROSSDEV)g++ # Windows-native toolchains
CPP = $(CROSSDEV)gcc -E DIRLINK = $(TOPDIR)/tools/winlink.sh
LD = $(CROSSDEV)ld DIRUNLINK = $(TOPDIR)/tools/unlink.sh
AR = $(CROSSDEV)ar rcs MKDEP = $(TOPDIR)/tools/mknulldeps.sh
NM = $(CROSSDEV)nm ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
OBJCOPY = $(CROSSDEV)objcopy ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
OBJDUMP = $(CROSSDEV)objdump ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/RIDE/$(LDSCRIPT)}"
MAXOPTIMIZATION = -O2
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)/RIDE/$(LDSCRIPT)
MAXOPTIMIZATION = -Os
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'} CC = $(CROSSDEV)gcc
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} 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 ("${CONFIG_DEBUG_SYMBOLS}","y") ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
ARCHOPTIMIZATION = -g ARCHOPTIMIZATION = -g
else else
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif endif
ARCHCFLAGS = -fno-builtin ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES = ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \ CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
$(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) AFLAGS = $(CFLAGS) -D__ASSEMBLY__
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \ NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
-T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \ LDNXFLATFLAGS = -e main -s 2048
-no-check-sections
LDNXFLATFLAGS = -e main -s 2048
OBJEXT = .o OBJEXT = .o
LIBEXT = .a LIBEXT = .a
EXEEXT = EXEEXT =
ifneq ($(CROSSDEV),arm-elf-) ifneq ($(CROSSDEV),arm-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs LDFLAGS += -nostartfiles -nodefaultlibs
endif endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y) ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g LDFLAGS += -g
endif endif
define PREPROCESS define PREPROCESS
@ -145,8 +166,8 @@ define CLEAN
@rm -f *.o *.a @rm -f *.o *.a
endef endef
HOSTCC = gcc HOSTCC = gcc
HOSTINCLUDES = -I. HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS = HOSTLDFLAGS =

View File

@ -88,7 +88,8 @@ CONFIG_ARCH_CALIBRATION=n
# #
# Identify toolchain # Identify toolchain
CONFIG_STM32_CODESOURCERY=n CONFIG_STM32_CODESOURCERYW=n
CONFIG_STM32_CODESOURCERYL=n
CONFIG_STM32_DEVKITARM=n CONFIG_STM32_DEVKITARM=n
CONFIG_STM32_RAISONANCE=y CONFIG_STM32_RAISONANCE=y
CONFIG_STM32_BUILDROOT=n CONFIG_STM32_BUILDROOT=n

View File

@ -38,88 +38,103 @@ include ${TOPDIR}/.config
# Setup for the selected toolchain # Setup for the selected toolchain
ifeq ($(CONFIG_STM32_DFU),y) ifeq ($(CONFIG_STM32_DFU),y)
LDSCRIPT = ld.script.dfu LDSCRIPT = ld.script.dfu
else else
LDSCRIPT = ld.script LDSCRIPT = ld.script
endif endif
ifneq ($(CONFIG_STM32_BUILDROOT),y) ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
# Windows-native toolchains # CodeSourcery under Windows
CROSSDEV = arm-none-eabi-
WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif
ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
# CodeSourcery under Linux
CROSSDEV = arm-none-eabi-
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif
ifeq ($(CONFIG_STM32_DEVKITARM),y) ifeq ($(CONFIG_STM32_DEVKITARM),y)
CROSSDEV = arm-eabi- # devkitARM under Windows
else CROSSDEV = arm-eabi-
CROSSDEV = arm-none-eabi- WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif endif
WINTOOL = y ifeq ($(CONFIG_STM32_RAISONANCE),y)
DIRLINK = $(TOPDIR)/tools/winlink.sh # Raisonance RIDE7 under Windows
DIRUNLINK = $(TOPDIR)/tools/unlink.sh CROSSDEV = arm-none-eabi-
MKDEP = $(TOPDIR)/tools/mknulldeps.sh WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" endif
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" ifeq ($(CONFIG_STM32_BUILDROOT),y)
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/$(LDSCRIPT)}" # NuttX buildroot under Linux or Cygwin
MAXOPTIMIZATION = -O2 CROSSDEV = arm-elf-
# The NuttX buildroot toolchain ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
else
# Linux/Cygwin-native toolchain (assumed from the NuttX buildroot)
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/$(LDSCRIPT)
MAXOPTIMIZATION = -Os
endif endif
CC = $(CROSSDEV)gcc ifeq ($(WINTOOL),y)
CXX = $(CROSSDEV)g++ # Windows-native toolchains
CPP = $(CROSSDEV)gcc -E DIRLINK = $(TOPDIR)/tools/winlink.sh
LD = $(CROSSDEV)ld DIRUNLINK = $(TOPDIR)/tools/unlink.sh
AR = $(CROSSDEV)ar rcs MKDEP = $(TOPDIR)/tools/mknulldeps.sh
NM = $(CROSSDEV)nm ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
OBJCOPY = $(CROSSDEV)objcopy ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
OBJDUMP = $(CROSSDEV)objdump ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/$(LDSCRIPT)}"
MAXOPTIMIZATION = -O2
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/$(LDSCRIPT)
MAXOPTIMIZATION = -Os
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'} CC = $(CROSSDEV)gcc
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} 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 ("${CONFIG_DEBUG_SYMBOLS}","y") ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
ARCHOPTIMIZATION = -g ARCHOPTIMIZATION = -g
else else
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif endif
ARCHCFLAGS = -fno-builtin ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES = ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \ CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
$(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) AFLAGS = $(CFLAGS) -D__ASSEMBLY__
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \ NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
-T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \ LDNXFLATFLAGS = -e main -s 2048
-no-check-sections
LDNXFLATFLAGS = -e main -s 2048
OBJEXT = .o OBJEXT = .o
LIBEXT = .a LIBEXT = .a
EXEEXT = EXEEXT =
ifneq ($(CROSSDEV),arm-elf-) ifneq ($(CROSSDEV),arm-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs LDFLAGS += -nostartfiles -nodefaultlibs
endif endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y) ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g LDFLAGS += -g
endif endif
define PREPROCESS define PREPROCESS
@ -151,8 +166,8 @@ define CLEAN
@rm -f *.o *.a @rm -f *.o *.a
endef endef
HOSTCC = gcc HOSTCC = gcc
HOSTINCLUDES = -I. HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS = HOSTLDFLAGS =

View File

@ -88,7 +88,8 @@ CONFIG_ARCH_CALIBRATION=n
# #
# Identify toolchain and liner options # Identify toolchain and liner options
CONFIG_STM32_CODESOURCERY=n CONFIG_STM32_CODESOURCERYW=n
CONFIG_STM32_CODESOURCERYL=n
CONFIG_STM32_DEVKITARM=n CONFIG_STM32_DEVKITARM=n
CONFIG_STM32_RAISONANCE=n CONFIG_STM32_RAISONANCE=n
CONFIG_STM32_BUILDROOT=y CONFIG_STM32_BUILDROOT=y

View File

@ -38,88 +38,103 @@ include ${TOPDIR}/.config
# Setup for the selected toolchain # Setup for the selected toolchain
ifeq ($(CONFIG_STM32_DFU),y) ifeq ($(CONFIG_STM32_DFU),y)
LDSCRIPT = ld.script.dfu LDSCRIPT = ld.script.dfu
else else
LDSCRIPT = ld.script LDSCRIPT = ld.script
endif endif
ifneq ($(CONFIG_STM32_BUILDROOT),y) ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
# Windows-native toolchains # CodeSourcery under Windows
CROSSDEV = arm-none-eabi-
WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif
ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
# CodeSourcery under Linux
CROSSDEV = arm-none-eabi-
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif
ifeq ($(CONFIG_STM32_DEVKITARM),y) ifeq ($(CONFIG_STM32_DEVKITARM),y)
CROSSDEV = arm-eabi- # devkitARM under Windows
else CROSSDEV = arm-eabi-
CROSSDEV = arm-none-eabi- WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif endif
WINTOOL = y ifeq ($(CONFIG_STM32_RAISONANCE),y)
DIRLINK = $(TOPDIR)/tools/winlink.sh # Raisonance RIDE7 under Windows
DIRUNLINK = $(TOPDIR)/tools/unlink.sh CROSSDEV = arm-none-eabi-
MKDEP = $(TOPDIR)/tools/mknulldeps.sh WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" endif
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" ifeq ($(CONFIG_STM32_BUILDROOT),y)
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/$(LDSCRIPT)}" # NuttX buildroot under Linux or Cygwin
MAXOPTIMIZATION = -O2 CROSSDEV = arm-elf-
# The NuttX buildroot toolchain ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
else
# Linux/Cygwin-native toolchain (assumed from the NuttX buildroot)
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/$(LDSCRIPT)
MAXOPTIMIZATION = -Os
endif endif
CC = $(CROSSDEV)gcc ifeq ($(WINTOOL),y)
CXX = $(CROSSDEV)g++ # Windows-native toolchains
CPP = $(CROSSDEV)gcc -E DIRLINK = $(TOPDIR)/tools/winlink.sh
LD = $(CROSSDEV)ld DIRUNLINK = $(TOPDIR)/tools/unlink.sh
AR = $(CROSSDEV)ar rcs MKDEP = $(TOPDIR)/tools/mknulldeps.sh
NM = $(CROSSDEV)nm ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
OBJCOPY = $(CROSSDEV)objcopy ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
OBJDUMP = $(CROSSDEV)objdump ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/$(LDSCRIPT)}"
MAXOPTIMIZATION = -O2
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/$(LDSCRIPT)
MAXOPTIMIZATION = -Os
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'} CC = $(CROSSDEV)gcc
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} 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 ("${CONFIG_DEBUG_SYMBOLS}","y") ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
ARCHOPTIMIZATION = -g ARCHOPTIMIZATION = -g
else else
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif endif
ARCHCFLAGS = -fno-builtin ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES = ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \ CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
$(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) AFLAGS = $(CFLAGS) -D__ASSEMBLY__
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \ NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
-T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \ LDNXFLATFLAGS = -e main -s 2048
-no-check-sections
LDNXFLATFLAGS = -e main -s 2048
OBJEXT = .o OBJEXT = .o
LIBEXT = .a LIBEXT = .a
EXEEXT = EXEEXT =
ifneq ($(CROSSDEV),arm-elf-) ifneq ($(CROSSDEV),arm-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs LDFLAGS += -nostartfiles -nodefaultlibs
endif endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y) ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g LDFLAGS += -g
endif endif
define PREPROCESS define PREPROCESS
@ -151,8 +166,8 @@ define CLEAN
@rm -f *.o *.a @rm -f *.o *.a
endef endef
HOSTCC = gcc HOSTCC = gcc
HOSTINCLUDES = -I. HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS = HOSTLDFLAGS =

View File

@ -88,7 +88,8 @@ CONFIG_ARCH_CALIBRATION=n
# #
# Identify toolchain and liner options # Identify toolchain and liner options
CONFIG_STM32_CODESOURCERY=n CONFIG_STM32_CODESOURCERYW=n
CONFIG_STM32_CODESOURCERYL=n
CONFIG_STM32_DEVKITARM=n CONFIG_STM32_DEVKITARM=n
CONFIG_STM32_RAISONANCE=n CONFIG_STM32_RAISONANCE=n
CONFIG_STM32_BUILDROOT=y CONFIG_STM32_BUILDROOT=y