Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Configuring Eclipse for cross compiling AD 2012 version ?(Let's come up with AD 2021 version ? )
Configuring Eclipse for cross compiling AD 2012 version ? [message #1844044] Sun, 29 August 2021 12:27 Go to next message
Eclipse UserFriend

The attached is a art of a tutorial written in 2012

Is there a more recent one which can be implemented it Eclipse 2021-06 ( and later ) ?

If one intuitively folows the wizard one reaches a point of selection of "prefix" and crosscompiler path .

There is a note somewhere that if "prefix " is not selected if will default - the note did not sopecify the default.

I vaguely recall that the "prefix" has to end with "-"

But It all does not make much sense - if the "prefix" defaults why is "path" needed ?




Configuring Eclipse
In Eclipse, create a new C++ project. In the "C++ Project" dialog box, select the project type "Cross-compile project".
Add a new file and write some code. Then, go to the project properties.
Go to "C/C++ build -> Settings".
In "Cross settings", set Path to the directory <path to the toolchain>/tools/arm-bcm2708/x86-linux64-cross-arm-linux-hardfp/bin/
In Cross GCC Compiler, rename the command from gcc to arm-bcm2708hardfp-linux-gnueabi-gcc.
In Cross G++ Compiler, rename the command from g++ to arm-bcm2708hardfp-linux-gnueabi-g++.
And the same in cross g++ linker (g++ -> arm-bcm2708hardfp-linux-gnueabi-g++).
Re: Configuring Eclipse for cross compiling AD 2012 version ? [message #1844047 is a reply to message #1844044] Sun, 29 August 2021 14:37 Go to previous messageGo to next message
Eclipse UserFriend
This is how I setup for ARM cross-compiles.
I'm assuming you

  • are using standard CDT (no third party add-ons)
  • want a Managed Build project
  • are using a version of GCC

These are the ARM compiler files in my system:
index.php/fa/40897/0/
Note they are in (path) :/opt/ARM/gcc-arm-none-eabi-10-2020-q4-major/bin
And all are preceded by (prefix) : arm-none-eabi-

These, of course, change depending upon where and what you have.

1) Select File-->New-->C/C++ Project-->C++ Managed Build
(or File-->New-->C/C++ Project-->C Managed Build if you prefer

2 ) you will get the following dialog.
Make sure to select the cross-compile toolchain
index.php/fa/40899/0/

3) After hitting Next a few times you come to this dialog
Note how the prefix and path values are set.
index.php/fa/40900/0/

4) You shouldn't have to change the tool settings.
But the path and prefix can be modified if needed.
index.php/fa/40901/0/

5) When you build, the cross-compile path will be prepended to the environment path
and the prefix will be prepended to the appropriate compiler, linker or utility name.
index.php/fa/40902/0/

This forum is for dealing with issues caused by CDT and how values should be set. Programming, what files to use and general discussion are off-topic.
Re: Configuring Eclipse for cross compiling AD 2012 version ? [message #1844054 is a reply to message #1844047] Mon, 30 August 2021 08:39 Go to previous messageGo to next message
Eclipse UserFriend
That it fine for targeting raw metal. It seems that Anne is attempting to cross-compile for a Raspberry Pi, which is a Linux machine, with the full operating system machinery there.

She should first figure out how a command-line cross-compilation is achieved. There are instructions around in the Net, and they are different depending on the host system she wants to use for the compilation toolkit.

When the command-line setup works, it is much easier to try Eclipse again.
Re: Configuring Eclipse for cross compiling AD 2012 version ? [message #1844064 is a reply to message #1844054] Mon, 30 August 2021 19:55 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for updating the procedure. It is basically what I am using .
For test proposes I did not specify the "prefix" and this is what I got

17:33:37 **** Build of configuration Debug for project AD9850_AA7_1 ****
make all
Building file: ../src/AD9850_AA7_1.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/AD9850_AA7_1.d" -MT"src/AD9850_AA7_1.o" -o "src/AD9850_AA7_1.o" "../src/AD9850_AA7_1.cpp"
Finished building: ../src/AD9850_AA7_1.cpp

Building file: ../src/MY_Wiring.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/MY_Wiring.d" -MT"src/MY_Wiring.o" -o "src/MY_Wiring.o" "../src/MY_Wiring.c"
../src/MY_Wiring.c: In function 'wiringPiISR':
../src/MY_Wiring.c:1983:13: warning: unused variable 'threadId' [-Wunused-variable]
1983 | pthread_t threadId ;
| ^~~~~~~~


It definitely compiles, both cpp and c files.


I went thru the TCF tutorial again and can compile and link using the above , but so far cannot verify the actual working of the RPi - there is no "flash" on expected pin.

I need to figure put how to edit the "no prefix" - the wizard is different on Linux.
The c/C+ -> build leads unfamiliar territory - nothing even close to edit the "prefix"...
I think I will just rebuild my est program with correct prefix.

I am still not sure how to "step thru" the remote code using TCF.
So far the TCF perspective is not "tracking" just gives on shot...
But it worked few years back so it will work again.
















Re: Configuring Eclipse for cross compiling AD 2012 version ? [message #1844087 is a reply to message #1844064] Tue, 31 August 2021 16:41 Go to previous messageGo to next message
Eclipse UserFriend
That it fine for targeting raw metal. It seems that Anne is attempting to cross-compile for a Raspberry Pi, which is a Linux machine, with the full operating system machinery there.

She should first figure out how a command-line cross-compilation is achieved. There are instructions around in the Net, and they are different depending on the host system she wants to use for the compilation toolkit.

When the command-line setup works, it is much easier to try Eclipse again. ???????????????

I believe part of the question was - why I can cross - compile / run when there is NO entry in "prefix" ...

I am not sure how using command line will help me USING Eclipse (IDE ?)




Re: Configuring Eclipse for cross compiling AD 2012 version ? [message #1844102 is a reply to message #1844064] Wed, 01 September 2021 08:03 Go to previous message
Eclipse UserFriend
Quote:
For test proposes I did not specify the "prefix"


I suggest you

  • open a command terminal
  • place the path you used at the head of the system PATH
  • type "gcc --version"
and see what you get.

There are actually two ways to invoke the cross-compiler from Eclipse:
I can do it with:
path: /opt/ARM/gcc-arm-none-eabi-10-2020-q4-major/bin
prefix: arm-none-eabi-

OR
path: /opt/ARM/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/bin
prefix: (none)
This may not work for all cross-compilers.

Using
path: /opt/ARM/gcc-arm-none-eabi-10-2020-q4-major/bin
prefix: (none)
Gets me the system /usr/bin/gcc because the cross-compiler in the path
is called arm-none-eabi-gcc



[Updated on: Wed, 01 September 2021 08:19] by Moderator

Previous Topic:Which GCC to use for cosscompiling for Raspberry Pi ?
Next Topic:Post-build steps Command objdump direct to file
Goto Forum:
  


Current Time: Fri Jul 25 18:37:00 EDT 2025

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

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

Back to the top