[PATCH] Adjust top-level Makefile for arm-none-eabi toolchain
The gnuarm.com toolchain works fine but is very old. And although it is based on newlib, the os name in the tuple that we used to configure for is arm-elf-linux, which is of course bogus since we are not building Linux applications. Finally, CC= should never be set, instead configure should detect the right compiler using the --host tuple. --- src/Makefile | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index b3594c1..e66f0ff 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,10 +1,10 @@ # this is not really used as we don't do 'make install'. You can still specify # it in case you _want_ to manually 'make install' the target libosmocore. -CROSS_INST_PREFIX=/usr/local/stow/osmocom-bb/arm-elf +CROSS_INST_PREFIX ?= /usr/local/stow/osmocom-bb/arm-2010.09 # this is the prefix of your cross-toolchain programs -CROSS_TOOL_PREFIX=arm-elf- +CROSS_TOOL_PREFIX ?= arm-none-eabi- TOPDIR=$(shell pwd) OSMOCORE_CONFIGURE_ENV= LIBOSMOCORE_LIBS=$(TOPDIR)/shared/libosmocore/build-host/src/.libs/libosmocore.a \ @@ -37,9 +37,9 @@ shared/libosmocore/build-target: shared/libosmocore/build-target/Makefile: shared/libosmocore/configure shared/libosmocore/build-target cd shared/libosmocore/build-target && ../configure \ - --host=arm-elf-linux --disable-vty --enable-panic-infloop \ + --host=arm-none-eabi --disable-vty --enable-panic-infloop \ --disable-shared --disable-talloc --disable-tests \ - CC="$(CROSS_TOOL_PREFIX)gcc" CFLAGS="-Os -ffunction-sections -I$(TOPDIR)/target/firmware/include -nostartfiles -nodefaultlibs" + CFLAGS="-Os -ffunction-sections -I$(TOPDIR)/target/firmware/include -nostartfiles -nodefaultlibs" shared/libosmocore/build-target/src/.libs/libosmocore.a: shared/libosmocore/build-target/Makefile cd shared/libosmocore/build-target && make -- 1.7.2
Hi, On Tue, Jan 25, 2011 at 10:31 PM, Peter Stuge <peter@stuge.se> wrote:
The gnuarm.com toolchain works fine but is very old. And although it is based on newlib, the os name in the tuple that we used to configure for is arm-elf-linux, which is of course bogus since we are not building Linux applications.
Well, I don't really agree here. arm-elf- is a perfectly valid prefix and not only used by the gnuarm toolchain ... Also, the cross prefix to use should _always_ be entirely selectable by an env variable, and it looks to me like your patch removes that. (i.e. if I do make CROSS_TOLL_PREFIX=arm-elf- it's not gonna work anymore AFAICT) Cheers, Sylvain
Thanks for review! Sylvain Munaut wrote:
On Tue, Jan 25, 2011 at 10:31 PM, Peter Stuge <peter@stuge.se> wrote:
The gnuarm.com toolchain works fine but is very old. And although it is based on newlib, the os name in the tuple that we used to configure for is arm-elf-linux, which is of course bogus since we are not building Linux applications.
Well, I don't really agree here.
arm-elf- is a perfectly valid prefix and not only used by the gnuarm toolchain ...
Note the difference between arm-elf and arm-elf-linux. The latter is what we configure for. But because that compiler doesn't work CC is overridden with a hard code to arm-elf-gcc. (Which works fine!)
Also, the cross prefix to use should _always_ be entirely selectable by an env variable, and it looks to me like your patch removes that. (i.e. if I do make CROSS_TOLL_PREFIX=arm-elf- it's not gonna work anymore AFAICT)
It looks like the other way around to me. I added ?= so that the variable only gets set if it does not already have a value, while previously I think it was overwritten by the value in Makefile? Anyway I reworked a little, so that HOST= can be used to specify the desired host tuple, which is then used both for configure, and passed on to the target/firmware Makefile. Patch attached. //Peter
Peter Stuge wrote:
Anyway I reworked a little, so that HOST= can be used
But then I typoed it when it was used. Here's an update.
Maybe this is the winner? :) After more good review and discussion with Sylvain the next version will autodetect arm-elf-gcc and default to using arm-elf for prefix if it is found. If not found will assume arm-none-eabi is available. //Peter
Hi Peter, On Tue, Jan 25, 2011 at 11:02:32PM +0100, Peter Stuge wrote:
+HOST ?= arm-none-eabi-
Remove that line.
# this is the prefix of your cross-toolchain programs -CROSS_TOOL_PREFIX=arm-elf- +CROSS_TOOL_PREFIX ?= $(HOST)-
Leave that unchanged.
TOPDIR=$(shell pwd) OSMOCORE_CONFIGURE_ENV= LIBOSMOCORE_LIBS=$(TOPDIR)/shared/libosmocore/build-host/src/.libs/libosmocore.a \ @@ -37,9 +40,9 @@ shared/libosmocore/build-target:
shared/libosmocore/build-target/Makefile: shared/libosmocore/configure shared/libosmocore/build-target cd shared/libosmocore/build-target && ../configure \ - --host=arm-elf-linux --disable-vty --enable-panic-infloop \ + --host=$(HOST) --disable-vty --enable-panic-infloop \
Use here instead: --host=$(CROSS_TOOL_PREFIX:-=)
--disable-shared --disable-talloc --disable-tests \ - CC="$(CROSS_TOOL_PREFIX)gcc" CFLAGS="-Os -ffunction-sections -I$(TOPDIR)/target/firmware/include -nostartfiles -nodefaultlibs" + CFLAGS="-Os -ffunction-sections -I$(TOPDIR)/target/firmware/include -nostartfiles -nodefaultlibs"
shared/libosmocore/build-target/src/.libs/libosmocore.a: shared/libosmocore/build-target/Makefile cd shared/libosmocore/build-target && make
Regards, Michael
participants (4)
-
Holger Hans Peter Freyther -
Michael Grzeschik -
Peter Stuge -
Sylvain Munaut