Add support for Windows GCC to lpc2148 and str711

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1875 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-06-11 14:47:03 +00:00
parent 9281d5118a
commit 7e646e6227
25 changed files with 687 additions and 204 deletions

View File

@ -28,7 +28,8 @@ GNU Toolchain Options
All testing has been conducted using the NuttX buildroot toolchain. However,
the make system is setup to default to use the devkitARM toolchain. To use
the CodeSource GNU toolchain, you simply need to build the system as follows:
the CodeSourcery or devkitARM GNU toolchain, you simply need to build the
system as follows:
make # Will build for the devkitARM toolchain
make CROSSDEV=arm-eabi- # Will build for the devkitARM toolchain

View File

@ -56,7 +56,6 @@ SECTIONS
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)

View File

@ -56,7 +56,6 @@ SECTIONS
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)

View File

@ -56,7 +56,6 @@ SECTIONS
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)

View File

@ -56,7 +56,6 @@ SECTIONS
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)

View File

@ -1,6 +1,110 @@
README
^^^^^^
Development Environment
^^^^^^^^^^^^^^^^^^^^^^^
Either Linux or Cygwin on Windows can be used for the development environment.
The source has been built only using the GNU toolchain (see below). Other
toolchains will likely cause problems.
GNU Toolchain Options
^^^^^^^^^^^^^^^^^^^^^
The NuttX make system has been modified to support the following different
toolchain options.
1. The NuttX buildroot Toolchain (see below).
2. The CodeSourcery GNU toolchain,
3. The devkitARM GNU toolchain, or
All testing has been conducted using the NuttX buildroot toolchain. To use
the CodeSourcery or devkitARM GNU toolchain, you simply need to build the
system as follows:
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
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 three biggest 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.
3. Dependencies are not made when using Windows versions of the GCC. This is
because the dependencies are generated using Windows pathes which do not
work with the Cygwin make.
Support has been added for making dependencies with the CodeSourcery toolchain.
That support can be enabled by modifying your Make.defs file as follows:
- MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
If you have problems with the dependency build (for example, if you are not
building on C:), then you may need to modify tools/mkdeps.sh
NOTE: The CodeSourcery toolchain (2009q1) may not work with default optimization
level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
-Os.
NuttX buildroot Toolchain
^^^^^^^^^^^^^^^^^^^^^^^^^
A GNU GCC-based toolchain is assumed. The files */setenv.sh should
be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
different from the default in your PATH variable).
If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
This GNU toolchain builds and executes in the Cygwin environment.
1. You must have already configured Nuttx in <some-dir>/nuttx.
cd tools
./configure.sh eagle100/<sub-dir>
2. Download the latest buildroot package into <some-dir>
3. unpack the buildroot tarball. The resulting directory may
have versioning information on it like buildroot-x.y.z. If so,
rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
4. cd <some-dir>/buildroot
5. cp configs/cortexm3-defconfig-4.3.3 .config
6. make oldconfig
7. make
8. Edit setenv.h, if necessary, so that the PATH variable includes
the path to the newly built binaries.
See the file configs/README.txt in the buildroot source tree. That has more
detailed PLUS some special instructions that you will need to follow if you are
building a Cortex-M3 toolchain for Cygwin under Windows.
Toolchain
^^^^^^^^^

View File

