nrf connect bare metal and blinky

Trying to get familiar with nrf connect bare metal. Some examples work fine, like ble_nus and ppi

But blinky cannot compile. I need to use bm_nrf54l15df/nrf54l15/cpuapp/s115_softdevice. Ok.

The compile error starts with

In file included from /home/sietse/ncs/nrf-bm/v2.0.1/zephyr/include/zephyr/toolchain/gcc.h:98,
                 from /home/sietse/ncs/nrf-bm/v2.0.1/zephyr/include/zephyr/toolchain.h:52,
                 from /home/sietse/ncs/nrf-bm/v2.0.1/zephyr/include/zephyr/kernel_includes.h:23,
                 from /home/sietse/ncs/nrf-bm/v2.0.1/zephyr/include/zephyr/kernel.h:17,
                 from /home/sietse/ncs/bm-examples/blinky/src/main.c:8:
/home/sietse/ncs/nrf-bm/v2.0.1/zephyr/include/zephyr/device.h:96:41: error: '__device_dts_ord_DT_N_ALIAS_led0_P_gpios_IDX_0_PH_ORD' undeclared here (not in a function)
   96 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
/home/sietse/ncs/nrf-bm/v2.0.1/zephyr/include/zephyr/toolchain/common.h:168:26: note: in definition of macro '_DO_CONCAT'
  168 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/home/sietse/ncs/nrf-bm/v2.0.1/zephyr/include/zephyr/device.h:96:33: note: in expansion of macro '_CONCAT'

The thing I don't understand is the need for a complete different device tree, like bm_nrf54l15dk_nrf54l15_cpuapp_s115_softdevice.dts.

This does also does not include   nrf54l15dk_common.dtsi, which describes the leds and buttons of the DK.

A device tree is mainly to describe the hardware, and that did not change when switching to bare metal!

What am I missing here? And how to make a simple example like blinky work?

Parents Reply Children
  • Thanks, that works.

    And you can consider my question answered, but I am actually curious as to why the regular devicetree (so not bm_xxx) isn't used. The hardware did not change when going to bare metal, or am I missing something?

  • Hi,
    That great! For your question, the hardware is indeed the same. In regular Zephyr, the devicetree tells the OS which drivers to build, which peripherals to manage, and how to configure them. In NCS Bare Metal you manage the hardware yourself to a much larger degree. Instead of using Zephyr’s drivers, those peripheral nodes serve no purpose. Only the memory layout and a few clock and timer nodes remain.

    It’s also important to note that NCS Bare Metal isn’t pure vanilla bare metal. It’s still part of the NCS family, so it reuses some parts of Zephyr.

    Benjamin

Related