Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Adding new "toolchain" to Eclipse. (add toolchain )
Adding new "toolchain" to Eclipse. [message #1799172] Sat, 01 December 2018 01:14 Go to next message
Anne Creek is currently offline Anne CreekFriend
Messages: 275
Registered: September 2014
Senior Member
Here are some results of my search for cross-compiling Eclipse for Raspberry Pi.

git clone https://github.com/raspberrypi/tools

The g++ compiler at
tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++

works to compile C or C++ code on my Pi Zero with Raspian Jessie. Interestingly, the gcc compiler in the same place did not work.


The post is pretty old so I am hoping somebody can help me in implementing this on Eclipse.

I did try to "implement" : this "tool in Build-> Setting but got lost.

I Eclipse terminology - I have can choose two "toolchains" Cross GSS and Linux GCC .

I can add / modify these "toolchains" or I should be able to ADD a new one using the downloaded "tools" from git.

I need , like ro have , step by step instruction on HOW. - to add new "toolchain".

Preferably to newest Eclipse 2018-09 - using its layout and terminology.

Can anybody help me ?
Any hint / help will be appreciated.

EDIT

OK, I have been doing my homework.
The standard " Cross prefix" in Eclipse IDE is " arm-linux-gnueabihf " .

Is this "prefix" part of the "toolchain" ?

Assuming "tools" folder is part of Linux (kernel?)
How is its purpose / function defined and where ?

/tools/arm-bcm2708
Where does the "subfolder " "arm-bcm2708" came from?

Stand-by for more silly questions...





[Updated on: Sat, 01 December 2018 02:33]

Report message to a moderator

Re: Adding new "toolchain" to Eclipse. [message #1799174 is a reply to message #1799172] Sat, 01 December 2018 02:17 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
When you select the Cross GCC toolchain,
a new entry appears in the Tool Settings tab dialog called Cross Settings
Project --> Properties --> C/C++ Build --> Settings --> Tool Settings tab --> Cross Settings
index.php/fa/34437/0/
Set the prefix in the prefix box: in your case arm-linux-gnueabihf-
Note the trailing '-'
Set the bin directory (Path box) with the Browse ... button.
Avoid using a relative path.

Set the compiler commands to the rest of the compiler names (e.g., gcc for C, g++ for C++)
I'm assuming those names and they look like the ones you have.

When a compiler is needed it will execute as <bin dir>/<prefix><command>
In your case, for C++, <bin dir>/arm-linux-gnueabihf-g++


You probably should select [ All Configurations ] in the Settings dialog.

[Updated on: Sat, 01 December 2018 02:42]

Report message to a moderator

Re: Adding new "toolchain" to Eclipse. [message #1799178 is a reply to message #1799174] Sat, 01 December 2018 05:38 Go to previous messageGo to next message
Anne Creek is currently offline Anne CreekFriend
Messages: 275
Registered: September 2014
Senior Member
Sorry, but that is not what I was asking.

I want to ADD (?) NEW "toolchain" so I can use " gcc-linaro-arm-linux-gnueabihf-raspbian-x64" from /tools.

tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++

I do not know the terminology , but there is ONE g++ compiler with this prefix arm-linux-gnueabihf.
However in /toools folder there are over half a dozen subfolders and I assume each one of them is for different hardware.
I want to use "gcc-linaro-arm-linux-gnueabihf-raspbian-x64" to compile for RPi ZERO.

I have been trying to use --build, --host, --target options for crosscompling but so far no luck.

As a side note - I found out it is not necessary to specify "path" for crosscompiler prefix - it complies just fine ,
for both RPi 3B and RPi Zero without the path.





Re: Adding new "toolchain" to Eclipse. [message #1799180 is a reply to message #1799178] Sat, 01 December 2018 06:47 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Then you are asking a confusing question.

It isn't clear if you already have the cross compiler you want to use or if you are trying to compile one.

All I can do is tell you how to get to an existing one using Eclipse CDT.
Which I've done.

If the compiler is found at tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++
You set prefix to: arm-linux-gnueabihf-
and Path to: tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/
But the path should be an absolute path.

How you go about creating a cross-compiler should be addressed elsewhere.
They are third party tools.
Asking here is doing the equivalent of taking a BMW to a Ferrari dealer and asking them
how to go about fitting the BMW with a Chevy Camaro engine.



[Updated on: Sat, 01 December 2018 07:04]

Report message to a moderator

Re: Adding new "toolchain" to Eclipse. [message #1799202 is a reply to message #1799180] Sat, 01 December 2018 17:10 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
You most likely do not need to add a new tool chain to your Eclipse in order to build your program. You should be able to configure the Cross GCC tool chain to get what you want.

Cross compiling can be quite confusing so you need to make sure you have a clear understanding of the concept and terms particularly the difference between host and target. Here is a link that may help explain the concepts https://wiki.osdev.org/GCC_Cross-Compiler.

This explanation assumes that you are running Eclipse on a Windows/Linux/Mac PC and are attempting to compile for a target Rasberry Pi device. This is not a procedure for running a compiler on the target Rasberry Pi device. This is an important distinction. This host where the tools are running is different from the target where the resulting program will run.

If you intention is to run the build tools on the Rasberry Pi device that will also be running the resulting program, you don't need a cross compiler.

Make sure you have the Cross GCC tool chain installed in Eclipse. (Help->About Eclipse IDE, click Installation Details and look for C/C++ GCC Cross Compiler Support).

If it isn't installed, use the Help->Install New Software dialog to install it. Be sure to restart Eclipse after installing.

Configuring the tool
Open Project Properties and go to the Tool Chain Editor under the C/C++ Build section. Select Cross GCC in the Current Toolchain selection box.

Select the Settings section right above Tool Chain Editor under C/C++ Build.

On the Tool Settings tab, select the Cross Settings item at the very top. This displays two text fields Prefix and Path. These two fields are used to narrow down the numerous cross compiler tools to the specific set you are interested in. Building a program involves a number of tools. You need to use a combination of assemblers, compilers, archivers, and linkers to get the program. If you look closely at the various directories you pullled down from the rasberripi/tools github site, you will see that there are several files that all end in '*gcc', or '*g++', or *ar', etc. These are command suffixes that denote the various tools used. gcc will compiler C files, g++ will compile C++ files, etc. Also notice that there is a common prefix that begins the name of each tool such as 'bcm2708-*', or 'arm-bcm2708-linux-gnueabi-*'. This prefix specifies the target architecture that the tool is built for. Combining the prefix with the various command suffixes gives you the set of tools required for the target platform. This prefix string is what you place in the Prefix field of the Cross Settings.

The Path box should contain the absolute path to the folder where the tool chain files reside. If you have cloned the git repository into a directory called /tools and you want to use the tools in the arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/ folder, you would set the Path text field to 'tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/' This gives Eclipse the place to start looking for the tools. If you want to use the arm-linux-gnueabihf tools, you need to set the Prefix to 'arm-linux-gnueabihf-'.

Eclipse will now combine the combination of the Path and Prefix strings when picking the individual tools. For instance, the default command for the Cross GCC Compiler is gcc (This is the C compiler). Eclipse combines these three strings together to come up with a command 'tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc'. This will then be the command that is run when compiling C source files.

Re: Adding new "toolchain" to Eclipse. [message #1799210 is a reply to message #1799202] Sun, 02 December 2018 11:11 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Quote:
Where does the "subfolder " "arm-bcm2708" came from?


As expected, it's best to ask third party questions in more appropriate forums.
Searching with Google yields: https://www.raspberrypi.org/forums/viewtopic.php?t=8758
The first answer is: https://www.raspberrypi.org/forums/viewtopic.php?t=8758#p103830


Re: Adding new "toolchain" to Eclipse. [message #1799220 is a reply to message #1799210] Sun, 02 December 2018 17:50 Go to previous messageGo to next message
Anne Creek is currently offline Anne CreekFriend
Messages: 275
Registered: September 2014
Senior Member
David,
thanks very much for your post.
First I have to apology for "jumping the gun" with my (other) reset post.
Somehow, probably me, I quit getting notification from this thread and your
post cleared some of the questions. Thanks,.

Secondly it seems to be no win situation , again blame it on customer - me .
No matter how I post it is either "confusing" or I miss some important stuff and then get reply I really do not need.
There is no answer for that and I am sorry for unnecessarily wasting some poster's tine.

That out of the way , so if do not mind I will replay to parts I really need more help.

"If you look closely at the various directories you pullled down from the rasberripi/tools github site, you will see that there are several files that all end in '*gcc', or '*g++', or *ar', etc"

I have been jumping form Oxygen to Eclipse 2018-09 and honestly have no idea where to look for these.
I assume I'll find the correct ones in SAME folder I am running the Eclipse ( back to Oxygen) from.
Here is MY the absolute path media/jim/DEV/Eclipse_Oxugen_3A_CLEAN/eclipse/eclipse
I should be able to use "find " to verify, right?

When I first try to cross compile I was successful when I DID NOT specify the "path"
SO I got spoiled and now it came back to hunt me,

BTW - like to know how "make": finds the correct gcc /g to use without "path".


EDIT
See attached file



Since "arm-linux-gnueabihf" at lest works cross compiling for arm7 and came
with "default " download with Eclipse I'll stick with it for now.
At least until I figure out if I can ever get
to cross compile for "armv6l".
Seem unlikely after few weeks trying.


Since "/tools" came form 3rd party I need to find if it indeed will work for arm6.
I'll skip using it for now.

Thanks again,

PS
Just found "clone" of Raspberry Pi Zero with "arm7" processor - time to switch!
And all this "exercise" just because I picked WRONG product - again!














If you look closely at the various directories you pullled down from the rasberripi/tools github site, you will see that there are several files that all end in '*gcc', or '*g++', or *ar', etc.
  • Attachment: PATH
    (Size: 33.35KB, Downloaded 406 times)

[Updated on: Sun, 02 December 2018 18:28]

Report message to a moderator

Re: Adding new "toolchain" to Eclipse. [message #1799228 is a reply to message #1799220] Sun, 02 December 2018 23:49 Go to previous message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
You seem to be confusing the things supplied by Eclipse with the things from other providers. Eclipse does not come with any C/C++ compilers, linkers, etc. Eclipse provides the UI that sits in front of these tools. The compilers all come from other providers. Either the OS provider that may include compilers, etc to develop software on the OS, or by third party providers that provide them for stand alone boards/computers such as Raspbery Pi or Arduino.

In your case, you downloaded tools from a RaspberyPi/tools Github repository. These appear to be cross compilers that can be used to build software for Raspbery Pi boards with various processor architectures. They are provided by the owner of the specific Github repository not by Eclipse. If you browse through the directory structure of that repository, you will be able to see the pattern that I discussed.

Eclipse is able to provide a UI to help with development because there are general conventions that tool providers follow to make it easier to work with their tools. One of those conventions appears to be to prefix all of the tools common for a specific architecture with a common string. These are then grouped together under a common folder that further identifies the architecture.

These are general conventions because there are no specific standards for the build tools. This tends to make C/C++ development quite difficult. You have to learn all the different tools required to build projects in addition to learning the language itself. When you venture into attempting to use one platform to build software that will run on a different platform, it drastically increased the complexity. However, it is possible to successfully navigate the complexity.
Previous Topic:toolchain etc.
Next Topic:Remote Debugging(windows to Linux)
Goto Forum:
  


Current Time: Wed Apr 24 22:54:41 GMT 2024

Powered by FUDForum. Page generated in 0.03716 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top