2013. szeptember 24., kedd

Building BeagleBone Black Cross compiler environment. UPDATED TOOLCHAIN LINKS


Ok, I'll write this post in English, so it might be helpful to someone else having the same problems.
So what I'm trying to do here is to use Eclipse in Ubuntu to develop C/C++ software for my BeagleBone Black. The goal is to have Eclipse to Cross Compile and upload the software, and then debug remotely, from Eclipse.
You might want to ask, why did you make another tutorial, there are loads of them on the internet. Well, because this works. I've followed 4(!) separate tutorials, but since I'm a linux-noob, something always went wrong.
Michael Leonard has a fairly well written article about building the cross compiler environment, but it has several errors. The end result is a "Segmentation fault" error. And that's that.
Also, I have discovered the post of Garagelab about building the environment, but nothing about the remote execution. This one works though, but not quite as I wanted. After following the steps carefully I ended up giving over the ownership of my "Downloads" folder to the root. Don't ask how, I'm a linux noob, remember?
My good news is this though: If you are a noob as well, but you follow what I write here, you'll see that reassuring "Hello Beagle" (or whatever makes you happy) line on the bottom of your virtual console.
Anyone reading this, please feel free to comment below.
So let's dig into it!

1)

First step is to install Eclipse. Some tutorial-writers skip certain steps, because they seem to be obvious, but that causes a lot of problems to the students sometimes.
So install Eclipse C/C++ edition using the Ubuntu software manager. It should be very simple.
sudo apt-get install eclipse eclipse-cdt g++ gcc
This will also make sure thet our system has c/c++ compiler ready.
So now we can develop C/C++ applications for our desktop system.

UPDATE:
For whatever mysterious reason the Angstrom Distribution has deleted the toolchains from its website.
It can still be accessed through this link:
http://web.archive.org/web/20130823131954/http://www.angstrom-distribution.org/toolchains/

Moreover, I have downloaded the whole bunch and stored it in multiple cloud services, so it's always available.
I published the downloaded files here:
 

2)

Next, you need to download the proper cross-compilers. VERY IMPORTANT! I don't know, whether I had segmentation fault errors because of my 64bit OS or not, but download the proper package from here: http://www.angstrom-distribution.org/toolchains/For me, angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2 worked fine. x86_64 because of my OS, armv7a because the Cortex M8 in the BeagleBone Black is ARMv7-A chip.After you have downloaded it, don't extract it right there for god's sake, because it contains root-owned directories. Instead, create a directory named "angstrom" and open the package with your Archive manager. You need to extract the /./usr/local/angstrom/arm folder wherever you want, then copy it to the angstrom folder you have just created.



3)

Start eclipse. Install (Help->Install new software) Remote System Explorer (select indigo update site, then search for remote, then select Remote System Explorer End-User Runtime)



4)

Good, now create a C or C++ project. I had problems with C++, but now I think it would work as well. But I'll show the C++ version here, because the C version works already, and I wonder if this will as well or not.So File->New->C++ project. Select Hello world project, then just accept and ignore everything else, we'll change them later.



5) Configure cross compiler environment:

Right click on your project in the Project explorer, then select properties. C/C++ Build -> Settings.Here we need to specify the compilers. Remember where you've copied the Angstrom compilers? Now is the time to find them. Locate the angstrom folder, and then replace/add the following (don't change anything else):



CrossGCC compiler: /home/fodi/Documents/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc
Includes: /home/fodi/Documents/angstrom/arm/include
CrossG++ compiler: /home/fodi/Documents/angstrom/arm/bin/arm-angstrom-linux-gnueabi-g++
Includes: /home/fodi/Documents/angstrom/arm/include
CrossG++ Linker: /home/fodi/Documents/angstrom/arm/bin/arm-angstrom-linux-gnueabi-g++
Libraries -> Library search path panel: /home/fodi/Documents/angstrom/arm/lib
CrossGCC Assembler: /home/fodi/Documents/angstrom/arm/bin/arm-angstrom-linux-gnueabi-as
Apply and close. At this point you should be able to build the project without errors:

6) Set up remote connection:Open your remote systems explorer (Window -> show view -> other... -> Remote Systems).



Right click in that window, New->Connection. Select Linux, then Next.



Set the Host to the address of your Beaglebone Black (192.168.7.2 for everyone)Give your connection a name -> NEXT -> select ssh.files -> NEXT -> select processes.shell.linux -> NEXT -> ssh.shells -> NEXT -> ssh.terminals -> Finish.



Now right click on your connection and select "connect". Log in as root.



7) Executing remotely:

Ok, we're almost there. Select the connection you have just created.Don't change the C/C++ Application part, it should say Debug/Whateverproject on your side, leave it like that. However, fill out the Remote Absolute File Path like I have, and the Commands to execute before application editbox as well. This former is required to give execution rights to your program. Now hit run and it should work.



8) Debugging

If you have any problems, you should refer to the other tutorial I have linked. I made this work based on those, so all the information is there, if I could do it you can as well.

Have fun!

2 megjegyzés:

  1. Hello Attila,
    Could you please give me a angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2 file?
    The angstrom distribution web is not available and I can't download it.
    Regards,
    Juan C.

    VálaszTörlés
  2. Hi Juan,

    Recently I switched back from Ubuntu to Windows as my main OS, so my toolchain is gone as well. However, you can always cross-compile a toolchain for yourself.

    I've found this page about how to do it for the BeagleBone:
    andrewjarrell.com/2013/07/13/building-a-cross-compilation-environment-for-the-beaglebone/

    Theoretically it shouldn't be different for the BeagleBone Black, because they have the same processor, but even if it is, there must be an exiating recepie you can use with this procedure.

    Good luck, and please post if it worked for you, or you have any more trouble.

    Best wishes,
    Attila

    VálaszTörlés