How to setup arm-linux-gnuabihf cross-compile ? [message #1784545] |
Thu, 29 March 2018 08:07  |
Eclipse User |
|
|
|
Hello,
I am trying to run cross-compile with arm-linux-gnuabihf for my developementboard with an armv7 (cortex-a9) with arm-ds-5 which is based on the eclipse enviroment. First im trying to run a simple "Helloworld" to validate the settings, but i have run into problems i somehow cannot overcome.
What i have done so far is to generate a linux with buildroot with a gdbserver to run on my board. Gdb-multiarch is installed on the host. The arm-linux-gnueabihf is installed on the host. I have compiled a Helloworld with the toolchain and was able to cross-compile with it on the board via commandline, so there shouldnt be any problem with these programs.
The ssh connection is setup as well and i am able to connect to the board properly.
Eclipse knows there is a arm-linux-gnueabihf and i can choose the toolchain inside eclipse (i used add_toolchain and select_default_toolchain to do this).
I created a new empty executable Project and added a sorce file for a Helloworld program (the same i used for command line test):
#include <stdio.h>
int main()
{
printf("Hello");
return 0;
}
The debug configurations for a c/c++ remote application point to the project and the executable hello file. The build configuration is set to Debug.
GDB debugger is set to gdb-multiarch ant the commant file is .gdbinit. Other settings are default.
So the first error i have is that the project doesnt get build correctly.
When running:
arm-linux.gnueabihf-gcc -o "Hello" ./hello.o
I get an error:
./hello.o: file not recognized: File format not recognized
collect2: error : ld returned 1 exit status
make: *** [Hello] Error 1
So when i run debug i will be asked if i want to proceed anyway and if i want to switch in debug view. In debug view i get a window which states "No source available for "__libc_csu_init() at 0x840c"" but I AM ABLE TO DEBUG in assembler.
I would like to debug directly from my sourcefile like normal people do, but i dont know how to accomplish that.
I am using ubuntu 14.04 64-bit the arm processor is 32-bit maybe there is some problem.
I would like to use eclipse under Windows, too, but i dont know how to setup mingw correctly (i think i need mingw).
So i basicly have 3 Problems in short:
1.) ERROR: ./hello.o: file not recognized: File format not recognized
2.) ERROR: No source available for "__libc_csu_init() at 0x840c
3.) Setting up MinGW for eclipse on win10
Any hints or solutions are highly appreciated. If anything is unclear give me a chance to be more specific. Although i belive i postet my thread in the correct location, please relocate this threat if i am mistaking.
|
|
|
|
Re: How to setup arm-linux-gnuabihf cross-compile ? [message #1784648 is a reply to message #1784647] |
Sun, 01 April 2018 02:58   |
Eclipse User |
|
|
|
Hello Again,
I know things get complicated. I tried to cross-compile w/ crosstools-ng on Ubuntu 16.04 and I have been unsuccessful so far. Are you following along in a book right now?
Seth
P.S. I was using a VMware workstation to attempt this idea but I am going to try again on an Ubuntu Desktop Distro next. I am cutting out the middle man.
|
|
|
|
Re: How to setup arm-linux-gnuabihf cross-compile ? [message #1784715 is a reply to message #1784650] |
Tue, 03 April 2018 07:34   |
Eclipse User |
|
|
|
First of all thanks for the replies i will work them through and give an update what has changed.
@Seth: No i dont have a book. Right now i am trying anything on the internet to accomplish this task. Unsuccessfull so far. I will read your link as soon as possible thanks.
@David: Thanks for the hint to the right forum.
Eclipse has not build an executable for me that is probably right. I have at some stage manually compiled with arm-linux-gnuabi-gcc from command line, that is how i got my executable.
I will read your links thank you. I will try to build hello for my host maschine and report
|
|
|
Re: How to setup arm-linux-gnuabihf cross-compile ? [message #1784750 is a reply to message #1784545] |
Tue, 03 April 2018 14:13   |
Eclipse User |
|
|
|
So i managed to setup the same project for the host machine and it works. Somehow some libs where included wrong so i had to delete these wrong libs. After that the Helloworld runs normally for the host.
The errors for the target machine remain the same but the changes i made were global so this is somehow a dead end.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03042 seconds