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

How to create a custom board file for the nRF9160

I am trying to create a custom board file in the ncs/zepher/boards directory for our nRF9160.

If I copy the nrf9160_pca10090 directory to a new nam eg. nrf9160_newboard it will compile and run just fine.

Then when i change the name of the files to nrf9160_newboard and change the references in each of the files to correspond to the new file names.

I was able to get the hello world example to compile and run as a nrf9160_newboard, but when I tried to compile as nrf9160_newboardns I get the following errors in spm.c

1> C:/ncs/nrf/subsys/spm/spm.c:129:2: error: 'NRF_SPU' undeclared (first use in this function); did you mean 'NRF_SPU_S'?
1> C:/ncs/nrf/subsys/spm/spm.c:129:2: note: each undeclared identifier is reported only once for each function it appears in
1> C:/ncs/nrf/subsys/spm/spm.c:160:3: error: 'NRF_SPU' undeclared (first use in this function); did you mean 'NRF_SPU_S'?
1> C:/ncs/nrf/subsys/spm/spm.c:207:3: error: 'NRF_SPU' undeclared (first use in this function); did you mean 'NRF_SPU_S'?
1> C:/ncs/nrf/subsys/spm/spm.c:224:21: error: 'NRF_SPU' undeclared (first use in this function); did you mean 'NRF_SPU_S'?
1> C:/ncs/nrf/subsys/spm/spm.c:262:3: error: 'NRF_SPU' undeclared (first use in this function); did you mean 'NRF_SPU_S'?
1> C:/ncs/nrf/subsys/spm/spm.c:293:24: error: 'NRF_UARTE2' undeclared (first use in this function); did you mean 'NRF_UARTE0'?
1> C:/ncs/nrf/subsys/spm/spm.c:93:23: note: in definition of macro 'NRFX_PERIPHERAL_ID_GET'
1> C:/ncs/nrf/subsys/spm/spm.c:293:3: note: in expansion of macro 'PERIPH'
1> C:/ncs/nrf/subsys/spm/spm.c:301:22: error: 'NRF_PWM1' undeclared (first use in this function); did you mean 'NRF_PWM0'?
1> C:/ncs/nrf/subsys/spm/spm.c:93:23: note: in definition of macro 'NRFX_PERIPHERAL_ID_GET'
1> C:/ncs/nrf/subsys/spm/spm.c:301:3: note: in expansion of macro 'PERIPH'
1> C:/ncs/nrf/subsys/spm/spm.c:302:22: error: 'NRF_PWM2' undeclared (first use in this function); did you mean 'NRF_PWM1'?
1> C:/ncs/nrf/subsys/spm/spm.c:93:23: note: in definition of macro 'NRFX_PERIPHERAL_ID_GET'
1> C:/ncs/nrf/subsys/spm/spm.c:302:3: note: in expansion of macro 'PERIPH'
1> C:/ncs/nrf/subsys/spm/spm.c:303:22: error: 'NRF_PWM3' undeclared (first use in this function); did you mean 'NRF_PWM2'?
1> C:/ncs/nrf/subsys/spm/spm.c:93:23: note: in definition of macro 'NRFX_PERIPHERAL_ID_GET'
1> C:/ncs/nrf/subsys/spm/spm.c:303:3: note: in expansion of macro 'PERIPH'
1> C:/ncs/nrf/subsys/spm/spm.c:321:3: error: 'NRF_SPU' undeclared (first use in this function); did you mean 'NRF_SPU_S'?
1> C:/ncs/nrf/subsys/spm/spm.c:321:10: error: 'const struct periph_cfg' has no member named 'GPIOPORT'
1> C:/ncs/nrf/subsys/spm/spm.c:321:23: error: 'const struct periph_cfg' has no member named 'PERM'
1> C:/ncs/nrf/subsys/spm/spm.c:321:3: warning: statement with no effect [-Wunused-value]
Build failed

i tried this using a grep replace function for 10090 on the new directory since I though I may have missed a line somewhere.

Is there a tutorial or set of directions on how to create new boards other than the one in Zephyr.

(Note: I did this before the introduction of the secure and non-secure versions of the board for section placement)

Parents Reply
  • See the above note I copied it here since I had trouble finding it in this thread

    • Placed the folder nrf9160_pca20190 into <..>/ncs/zephyr/boards/arm with all the files you provided
    • Added the following lines of code into <..>\ncs\zephyr\cmake\app\boilerplate.cmake:

    if(FIRST_BOILERPLATE_EXECUTION)
    .
    .
    else() # NOT FIRST_BOILERPLATE_EXECUTION
    .
    .
        set(BOARD nrf9160_pca20035)
        message("Changed board to secure nrf9160_pca20035 (NOT NS)")
      endif()
      
        if(${BOARD} STREQUAL nrf9160_pca20190ns)                     //Added this
        set(BOARD nrf9160_pca20190)                                  //Added this
        message("Changed board to secure nrf9160_pca20035 (NOT NS)") //Added this
      endif()                                                        //Added this
      
      unset(${IMAGE}DTC_OVERLAY_FILE)...
      .
      .
      .

    • Built and flashed the hello world sample by running the commands  "west build -b nrf9160_pca20190ns" and "west flash"

    This should solve your problem

Children
Related