Hello all I am new to Beaglebone. I got an issue when I setup the Eclipse for cross compilation of my code on my Windows 10 platform.
I follow the instruction in “HelloBone - HelloBone” and everything works fine. My code can be compiled successfully.
But when I tried to run the code on my BBB, “Launching hellobone Default” has encounter problem" occurs.
When I checked my BBB with SSH, I found that the object file can be loaded to my target folder but it is not an executable one.
I checked my Run Configuration , I had added a commands to execute before application “chmod +x /home/debian/hellobone/hellobone”. This is an absolute path but this didn’t work. I have searched for a solution for it but may be I am stupid and still can’t solve it. May I ask if anyone can help me to get some hints to solve it? Thank you very much guys.
I’m not fully there yet as well and doing this in the background and when my attention comes back around, will fix my mis-configured cross-platform debug. But that’s for another day.
To throw my “clue” into this thread…
Watch the toolchain and output format.
I did get a binary that ran, but not at first. I’d installed an ARM toolchain for the AM3358 (either off the ARM or TI websites) and attempt(s) to execute got a “Segmentation Fault” error. They didn’t build a binary image that the linux environment understood.
Setting the toolchain to “gcc-arm-10.3-2021.07-mingw-w64-i686-arm-none-linux-gnueabihf”, and making sure it produced “elf” binaries got me the executable.
There are many solutions to this, but I did post some suggestions on a thread in the old forum some time back.
Try downloading the gcc-linaro-7.5.0-2019.12-i686-mingw32_arm-linux-gnueabihf toolchain and set the Cross Settings to reference this:
Just unpack the file and reference it in Eclipse.
Path: “Path to the toolchain”
NOTE: Since the BB is 32 bit ensure you are selecting a 32 bit toolchain.
Set Tool Chain Editor to:
Current toolchains: Cross GCC
Current builder: CDT Internal Builder
This works for me with Eclipse 2019
Other references are:
Derek Molloy’s Exploring BB. It is a bit older:
Or Jan Cumps post on element14:
I did this w/ the Eclipse IDE on Windows 10 some time back for a couple of ideas relating to CC to the BBB b/c of motors and a SDK from ClearPath Teknic ideas.
I think since then, their SDK, has become a bit of an easy make, native compilation though.
P.S. But, if people are still wanting to produce on Eclipse either from Win or Linux, the toolchain and whereabouts of the toolchain are extremely important is what I remember. Anyway, ARM makes a toolchain for Win 64-bit too. I am not completely sure about Linaro as of now but I know ARM has them listed on their site, i.e. Arm GNU Toolchain | Arm GNU Toolchain Downloads – Arm Developer .
Depending on the Eclipse IDE you are using. I use the Eclipse IDE for C/C++ Developers version and have used up to the 2021-12 version which works just fine.
If you use a Win 64-bit version of the toolchain you have to ensure you are compiling for the 32-bit BB, otherwise it will not work. It is easier just to pull in the 32-bit toolchain and not fuss with the conversion. Also, I prefer to choose the toolchain myself and not mess with Eclipse doing this. This works fine for me.
I gave the link to the toolchain that works with the BB so I would suggest starting there.
I found this toolchain works as well:
AArch32 target with hard float (arm-none-linux-gnueabihf)
I tried the latest 11.2-2022.02 toolchain but it’s complaining about missing “GLIBC_2.34” on the 4.19 kernel. Perhaps it requires a newer kernel.
Thanks for your advise. I am working on the Windows 10 platform and run the Eclipse on the Windows platform as well.
As per my testing, I can cross-compile the code successfully and the .o file can also be transferred to my designed path on the BBB through the use of the Eclipse.
I have also tested whether the .o file can be executed on the BBB as well. But found that the file is not an executable one. So I “chomd 777” for my .o file. It can be executed after this.
So I suspect that the the commands to execute before application doesn’t take effect and lead to this problem to occurs.
So do you have any idea on this? Thanks!
I think the root cause of my issue is due to why the “Commands to execute before application” doesn’t work. So may I ask if you have any idea in it? Thanks !
Interesting. Are you saying the file that gets created is a .o file?
This should just be the object file and not the executable. The executable on a Linux system should have no extension. It should just be “MyApp”, not “MyApp.o” or “MyApp.exe”.
Also, when I set the Run or Debug configuration I use ssh. This will cause the file to be deployed to the BB and will show it run in the Eclipse console window. You should not have to set the file to being executable. That is unless you are transferring the file as one user and running it as another. This could cause an issue.
For Remote Absolute file Path, from you shown, it should be:
This being " /home/debian/" the destination folder, and “hellobone” file. if you have a folder hellobone under debain, then the path should be set to:
Sorry that the generated file is without any extension. I have mixed it up.
Yes. I would like to run the deployed program on the Eclipse Console Windows. But I failed to do so. When I click the “Run” button, it end up with the following error message
I am very puzzle about it.
Did you change the Remote Absolute File Path in the Remote Application setting in Eclipse to what I listed. What you shown previously would basically cause it to attempt to execute the directory. You need to give the fully qualified path including filename in the Remote Absolute File Path.
I do have a few questions:
1 . If you manually copy the compiled file to the BB, does it run?
2. What version of Eclipse are you running?
3. What version of OS (kernel) are you running on your BB?
Another thing I do is to set ‘Linux Tools Path’ in Properties to “Prepend string to PATH”, select Custom, and add the full path to the gcc-arm toolchain ‘bin’ folder. I’m not sure if this is completely necessary but it does not hurt.
However, if the executable is building and will run on the BB if manually copied to it, then the focus should be on resolving the connection between Eclipse and the BB.
Firstly, I would like to thank you for your advise and your patient to help me to analyze my issue.
I have tried the absolute path that you mentioned but it still comes to an error message. The complied file can be copied automatically to the path /home/debian
Regarding to your questions, here below are my answers
1 . If you manually copy the compiled file to the BB, does it run?
Yes. There is no problem in the complied file. It can be run but I have to change it to be executable first by command “chmod +x hellobone” first manually.
- What version of Eclipse are you running?
My Eclipse Version is : Kepler Service Release 2
- What version of OS (kernel) are you running on your BB?
My Kernal version and Image version is as below
Image Version = Debian Buster IoT Image 2020-04-06
Kernal Version = Debian GNU / Linux 10 (buster)
Yes. I think so too. I am just thinking about what’s wrong in the SSH. It seems that the Eclipse fail to start the SSH section through it.
Is there a reason you are using a 2014 version of Eclipse? Could you download a more recent one such as 2021-12 and try that?
Preferably Eclipse IDE for C/C++ Developers.
When you open it, create a new workspace.
Create a new Project:
Once the project has been created, you set the other Cross Compile options.
All you need to set are:
C/C++ Build->Settings->Cross Settings
- Prefix: arm-none-linux-gnueabihf-
C/C++ Build->Tool Chain Editor
- Set it as such:
- Current toolchain: Cross GCC
- Current builder: CDT Internal Builder
Linux Tools Path:
- Prepend string to PATH
- Options: Custom
- Set the full path to the toolchain ‘bin’ folder
- Apply and close
Set the Run Configuration
To run the application
- Create a main.c source file and add some stuff to it to print something.
- Build it
- Right click on the Project name and select:
- Run As->Run Configurations…
- Select your run config to run the application.
- Compiled file should be ssh’d to your BB and then run which you should see in the Eclipse Console window.
This should run without issue; unless I missed something.
Thank you very much! It is very detail. Let me take time to have a try.
I just following the instruction which is described in Step #2 in http://jkuhlm.bplaced.net/hellobone/. This is reason why I use an 2014 version of Eclipse.
Yeah, that post seems to go back to 2013 so although some of it might be applicable today, I would certainly go with the newer Eclipse and toolchain.
I would not do the import project step though. Just create a new one and work from there.