Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Advice on developing for an embedded ARM7 target
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures
View previous topic :: View next topic  
Author Message
vespaman
Apprentice
Apprentice


Joined: 28 Aug 2002
Posts: 251
Location: Stockholm, Sweden

PostPosted: Fri Sep 05, 2008 8:58 am    Post subject: Advice on developing for an embedded ARM7 target Reply with quote

I have a project that includes running an ARM7 (LPC2387) using;

FreeRtos
gcc
binutils
newlib
gdb
i.e. no linux, no gentoo on this box; totally embedded.

How do this the best way? I set off this morning by downloading all sources, and then read about crossdev, which seams useful for this? Is it?

One of my concern is that I would prefer to be able to come back to this project in say, a few years, and not having to spend time updating the code for the gcc that is 'default' at the
time, will this be an issue if I go the crossdev route?

Thanks,
Micael
Back to top
View user's profile Send private message
vespaman
Apprentice
Apprentice


Joined: 28 Aug 2002
Posts: 251
Location: Stockholm, Sweden

PostPosted: Fri Sep 05, 2008 12:05 pm    Post subject: Reply with quote

OK, so in order to get going, I tried to use crossdev. I admit that I don't understand the 'target part', and I cant find any good source of information for it either. I randomly tried some combinations that I hoped would work, and I got the furthest with;

crossdev -t arm-elf

..but it ends with an error.. :( in that it does not find arm-elf-cc. I can't find it either, but the following stuff appeared;

arm-elf-addr2line arm-elf-c++filt arm-elf-nm arm-elf-ranlib arm-elf-strings
arm-elf-ar arm-elf-gprof arm-elf-objcopy arm-elf-readelf arm-elf-strip
arm-elf-as arm-elf-ld arm-elf-objdump arm-elf-size



Code:

# crossdev -t arm-elf
---------------------------------------------------------------------------------------------------------------------------------
 * Host Portage ARCH:     amd64
 * Target Portage ARCH:   arm
 * Target System:         arm-elf
 * Stage:                 3 (C compiler & libc)

 * binutils:              binutils-[latest]
 * gcc:                   gcc-[latest]
 * libc:                  newlib-[latest]

 * PORTDIR_OVERLAY:       /usr/local/portage
 * PORT_LOGDIR:           /var/log/portage
 * PKGDIR:                /usr/portage/packages/cross/arm-elf
 * PORTAGE_TMPDIR:        /var/tmp/cross/arm-elf
  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~
WARNING: repository at /usr/local/portage is missing a repo_name entry
 * Forcing the latest versions of {binutils,gcc}-config/gnuconfig ...                                                      [ ok ]
 * Log: /var/log/portage/cross-arm-elf-binutils.log
 * Emerging cross-binutils ...                                                                                             [ ok ]
 * Log: /var/log/portage/cross-arm-elf-newlib-headers.log
 * Emerging cross-newlib-headers ...

 * newlib failed :(
 * If you file a bug, please attach the following logfiles:
 * /var/log/portage/cross-arm-elf-info.log
 * /var/log/portage/cross-arm-elf-newlib-headers.log



and /var/log/portage/cross-arm-elf-newlib-headers.log gives;

Code:

WARNING: repository at /usr/local/portage is missing a repo_name entry

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) cross-arm-elf/newlib-1.16.0
 * newlib-1.16.0.tar.gz RMD160 SHA1 SHA256 size ;-) ...                  [ ok ]
 * checking ebuild checksums ;-) ...                                     [ ok ]
 * checking auxfile checksums ;-) ...                                    [ ok ]
 * checking miscfile checksums ;-) ...                                   [ ok ]
>>> Unpacking source...
>>> Unpacking newlib-1.16.0.tar.gz to /var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work
>>> Source unpacked.
>>> Compiling source in /var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0 ...
 * econf: updating newlib-1.16.0/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating newlib-1.16.0/config.sub with /usr/share/gnuconfig/config.sub