@ -1,7 +1,7 @@
##############################################################################
# configs/mcu123-lpc214x/nsh/Make.defs
#
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -35,8 +35,15 @@
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
CROSSDEV = arm-elf-
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
@ -58,23 +65,41 @@ endif
ifeq ("${CONFIG_DEBUG}","y")
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
-fomit-frame-pointer
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ifeq ($(ARCHCCMAJOR),4)
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
else
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
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
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}"
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
@ -82,7 +107,10 @@ OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifeq ("${CONFIG_DEBUG}","y")
ifneq ($(CROSSDEV),arm-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG),y)
LDFLAGS += -g
endif
@ -96,6 +124,11 @@ define COMPILE
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define COMPILEXX
@echo "CXX: $1"
@$(CXX) -c $(CXXFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
@ -110,10 +143,8 @@ define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =

View File

@ -1,7 +1,7 @@
############################################################################
# configs/mcu123-lpc214x/nsh/defconfig
#
# Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -577,6 +577,7 @@ CONFIG_EXAMPLES_NSH_MMCSDMINOR=0
#
# CONFIG_BOOT_RUNFROMFLASH - Some configurations support XIP
# operation from FLASH but must copy initialized .data sections to RAM.
# (Must always =n; the LPC214x always runs from FLASH)
# CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH
# but copy themselves entirely into RAM for better performance.
# CONFIG_CUSTOM_STACK - The up_ implementation will handle
@ -594,7 +595,7 @@ CONFIG_EXAMPLES_NSH_MMCSDMINOR=0
# CONFIG_HEAP_BASE - The beginning of the heap
# CONFIG_HEAP_SIZE - The size of the heap
#
CONFIG_BOOT_RUNFROMFLASH=y
CONFIG_BOOT_RUNFROMFLASH=n
CONFIG_BOOT_COPYTORAM=n
CONFIG_CUSTOM_STACK=n
CONFIG_STACK_POINTER=

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/mcu123-lpc214x/nsh/ld.script
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -33,59 +33,75 @@
*
****************************************************************************/
/* FLASH:
* The lpc2148 has 512Kb of non-volatile memory beginning at address
* 0x00000000. The OS entry point is via the reset vector at address
* 0x00000000 (default MEMMAP mode assumed)
*
* SRAM:
* The lpc2148 has 32Kb of on-chip static RAM beginning at address
* 0x40000000. The .data section will be relocated from _eronly
* to _sdata at boot time.
*/
MEMORY
{
flash (rx) : ORIGIN = 0, LENGTH = 500K
ram (rw) : ORIGIN = 0x40000000, LENGTH = 32K - 32
flash (rx) : ORIGIN = 0x00000000, LENGTH = 500K
sram (rw) : ORIGIN = 0x40000000, LENGTH = 32K - 32
}
OUTPUT_ARCH(arm)
ENTRY(_stext)
SECTIONS
{
/* The lpc2148 has 512Kb of non-volatile memory beginning at address
* 0x00000000. The OS entry point is via the reset vector at address
* 0x00000000 (default MEMMAP mode assumed)
*/
.text : {
_stext = ABSOLUTE(.);
*(.text)
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata.str1.4)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got) /* Global offset table */
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > flash
_eronly = ABSOLUTE(.); /* This is where the .data section
* is relocated for execution out
* FLASH */
/* The lpc2148 has 32Kb of on-chip static RAM beginning at address
* 0x40000000. The .data section will be relocated from _eronly
/* This is where the .data section is relocated for execution out
* FLASH. The .data section will be relocated from _eronly
* to _sdata at boot time.
*/
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data)
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} >ram AT>flash
} > sram AT > flash
. = ALIGN(32 / 8);
.bss : { /* BSS */
.ARM.extab : {
*(.ARM.extab*)
} >sram
.ARM.exidx : {
*(.ARM.exidx*)
} >sram
.bss : {
_sbss = ABSOLUTE(.);
*(.bss)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
}
} > sram
. = ALIGN(32 / 8);
/* Stabs debugging sections. */
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }

View File

