0

I have a Beaglebone (Rev: A6) and i want to develop C/C++ program in windows 7 using Eclipse and then transfer executable in the board. But i'm having trouble setting up compiler/debugger/toolchain needed for Beaglebone. Searching the internet only gives me how to setup environment in Linux like installing 'arm-linux-gnueabi', setting up the paths to 'includes' etc. I need a step by step instruction to set up the environment in Eclipse in a windows machine. Can anyone help ?

I have tried these steps: 1. I have GNUARM installed on windows. 2. On eclipse IDE i open a C++ project with Corss GCC. 3. From project -> properties -> C/C++ build -> settings i add 'arm-elf-' to every cross compiler command. 4. From the GNUARM installation directory i add few path to '.../include/' in the 'C++ General -> paths and symbos'.

my 'build all' shows something as below:

10:32:20 **** Build of configuration Debug for project h ****
make all 
Building file: ../src/hello.cpp
Invoking: Cross G++ Compiler
arm-elf-g++ -I"C:\GNUARM\include\c++\4.1.1" -I"C:\GNUARM\include\c++\4.1.1\arm-elf" -   I"C:\GNUARM\include\c++\4.1.1\backward" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -  MF"src/hello.d" -MT"src/hello.d" -o "src/hello.o" "../src/hello.cpp"
Finished building: ../src/hello.cpp

Building target: h
Invoking: Cross G++ Linker
arm-elf-g++ -L"C:\GNUARM\lib\gcc\arm-elf\4.1.1\include" -o "h"  ./src/hello.o   
Finished building target: h


10:32:23 Build Finished (took 2s.967ms) 

It is simple 'Hello world' printing program. From the project explorer 'Debug->src->hello.o -[arm/le]' i copy it and when run on beaglebone with

chmod ugo+x hello.o
./hello.o
-sh: ./hello.o: cannot execute binary file    

the above massage is printed. I don't know what i did wrong. Perhaps the ARM environment in eclipse is set up incorrectly.

croc
  • 241
  • 1
  • 4
  • 13

2 Answers2

0

Isn't hello.o the pre-linked object file (just the compiled content of hello.cpp)? It doesn't contain the startup code or any library functions. The linker adds those to produce the final output.

Don't you want to run the linker ouput file h (which should already be executable)?

Martin Thompson
  • 16,395
  • 1
  • 38
  • 56
  • how stupid of me. sorry. yes i should be running the 'h'. But the size of 'h' is 2468566 byets ! too big for a simple hello world program. Anyway when i run it, console shows segmentation fault. root@beaglebone:~# chmod ugo+x h root@beaglebone:~# ./h Segmentation fault Do you think i set up the compilation environment correctly ? – croc Mar 18 '13 at 10:38
  • C++ bloat? http://www.cplusplus.com/forum/beginner/77852/. iostream can pull in an awful lot of code... Can you create a C-version with just puts? – Martin Thompson Mar 18 '13 at 11:04
  • It is possible to code in C. But why the C++ linker output 'h' is not running ? It is showing 'Segmentation fault'. – croc Mar 18 '13 at 11:35
  • Could be all sorts of things - update your question with your new information and see who else has chance to look at it. – Martin Thompson Mar 18 '13 at 13:23
0

i got my answer here. http://www.acmesystems.it/foxg20_eclipse_windows_c. CodeSourcery was the toolchain that i was looking for and this also explains how to setup the corss compiling environment.

croc
  • 241
  • 1
  • 4
  • 13