User Tools

Site Tools


raspberrypi:settingupc_developmentenvironment

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
raspberrypi:settingupc_developmentenvironment [2018/03/30 21:00] – [Install the cross compiler] rlunaroraspberrypi:settingupc_developmentenvironment [2022/12/02 22:02] (current) – external edit 127.0.0.1
Line 48: Line 48:
 As it says in the webpage, can download it at [[https://github.com/raspberrypi/tools]]. I've  As it says in the webpage, can download it at [[https://github.com/raspberrypi/tools]]. I've 
 downloaded the tools in ~/tools-master. So, because my linux system is 64 bits, the path  downloaded the tools in ~/tools-master. So, because my linux system is 64 bits, the path 
-for the compiler is in ''~/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/bin''.+for the compiler is in ''~/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin''.
  
 ===== Create your first project in eclipse ===== ===== Create your first project in eclipse =====
Line 54: Line 54:
 Don't forget the path in the previous step, because you will need to create your first hello world Don't forget the path in the previous step, because you will need to create your first hello world
 project in eclipse. project in eclipse.
 +
 +Let's go for it: first, open eclipse and click on "File -> New -> C/C++ Project": 
 +
 +{{ :raspberrypi:step01.png?nolink&600 |}}
 +
 +Then, pick up "C++ Managed build" or "C Managed buid", whichever you prefer. I've chosen C++ Managed build:
 +
 +{{ :raspberrypi:step02.png?nolink&600 |}}
 +
 +Next, I've selected the empty project and, very important, pick up "Cross GCC" to select a cross compiler:
 +
 +{{ :raspberrypi:step03.png?nolink&600 |}}
 +
 +On the screen that appears, you can click on next:
 +
 +{{ :raspberrypi:step04.png?nolink&600 |}}
 +
 +This is the important part: when you have to select the g++ cross compiler. In the previous section I've spotted that and took note of the path and the prefix to use here:
 +
 +{{ :raspberrypi:step05.png?nolink&600 |}}
 +
 +However, if you are unsure which to use, you can try several. A good option is to try to execute the 
 +cross compiler to see if it runs: at least it has to execute properly in your computer. At the end, 
 +this is a cross compiler, isn't it?
 +
 +Finally, you will get the project on eclipse:
 +
 +{{ :raspberrypi:step06.png?nolink&600 |}}
 +
 +Then, right-click on new -> source file and tye something like this:
 +
 +<code cpp>
 +/*
 + * main.cpp
 + *
 +  Created on: 31 mar. 2018
 +      Author: dictinio
 + */
 +
 +#include <iostream>
 +
 +int main( int argc, char *argv[] )
 +{
 + std::cout << "hello world!!!" << std::endl;
 +}
 +
 +</code>
 +
 +And compile it. At this point it's very important to have some experience with C++ and/or eclipse. It's
 +not the purpose of this tutorial to teach you to use the eclipse IDE, to do that, probably
 +you will have to read other tutorials. 
 +
 +===== Compile and run =====
 +
 +Build the program and copy it to your raspberry: it should run smoothly in the raspi. Obviously, it
 +won't execute locally. 
 +
 +===== Execute and run in the raspberry pi remotely =====
 +
 +Eclipse CDT has facilities to move every build in the raspberry pi and execute it remotely.
 +
 +
 +NEXT STEP: debug remotely.
 +
  
  
raspberrypi/settingupc_developmentenvironment.1522436403.txt.gz · Last modified: 2022/12/02 22:02 (external edit)