@ -1,7 +1,7 @@
##############################################################################
# configs/mcu123-lpc214x/ostest/Make.defs
#
# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
# Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -35,8 +35,15 @@
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
CROSSDEV = arm-elf-
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
@ -58,23 +65,41 @@ endif
ifeq ("${CONFIG_DEBUG}","y")
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
-fomit-frame-pointer
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ifeq ($(ARCHCCMAJOR),4)
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
else
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
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
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}"
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
@ -82,7 +107,10 @@ OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifeq ("${CONFIG_DEBUG}","y")
ifneq ($(CROSSDEV),arm-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG),y)
LDFLAGS += -g
endif
@ -96,6 +124,11 @@ define COMPILE
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define COMPILEXX
@echo "CXX: $1"
@$(CXX) -c $(CXXFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
@ -110,10 +143,8 @@ define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =

View File

@ -563,6 +563,7 @@ CONFIG_EXAMPLES_NSH_MMCSDMINOR=0
#
# CONFIG_BOOT_RUNFROMFLASH - Some configurations support XIP
# operation from FLASH but must copy initialized .data sections to RAM.
# (Must always =n; the LPC214x always runs from FLASH)
# CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH
# but copy themselves entirely into RAM for better performance.
# CONFIG_CUSTOM_STACK - The up_ implementation will handle
@ -580,7 +581,7 @@ CONFIG_EXAMPLES_NSH_MMCSDMINOR=0
# CONFIG_HEAP_BASE - The beginning of the heap
# CONFIG_HEAP_SIZE - The size of the heap
#
CONFIG_BOOT_RUNFROMFLASH=y
CONFIG_BOOT_RUNFROMFLASH=n
CONFIG_BOOT_COPYTORAM=n
CONFIG_CUSTOM_STACK=n
CONFIG_STACK_POINTER=

View File

@ -33,52 +33,75 @@
*
****************************************************************************/
/* FLASH:
* The lpc2148 has 512Kb of non-volatile memory beginning at address
* 0x00000000. The OS entry point is via the reset vector at address
* 0x00000000 (default MEMMAP mode assumed)
*
* SRAM:
* The lpc2148 has 32Kb of on-chip static RAM beginning at address
* 0x40000000. The .data section will be relocated from _eronly
* to _sdata at boot time.
*/
MEMORY
{
flash (rx) : ORIGIN = 0x00000000, LENGTH = 500K
sram (rw) : ORIGIN = 0x40000000, LENGTH = 32K - 32
}
OUTPUT_ARCH(arm)
ENTRY(_stext)
SECTIONS
{
/* The lpc2148 has 512Kb of non-volatile memory beginning at address
* 0x00000000. The OS entry point is via the reset vector at address
* 0x00000000 (default MEMMAP mode assumed)
*/
. = 0x00000000;
.text : {
_stext = ABSOLUTE(.);
*(.text)
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata.str1.4)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got) /* Global offset table */
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
}
_eronly = ABSOLUTE(.); /* This is where the .data section
* is relocated for execution out
* FLASH */
} > flash
/* The lpc2148 has 32Kb of on-chip static RAM beginning at address
* 0x40000000. The .data section will be relocated from _eronly
/* This is where the .data section is relocated for execution out
* FLASH. The .data section will be relocated from _eronly
* to _sdata at boot time.
*/
. = 0x40000000;
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data)
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
}
} > sram AT > flash
.bss : { /* BSS */
.ARM.extab : {
*(.ARM.extab*)
} >sram
.ARM.exidx : {
*(.ARM.exidx*)
} >sram
.bss : {
_sbss = ABSOLUTE(.);
*(.bss)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
}
/* Stabs debugging sections. */
} > sram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }

View File

@ -1,7 +1,7 @@
############################################################################
# configs/mcu123-lpc214x/src/Makefile
#
# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
# Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -36,7 +36,14 @@
-include $(TOPDIR)/Make.defs
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm -I$(TOPDIR)/sched
ifeq ($(WINTOOL),y)
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/arm}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/sched}"
else
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm -I$(TOPDIR)/sched
endif
ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))

View File

