Adding The bcm2835 Library By Mike McCauley

Install the library on a RPi by following the instructions here.

Copy the bcm2835-#.# folder after compiling it onto your windows PC using a USB stick.

Copy the following files:

bcm2835.o

libbcm2835.a

into the folder:

C:\cygwin\opt\cross\x-tools\arm-unknown-linux-gnueabi\arm-unknown-linux-gnueabi\sysroot\usr\lib\

Add the library to eclipse

In eclipse, right click your project > Properties > C/C++ Build > Settings > Cygwin C++ Linker > Libraries.  Add a new library entry: bcm2835

Copy file bcm2835.h into your project and include it in your source code files that use the IO.

Auto Save Before Build

Window > Preferences > General > Workspace.  Check 'Save automatically before build'.

Compile Warnings Options

Right click project > Properties > C/C++ Build > Settings > Cygwin C++ Compiler > Warnings (also Cygwin C Compiler)

Adding files to project

Just copy them into the projects src folder and they will appear.

Otherwise for files located outside of the project

Right click the projects src folder > Import > General > File System

Turning Off Warnings

Window > Preferences > C/C++ > Code Analysis.  Uncheck warnings you don't want.

Show Line Numbers

Eclipse show line numbers option is in: Menu > preference > general > editors > text editors > show line numbers.

Adding Object Files From Other Libraries

There can be issues with absolute paths when using Cygwin.  They can be resolved by simply replacing all of the c:/ with /cygdrive/c and storing the files in C:\cygwin.

Eclipse Resources

http://www3.ntu.edu.sg/home/ehchua/programming/howto/EclipseCpp_HowTo.html

 

 

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

  1. Kil

    4 years ago

    You can put bcm2835.h file in “C:cygwinoptcrossx-toolsarm-unknown-linux-gnueabiarm-unknown-linux-gnueabisysrootusrinclude” folder and leave the code (the example blink.c code) as:

    #include

    If you put bcm2835.h in your src folder, then it should be:

    #include “bcm2835.h”

    Both works!

  2. Pingback: Windows Eclipse Programming of the RPi « Raspberry Pi Projects

Comments

Your email address will not be published. Required fields are marked *