Skip to content

Commit

Permalink
samples: caf_sensor_manager: Adapt to sysbuild
Browse files Browse the repository at this point in the history
This adapts CAF Sensor Manager sample to be correctly build
with sysbuild.

NCSDK-28207

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
  • Loading branch information
KAGA164 authored and anangl committed Jul 1, 2024
1 parent 69be66c commit 43e521e
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 59 deletions.
1 change: 0 additions & 1 deletion samples/caf_sensor_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#
cmake_minimum_required(VERSION 3.20.0)

set(ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_LIST_DIR})
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project("Sensor manager sample")

Expand Down
16 changes: 0 additions & 16 deletions samples/caf_sensor_manager/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,6 @@

menu "Sensor manager sample"
rsource "src/modules/Kconfig"

config APP_INCLUDE_REMOTE_IMAGE
bool "Include remote image build"
depends on SOC_NRF5340_CPUAPP
default y if (BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS)
select PARTITION_MANAGER_ENABLED
select BOARD_ENABLE_CPUNET

config APP_REMOTE_BOARD
string "The name of the board to be used by remote image"
depends on APP_INCLUDE_REMOTE_IMAGE

# Disabling adding an empty net core image as we provide our own in this sample.
config NCS_SAMPLE_EMPTY_NET_CORE_CHILD_IMAGE
bool "Add empty netcore child image"
default n
endmenu

menu "Zephyr Kernel"
Expand Down
8 changes: 7 additions & 1 deletion samples/caf_sensor_manager/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"

config INCLUDE_REMOTE_IMAGE
bool "Include CAF Sensor Manager romete image"
default y

config REMOTE_BOARD
string "The board used for remote target"
default "nrf5340dk/nrf5340/cpunet" if BOARD_NRF5340DK
default "nrf5340dk/nrf5340/cpunet" if BOARD_NRF5340DK_NRF5340_CPUAPP
default "nrf5340dk/nrf5340/cpunet" if BOARD_NRF5340DK_NRF5340_CPUAPP_NS
default "nrf54h20dk/nrf54h20/cpuppr" if BOARD_NRF54H20DK_NRF54H20_CPUAPP
2 changes: 1 addition & 1 deletion samples/caf_sensor_manager/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ To use this configuration, run the following command:

.. code-block:: console
west build -b nrf5340dk/nrf5340/cpuapp -- -DEXTRA_CONF_FILE=boards/nrf5340dk_nrf5340_cpuapp_nrf5340_singlecore.conf
west build -b nrf5340dk/nrf5340/cpuapp -- -DFILE_SUFFIX=singlecore
Building and running
********************
Expand Down
15 changes: 0 additions & 15 deletions samples/caf_sensor_manager/aci/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
#
################################################################################

CONFIG_APP_INCLUDE_REMOTE_IMAGE=y
CONFIG_APP_REMOTE_BOARD="nrf5340dk_nrf5340_cpunet"

CONFIG_EVENT_MANAGER_PROXY=y
CONFIG_IPC_SERVICE=y
CONFIG_MBOX=y
Expand All @@ -16,3 +13,6 @@ CONFIG_OPENAMP=y
CONFIG_OPENAMP_SLAVE=n

CONFIG_CAF_SENSOR_DATA_AGGREGATOR_EVENTS=y

CONFIG_PARTITION_MANAGER_ENABLED=y
CONFIG_BOARD_ENABLE_CPUNET=y
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
#
################################################################################

CONFIG_APP_INCLUDE_REMOTE_IMAGE=n
CONFIG_APP_REMOTE_BOARD=""

CONFIG_EVENT_MANAGER_PROXY=n
CONFIG_IPC_SERVICE=n
CONFIG_MBOX=n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ ipc0: &cpuapp_cpuppr_ipc {
status = "okay";
};

&cpuppr_ram3x_region {
cpuppr_code_data: memory@0 {
reg = <0x0 0xf200>;
};

ram3x_agg_area0: memory@f200 {
reg = <0xf200 0x600>;
};
};

/* UART and RAM3 instance used by PPR should be enabled at build time
* using nordic-ppr snippet.
*/
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
#
################################################################################

CONFIG_OPENAMP=n

CONFIG_ASSERT=n
CONFIG_BOOT_BANNER=n
CONFIG_HEAP_MEM_POOL_SIZE=512
CONFIG_SIZE_OPTIMIZATIONS=y

CONFIG_NCS_BOOT_BANNER=n

CONFIG_LOG_MODE_MINIMAL=y

CONFIG_CAF_INIT_LOG_SENSOR_EVENTS=y
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
};