@ -1,7 +1,7 @@
##############################################################################
# configs/mcu123-lpc214x/usbserial/Make.defs
#
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -35,8 +35,15 @@
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
CROSSDEV = arm-elf-
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
@ -58,23 +65,41 @@ endif
ifeq ("${CONFIG_DEBUG}","y")
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
-fomit-frame-pointer
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ifeq ($(ARCHCCMAJOR),4)
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
else
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
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)/usbserial/ld.script
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)/usbserial/ld.script}"
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbserial/ld.script
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
@ -82,7 +107,10 @@ OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifeq ("${CONFIG_DEBUG}","y")
ifneq ($(CROSSDEV),arm-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG),y)
LDFLAGS += -g
endif
@ -96,6 +124,11 @@ define COMPILE
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define COMPILEXX
@echo "CXX: $1"
@$(CXX) -c $(CXXFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
@ -110,10 +143,8 @@ define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =

View File

@ -1,7 +1,7 @@
############################################################################
# configs/mcu123-lpc214x/usbserial/defconfig
#
# Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -584,6 +584,7 @@ CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
#
# CONFIG_BOOT_RUNFROMFLASH - Some configurations support XIP
# operation from FLASH but must copy initialized .data sections to RAM.
# (Must always =n; the LPC214x always runs from FLASH)
# CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH
# but copy themselves entirely into RAM for better performance.
# CONFIG_CUSTOM_STACK - The up_ implementation will handle
@ -601,7 +602,7 @@ CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
# CONFIG_HEAP_BASE - The beginning of the heap
# CONFIG_HEAP_SIZE - The size of the heap
#
CONFIG_BOOT_RUNFROMFLASH=y
CONFIG_BOOT_RUNFROMFLASH=n
CONFIG_BOOT_COPYTORAM=n
CONFIG_CUSTOM_STACK=n
CONFIG_STACK_POINTER=

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/mcu123-lpc214x/usbserial/ld.script
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -33,52 +33,75 @@
*
****************************************************************************/
/* FLASH:
* The lpc2148 has 512Kb of non-volatile memory beginning at address
* 0x00000000. The OS entry point is via the reset vector at address
* 0x00000000 (default MEMMAP mode assumed)
*
* SRAM:
* The lpc2148 has 32Kb of on-chip static RAM beginning at address
* 0x40000000. The .data section will be relocated from _eronly
* to _sdata at boot time.
*/
MEMORY
{
flash (rx) : ORIGIN = 0x00000000, LENGTH = 500K
sram (rw) : ORIGIN = 0x40000000, LENGTH = 32K - 32
}
OUTPUT_ARCH(arm)
ENTRY(_stext)
SECTIONS
{
/* The lpc2148 has 512Kb of non-volatile memory beginning at address
* 0x00000000. The OS entry point is via the reset vector at address
* 0x00000000 (default MEMMAP mode assumed)
*/
. = 0x00000000;
.text : {
_stext = ABSOLUTE(.);
*(.text)
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata.str1.4)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got) /* Global offset table */
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
}
_eronly = ABSOLUTE(.); /* This is where the .data section
* is relocated for execution out
* FLASH */
} > flash
/* The lpc2148 has 32Kb of on-chip static RAM beginning at address
* 0x40000000. The .data section will be relocated from _eronly
/* This is where the .data section is relocated for execution out
* FLASH. The .data section will be relocated from _eronly
* to _sdata at boot time.
*/
. = 0x40000000;
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data)
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
}
} > sram AT > flash
.bss : { /* BSS */
.ARM.extab : {
*(.ARM.extab*)
} >sram
.ARM.exidx : {
*(.ARM.exidx*)
} >sram
.bss : {
_sbss = ABSOLUTE(.);
*(.bss)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
}
/* Stabs debugging sections. */
} > sram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }

View File

