Help with Cross Compile of first HelloWorld App

I’m a newbie and this is my first post.

I just got started with building my first HelloWorld style app to test the cross-compile capabilities of Eclipse/CDT, The app compiles successfully and generate the expected HelloBeagle.elf executable. However, when I transfer it to my beagle and attempt to run, I get an “Illegal instruction” error.

I’ve watched every video I could find (Thanks Derek Malloy) and I still can’t find the reason for the error. Obviously it’s not generating the right code base, but the build output does show that it it aimed for the cortex-a8 processor which I believe is correct for the beaglebone black.

I would appreciate any suggestions or ideas!!


Here is my environment info and build output:

Build Environment:
Windows 7
Eclipse Kepler SR2
GNU ARM Eclipse Plug-in

Beaglebone Black: (Angstrom Distro)
Linux beaglebone 3.8.13 #1 SMP Wed Sep 4 09:09:32 CEST 2013 armv7l GNU/Linux

Build output:

16:11:12 **** Build of configuration Debug for project HelloBeagle ****
make pre-build main-build
arm-none-eabi-gcc --version
arm-none-eabi-gcc.exe (GNU Tools for ARM Embedded Processors) 4.8.3 20140228 (release) [ARM/embedded-4_8-branch revision 208322]
Copyright © 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO

Building file: …/src/HelloBeagle.cpp
Invoking: Cross ARM C++ Compiler
arm-none-eabi-g++ -mcpu=cortex-a8 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -g3 -MMD -MP -MF"src/HelloBeagle.d" -MT"src/HelloBeagle.d" -c -o “src/HelloBeagle.o” “…/src/HelloBeagle.cpp”
Finished building: …/src/HelloBeagle.cpp

Building target: HelloBeagle.elf
Invoking: Cross ARM C++ Linker
arm-none-eabi-g++ -mcpu=cortex-a8 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -g3 -Xlinker --gc-sections -Wl,-Map,“” --specs=rdimon.specs -Wl,–start-group -lgcc -lc -lc -lm -lrdimon -Wl,–end-group -o “HelloBeagle.elf” ./src/HelloBeagle.o
Finished building target: HelloBeagle.elf

Invoking: Cross ARM GNU Create Flash Image
arm-none-eabi-objcopy -O ihex “HelloBeagle.elf” “HelloBeagle.hex”
Finished building: HelloBeagle.hex

Invoking: Cross ARM GNU Print Size
arm-none-eabi-size --format=berkeley “HelloBeagle.elf”
text data bss dec hex filename
211304 2732 7776 221812 36274 HelloBeagle.elf
Finished building: HelloBeagle.siz

16:11:28 Build Finished (took 16s.236ms)

the arm-none-eabi-gcc cross-compiler is in my humble understanding intended for use with’ bare-metal’ ‘non-mmu’ ‘sans Linux’ ARM microcontrollers…specifically the Cortex-R/Cortex-M cores.

You need to use a different toolchain for Linux-based, MMU-based Cortex-A setups such as that of the beaglebone black. typically the cross-compiler toolchain that you should use should be called arm-linux-gnueabiXX-gcc. I’m not sure where you can get such a toolchain for angstrom…you could probably build it with openembedded/yocto.


Just compile the kernel following the commonly known instructions for BBB. On of the step, will download appropriate gcc toolchain, it will be named like “gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/”.
That’s it.


W dniu czwartek, 10 kwietnia 2014 01:20:47 UTC+2 użytkownik RV9Flyer napisał:

Piotr I know that the linaro toolchain will work with Debian/Ubuntu armhf images

. Will it also work in the same way with angstrom?

…I thought that angstrom needed a different toolchain for cross-compiling applications. But I could be wrong.

Not sure I want to dive into compiling a new kernel just yet. heck, can’t even get a hello world running, although I can compile just fine on the BBB. Is there a specific toolchain for Eclipse for angstrom for the cortex-a8?

here what does dec 221812 hex 36274 represents?

here what does dec 221812 hex 36274 represents?

  text data bss dec hex filename

211304 2732 7776 221812 36274 HelloBeagle.elf

text segment size ( 211304) plus data segment size (2732) plus BSS/zeroed
segment size (7776) equals the total program size 221812, which written as
a hex number is 0x36274