PlatformIO Community

Problem with Zephyr project and custom nRF52840 board after updating nordicnrf52

I am using PlatformIO (Core v4.3.4 and Home v3.2.3), VSCode v1.489.2, MacOS 10.15.6, nordicnf52 v4.4.0, Zephyr v2.3.0.

I created my custom board by simply copying and modifying the nRF52840DK_nRF52840 board. Since the example I made using the nRF52840DK_nRF52840 board works fine, and populates the c_cpp_properties.json file correctly, but my renamed and slightly modified copy doesn’t work. I think there has to be some background nordicnrf52 settings or files that aren’t linked to the custom board I created, but I am at a loss for what they could be.

This project worked before I updated to nordicnf52 v4.4.0. Now the project can’t open the following source files: device.h, devicetree.h, sys/printk.h, sys/util.h, version.h, zephyr.h, and zephyr/types.h. The problem seems to be caused by the system compiler arguments include paths not being populated in the generated c_cpp_properties.json file.

In the currently working nRF52840DK_nRF52840 board project the following lines are in its c_cpp_properties.json file.

            "-isystem",
            "/Users/mdcraver/.platformio/packages/framework-zephyr/lib/libc/minimal/include",
            "-isystem",
            "/Users/mdcraver/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include",
            "-isystem",
            "/Users/mdcraver/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include-fixed",

However, in the project with my custom nRF52840 board those lines are not present.

In looking at the release notes for nordicnrf52 v4.3.0 and for the Zephyr framework v2.3.0 I noticed in the Zephyr release notes that the nRF52 boards were renamed. Also, it mentions a new Zephyr CMake package. I was wondering if this could lead to my problems.

Has anyone successfully created a custom nordic nRF52 board, using the recommended method of copying and modifying an existing board, that works with the most recent versions of PlatformIO, nordicnrf52, and Zephyr?

I just upgraded to PlatformIO Core v5.0.0 and still experience the problem.

Working though this process again and wondering if the problem resulted from the “variant” field in the board configuration JSON structure.

"variant": "nRF52DK",
"zephyr": {
  "variant": "nrf52840_pca10056"
}

If this is going to be used for a custom nRF52840 board, it would not be a variant on the nRF52DK. As for the Zephyr variant, in the release notes for nordicnrf52 v4.3.0 and for the Zephyr framework v2.3.0 mentions that the nRF52 boards were renamed. So should this variant board name even be recognized?

Following is my new, renamed and slightly modified, “Test_Custom_nrf52840_dk.json” file.

{
  "build": {
    "arduino": {
      "ldscript": "nrf52_xxaa.ld"
    },
    "core": "nRF5",
    "cpu": "cortex-m4",
    "extra_flags": "-DHELLO_PLATFORMIO",
    "f_cpu": "64000000L",
    "mcu": "nrf52840",
    "variant": "nRF52DK",
    "zephyr": {
      "variant": "nrf52840_pca10056"
    }
  },
  "connectivity": [
    "bluetooth"
  ],
  "debug": {
    "default_tools": [
      "jlink"
    ],
    "jlink_device": "nRF52840_xxAA",
    "onboard_tools": [
      "cmsis-dap",
      "jlink"
    ],
    "svd_path": "nrf52840.svd"
  },
  "frameworks": [
    "zephyr"
  ],
  "name": "Test Custom Nordic nRF52840-DK",
  "upload": {
    "maximum_ram_size": 262144,
    "maximum_size": 1048576,
    "protocol": "jlink",
    "protocols": [
      "jlink",
      "nrfjprog",
      "stlink",
      "blackmagic",
      "cmsis-dap",
      "mbed"
    ]
  },
  "url": "https://os.mbed.com/platforms/Nordic-nRF52840-DK/",
  "vendor": "Nordic"
}

Solution.