Building arm-{none,stellaris}-eabi toolchains
Stuart Longland
redhatter@gentoo.org
Sat Jan 16 09:44:00 GMT 2010
Hi all,
I was wondering if anyone has had building a toolchain for one
of the above targets? I'm trying to get a cross-compiling toolchain for
a Luminary Micro Stellaris LM3S8962 microcontroller (ARM Cortex
M3-based) built on my netbook (a Lemote Yeeloong). We'll be using this
at my workplace for some of our motor control apps, but I also intend to
buy a few of these MCUs to play with in my amateur radio projects too.
For the present time, I'm using one of the demos that came with
FreeRTOS as a test of the toolchain -- the CORTEX_LM3Sxxxx_Eclipse demo
builds fine using the CodeSourcery Stellaris EABI toolchain, which I
understand to be very similar to their ARM EABI toolchain for which I
have the sources. The code generated works as expected too.
I've tried building the toolchain by hand on my netbook (which
can't run the CodeSourcery built toolchains, even if I could afford
them) both using official Gnu/Red Hat...etc sources, and using the
CodeSourcery toolchain sources.
The Makefile I use with the latter is attached... after
unpacking arm-2009q3-68-arm-none-eabi.src.tar.bz2, drop it in the
directory created as Makefile and run `make` (or have a look with a
text editor, there are some configurable options). It is based on the
shell script that CodeSourcery distribute with their sources.
Running on Gentoo/MIPS 10.0, it builds okay.
In both cases (GNU sources and CodeSourcery sources) the
toolchain produced fails to build the aforementioned FreeRTOS demo with
the following error message:
-------------------------------------------------------------------------------
stuartl@zhouman
~/ezecorp/wsbackup/freertos601/FreeRTOS/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo
$ make
arm-stellaris-eabi-gcc -g -I . -I ../../../Source/include -I
../../../Source/portable/GCC/ARM_CM3 -I ../../Common/include -D
GCC_ARMCM3_LM3S102 -D inline= -mthumb -mcpu=cortex-m3 -O0
-Tstandalone.ld -D PACK_STRUCT_END=__attribute\(\(packed\)\) -D
ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\) -D sprintf=usprintf -D
snprintf=usnprintf -D printf=uipprintf -I
../../Common/ethernet/uIP/uip-1.0/uip -I ./webserver -ffunction-sections
-fdata-sections -I ../../Common/drivers/LuminaryMicro main.o timertest.o
./ParTest/ParTest.o rit128x96x4.o osram128x64x4.o formike128x128x16.o
../../Common/drivers/LuminaryMicro/ustdlib.o
../../Common/Minimal/BlockQ.o ../../Common/Minimal/blocktim.o
../../Common/Minimal/death.o ../../Common/Minimal/integer.o
../../Common/Minimal/PollQ.o ../../Common/Minimal/semtest.o
../../Common/Minimal/GenQTest.o ../../Common/Minimal/QPeek.o
../../Common/Minimal/recmutex.o ../../Common/Minimal/IntQueue.o
./IntQueueTimer.o ./webserver/uIP_Task.o ./webserver/emac.o
./webserver/httpd.o ./webserver/httpd-cgi.o ./webserver/httpd-fs.o
./webserver/http-strings.o
../../Common/ethernet/uIP/uip-1.0/uip/uip_arp.o
../../Common/ethernet/uIP/uip-1.0/uip/psock.o
../../Common/ethernet/uIP/uip-1.0/uip/timer.o
../../Common/ethernet/uIP/uip-1.0/uip/uip.o ../../../Source/list.o
../../../Source/queue.o ../../../Source/tasks.o
../../../Source/portable/GCC/ARM_CM3/port.o
../../../Source/portable/MemMang/heap_2.o startup.o
../../Common/drivers/LuminaryMicro/arm-none-eabi-gcc/libdriver.a
../../Common/drivers/LuminaryMicro/arm-none-eabi-gcc/libgr.a
-nostartfiles -Xlinker -oRTOSDemo.axf -Xlinker -M -Xlinker
-Map=rtosdemo.map -Xlinker --no-gc-sections
/usr/local/lib/gcc/arm-stellaris-eabi/4.4.1/../../../../arm-stellaris-eabi/bin/ld:
section .eh_frame loaded at [00014a70,00016c57] overlaps section .data
loaded at [00014a70,00014bc3]
collect2: ld returned 1 exit status
make: *** [RTOSDemo.axf] Error 1
-------------------------------------------------------------------------------
As I say, using the demo of the CodeSourcery toolchain on Win32,
it builds fine, links fine, works as advertised. Does anyone know what
I might be doing wrong with my toolchain to yield the above error?
Also worth pointing out, I've tried some of the others (Yagarto,
GNUARM, etc.) which use an arm-elf target... these don't seem to work
either, erroring out with binary compatibility errors (different FPU
instruction sets, Thumb vs native ARM...etc). Reading up seems to
suggest I should be using EABI (arm-*-eabi), not the old ABI
(arm-*-elf). Or am I mistaken?
Regards,
--
Stuart Longland (aka Redhatter, VK4MSL) .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer '.'` :
. . . . . . . . . . . . . . . . . . . . . . .'.'
http://dev.gentoo.org/~redhatter :.'
I haven't lost my mind...
...it's backed up on a tape somewhere.
-------------- next part --------------
# CodeSourcery Toolchain version
CS_VER=2009q3-68
# Target for toolchain
TARGET=arm-stellaris-eabi
# Build host type -- this automatically detects the local host type
# use CROSS_COMPILE=foo- to set the build toolchain to use.
BUILD=$(shell $(CROSS_COMPILE)gcc -dumpmachine)
HOST=$(BUILD)
# Source tarball directory ... assumed to be same dir as Makefile
SRCDIR=$(PWD)
# Unpack directory
UNPACKDIR=$(PWD)/unpack
# Build working directory
WORKDIR=$(PWD)/build
# Toolchain prefix directory -- all components will be installed here
PREFIX=/usr/local
# Build Library Prefix -- libraries will be built here
BLPREFIX=$(PWD)/buildlibs
# Build Library Prefix -- libraries will be built here
BLPREFIX=$(PWD)/buildlibs
# Superuser access command... if needed
SUDO=
# Package naming to use (DO NOT brand your custom toolchain as "CodeSourcery")
PKGVERSION="Luminary Micro Stellaris Toolchain; Eze Corp Build"
BUGURL=http://a64/wiki/
# Package directory names
BINUTILS=binutils-stable
CLOOG=cloog-0.15
EXPAT=expat-mirror
GCC=gcc-4.4
GDB=gdb-stable
MPFR=mpfr-stable
NEWLIB=newlib-stable
PPL=ppl-0.10.2
##### Tasks begin here #####
.PHONY: all
all: $(WORKDIR)/gdb/.install
%/.md:
-mkdir $(@D)
[ -f $@ ] || touch $@
$(UNPACKDIR)/$(MPFR)/.unpacked: $(SRCDIR)/mpfr-$(CS_VER).tar.bz2 $(UNPACKDIR)/.md
tar -C $(UNPACKDIR) -xjvf $<
[ -f $@ ] || touch $@
$(UNPACKDIR)/$(PPL)/.unpacked: $(SRCDIR)/ppl-$(CS_VER).tar.bz2 $(UNPACKDIR)/.md
tar -C $(UNPACKDIR) -xjvf $<
[ -f $@ ] || touch $@
$(UNPACKDIR)/$(CLOOG)/.unpacked: $(SRCDIR)/cloog-$(CS_VER).tar.bz2 $(UNPACKDIR)/.md
tar -C $(UNPACKDIR) -xjvf $<
[ -f $@ ] || touch $@
$(UNPACKDIR)/$(BINUTILS)/.unpacked: $(SRCDIR)/binutils-$(CS_VER).tar.bz2 $(UNPACKDIR)/.md
tar -C $(UNPACKDIR) -xjvf $<
[ -f $@ ] || touch $@
$(UNPACKDIR)/$(GCC)/.unpacked: $(SRCDIR)/gcc-$(CS_VER).tar.bz2 $(UNPACKDIR)/.md
tar -C $(UNPACKDIR) -xjvf $<
[ -f $@ ] || touch $@
$(UNPACKDIR)/$(NEWLIB)/.unpacked: $(SRCDIR)/newlib-$(CS_VER).tar.bz2 $(UNPACKDIR)/.md
tar -C $(UNPACKDIR) -xjvf $<
[ -f $@ ] || touch $@
$(UNPACKDIR)/$(EXPAT)/.unpacked: $(SRCDIR)/expat-$(CS_VER).tar.bz2 $(UNPACKDIR)/.md
tar -C $(UNPACKDIR) -xjvf $<
[ -f $@ ] || touch $@
$(UNPACKDIR)/$(GDB)/.unpacked: $(SRCDIR)/gdb-$(CS_VER).tar.bz2 $(UNPACKDIR)/.md
tar -C $(UNPACKDIR) -xjvf $<
[ -f $@ ] || touch $@
$(WORKDIR)/mpfr/.md: $(WORKDIR)/.md
$(WORKDIR)/mpfr.deps-installed:
touch $@
$(WORKDIR)/mpfr/.config: $(UNPACKDIR)/$(MPFR) $(WORKDIR)/mpfr/.md $(BLPREFIX)/.md $(WORKDIR)/mpfr.deps-installed
cd $(@D) ; \
CC_FOR_BUILD=$(CROSS_COMPILE)gcc \
CC=$(CROSS_COMPILE)gcc \
AR=$(CROSS_COMPILE)ar \
RANLIB=$(CROSS_COMPILE)ranlib \
$(UNPACKDIR)/$(MPFR)/configure \
--build=$(BUILD) \
--target=$(TARGET) \
--host=$(HOST) \
--prefix=$(BLPREFIX) \
--disable-shared
touch $@
$(WORKDIR)/ppl/.md: $(WORKDIR)/.md
$(WORKDIR)/ppl.deps-installed:
touch $@
$(WORKDIR)/ppl/.config: $(UNPACKDIR)/$(PPL)/.unpacked $(WORKDIR)/ppl/.md $(BLPREFIX)/.md $(WORKDIR)/ppl.deps-installed
cd $(@D) ; \
CC_FOR_BUILD=$(CROSS_COMPILE)gcc \
CC=$(CROSS_COMPILE)gcc \
AR=$(CROSS_COMPILE)ar \
RANLIB=$(CROSS_COMPILE)ranlib \
$(UNPACKDIR)/$(PPL)/configure \
--build=$(BUILD) \
--target=$(TARGET) \
--host=$(HOST) \
--prefix=$(BLPREFIX) \
--disable-shared \
--disable-nls
touch $@
$(WORKDIR)/cloog/.md: $(WORKDIR)/.md
$(WORKDIR)/cloog.deps-installed: $(WORKDIR)/ppl/.install
touch $@
$(WORKDIR)/cloog/.config: $(UNPACKDIR)/$(CLOOG)/.unpacked $(WORKDIR)/cloog/.md $(BLPREFIX)/.md $(WORKDIR)/cloog.deps-installed
cd $(@D) ; \
CC_FOR_BUILD=$(CROSS_COMPILE)gcc \
CC=$(CROSS_COMPILE)gcc \
AR=$(CROSS_COMPILE)ar \
RANLIB=$(CROSS_COMPILE)ranlib \
$(UNPACKDIR)/$(CLOOG)/configure \
--build=$(BUILD) \
--target=$(TARGET) \
--host=$(HOST) \
--prefix=$(BLPREFIX) \
--disable-shared \
--disable-nls \
--with-ppl=$(BLPREFIX)
touch $@
$(WORKDIR)/binutils/.md: $(WORKDIR)/.md
$(WORKDIR)/binutils.deps-installed: $(WORKDIR)/mpfr/.install $(WORKDIR)/ppl/.install $(WORKDIR)/cloog/.install
touch $@
$(WORKDIR)/binutils/.config: $(UNPACKDIR)/$(BINUTILS)/.unpacked $(WORKDIR)/binutils/.md $(WORKDIR)/binutils.deps-installed
cd $(@D) ; \
CC_FOR_BUILD=$(CROSS_COMPILE)gcc \
CC=$(CROSS_COMPILE)gcc \
AR=$(CROSS_COMPILE)ar \
RANLIB=$(CROSS_COMPILE)ranlib \
$(UNPACKDIR)/$(BINUTILS)/configure \
--build=$(BUILD) \
--target=$(TARGET) \
--prefix=$(PREFIX) \
--host=$(HOST) \
--with-pkgversion=$(PKGVERSION) \
--with-bugurl=$(BUGURL) \
--with-mpfr=$(BLPREFIX) \
--with-ppl=$(BLPREFIX) \
--with-cloog=$(BLPREFIX) \
--disable-nls
touch $@
$(WORKDIR)/binutils/.install: $(WORKDIR)/binutils/.build
sudo $(MAKE) -C $(@D) \
installdirs \
install-host \
install-target
touch $@
# task [055/174] /$(CROSS_COMPILE)/toolchain/gcc_first/configure
$(WORKDIR)/gcc-s1/.md: $(WORKDIR)/.md
$(WORKDIR)/gcc-s1.deps-installed: $(WORKDIR)/binutils/.install $(WORKDIR)/mpfr/.install $(WORKDIR)/ppl/.install $(WORKDIR)/cloog/.install
touch $@
$(WORKDIR)/gcc-s1/.config: $(UNPACKDIR)/$(GCC)/.unpacked $(WORKDIR)/gcc-s1/.md $(WORKDIR)/gcc-s1.deps-installed
cd $(@D) ; \
CC_FOR_BUILD=$(CROSS_COMPILE)gcc \
CC=$(CROSS_COMPILE)gcc \
AR=$(CROSS_COMPILE)ar \
RANLIB=$(CROSS_COMPILE)ranlib \
AR_FOR_TARGET=arm-none-eabi-ar \
NM_FOR_TARGET=arm-none-eabi-nm \
OBJDUMP_FOR_TARET=arm-none-eabi-objdump \
STRIP_FOR_TARGET=arm-none-eabi-strip \
gcc_cv_as_cfi_directive=no \
$(UNPACKDIR)/$(GCC)/configure \
--build=$(BUILD) \
--host=$(HOST) \
--target=$(TARGET) \
--disable-libmudflap \
--disable-libstdcxx-pch \
--enable-extra-sgxxlite-multilibs \
--with-gnu-as \
--with-gnu-ld \
'--with-specs=%{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' \
--disable-lto \
--with-newlib \
--with-pkgversion=$(PKGVERSION) \
--with-bugurl=$(BUGURL) \
--disable-nls \
--prefix=$(PREFIX) \
--disable-shared \
--disable-threads \
--disable-libssp \
--disable-libgomp \
--without-headers \
--with-newlib \
--disable-decimal-float \
--disable-libffi \
--enable-languages=c \
--with-mpfr=$(PREFIX) \
--with-ppl=$(PREFIX) \
'--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \
--with-cloog=$(PREFIX) \
--disable-libgomp
touch $@
$(WORKDIR)/gcc-s1/.install: $(WORKDIR)/gcc-s1/.build
sudo $(MAKE) -C $(@D)/gcc \
install-common \
install-cpp \
install- \
install-driver
touch $@
# task [059/174] /$(CROSS_COMPILE)/toolchain/newlib/configure
$(WORKDIR)/newlib/.md: $(WORKDIR)/.md
$(WORKDIR)/newlib.deps-installed: $(WORKDIR)/gcc-s1/.install
touch $@
$(WORKDIR)/newlib/.config: $(UNPACKDIR)/$(NEWLIB)/.unpacked $(WORKDIR)/newlib/.md $(WORKDIR)/newlib.deps-installed
cd $(@D) ; \
CC_FOR_BUILD=$(CROSS_COMPILE)gcc \
CC=$(CROSS_COMPILE)gcc \
AR=$(CROSS_COMPILE)ar \
RANLIB=$(CROSS_COMPILE)ranlib \
CFLAGS_FOR_TARGET='-g -O2 -fno-unroll-loops' \
$(UNPACKDIR)/$(NEWLIB)/configure \
--build=$(BUILD) \
--target=$(TARGET) \
--prefix=$(PREFIX) \
--host=$(HOST) \
--enable-newlib-io-long-long \
--disable-newlib-supplied-syscalls \
--disable-libgloss \
--disable-newlib-supplied-syscalls \
--disable-nls
touch $@
# task [063/174] /$(CROSS_COMPILE)/toolchain/gcc_final/configure
$(WORKDIR)/gcc-s2/.md: $(WORKDIR)/.md
$(WORKDIR)/gcc-s2.deps-installed: $(WORKDIR)/newlib/.install
touch $@
$(WORKDIR)/gcc-s2/.config: $(UNPACKDIR)/$(GCC)/.unpacked $(WORKDIR)/gcc-s2/.md $(WORKDIR)/gcc-s2.deps-installed
cd $(@D) ; \
CC_FOR_BUILD=$(CROSS_COMPILE)gcc \
CC=$(CROSS_COMPILE)gcc \
AR=$(CROSS_COMPILE)ar \
RANLIB=$(CROSS_COMPILE)ranlib \
AR_FOR_TARGET=arm-none-eabi-ar \
NM_FOR_TARGET=arm-none-eabi-nm \
OBJDUMP_FOR_TARET=arm-none-eabi-objdump \
STRIP_FOR_TARGET=arm-none-eabi-strip \
gcc_cv_as_cfi_directive=no \
$(UNPACKDIR)/$(GCC)/configure \
--build=$(BUILD) \
--host=$(HOST) \
--target=$(TARGET) \
--enable-threads \
--disable-libmudflap \
--disable-libssp \
--disable-libstdcxx-pch \
--enable-extra-sgxxlite-multilibs \
--with-gnu-as \
--with-gnu-ld \
'--with-specs=%{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' \
--enable-languages=c,c++ \
--disable-shared \
--disable-lto \
--with-newlib \
--with-pkgversion=$(PKGVERSION) \
--with-bugurl=$(BUGURL) \
--disable-nls \
--prefix=$(PREFIX) \
--with-headers=yes \
--with-mpfr=$(PREFIX) \
--with-ppl=$(PREFIX) \
'--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \
--with-cloog=$(PREFIX) \
--disable-libgomp
touch $@
$(WORKDIR)/gcc-s2/.install: $(WORKDIR)/gcc-s2/.build
sudo $(MAKE) -C $(@D)/gcc \
install-common \
install-cpp \
install- \
install-driver
touch $@
# task [071/174] /$(CROSS_COMPILE)/toolchain/expat/0/configure
$(WORKDIR)/expat/.md: $(WORKDIR)/.md
$(WORKDIR)/expat.deps-installed: $(WORKDIR)/gcc-s2/.install
touch $@
$(WORKDIR)/expat/.config: $(UNPACKDIR)/$(EXPAT)/.unpacked $(WORKDIR)/expat/.md $(WORKDIR)/expat.deps-installed
cd $(@D) ; \
CC_FOR_BUILD=$(CROSS_COMPILE)gcc \
CC=$(CROSS_COMPILE)gcc \
AR=$(CROSS_COMPILE)ar \
RANLIB=$(CROSS_COMPILE)ranlib \
$(UNPACKDIR)/$(EXPAT)/configure \
--build=$(BUILD) \
--target=$(TARGET) \
--prefix=$(PREFIX) \
--disable-shared \
--host=$(HOST) \
--disable-nls
touch $@
# task [075/174] /$(CROSS_COMPILE)/toolchain/gdb/0/configure
$(WORKDIR)/gdb/.md: $(WORKDIR)/.md
$(WORKDIR)/gdb.deps-installed: $(WORKDIR)/expat/.install
touch $@
$(WORKDIR)/gdb/.config: $(UNPACKDIR)/$(GDB)/.unpacked $(WORKDIR)/gdb/.md $(WORKDIR)/gdb.deps-installed
cd $(@D) ; \
CC_FOR_BUILD=$(CROSS_COMPILE)gcc \
CC=$(CROSS_COMPILE)gcc \
AR=$(CROSS_COMPILE)ar \
RANLIB=$(CROSS_COMPILE)ranlib \
$(UNPACKDIR)/$(GDB)/configure \
--build=$(BUILD) \
--target=$(TARGET) \
--prefix=$(PREFIX) \
--host=$(HOST) \
--with-pkgversion=$(PKGVERSION) \
--with-bugurl=$(BUGURL) \
--disable-nls \
--with-libexpat-prefix=$(PREFIX)
touch $@
$(WORKDIR)/%/.build: $(WORKDIR)/%/.config $(WORKDIR)/%.deps-installed
$(MAKE) -C $(@D)
touch $@
$(WORKDIR)/%/.install: $(WORKDIR)/%/.build
CC_FOR_BUILD=$(CROSS_COMPILE)gcc \
CC=$(CROSS_COMPILE)gcc \
AR=$(CROSS_COMPILE)ar \
RANLIB=$(CROSS_COMPILE)ranlib \
$(SUDO) $(MAKE) -C $(@D) install
touch $@
-------------- next part --------------
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list