@ -1,7 +1,7 @@
##############################################################################
# configs/mcu123-lpc214x/usbstorage/Make.defs
#
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -35,8 +35,15 @@
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
CROSSDEV = arm-elf-
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
@ -58,23 +65,41 @@ endif
ifeq ("${CONFIG_DEBUG}","y")
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
-fomit-frame-pointer
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ifeq ($(ARCHCCMAJOR),4)
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
else
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
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)/usbstorage/ld.script
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)/usbstorage/ld.script}"
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/ld.script
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
@ -82,7 +107,10 @@ OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifeq ("${CONFIG_DEBUG}","y")
ifneq ($(CROSSDEV),arm-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG),y)
LDFLAGS += -g
endif
@ -96,6 +124,11 @@ define COMPILE
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define COMPILEXX
@echo "CXX: $1"
@$(CXX) -c $(CXXFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
@ -110,10 +143,8 @@ define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =

View File

@ -1,7 +1,7 @@
############################################################################
# configs/mcu123-lpc214x/usbstorage/defconfig
#
# Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -626,6 +626,7 @@ CONFIG_EXAMPLES_USBSTRG_TRACEINTERRUPTS=n
#
# CONFIG_BOOT_RUNFROMFLASH - Some configurations support XIP
# operation from FLASH but must copy initialized .data sections to RAM.
# (Must always =n; the LPC214x always runs from FLASH)
# CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH
# but copy themselves entirely into RAM for better performance.
# CONFIG_CUSTOM_STACK - The up_ implementation will handle
@ -643,7 +644,7 @@ CONFIG_EXAMPLES_USBSTRG_TRACEINTERRUPTS=n
# CONFIG_HEAP_BASE - The beginning of the heap
# CONFIG_HEAP_SIZE - The size of the heap
#
CONFIG_BOOT_RUNFROMFLASH=y
CONFIG_BOOT_RUNFROMFLASH=n
CONFIG_BOOT_COPYTORAM=n
CONFIG_CUSTOM_STACK=n
CONFIG_STACK_POINTER=

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/mcu123-lpc214x/usbstorage/ld.script
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -33,52 +33,75 @@
*
****************************************************************************/
/* FLASH:
* The lpc2148 has 512Kb of non-volatile memory beginning at address
* 0x00000000. The OS entry point is via the reset vector at address
* 0x00000000 (default MEMMAP mode assumed)
*
* SRAM:
* The lpc2148 has 32Kb of on-chip static RAM beginning at address
* 0x40000000. The .data section will be relocated from _eronly
* to _sdata at boot time.
*/
MEMORY
{
flash (rx) : ORIGIN = 0x00000000, LENGTH = 500K
sram (rw) : ORIGIN = 0x40000000, LENGTH = 32K - 32
}
OUTPUT_ARCH(arm)
ENTRY(_stext)
SECTIONS
{
/* The lpc2148 has 512Kb of non-volatile memory beginning at address
* 0x00000000. The OS entry point is via the reset vector at address
* 0x00000000 (default MEMMAP mode assumed)
*/
. = 0x00000000;
.text : {
_stext = ABSOLUTE(.);
*(.text)
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata.str1.4)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got) /* Global offset table */
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
}
_eronly = ABSOLUTE(.); /* This is where the .data section
* is relocated for execution out
* FLASH */
} > flash
/* The lpc2148 has 32Kb of on-chip static RAM beginning at address
* 0x40000000. The .data section will be relocated from _eronly
/* This is where the .data section is relocated for execution out
* FLASH. The .data section will be relocated from _eronly
* to _sdata at boot time.
*/
. = 0x40000000;
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data)
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
}
} > sram AT > flash
.bss : { /* BSS */
.ARM.extab : {
*(.ARM.extab*)
} >sram
.ARM.exidx : {
*(.ARM.exidx*)
} >sram
.bss : {
_sbss = ABSOLUTE(.);
*(.bss)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
}
/* Stabs debugging sections. */
} > sram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }

View File

