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?

  • 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

  • If you like bare metal led blinking and use eclipse, try the IOsoanta library.  https://github.com/IOsonata/IOsonata

    It has ready made Eclipse native project for LED blinking and drivers for UART, SPI, I2C as well.  No Zephyr in your legs, no board to define. Just give it the pins numbers you want to use.  Complete board independent and rtos independent. 

    The nRF91 target is in ARM/Nordic/nRF91

  • Thank you Håkon, for your great response time and thorough answer!

    So far I got the LEDs working. Indeed, I experience problems with re-mapping the UART, which is probably due to what you described. Currently I am trying to adapt the Device Tree. What is the difference between doing this, versus using an overlay?

    I will look at your answer about Eclipse later this week.

  • Thank you for your answer. Though, our system is a little more complex than just LED blinking. It would probably be better to use an RTOS.

  • Hi,

     

    newUser said:
    What is the difference between doing this, versus using an overlay?

    Its two ways of doing the same thing.

     

    Doing your own board means patching (in this case, adding) "ncs/nrf/boards/" folder, or "ncs/zephyr/boards" with a new board, "nrf9160_myboard" for instance.

    This is a change outside of the scope of the application itself.

    Doing an overlay on nrf9160_pca10090 (or nrf9160dk_nrf9160, as of ncs v1.3.0) on a specific application is then contained to that application. So if you want to share this with a colleague or someone else, the pin re-definition is already in that specific example.

     

    However; if you are planning on doing multiple applications, then its likely easier just to create the board, as it isn't always fun to copy overlay files into each project you're running.

     

    Cheerse,

    Håkon

Related