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

  1. Download eclipse
    1. start eclipse if it returns eclipse returned exit code 1. You need to point eclipse to the correct java version
    2. Download the correct version of java jdk for eclipse (1.8 minimum for eclipse neon)
    3. Open eclipse.ini located in the eclipse directory
    4. Add the following above two lines before -vmargs: -vm and <Path to JDK>/bin
    5. now eclipse should start
  2. Install the GNU ARM Eclipse plug-in [1]
    1. Open eclipse marketplace from help-> marketplace and drag the install from the link in.
    2. Confirm and install

      If this fails with handshake exception[2]. You need the Java Cryptography Extention(JCE)[3].

      1. Download this from oracle.
      2. Extract and copy files into <path to JDK>/jre/lib/security
      3. Restart eclipse and try again
  3. Check the global tools paths
    1. Go to window->preferences->c/c++ ->build->global tools path and check if this is correct. (GNU Tools for ARM Embedded Processors)
  4. 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.)
  5. You should now be ready to go!

Eclipse on Linux <xx>

Linux gurus write something here!

Start a new Project

  1. Find a suitable location for your project
  2. Copy a config folder from one of the examples in the SDK to your project folder
  3. 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.
  4. Try making the project on the command line before trying to compile trough Eclipse.
  5. Import the project in Eclipse by file->new(alt+shift+n).
    1. Name your project
    2. Existing code location should be the location of your makefile for the project.
    3. Select "Cross ARM GCC" from the list of toolchains.
    4. Click finish and you are done.
  6. 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.
  7. Try compiling.
  8. 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.
  9. Try rebuilding the project and you should be good.
  10. 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.

  • No labels