@ -57,14 +57,81 @@ Olimex STR-P711
Jumpers
STNBY Will pull pin 23 /STDBY low
Toolchain
^^^^^^^^^
Development Environment
^^^^^^^^^^^^^^^^^^^^^^^
Either Linux or Cygwin on Windows can be used for the development environment.
The source has been built only using the GNU toolchain (see below). Other
toolchains will likely cause problems.
GNU Toolchain Options
^^^^^^^^^^^^^^^^^^^^^
The NuttX make system has been modified to support the following different
toolchain options.
1. The NuttX buildroot Toolchain (see below).
2. The CodeSourcery GNU toolchain,
3. The devkitARM GNU toolchain, or
All testing has been conducted using the NuttX buildroot toolchain. To use
the CodeSourcery or devkitARM GNU toolchain, you simply need to build the
system as follows:
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
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 three biggest 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.
3. Dependencies are not made when using Windows versions of the GCC. This is
because the dependencies are generated using Windows pathes which do not
work with the Cygwin make.
Support has been added for making dependencies with the CodeSourcery toolchain.
That support can be enabled by modifying your Make.defs file as follows:
- MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
If you have problems with the dependency build (for example, if you are not
building on C:), then you may need to modify tools/mkdeps.sh
NOTE: The CodeSourcery toolchain (2009q1) may not work with default optimization
level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
-Os.
NuttX buildroot Toolchain
^^^^^^^^^^^^^^^^^^^^^^^^^
A GNU GCC-based toolchain is assumed. The files */setenv.sh should
be modified to point to the correct path to the SH toolchain (if
be modified to point to the correct path to the ARM toolchain (if
different from the default).
If you have no SH toolchain, one can be downloaded from the NuttX
If you have no ARM toolchain, one can be downloaded from the NuttX
SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
1. You must have already configured Nuttx in <some-dir>nuttx.

View File

@ -1,7 +1,7 @@
##############################################################################
# configs/olimex-strp711/nsh/Make.defs
#
# Copyright (C) 2009 Gregory Nutt. All rights reserved.
# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -35,8 +35,15 @@
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
CROSSDEV = arm-elf-
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
@ -58,23 +65,41 @@ endif
ifeq ("${CONFIG_DEBUG}","y")
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
-fomit-frame-pointer
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ifeq ($(ARCHCCMAJOR),4)
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
else
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
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
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}"
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
@ -82,7 +107,10 @@ OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifeq ("${CONFIG_DEBUG}","y")
ifneq ($(CROSSDEV),arm-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG),y)
LDFLAGS += -g
endif
@ -96,6 +124,11 @@ define COMPILE
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define COMPILEXX
@echo "CXX: $1"
@$(CXX) -c $(CXXFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
@ -110,10 +143,8 @@ define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/olimex-strp711/nsh/ld.script
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -60,14 +60,16 @@ SECTIONS
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata.str1.*)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got) /* Global offset table */
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > flash
@ -80,18 +82,29 @@ SECTIONS
.data : {
_sdata = ABSOLUTE(.);
*(.data)
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram AT > flash
.bss : { /* BSS */
.ARM.extab : {
*(.ARM.extab*)
} >sram
.ARM.exidx : {
*(.ARM.exidx*)
} >sram
.bss : {
_sbss = ABSOLUTE(.);
*(.bss)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > sram
/* Stabs debugging sections. */
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }

View File

@ -35,8 +35,15 @@
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
CROSSDEV = arm-elf-
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
@ -58,23 +65,41 @@ endif
ifeq ("${CONFIG_DEBUG}","y")
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
-fomit-frame-pointer
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ifeq ($(ARCHCCMAJOR),4)
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
else
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
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
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}"
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
@ -82,7 +107,10 @@ OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifeq ("${CONFIG_DEBUG}","y")
ifneq ($(CROSSDEV),arm-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG),y)
LDFLAGS += -g
endif
@ -96,6 +124,11 @@ define COMPILE
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define COMPILEXX
@echo "CXX: $1"
@$(CXX) -c $(CXXFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
@ -110,10 +143,8 @@ define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/olimex-strp711/ostest/ld.script
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -60,14 +60,16 @@ SECTIONS
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata.str1.*)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got) /* Global offset table */
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > flash
@ -80,18 +82,29 @@ SECTIONS
.data : {
_sdata = ABSOLUTE(.);
*(.data)
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram AT > flash
.bss : { /* BSS */
.ARM.extab : {
*(.ARM.extab*)
} >sram
.ARM.exidx : {
*(.ARM.exidx*)
} >sram
.bss : {
_sbss = ABSOLUTE(.);
*(.bss)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > sram
/* Stabs debugging sections. */
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }

View File

@ -36,7 +36,14 @@
-include $(TOPDIR)/Make.defs
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm -I$(TOPDIR)/sched
ifeq ($(WINTOOL),y)
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/arm}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/sched}"
else
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm -I$(TOPDIR)/sched
endif
ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))