/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/configure --prefix=/usr --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --enable-newlib-mb --enable-nls --enable-newlib-hw-fp --enable-threads --libdir=/usr/lib --target=arm-elf --build=x86_64-pc-linux-gnu
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... arm-unknown-elf
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... yes
checking for x86_64-pc-linux-gnu-gcc option to accept ANSI C... none needed
checking for x86_64-pc-linux-gnu-g++... x86_64-pc-linux-gnu-g++
checking whether we are using the GNU C++ compiler... yes
checking whether x86_64-pc-linux-gnu-g++ accepts -g... yes
checking for x86_64-pc-linux-gnu-gnatbind... no
checking for gnatbind... no
checking for x86_64-pc-linux-gnu-gnatmake... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for bison... bison -y
checking for bison... bison
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... makeinfo
checking for expect... no
checking for runtest... no
checking for x86_64-pc-linux-gnu-ar... x86_64-pc-linux-gnu-ar
checking for x86_64-pc-linux-gnu-as... x86_64-pc-linux-gnu-as
checking for x86_64-pc-linux-gnu-dlltool... no
checking for dlltool... no
checking for ld... (cached) /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/../../../../x86_64-pc-linux-gnu/bin/ld
checking for x86_64-pc-linux-gnu-ld... (cached) /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/../../../../x86_64-pc-linux-gnu/bin/ld
checking for x86_64-pc-linux-gnu-lipo... no
checking for lipo... no
checking for x86_64-pc-linux-gnu-nm... x86_64-pc-linux-gnu-nm
checking for x86_64-pc-linux-gnu-ranlib... x86_64-pc-linux-gnu-ranlib
checking for x86_64-pc-linux-gnu-strip... x86_64-pc-linux-gnu-strip
checking for x86_64-pc-linux-gnu-windres... no
checking for windres... no
checking for x86_64-pc-linux-gnu-windmc... no
checking for windmc... no
checking for x86_64-pc-linux-gnu-objcopy... x86_64-pc-linux-gnu-objcopy
checking for x86_64-pc-linux-gnu-objdump... x86_64-pc-linux-gnu-objdump
checking for arm-elf-cc... no
checking for arm-elf-gcc... no
checking for arm-elf-c++... no
checking for arm-elf-g++... no
checking for arm-elf-cxx... no
checking for arm-elf-gxx... no
checking for arm-elf-gcc... no
checking for arm-elf-gcj... no
checking for arm-elf-gfortran... no
checking for arm-elf-ar... arm-elf-ar
checking for arm-elf-as... arm-elf-as
checking for arm-elf-dlltool... no
checking for arm-elf-ld... arm-elf-ld
checking for arm-elf-lipo... no
checking for arm-elf-nm... arm-elf-nm
checking for arm-elf-objdump... arm-elf-objdump
checking for arm-elf-ranlib... arm-elf-ranlib
checking for arm-elf-strip... arm-elf-strip
checking for arm-elf-windres... no
checking for arm-elf-windmc... no
checking where to find the target ar... pre-installed
checking where to find the target as... pre-installed
checking where to find the target cc... pre-installed
checking where to find the target c++... pre-installed
checking where to find the target c++ for libstdc++... pre-installed
checking where to find the target dlltool... pre-installed
checking where to find the target gcc... pre-installed
checking where to find the target gcj... pre-installed
checking where to find the target gfortran... pre-installed
checking where to find the target ld... pre-installed
checking where to find the target lipo... pre-installed
checking where to find the target nm... pre-installed
checking where to find the target objdump... pre-installed
checking where to find the target ranlib... pre-installed
checking where to find the target strip... pre-installed
checking where to find the target windres... pre-installed
checking where to find the target windmc... pre-installed
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether -fkeep-inline-functions is supported... yes
configure: creating ./config.status
config.status: creating Makefile
make[1]: Entering directory `/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build'
Checking multilib configuration for newlib...
mkdir -p -- ./etc
Checking multilib configuration for libgloss...
Configuring in ./etc
mkdir -p -- arm-elf/newlib
mkdir -p -- arm-elf/libgloss
Configuring in arm-elf/newlib
Configuring in arm-elf/libgloss
configure: creating cache ./config.cache
checking for a BSD-compatible install... /usr/bin/install -c
updating cache ./config.cache
configure: creating ./config.status
configure: creating cache ./config.cache
checking for a BSD-compatible install... /usr/bin/install -c
configure: creating cache ./config.cache
checking build system type... checking build system type... x86_64-pc-linux-gnu
x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... checking host system type... arm-unknown-elf
config.status: creating Makefile
checking target system type... arm-unknown-elf
checking whether build environment is sane... make[2]: Entering directory `/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/etc'
for f in standards.info configure.info; do \
          if test -f /var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/etc/`echo $f | sed -e 's/.info$/.texi/'`; then \
            if make "MAKEINFO=makeinfo --split-size=5000000 --split-size=5000000" $f; then \


