07-02-2018, 11:04 AM
Eclipse is a robust development environment available for linux which offers better scope for dealing with remote projects than other utilities that I've tried on the O/S. With it you can install a GDB add-on and manage your files across a network, perfect for remote compiling. I will offer the links for all the items you will need to code and cross-compile for the Raspberry Pi 3 B(+.) Here goes:
Installing Eclipse should be the first step, you can get it at the official site, as Brians' book is dealing with C/C++ we should install the IDE for working in those languages (Eclpise C/C++ IDE) or you can download it using your favourite package manager. The official website for Eclipse finds its home at: https://www.eclipse.org/
Now because the Raspberry Pi has proprietary hardware we will need to have drivers ready for our host computer to compile against. You can find these here [https://github.com/raspberrypi/firmware] and because the Rpi has a different architecture to your desktop or laptop we need more tools for remote compiling which can be found here [https://github.com/raspberrypi/tools].
With Eclipse installed we need to extract the files we got from github to somewhere. For ease of use I suggest just extracting them to your workspace folder.
Let's start Eclipse and get it ready to speak to the Rpi.
Open a .cpp file, start a new project, import an existing one, whichever way you go you'll need to direct Eclipse to files from both the firmware and tools-master folders. To set this up we need to open up the properties panel in the projects menu at the top bar. Once in there open the C/C++ Build menu and go to settings. And from there, in the newly visible settings panel, you should be seeing Cross Settings.
In the Cross Settings you need to set the prefix to 'arm-linux-gnueabihf-' and set the path to '~/workspace/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin' or wherever you have put these files.
It's from the properties panel that we include the libraries and names of the modules we will be using to compile with. First up we include the directories in the Cross G++ Compiler->Includes section. You can find most of these in the section of the book that details setting up Visual Studio, they have paths like '/opt/vc/include/.' In fact this is so similar that it's practically the same thing. Further to setting up the libraries we have to include the names and this is done in the Cross G++ Linker section->Libraries and these look like 'bcm_host' and 'EGL_static.' You can also set the path for the compiler to find them.
For a more in depth, and easier to follow example, you can check here: https://www.96boards.org/blog/eclipse-re...debugging/
However it must be noted that the tools-master and firmware are both required to make the tool chain, again you can find these here: https://github.com/raspberrypi/tools and here: https://github.com/raspberrypi/firmware respectively.
Any questions?
Installing Eclipse should be the first step, you can get it at the official site, as Brians' book is dealing with C/C++ we should install the IDE for working in those languages (Eclpise C/C++ IDE) or you can download it using your favourite package manager. The official website for Eclipse finds its home at: https://www.eclipse.org/
Now because the Raspberry Pi has proprietary hardware we will need to have drivers ready for our host computer to compile against. You can find these here [https://github.com/raspberrypi/firmware] and because the Rpi has a different architecture to your desktop or laptop we need more tools for remote compiling which can be found here [https://github.com/raspberrypi/tools].
With Eclipse installed we need to extract the files we got from github to somewhere. For ease of use I suggest just extracting them to your workspace folder.
Let's start Eclipse and get it ready to speak to the Rpi.
Open a .cpp file, start a new project, import an existing one, whichever way you go you'll need to direct Eclipse to files from both the firmware and tools-master folders. To set this up we need to open up the properties panel in the projects menu at the top bar. Once in there open the C/C++ Build menu and go to settings. And from there, in the newly visible settings panel, you should be seeing Cross Settings.
In the Cross Settings you need to set the prefix to 'arm-linux-gnueabihf-' and set the path to '~/workspace/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin' or wherever you have put these files.
It's from the properties panel that we include the libraries and names of the modules we will be using to compile with. First up we include the directories in the Cross G++ Compiler->Includes section. You can find most of these in the section of the book that details setting up Visual Studio, they have paths like '/opt/vc/include/.' In fact this is so similar that it's practically the same thing. Further to setting up the libraries we have to include the names and this is done in the Cross G++ Linker section->Libraries and these look like 'bcm_host' and 'EGL_static.' You can also set the path for the compiler to find them.
For a more in depth, and easier to follow example, you can check here: https://www.96boards.org/blog/eclipse-re...debugging/
However it must be noted that the tools-master and firmware are both required to make the tool chain, again you can find these here: https://github.com/raspberrypi/tools and here: https://github.com/raspberrypi/firmware respectively.
Any questions?