/* Place aggregator buffers in PPR memory region. */

&cpuppr_ram3x_region {
cpuppr_code_data: memory@0 {
reg = <0x0 0xf200>;
Expand All @@ -44,6 +43,10 @@
status = "okay";
};

&uart135 {
/delete-property/ hw-flow-control;
};

ipc0: &cpuapp_cpuppr_ipc {
status = "okay";
};
16 changes: 5 additions & 11 deletions samples/caf_sensor_manager/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,17 @@ tests:
integration_platforms:
- nrf5340dk/nrf5340/cpuapp
extra_args: >
OVERLAY_CONFIG=boards/nrf5340dk_nrf5340_cpuapp_singlecore.conf CONFIG_SERIAL=n
FILE_SUFFIX=singlecore
CONFIG_CONSOLE=n CONFIG_UART_CONSOLE=n CONFIG_LOG=n
DTC_OVERLAY_FILE=boards/nrf5340dk_nrf5340_cpuapp_singlecore.overlay
tags: sysbuild
sample.caf_sensor_manager.nrf5340dk_singlecore.correctness_test:
sysbuild: true
build_only: false
platform_allow: nrf5340dk/nrf5340/cpuapp
integration_platforms:
- nrf5340dk/nrf5340/cpuapp
extra_args: OVERLAY_CONFIG=boards/nrf5340dk_nrf5340_cpuapp_singlecore.conf
DTC_OVERLAY_FILE=boards/nrf5340dk_nrf5340_cpuapp_singlecore.overlay
extra_args:
FILE_SUFFIX=singlecore
harness: console
harness_config:
type: multi_line
Expand All @@ -76,12 +75,8 @@ tests:
integration_platforms:
- nrf54h20dk/nrf54h20/cpuapp
extra_args:
SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpuppr.conf
caf_sensor_manager_SNIPPET=nordic-ppr
caf_sensor_manager_OVERLAY_CONFIG=boards/nrf54h20dk_nrf54h20_cpuapp_multicore.conf
caf_sensor_manager_DTC_OVERLAY_FILE=boards/nrf54h20dk_nrf54h20_cpuapp_multicore.overlay
remote_OVERLAY_CONFIG=boards/nrf54h20dk_nrf54h20_cpuppr.conf
remote_DTC_OVERLAY_FILE=boards/nrf54h20dk_nrf54h20_cpuppr.overlay

sample.caf_sensor_manager.nrf54h20.singlecore:
build_only: true
sysbuild: true
Expand All @@ -90,5 +85,4 @@ tests:
integration_platforms:
- nrf54h20dk/nrf54h20/cpuapp
extra_args:
caf_sensor_manager_OVERLAY_CONFIG=boards/nrf54h20dk_nrf54h20_cpuapp_singlecore.conf
caf_sensor_manager_DTC_OVERLAY_FILE=boards/nrf54h20dk_nrf54h20_cpuapp_singlecore.overlay
FILE_SUFFIX=singlecore
11 changes: 9 additions & 2 deletions samples/caf_sensor_manager/sysbuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "")
if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "" OR NOT SB_CONFIG_INCLUDE_REMOTE_IMAGE)
return()
endif()

# This sample always requires PPR snippet for nRF54h20
if (${NORMALIZED_BOARD_TARGET} STREQUAL "nrf54h20dk_nrf54h20_cpuapp")
if(NOT nordic-ppr IN_LIST caf_sensor_manager_SNIPPET)
set(caf_sensor_manager_SNIPPET nordic-ppr CACHE STRING "" FORCE)
endif()
endif()

message(STATUS "Building remote firmware for ${SB_CONFIG_REMOTE_BOARD}")

# Add remote project
Expand All @@ -25,6 +32,6 @@ if(SB_CONFIG_PARTITION_MANAGER)
endif()

# Add a dependency so that the remote sample will be built and flashed first
add_dependencies(caf_sensor_manager remote)
sysbuild_add_dependencies(CONFIGURE caf_sensor_manager remote)
# Add dependency so that the remote image is flashed first.
sysbuild_add_dependencies(FLASH caf_sensor_manager remote)

This file was deleted.

8 changes: 8 additions & 0 deletions samples/caf_sensor_manager/sysbuild_singlecore.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Copyright (c) 2024 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
################################################################################

SB_CONFIG_INCLUDE_REMOTE_IMAGE=n
2 changes: 0 additions & 2 deletions samples/caf_sensor_manager/zephyr/module.yml

This file was deleted.

0 comments on commit 43e521e

Please sign in to comment.