[..]

Making all in libc
make[4]: Entering directory `/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/newlib/libc'
Making all in argz
make[5]: Entering directory `/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/newlib/libc/argz'
arm-elf-cc -B/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/newlib/ -isystem /var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/newlib/targ-include -isystem /var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/newlib/libc/include -B/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/libgloss/arm -L/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/libgloss/libnosys -L/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/libgloss/arm -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.16.0\" -DPACKAGE_STRING=\"newlib\ 1.16.0\" -DPACKAGE_BUGREPORT=\"\" -I. -I/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/newlib/libc/argz -O2 -DARM_RDI_MONITOR -fno-builtin      -O2 -g -march=nocona -O2 -pipe   -c -o lib_a-dummy.o `test -f 'dummy.c' || echo '/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/newlib/libc/argz/'`dummy.c
arm-elf-cc -B/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/newlib/ -isystem /var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/newlib/targ-include -isystem /var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/newlib/libc/include -B/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/libgloss/arm -L/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/libgloss/libnosys -L/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/libgloss/arm -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.16.0\" -DPACKAGE_STRING=\"newlib\ 1.16.0\" -DPACKAGE_BUGREPORT=\"\" -I. -I/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/newlib/libc/argz -O2 -DARM_RDI_MONITOR -fno-builtin      -O2 -g -march=nocona -O2 -pipe   -c -o lib_a-argz_add.o `test -f 'argz_add.c' || echo '/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/newlib/libc/argz/'`argz_add.c
arm-elf-cc -B/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/newlib/ -isystem /var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/newlib/targ-include -isystem /var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/newlib/libc/include -B/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/libgloss/arm -L/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/libgloss/libnosys -L/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/libgloss/arm -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.16.0\" -DPACKAGE_STRING=\"newlib\ 1.16.0\" -DPACKAGE_BUGREPORT=\"\" -I. -I/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/newlib/libc/argz -O2 -DARM_RDI_MONITOR -fno-builtin      -O2 -g -march=nocona -O2 -pipe   -c -o lib_a-argz_add_sep.o `test -f 'argz_add_sep.c' || echo '/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/newlib-1.16.0/newlib/libc/argz/'`argz_add_sep.c
/bin/sh: arm-elf-cc: command not found
/bin/sh: arm-elf-cc: command not found
make[5]: *** [lib_a-dummy.o] Error 127/bin/sh: arm-elf-cc: command not found

make[5]: *** Waiting for unfinished jobs....
make[5]: *** [lib_a-argz_add.o] Error 127
make[5]: *** [lib_a-argz_add_sep.o] Error 127
make[5]: Leaving directory `/var/tmp/cross/arm-elf/portage/cross-arm-elf/newlib-1.16.0/work/build/arm-elf/newlib/libc/argz'
Making all in stdlib

[..]


And then there's a few similar errors.


Any suggestions? Did I get the target right?


Last edited by vespaman on Fri Sep 05, 2008 1:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3731

PostPosted: Fri Sep 05, 2008 1:13 pm    Post subject: Reply with quote

i think you should have a look to this -> http://www.gentoo.org/proj/en/base/embedded/handbook/ , it clarified a lot of things for me when i first played with several arm5 based devices.

Quote:
How do this the best way?


well, that´s your decission of course, but i use gentoo because it allows me to quickly create a toolchain to build some stuff and copy it to the target device(s). Other possibilities are f.ex. crosstool or maybe buildroot ( an awesome project btw) but if you are already running gentoo and you are familiar with it, why wouldn´t you use it, right ? ;)

Quote:
Any suggestions? Did I get the target right?


hopefully you will find the answer in section 3.b of the guide. I have only tried eabi and have no idea about newlib.

hope this helps you a bit further !

cheers
( will inform the mods to move this to the "Gentoo on Alternative Architectures" section - you should get more help there).
_________________
Error: Failing not supported by current locale
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31884
Location: 56N 3W

PostPosted: Fri Sep 05, 2008 1:50 pm    Post subject: Reply with quote

Moved from Portage & Programming to Gentoo on Alternative Architectures.

There is a gentoo-embedded project they also have a channel on freenode, probably #gentoo-embedded
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
vespaman
Apprentice
Apprentice


Joined: 28 Aug 2002
Posts: 251
Location: Stockholm, Sweden

PostPosted: Fri Sep 05, 2008 1:55 pm    Post subject: Reply with quote

Thanks,

I have read the embedded handbook, and while it spreads som light, 3b does not mention newlib at all (while crossdev does).

And using a line like;

# crossdev -t arm-unknown-elf-newlib

.. only gives

checking target system type... Invalid configuration `arm-unknown-elf-newlib': machine `arm-unknown-elf' not recognized

