diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-06-11 14:47:03 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-06-11 14:47:03 +0000 |
commit | 94a04f9e5a37e615bc7f8809a055ed98ea36a19b (patch) | |
tree | 78aebf6ed7c5d6f6b9b81f7f81d33b71810593e1 /nuttx/configs/mcu123-lpc214x | |
parent | 3ad84ca396bbfad20398f519d4493111c2bf63a6 (diff) | |
download | px4-nuttx-94a04f9e5a37e615bc7f8809a055ed98ea36a19b.tar.gz px4-nuttx-94a04f9e5a37e615bc7f8809a055ed98ea36a19b.tar.bz2 px4-nuttx-94a04f9e5a37e615bc7f8809a055ed98ea36a19b.zip |
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
Diffstat (limited to 'nuttx/configs/mcu123-lpc214x')
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/README.txt | 104 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/nsh/Make.defs | 55 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/nsh/defconfig | 5 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/nsh/ld.script | 66 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/ostest/Make.defs | 55 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/ostest/defconfig | 3 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/ostest/ld.script | 69 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/src/Makefile | 11 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/usbserial/Make.defs | 55 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/usbserial/defconfig | 5 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/usbserial/ld.script | 71 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/usbstorage/Make.defs | 55 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/usbstorage/defconfig | 5 | ||||
-rw-r--r-- | nuttx/configs/mcu123-lpc214x/usbstorage/ld.script | 71 |
14 files changed, 477 insertions, 153 deletions
diff --git a/nuttx/configs/mcu123-lpc214x/README.txt b/nuttx/configs/mcu123-lpc214x/README.txt index 65c7c454f..b1622b3ef 100644 --- a/nuttx/configs/mcu123-lpc214x/README.txt +++ b/nuttx/configs/mcu123-lpc214x/README.txt @@ -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 ^^^^^^^^^ diff --git a/nuttx/configs/mcu123-lpc214x/nsh/Make.defs b/nuttx/configs/mcu123-lpc214x/nsh/Make.defs index b306fb1c8..57f621ef7 100644 --- a/nuttx/configs/mcu123-lpc214x/nsh/Make.defs +++ b/nuttx/configs/mcu123-lpc214x/nsh/Make.defs @@ -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 = diff --git a/nuttx/configs/mcu123-lpc214x/nsh/defconfig b/nuttx/configs/mcu123-lpc214x/nsh/defconfig index 23366a1ea..f7a65c730 100644 --- a/nuttx/configs/mcu123-lpc214x/nsh/defconfig +++ b/nuttx/configs/mcu123-lpc214x/nsh/defconfig @@ -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= diff --git a/nuttx/configs/mcu123-lpc214x/nsh/ld.script b/nuttx/configs/mcu123-lpc214x/nsh/ld.script index 849f8492e..dfc44db5e 100644 --- a/nuttx/configs/mcu123-lpc214x/nsh/ld.script +++ b/nuttx/configs/mcu123-lpc214x/nsh/ld.script @@ -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 + + .ARM.extab : { + *(.ARM.extab*) + } >sram + + .ARM.exidx : { + *(.ARM.exidx*) + } >sram - . = ALIGN(32 / 8); - .bss : { /* BSS */ + .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) } diff --git a/nuttx/configs/mcu123-lpc214x/ostest/Make.defs b/nuttx/configs/mcu123-lpc214x/ostest/Make.defs index f1c6bb7ca..1d5ededb0 100644 --- a/nuttx/configs/mcu123-lpc214x/ostest/Make.defs +++ b/nuttx/configs/mcu123-lpc214x/ostest/Make.defs @@ -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 = diff --git a/nuttx/configs/mcu123-lpc214x/ostest/defconfig b/nuttx/configs/mcu123-lpc214x/ostest/defconfig index 142023777..98f9f34b1 100644 --- a/nuttx/configs/mcu123-lpc214x/ostest/defconfig +++ b/nuttx/configs/mcu123-lpc214x/ostest/defconfig @@ -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= diff --git a/nuttx/configs/mcu123-lpc214x/ostest/ld.script b/nuttx/configs/mcu123-lpc214x/ostest/ld.script index 04e381b8b..344fdd6d1 100644 --- a/nuttx/configs/mcu123-lpc214x/ostest/ld.script +++ b/nuttx/configs/mcu123-lpc214x/ostest/ld.script @@ -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 + + .ARM.extab : { + *(.ARM.extab*) + } >sram - .bss : { /* BSS */ + .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) } diff --git a/nuttx/configs/mcu123-lpc214x/src/Makefile b/nuttx/configs/mcu123-lpc214x/src/Makefile index 2dbb86362..ab71e0cce 100644 --- a/nuttx/configs/mcu123-lpc214x/src/Makefile +++ b/nuttx/configs/mcu123-lpc214x/src/Makefile @@ -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)) diff --git a/nuttx/configs/mcu123-lpc214x/usbserial/Make.defs b/nuttx/configs/mcu123-lpc214x/usbserial/Make.defs index c2888512f..8df0be010 100644 --- a/nuttx/configs/mcu123-lpc214x/usbserial/Make.defs +++ b/nuttx/configs/mcu123-lpc214x/usbserial/Make.defs @@ -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 = diff --git a/nuttx/configs/mcu123-lpc214x/usbserial/defconfig b/nuttx/configs/mcu123-lpc214x/usbserial/defconfig index 7760edbe5..60bf4e5ae 100644 --- a/nuttx/configs/mcu123-lpc214x/usbserial/defconfig +++ b/nuttx/configs/mcu123-lpc214x/usbserial/defconfig @@ -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= diff --git a/nuttx/configs/mcu123-lpc214x/usbserial/ld.script b/nuttx/configs/mcu123-lpc214x/usbserial/ld.script index d16b9e8e1..bcfb4c738 100644 --- a/nuttx/configs/mcu123-lpc214x/usbserial/ld.script +++ b/nuttx/configs/mcu123-lpc214x/usbserial/ld.script @@ -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 + + .ARM.extab : { + *(.ARM.extab*) + } >sram - .bss : { /* BSS */ + .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) } diff --git a/nuttx/configs/mcu123-lpc214x/usbstorage/Make.defs b/nuttx/configs/mcu123-lpc214x/usbstorage/Make.defs index 224a7739c..bdde83ef5 100644 --- a/nuttx/configs/mcu123-lpc214x/usbstorage/Make.defs +++ b/nuttx/configs/mcu123-lpc214x/usbstorage/Make.defs @@ -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 = diff --git a/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig b/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig index 99750003d..8394375a6 100644 --- a/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig +++ b/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig @@ -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= diff --git a/nuttx/configs/mcu123-lpc214x/usbstorage/ld.script b/nuttx/configs/mcu123-lpc214x/usbstorage/ld.script index a32980fde..2236cd7ca 100644 --- a/nuttx/configs/mcu123-lpc214x/usbstorage/ld.script +++ b/nuttx/configs/mcu123-lpc214x/usbstorage/ld.script @@ -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 + + .ARM.extab : { + *(.ARM.extab*) + } >sram - .bss : { /* BSS */ + .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) } |