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

Reply
  • 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

Children
Related