Custom board revision/extension with new Zephyr hardware model

I'm upgrading from SDK version v2.4 to v2.7 which introduces the new Zephyr hardware model and I'm struggling with the transition. I have two custom revisions is based off of the nrf5340dk:

In my v2.4 project I added the following to my CMakeLists.txt:

set(REVISIONS "foo_v4" "bar_v1")
if (NOT DEFINED BOARD_REVISION)
    string(REGEX MATCH "nrf5340dk_nrf5340_cpuapp@([a-zA-Z0-9_]+)" _ ${BOARD})
    set(BOARD_REVISION ${CMAKE_MATCH_1})
endif()
if (NOT BOARD_REVISION IN_LIST REVISIONS)
    message(FATAL_ERROR "${BOARD_REVISION} is invalid. Accepted revisions: ${REVISIONS}")
endif()

I then added the following files:

build/
  nrf5340dk_nrf5340_cpuapp_bar_v1.conf
  nrf5340dk_nrf5340_cpuapp_bar_v1.overlay
  nrf5340dk_nrf5340_cpuapp_foo_v4.conf
  nrf5340dk_nrf5340_cpuapp_foo_v4.overlay

Then I built with: west build -b nrf5340dk_nrf5340_cpuapp@foo_v4 --build-dir build/foo_v4

This worked great.

After updating to v2.7 I tweaked my CMakeLists.txt to match the new string, I tried to build with: west build -b nrf5340dk@foo_v4/nrf5340/cpuapp --build-dir=build/foo_v4

but I get the following error:

Invalid board revision: foo_v4

Board 'nrf5340dk' does not define any revisions.

Looking at the "Board Extensions" section of the documentation it seems like this should still be valid: docs.zephyrproject.org/.../board_porting.html

Related