Building for custom board becomes platformless

Hi,

I’m posting to IDE because I observe relevant differences at that level but using CLI has the same results.

I’ve derived custom board from nrf52_dk (JFYI also tried from nrf52832_mdk with same results) for Zephyr framework. I’ve followed existing documentation here Enabling PlatformIO and Zephyr on custom hardware - Zephyr Project

Here’s my platform.ini

[env:mytest]
platform = nordicnrf52
board = mytest
framework = zephyr
monitor_speed = 115000
debug_tool = jlink
upload_protocol = jlink

And my mytest.json under boards dir

{
    "build": {
      "cpu": "cortex-m4",
      "f_cpu": "64000000L",
      "mcu": "nrf52832",
      "zephyr": {
         "variant": "mytest"
      }
    },
    "connectivity": [
      "bluetooth"
    ],
    "debug": {
      "jlink_device": "nRF52832_xxAA",
      "svd_path": "nrf52.svd"
    },
    "frameworks": [
      "zephyr"
    ],
    "platforms": [
      "nordicnrf52"
    ],
    "name": "My Test",
    "upload": {
      "maximum_ram_size": 65536,
      "maximum_size": 524288,
      "protocol": "jlink",
      "protocols": [
        "jlink"
      ]
    },
    "url": "https://www.mytest.com",
    "vendor": "My Test"
}

I notice two things:

  1. In PlatformIO’s vscode panel, in Project Tasks, I don’t have a ‘Platform’ section (between General and Advanced section) with ‘Run menuconfig’, etc. I do have it for the nrf52_dk environment and everything works for that.

  2. When I build - in IDE or by executing ‘pio run --environment mytest --verbose’ Cmake is unable to complete generation

    Processing mytest (platform: nordicnrf52; board: mytest; framework: zephyr; monitor_speed: 115000; debug_tool: jlink; upload_protocol: jlink)

    CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/mytest.html
    PLATFORM: Nordic nRF52 (7.0.0) > My Test
    HARDWARE: NRF52832 64MHz, 64KB RAM, 512KB Flash
    DEBUG: Current (jlink) External (jlink)
    PACKAGES:

    • framework-zephyr 2.20500.210226 (2.5.0)
    • framework-zephyr-canopennode 0.0.0-alpha+sha.468d350028
    • framework-zephyr-civetweb 0.0.0-alpha+sha.e6903b80c0
    • framework-zephyr-cmsis 0.0.0-alpha+sha.c3bd2094f9
    • framework-zephyr-fatfs 0.0.0-alpha+sha.1d1fcc725a
    • framework-zephyr-hal-nordic 0.0.0-alpha+sha.f0d54d8449
    • framework-zephyr-hal-st 0.0.0-alpha+sha.b52fdbf4b6
    • framework-zephyr-libmetal 0.0.0-alpha+sha.9d4ee2c3cf
    • framework-zephyr-littlefs 0.0.0-alpha+sha.9e4498d1c7
    • framework-zephyr-loramac-node 0.0.0-alpha+sha.3f545d76a2
    • framework-zephyr-lvgl 0.0.0-alpha+sha.31acbaa36e
    • framework-zephyr-mbedtls 0.0.0-alpha+sha.24d84ecff1
    • framework-zephyr-mcuboot 0.0.0-alpha+sha.3fc59410b6
    • framework-zephyr-mcumgr 0.0.0-alpha+sha.43845e883f
    • framework-zephyr-mipi-sys-t 0.0.0-alpha+sha.75e671550a
    • framework-zephyr-open-amp 0.0.0-alpha+sha.de1b85a130
    • framework-zephyr-openthread 0.0.0-alpha+sha.1d668284a0
    • framework-zephyr-segger 0.0.0-alpha+sha.38c79a447e
    • framework-zephyr-sof 0.0.0-alpha+sha.b5b772dd61
    • framework-zephyr-tfm-mcuboot 1.7.0-rc1
    • framework-zephyr-tinycbor 0.0.0-alpha+sha.40daca97b4
    • framework-zephyr-tinycrypt 0.0.0-alpha+sha.3e9a49d267
    • framework-zephyr-trusted-firmware-m 0.0.0-alpha+sha.96340fb6c0
    • tool-cmake 3.16.4
    • tool-dtc 1.4.7
    • tool-gperf 3.0.4
    • tool-ninja 1.7.1
    • tool-sreccat 1.164.0 (1.64)
    • toolchain-gccarmnoneeabi 1.80201.181220 (8.2.1)
      Reading CMake configuration…
      – Application: /home/gobbled/zephyr
      – Zephyr version: 2.5.0 (/home/gobbled/.platformio/packages/framework-zephyr)
      – Found Python3: /home/gobbled/.platformio/penv/bin/python3.9 (found suitable exact version “3.9.2”) found components: Interpreter
      – Board: mytest
      – Cache files will be written to: /home/gobbled/.cache/zephyr
      – Found dtc: /home/gobbled/.platformio/packages/tool-dtc/dtc (found suitable version “1.4.7”, minimum required is “1.4.6”)
      – Found toolchain: gnuarmemb (/home/gobbled/.platformio/packages/toolchain-gccarmnoneeabi@1.80201.181220)
      – Found BOARD.dts: /home/gobbled/zephyr/boards/arm/mytest/mytest.dts
      – Generated zephyr.dts: /home/gobbled/.pio/build/mytest/zephyr/zephyr.dts
      – Generated devicetree_unfixed.h: /home/gobbled/.pio/build/mytest/zephyr/include/generated/devicetree_unfixed.h
      – Generated device_extern.h: /home/gobbled/.pio/build/mytest/zephyr/include/generated/device_extern.h
      Parsing /home/gobbled/.platformio/packages/framework-zephyr/Kconfig
      Loaded configuration ‘/home/gobbled/zephyr/boards/arm/mytest/mytest_defconfig’
      Merged configuration ‘/home/gobbled/zephyr/prj.conf’
      Configuration saved to ‘/home/gobbled/.pio/build/mytest/zephyr/.config’
      Kconfig header saved to ‘/home/gobbled/.pio/build/mytest/zephyr/include/generated/autoconf.h’
      – The C compiler identification is GNU 8.2.1
      – The CXX compiler identification is GNU 8.2.1
      – The ASM compiler identification is GNU
      – Found assembler: /home/gobbled/.platformio/packages/toolchain-gccarmnoneeabi@1.80201.181220/bin/arm-none-eabi-gcc
      – Configuring done

    CMake Error at /home/gobbled/.platformio/packages/framework-zephyr/cmake/extensions.cmake:416 (add_library):
    No SOURCES given to target: drivers__serial
    Call Stack (most recent call first):
    /home/gobbled/.platformio/packages/framework-zephyr/cmake/extensions.cmake:393 (zephyr_library_named)
    /home/gobbled/.platformio/packages/framework-zephyr/drivers/serial/CMakeLists.txt:3 (zephyr_library)

    CMake Generate step failed. Build files cannot be regenerated correctly.
    ========================== [FAILED] Took 1.75 seconds ==========================

    Environment Status Duration


    mytest FAILED 00:00:01.750
    nrf52_dk IGNORED
    ==================== 1 failed, 0 succeeded in 00:00:01.750 ====================

Am I missing something or is there a bug lurking here?

Thanks in advance

Something is wrong with the port of Zephyr for your board, probably the device tree file – see Out of tree board: No sources given to target · Issue #25499 · zephyrproject-rtos/zephyr · GitHub

Probably related to the second error, since it can’t configure Zephyr properly since CMake fails on it. Try and solve the above error first.

1 Like