From b59a813a8088060da47135b16d71a3ed3e4a93c0 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 29 Apr 2009 23:17:39 +0000 Subject: [PATCH] Fix objcopy problem with newer toolchains git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1746 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 5 +++++ Documentation/NuttX.html | 5 +++++ Makefile | 6 +++--- TODO | 7 ------- arch/arm/src/Makefile | 4 ++-- configs/mcu123-lpc214x/nsh/Make.defs | 8 ++++++++ configs/mcu123-lpc214x/ostest/Make.defs | 8 ++++++++ configs/mcu123-lpc214x/usbserial/Make.defs | 8 ++++++++ configs/mcu123-lpc214x/usbstorage/Make.defs | 8 ++++++++ configs/olimex-strp711/ostest/Make.defs | 10 +++++++++- 10 files changed, 56 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba377d4940d..e2c3431b133 100644 --- a/ChangeLog +++ b/ChangeLog @@ -707,3 +707,8 @@ * SPI: Add a method to set the number of bits per word. Also add an alternative interface for so that (eventually) I can phase the sndblock and recvblock methods and replace them with a single exchange method + * Build: objcopy fails with toolchains that use newer GCC and binutils. The + following arguments need to be included in the objcopy command line "-R .note + -R .note.gnu.build-id -R .comment" This has bin fixed in arch/arm/src/Makefile, + but other architectures may have the same problem. Thanks to Dave Marples + for verifying this. diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index d20111112d8..d779698a2e0 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -1393,6 +1393,11 @@ nuttx-0.4.6 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> * SPI: Add a method to set the number of bits per word. Also add an alternative interface for so that (eventually) I can phase the sndblock and recvblock methods and replace them with a single exchange method + * Build: objcopy fails with toolchains that use newer GCC and binutils. The + following arguments need to be included in the objcopy command line "-R .note + -R .note.gnu.build-id -R .comment" This has bin fixed in arch/arm/src/Makefile, + but other architectures may have the same problem. Thanks to Dave Marples + for verifying this. pascal-0.1.3 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/Makefile b/Makefile index e1cd923332f..d72aa48b875 100644 --- a/Makefile +++ b/Makefile @@ -245,13 +245,13 @@ ifeq ($(CONFIG_RRLOAD_BINARY),y) fi endif ifeq ($(CONFIG_INTELHEX_BINARY),y) - @$(OBJCOPY) -O ihex $(TOPDIR)/$@ $(TOPDIR)/$@.ihx + @$(OBJCOPY) $(OBJCOPYARGS) -O ihex $(TOPDIR)/$@ $(TOPDIR)/$@.ihx endif ifeq ($(CONFIG_MOTOROLA_SREC),y) - @$(OBJCOPY) -O srec $(TOPDIR)/$@ $(TOPDIR)/$@.srec + @$(OBJCOPY) $(OBJCOPYARGS) -O srec $(TOPDIR)/$@ $(TOPDIR)/$@.srec endif ifeq ($(CONFIG_RAW_BINARY),y) - @$(OBJCOPY) -O binary $(TOPDIR)/$@ $(TOPDIR)/$@.bin + @$(OBJCOPY) $(OBJCOPYARGS) -O binary $(TOPDIR)/$@ $(TOPDIR)/$@.bin endif depend: diff --git a/TODO b/TODO index 1007989d18c..af3018b61c2 100644 --- a/TODO +++ b/TODO @@ -366,13 +366,6 @@ o Build system Status: Open Priority: Medium-low - Descripton I am having trouble using the newer gcc 4.2.4 + binutils 2.19 - toolchain for ARM. The problem is in arch/arm/src/Makefile: - In the call to objcopy to relocate the .data section, arm-elf-objcopy - dies with a 'Floating point exception' No clue to the cause yet. - Status: Open - Priority: Medium-Low -- workaroung, stick with the 3.4.6 toolchain - o NuttShell (NSH) (examples/nsh) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/arch/arm/src/Makefile b/arch/arm/src/Makefile index a320cdb3196..41ef077b56b 100644 --- a/arch/arm/src/Makefile +++ b/arch/arm/src/Makefile @@ -85,7 +85,7 @@ nuttx: $(HEAD_AOBJ) board/libboard$(LIBEXT) --start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC) ifeq ($(CONFIG_BOOT_RUNFROMFLASH),y) @export flashloc=`$(OBJDUMP) --all-headers $(TOPDIR)/$@ | grep _eronly | cut -d' ' -f1`; \ - $(OBJCOPY) --adjust-section-vma=.data=0x$$flashloc $(TOPDIR)/$@ $(TOPDIR)/$@.flashimage + $(OBJCOPY) $(OBJCOPYARGS) --adjust-section-vma=.data=0x$$flashloc $(TOPDIR)/$@ $(TOPDIR)/$@.flashimage @mv $(TOPDIR)/$@.flashimage $(TOPDIR)/$@ endif @$(NM) $(TOPDIR)/$@ | \ @@ -93,7 +93,7 @@ endif sort > $(TOPDIR)/System.map @export vflashstart=`$(OBJDUMP) --all-headers $(TOPDIR)/$@ | grep _vflashstart | cut -d' ' -f1`; \ if [ ! -z "$$vflashstart" ]; then \ - $(OBJCOPY) --adjust-section-vma=.vector=0x$$vflashstart $(TOPDIR)/$@ $(TOPDIR)/$@.flashimage; \ + $(OBJCOPY) $(OBJCOPYARGS) --adjust-section-vma=.vector=0x$$vflashstart $(TOPDIR)/$@ $(TOPDIR)/$@.flashimage; \ mv $(TOPDIR)/$@.flashimage $(TOPDIR)/$@; \ fi diff --git a/configs/mcu123-lpc214x/nsh/Make.defs b/configs/mcu123-lpc214x/nsh/Make.defs index 512b78cfb4c..b306fb1c80c 100644 --- a/configs/mcu123-lpc214x/nsh/Make.defs +++ b/configs/mcu123-lpc214x/nsh/Make.defs @@ -44,9 +44,17 @@ NM = $(CROSSDEV)nm OBJCOPY = $(CROSSDEV)objcopy OBJDUMP = $(CROSSDEV)objdump +HOSTOS = ${shell uname -o} + ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} +ifeq ($(ARCHCCMAJOR),4) +ifneq ($(HOSTOS),Cygwin) +OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment +endif +endif + ifeq ("${CONFIG_DEBUG}","y") ARCHOPTIMIZATION = -g else diff --git a/configs/mcu123-lpc214x/ostest/Make.defs b/configs/mcu123-lpc214x/ostest/Make.defs index 1967f627d93..f1c6bb7ca45 100644 --- a/configs/mcu123-lpc214x/ostest/Make.defs +++ b/configs/mcu123-lpc214x/ostest/Make.defs @@ -44,9 +44,17 @@ NM = $(CROSSDEV)nm OBJCOPY = $(CROSSDEV)objcopy OBJDUMP = $(CROSSDEV)objdump +HOSTOS = ${shell uname -o} + ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} +ifeq ($(ARCHCCMAJOR),4) +ifneq ($(HOSTOS),Cygwin) +OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment +endif +endif + ifeq ("${CONFIG_DEBUG}","y") ARCHOPTIMIZATION = -g else diff --git a/configs/mcu123-lpc214x/usbserial/Make.defs b/configs/mcu123-lpc214x/usbserial/Make.defs index 5fca3757fca..c2888512f2d 100644 --- a/configs/mcu123-lpc214x/usbserial/Make.defs +++ b/configs/mcu123-lpc214x/usbserial/Make.defs @@ -44,9 +44,17 @@ NM = $(CROSSDEV)nm OBJCOPY = $(CROSSDEV)objcopy OBJDUMP = $(CROSSDEV)objdump +HOSTOS = ${shell uname -o} + ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} +ifeq ($(ARCHCCMAJOR),4) +ifneq ($(HOSTOS),Cygwin) +OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment +endif +endif + ifeq ("${CONFIG_DEBUG}","y") ARCHOPTIMIZATION = -g else diff --git a/configs/mcu123-lpc214x/usbstorage/Make.defs b/configs/mcu123-lpc214x/usbstorage/Make.defs index 1ec3cfc19d9..224a7739cb1 100644 --- a/configs/mcu123-lpc214x/usbstorage/Make.defs +++ b/configs/mcu123-lpc214x/usbstorage/Make.defs @@ -44,9 +44,17 @@ NM = $(CROSSDEV)nm OBJCOPY = $(CROSSDEV)objcopy OBJDUMP = $(CROSSDEV)objdump +HOSTOS = ${shell uname -o} + ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} +ifeq ($(ARCHCCMAJOR),4) +ifneq ($(HOSTOS),Cygwin) +OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment +endif +endif + ifeq ("${CONFIG_DEBUG}","y") ARCHOPTIMIZATION = -g else diff --git a/configs/olimex-strp711/ostest/Make.defs b/configs/olimex-strp711/ostest/Make.defs index 96c955804c8..f33c444fe19 100644 --- a/configs/olimex-strp711/ostest/Make.defs +++ b/configs/olimex-strp711/ostest/Make.defs @@ -1,7 +1,7 @@ ############################################################################## # configs/olimex-strp711/ostest/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 @@ -44,9 +44,17 @@ NM = $(CROSSDEV)nm OBJCOPY = $(CROSSDEV)objcopy OBJDUMP = $(CROSSDEV)objdump +HOSTOS = ${shell uname -o} + ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} +ifeq ($(ARCHCCMAJOR),4) +ifneq ($(HOSTOS),Cygwin) +OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment +endif +endif + ifeq ("${CONFIG_DEBUG}","y") ARCHOPTIMIZATION = -g else