Zephyr Module Child image

****** Solution *********

I needed to add a pm.yml file that specified the child image partition size.

childapp:
  size: 0x4C000
  placement:
    before: [app]

I also needed to specify the board in the zephyr cmake file

if (CONFIG_INCLUDE_CHILDAPP)
add_child_image(
    NAME childapp
    SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../childapp
    BOARD nrf5340dk_nrf5340_cpuapp
)
endif()

================ Original Post ================ 

I would like to create a child image using the Zephyr Modules Method.  I am following this example/documentation:

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_dev/multi_image/index.html#adding-a-child-image-using-zephyr-modules

I believe the issue is selecting the build strategy in the Child Kconfig.

My setup is as follows:

root directory:

#root CMakeLists.txt
cmake_minimum_required(VERSION 3.20.0)

set(ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_LIST_DIR})

message(WARNING "Building Parent Image" )

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(hello_world)

target_sources(app PRIVATE src/main.c)

zephyr directory:

# zephyr/module.yml
build:
  cmake: zephyr

# zephyr/CMakeLists.txt
add_child_image(
    NAME childapp
    SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../childapp
)

childapp directory

# Child app Kconfig
module=CHILDAPP
source "${ZEPHYR_BASE}/../nrf/subsys/partition_manager/Kconfig.template.build_strategy"

# childapp/prj.conf
CONFIG_CHILDAPP_BUILD_STRATEGY_FROM_SOURCE=y

# childapp/CMakeLists.txt
cmake_minimum_required(VERSION 3.20.0)

message(WARNING "Building Child Image" )

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(childapp)

target_sources(myapp PRIVATE src/rec.c)

Compile errors:

=== child image childapp -  begin ===
loading initial cache file /Users/lcorbin/Programming/ncs_projects/hello_world/build/childapp/child_image_preload.cmake
CMake Warning at CMakeLists.txt:6 (message):
  Building Child Image


Loading Zephyr default modules (Zephyr base).
-- Application: /Users/lcorbin/Programming/ncs_projects/hello_world/childapp
-- Using NCS Toolchain 2.3.0 for building. (/opt/nordic/ncs/toolchains/v2.3.0/cmake)
-- Found Python3: /opt/nordic/ncs/toolchains/v2.3.0/bin/python3 (found suitable exact version "3.9.6") found components: Interpreter 
-- Cache files will be written to: /Users/lcorbin/Library/Caches/zephyr
-- Zephyr version: 3.2.99 (/opt/nordic/ncs/v2.3.0/zephyr)
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: nrf52840dk_nrf52840
-- Found host-tools: zephyr 0.15.2 (/Users/lcorbin/zephyr-sdk-0.15.2)
-- Found toolchain: zephyr 0.15.2 (/Users/lcorbin/zephyr-sdk-0.15.2)
-- Found Dtc: /opt/nordic/ncs/toolchains/v2.3.0/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6") 
-- Found BOARD.dts: /opt/nordic/ncs/v2.3.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Generated zephyr.dts: /Users/lcorbin/Programming/ncs_projects/hello_world/build/childapp/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /Users/lcorbin/Programming/ncs_projects/hello_world/build/childapp/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /Users/lcorbin/Programming/ncs_projects/hello_world/build/childapp/zephyr/dts.cmake
Parsing /Users/lcorbin/Programming/ncs_projects/hello_world/childapp/Kconfig
Loaded configuration '/opt/nordic/ncs/v2.3.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
Merged configuration '/Users/lcorbin/Programming/ncs_projects/hello_world/childapp/prj.conf'
Merged configuration '/opt/nordic/ncs/v2.3.0/nrf/subsys/partition_manager/partition_manager_enabled.conf'
Traceback (most recent call last):
  File "/opt/nordic/ncs/v2.3.0/zephyr/scripts/kconfig/kconfig.py", line 292, in <module>
    main()
  File "/opt/nordic/ncs/v2.3.0/zephyr/scripts/kconfig/kconfig.py", line 65, in main
    if kconf.syms['WARN_DEPRECATED'].tri_value == 2:
KeyError: 'WARN_DEPRECATED'
CMake Error at /opt/nordic/ncs/v2.3.0/zephyr/cmake/modules/kconfig.cmake:328 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  /opt/nordic/ncs/v2.3.0/nrf/cmake/modules/kconfig.cmake:29 (include)
  /opt/nordic/ncs/v2.3.0/zephyr/cmake/modules/zephyr_default.cmake:108 (include)
  /opt/nordic/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /opt/nordic/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:8 (find_package)


-- Configuring incomplete, errors occurred!
CMake Error at /opt/nordic/ncs/v2.3.0/nrf/cmake/multi_image.cmake:433 (message):
  CMake generation for childapp failed, aborting.  Command: 1
Call Stack (most recent call first):
  /opt/nordic/ncs/v2.3.0/nrf/cmake/multi_image.cmake:163 (add_child_image_from_source)
  zephyr/CMakeLists.txt:2 (add_child_image)


-- Configuring incomplete, errors occurred!
See also "/Users/lcorbin/Programming/ncs_projects/hello_world/build/CMakeFiles/CMakeOutput.log".
See also "/Users/lcorbin/Programming/ncs_projects/hello_world/build/CMakeFiles/CMakeError.log".

Parents Reply Children
Related