Help with Cross Compile of first HelloWorld App

363 views
Skip to first unread message

RV9Flyer

unread,
Apr 9, 2014, 7:20:47 PM4/9/14
to beagl...@googlegroups.com
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!!

Thanks

Here is my environment info and build output:

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

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 (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 
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,"HelloBeagle.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)


halh...@gmail.com

unread,
Apr 10, 2014, 9:57:03 AM4/10/14
to beagl...@googlegroups.com
RV9Flyer,
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.

Hussam

Piotr Murawski

unread,
Apr 10, 2014, 10:28:02 AM4/10/14
to beagl...@googlegroups.com
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.

Regards,
Piotr.

Hussam Hertani

unread,
Apr 10, 2014, 5:03:49 PM4/10/14
to beagl...@googlegroups.com
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.


--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/8t7XwDdd6ZI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

kbeh...@cascadiasoftware.com

unread,
Apr 10, 2014, 6:35:19 PM4/10/14
to beagl...@googlegroups.com
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? 

ee14mte...@iith.ac.in

unread,
May 31, 2017, 7:17:54 AM5/31/17
to BeagleBoard
here what does dec 221812 hex 36274 represents?

Przemek Klosowski

unread,
May 31, 2017, 9:14:49 AM5/31/17
to beagl...@googlegroups.com
On Wed, May 31, 2017 at 6:23 AM, ee14mtech11049 via BeagleBoard <beagl...@googlegroups.com> wrote:
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


--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/7fd10f76-e2e1-4e3b-a928-1baa94a6c5a6%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages