This page is intended to give an introduction on how to set up Eclipse with the tools needed to develop code for nrf51 and nrf52 kits from Nordic
Nomenclature
CDT c/c++ Developement tools JDK Java Developement Kit JRE Jave Runtime Enviroment
Configuring Eclipse with CDT
Eclipse neon on windows 10
- Download eclipse
- start eclipse if it returns eclipse returned exit code 1. You need to point eclipse to the correct java version
- Download the correct version of java jdk for eclipse (1.8 minimum for eclipse neon)
- Open eclipse.ini located in the eclipse directory
- Add the following above two lines before -vmargs: -vm and <Path to JDK>/bin
- now eclipse should start
- Install the GNU ARM Eclipse plug-in [1]
- Open eclipse marketplace from help-> marketplace and drag the install from the link in.
- Confirm and install
If this fails with handshake exception[2]. You need the Java Cryptography Extention(JCE)[3].
- Download this from oracle.
- Extract and copy files into <path to JDK>/jre/lib/security
- Restart eclipse and try again
- Check the global tools paths
- Go to window->preferences->c/c++ ->build->global tools path and check if this is correct. (GNU Tools for ARM Embedded Processors)
- Set workspace preferences [4]. At least set the space formatting in the code formatter! (Remember that this will make you unable to use tab in makefiles.)
- You should now be ready to go!
Eclipse on Linux <xx>
Linux gurus write something here!
Start a new Project
- Find a suitable location for your project
- Copy a config folder from one of the examples in the SDK to your project folder
- Update your makefile to reflect these changes. This includes the PROJECT_NAME, SDK_ROOT, PROJ_DIR, LINKER_SCRIPT also some backslash needs to be removed or added depending on your chosen location.
- Try making the project on the command line before trying to compile trough Eclipse.
- Import the project in Eclipse by file->new(alt+shift+n).
- Name your project
- Existing code location should be the location of your makefile for the project.
- Select "Cross ARM GCC" from the list of toolchains.
- Click finish and you are done.
- Remember to set the build command to "make VERBOSE=1" this field can be found by marking the project, pressing alt+enter and navigate to c/c++ build -> build settings.
- Try compiling.
- Change the compiler command pattern under project properties-> c/c++ General-> Preprocessor Include Paths, Macros... -> providers -> CDT GCC Build output parser to "(.*gcc)|(.*[gc]\+\+)" This is for symbols to be handled correctly in Eclipse.
- Try rebuilding the project and you should be good.
- If symbols are not detected by the OCD add symbol by hand in properties->c/c++ General->Paths and Symbols -> symbols-> add. Do you find another solution please write it down here!
Tips And Tricks for error messages
If you have forgotten to include paths to c files in the make file you would get undefined reference errors similar to: main.c:139: undefined reference to `nrf_drv_timer_init'
If you get error messages similar to this: error: invalid suffix "_INSTANCE_INDEX" on integer constant
You probably defined something you shouldnt have.