From 94a04f9e5a37e615bc7f8809a055ed98ea36a19b Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 11 Jun 2009 14:47:03 +0000 Subject: 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 --- nuttx/configs/mcu123-lpc214x/usbserial/Make.defs | 55 ++++++++++++++---- nuttx/configs/mcu123-lpc214x/usbserial/defconfig | 5 +- nuttx/configs/mcu123-lpc214x/usbserial/ld.script | 71 ++++++++++++++++-------- 3 files changed, 93 insertions(+), 38 deletions(-) (limited to 'nuttx/configs/mcu123-lpc214x/usbserial') 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 # # 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 # # 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 * * 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) } -- cgit v1.2.3