So, that's why I was happy to see that a simple -t arm-elf at least continues the make a few steps further.
:?
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3731

PostPosted: Fri Sep 05, 2008 2:40 pm    Post subject: Reply with quote

ok, i searched a bit in bugzilla and found this, which looks like a similar issue.
Does it work if you run :

crossdev -t arm-elf --without-headers

?

maybe not using latest versions of everything may help a bit too, specially the gcc version can be a critical part.

Quote:
3b does not mention newlib at all


all it says is : [...]When you use elf as the operating system, you're actually saying you do not want to run an operating system at all, but just some code directly on the hardware. This is almost exclusively accomplished with newlib (with help from libgloss)[...], just in case this helps you.

cheers
_________________
Error: Failing not supported by current locale
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31884
Location: 56N 3W

PostPosted: Fri Sep 05, 2008 3:09 pm    Post subject: Reply with quote

vespaman,

Have you seen handhelds.org ?

Familiar is a Linux for handheld devices, including some ARM based ones.
If you cannot use familiar directly, they used to have directions for getting a cross development system running.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
vespaman
Apprentice
Apprentice


Joined: 28 Aug 2002
Posts: 251
Location: Stockholm, Sweden

PostPosted: Fri Sep 05, 2008 4:20 pm    Post subject: Reply with quote

gringo wrote:
ok, i searched a bit in bugzilla and found this, which looks like a similar issue.
Does it work if you run :

crossdev -t arm-elf --without-headers



Thanks a lot for finding that one! I have yet to test, but it is exactly the error that i get, so I am fairly confident that this will indeed fix the issue.

:D
Back to top
View user's profile Send private message
vespaman
Apprentice
Apprentice


Joined: 28 Aug 2002
Posts: 251
Location: Stockholm, Sweden

PostPosted: Fri Sep 05, 2008 4:23 pm    Post subject: Reply with quote

NeddySeagoon wrote:
vespaman,

Have you seen handhelds.org ?

Familiar is a Linux for handheld devices, including some ARM based ones.
If you cannot use familiar directly, they used to have directions for getting a cross development system running.


For this project, familiar is (far) too heavy. But it looks interesting enough to learn some more about. Maybe the next project would benefit from it!
Back to top
View user's profile Send private message
vespaman
Apprentice
Apprentice


Joined: 28 Aug 2002
Posts: 251
Location: Stockholm, Sweden

PostPosted: Sat Sep 06, 2008 11:25 am    Post subject: Reply with quote

vespaman wrote:
gringo wrote:
ok, i searched a bit in bugzilla and found this, which looks like a similar issue.
Does it work if you run :

crossdev -t arm-elf --without-headers



Thanks a lot for finding that one! I have yet to test, but it is exactly the error that i get, so I am fairly confident that this will indeed fix the issue.

:D



:D .. and it did! crossdev really saved me some time once I got the line right.
Back to top
View user's profile Send private message
regomodo
Guru
Guru


Joined: 25 Mar 2008
Posts: 445

PostPosted: Tue Apr 06, 2010 10:19 pm    Post subject: Reply with quote

I know this is necro-bumping but I just had the same error.

Found that using --without headers and not using -S worked for me to get rid of the newlibs errors.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum