This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Getting started with a custom nRF9160 board and Eclipse IDE instead of SEGGER

We just received a batch of custom boards containing the nRF9160. I would like to test them and start developing our actual application.

So far I have switched SW11 to match the DK voltage with our board voltage, and connected the P22 Debug Out to our board. It seems that when I flash a program, our custom board is targeted. We see its status LED blink.

Currently I am experiencing some barriers:
- Can I use Eclipse instead of SEGGER?
I have used SES for the past 2 days, and it's just not what I want to use. What are steps to take so I can use Eclipse?

- How to define our custom board so I can e.g. blink its LEDs?
The LEDs are on different pins than they are on the DK.
Besides adding a new board folder to the zephyr/boards folder, what are the actual changes I should make to these files. Currently when I tried it with Hello_world, i get "attempt to assign the value 'y' to the undefined symbol"
What other files do I need to edit?
How do I actually make the build use my custom board?

Parents
  • Hi,

     

    - Can I use Eclipse instead of SEGGER?

    Yes, but not as a managed project (ie: eclipse building natively).

    These are the generators that cmake v3.16.3 supports:

    Generators
    * Unix Makefiles               = Generates standard UNIX makefiles.
      Green Hills MULTI            = Generates Green Hills MULTI files
                                     (experimental, work-in-progress).
      Ninja                        = Generates build.ninja files.
      Watcom WMake                 = Generates Watcom WMake makefiles.
      CodeBlocks - Ninja           = Generates CodeBlocks project files.
      CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
      CodeLite - Ninja             = Generates CodeLite project files.
      CodeLite - Unix Makefiles    = Generates CodeLite project files.
      Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
      Sublime Text 2 - Unix Makefiles
                                   = Generates Sublime Text 2 project files.
      Kate - Ninja                 = Generates Kate project files.
      Kate - Unix Makefiles        = Generates Kate project files.
      Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
      Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
    

    You can generate a build with eclipse cdt4 project files using cmake:

    cd samples/nrf9160/my_project/
    mkdir build && cd build
    cmake .. -DBOARD=my_board -G"Eclipse CDT4 - Ninja"
     

     

    - How to define our custom board so I can e.g. blink its LEDs?

    Unfortunately, we do not have a guide on creating your own board yet, or any easier way to modify peripheral configuration.

    There is a board porting guideline in zephyr: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/porting/board_porting.html#board-porting-guide

     

    To configure and control a GPIO using the zephyr gpio driver, you do not really need to setup the LED in DTS. You can change the define to any unused GPIO that you have available, for instance by changing the define LED to 10 here:

    https://github.com/nrfconnect/sdk-zephyr/blob/v2.1.99-ncs1/samples/basic/blinky/src/main.c#L12

     

    If you need to do some more advance things, like changing the uart pinout, enabling more peripherals or similar, I would recommend overlaying based on the board you're using:

     

    To override the default pin configuration for board nrf9160_pca10090ns (or nrf9160dk_nrf9160ns as its been renamed to now in ncs v1.3.0), it requires changing both the CMakelist.txt file for the specific project (due to multi-image building, spm/mcuboot/application in one), as well as providing a $(board).overlay file.

     

    If you in your CMakeLists.txt file, just below the "cmake_minimum_required()" line, add this:

    if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/spm.conf")
      set(spm_CONF_FILE
        prj.conf
        ${CMAKE_CURRENT_LIST_DIR}/spm.conf
      )
    endif()
    
     
    
    if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mcuboot.conf")
      set(mcuboot_CONF_FILE
        prj.conf
        ${CMAKE_CURRENT_LIST_DIR}/mcuboot.conf
      )
    endif()
    
     
    
    if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${BOARD}.overlay")
      set(mcuboot_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${BOARD}.overlay")
      set(spm_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${BOARD}.overlay")
    endif()

     

    This will allow you to override mcuboot and spm configurations by inputting these in "my_application/mcuboot.conf" file and "my_application/spm.conf".

    An overlay file, describing the pin information and status of a peripheral, can be done like this in the application overlay file, where uart2 is used, and chosen as the bluetooth hci uart:

    https://github.com/nrfconnect/sdk-nrf/blob/master/samples/nrf9160/lte_ble_gateway/nrf9160dk_nrf9160ns.overlay

     

    You can also copy certain things, like the LED definition from the nrf9160_pca10090 main dts definition, into this file and modify accordingly.

     

    Kind regards,

    Håkon

  • Hi Håkon,

    If I understand correctly, to use Eclipse, I should:
    - Follow the "Installing the nRF Connect SDK manually" page to get all the necessary tools and settings (I already have the Desktop app and SES)
    - Install Eclipse
    - Get Eclipse CDT
    - Import a project in Eclipse, and edit it for example
    - Build with the cmake + eclipse CDT command you provided
    - Flash from command line, as explained in the nRF Connect SDK guide

Reply
  • Hi Håkon,

    If I understand correctly, to use Eclipse, I should:
    - Follow the "Installing the nRF Connect SDK manually" page to get all the necessary tools and settings (I already have the Desktop app and SES)
    - Install Eclipse
    - Get Eclipse CDT
    - Import a project in Eclipse, and edit it for example
    - Build with the cmake + eclipse CDT command you provided
    - Flash from command line, as explained in the nRF Connect SDK guide

Children
  • Yes, that is correct, this should then create a workspace for eclipse cdt.

    "ninja flash" from the build directory will flash the device, so you can setup that as a custom command to flash from eclipse cdt if you want.

     

    Cheers,

    Håkon

  • Awesome, thank you. I will go through the steps and let you know if I got it working!

    By the way, I must say that I'm quite happy with the support you are offering, phenomenal response times.

  • newUser said:
    Awesome, thank you. I will go through the steps and let you know if I got it working!

    Just let me know if anything pops up! 

    I'm not very familiar with eclipse, but I think most of the things related to building and so-forth should be quite OK to setup. Debug setup might be a bit more challenging.

    I see there is a helper plugin (I personally haven't tested) that might be beneficial to look at

    https://github.com/zephyrproject-rtos/eclipse-plugin

      

    newUser said:
    By the way, I must say that I'm quite happy with the support you are offering, phenomenal response times.

    I'm glad to hear.

    We usually respond within 24 hours, but we tend to respond quicker when the time zones align.

     

    Kind regards,

    Håkon

  • Hi Håkon, hope you had a good weekend,

    So far I can build via Eclipse, after adding the west build commands to it.
    I got some errors about include files it couldn't find, so I added those paths to the include paths.

    Currently I am still getting errors saying that it can't find types / functions declared in those header files, but if I open the header file, they are there. Any tips on this?

    Also, any thoughts on how I can flash and debug from within Eclipse?

  • Hi,

     

    newUser said:
    Currently I am still getting errors saying that it can't find types / functions declared in those header files, but if I open the header file, they are there. Any tips on this?

    That sounds like a indexing problem within eclipse. I'm not that familiar with eclipse, but have to regenerated the index after adding files?

      

    newUser said:
    Also, any thoughts on how I can flash and debug from within Eclipse?

    This is where it will be a bit complicated, and we do not have a guide on this, unfortunately.

    Did you look into the zephyr plugin? It seems to have a section on hardware debugging:

    https://github.com/zephyrproject-rtos/eclipse-plugin#debugging-on-hardware

     

    You can start the debugger via "west debug", or command line:

    JLinkGDBServer -if swd -device nrf9160_xxaa

     

    Your .gdbinit should autoconnect if you add these commands:

    target remote localhost:2331

    load

     

    But; note that if you have a multi-image build, like all project for nrf9160 are, you should first load the merged.hex file, to get SPM and other multi-build images (mcuboot for instance) loaded to flash.

     

    Kind regards,

    Håkon

Related