Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downmerge a few nrfbsim related changes #2112

Closed
wants to merge 9 commits into from
Closed
1 change: 1 addition & 0 deletions boards/native/nrf_bsim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ zephyr_library_sources(
cpu_wait.c
argparse.c
nsi_if.c
native_remap.c
soc/nrfx_coredep.c
common/bstests_entry.c
common/cmsis/cmsis.c
Expand Down
12 changes: 12 additions & 0 deletions boards/native/nrf_bsim/native_remap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdbool.h>
#include "NHW_misc.h"

bool native_emb_addr_remap(void **addr)
{
return nhw_convert_RAM_addr(addr);
}
38 changes: 30 additions & 8 deletions include/zephyr/ipc/pbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
*/
#define _PBUF_MIN_DATA_LEN ROUND_UP(PBUF_PACKET_LEN_SZ + 1 + _PBUF_IDX_SIZE, _PBUF_IDX_SIZE)

#if defined(CONFIG_ARCH_POSIX)
/* For the native simulated boards we need to modify some pointers at init */
#define PBUF_MAYBE_CONST
#else
#define PBUF_MAYBE_CONST const
#endif

/** @brief Control block of packet buffer.
*
* The structure contains configuration data.
Expand Down Expand Up @@ -87,9 +94,9 @@
* written in a way to protect the data from being corrupted.
*/
struct pbuf {
const struct pbuf_cfg *const cfg; /* Configuration of the
* buffer.
*/
PBUF_MAYBE_CONST struct pbuf_cfg *const cfg; /* Configuration of the
* buffer.
*/
struct pbuf_data data; /* Data used to read and write
* to the buffer
*/
Expand Down Expand Up @@ -144,17 +151,32 @@
"Misaligned memory."); \
BUILD_ASSERT(size >= (MAX(dcache_align, _PBUF_IDX_SIZE) + _PBUF_IDX_SIZE + \
_PBUF_MIN_DATA_LEN), "Insufficient size."); \
\
static const struct pbuf_cfg cfg_##name = \
static PBUF_MAYBE_CONST struct pbuf_cfg cfg_##name = \
PBUF_CFG_INIT(mem_addr, size, dcache_align); \
static struct pbuf name = { \
.cfg = &cfg_##name, \
}

Check notice on line 158 in include/zephyr/ipc/pbuf.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/ipc/pbuf.h:158 -#define PBUF_DEFINE(name, mem_addr, size, dcache_align) \ - BUILD_ASSERT(dcache_align >= 0, \ - "Cache line size must be non negative."); \ - BUILD_ASSERT((size) > 0 && IS_PTR_ALIGNED_BYTES(size, _PBUF_IDX_SIZE), \ - "Incorrect size."); \ - BUILD_ASSERT(IS_PTR_ALIGNED_BYTES(mem_addr, MAX(dcache_align, _PBUF_IDX_SIZE)), \ - "Misaligned memory."); \ - BUILD_ASSERT(size >= (MAX(dcache_align, _PBUF_IDX_SIZE) + _PBUF_IDX_SIZE + \ - _PBUF_MIN_DATA_LEN), "Insufficient size."); \ - static PBUF_MAYBE_CONST struct pbuf_cfg cfg_##name = \ - PBUF_CFG_INIT(mem_addr, size, dcache_align); \ - static struct pbuf name = { \ - .cfg = &cfg_##name, \ +#define PBUF_DEFINE(name, mem_addr, size, dcache_align) \ + BUILD_ASSERT(dcache_align >= 0, "Cache line size must be non negative."); \ + BUILD_ASSERT((size) > 0 && IS_PTR_ALIGNED_BYTES(size, _PBUF_IDX_SIZE), "Incorrect size."); \ + BUILD_ASSERT(IS_PTR_ALIGNED_BYTES(mem_addr, MAX(dcache_align, _PBUF_IDX_SIZE)), \ + "Misaligned memory."); \ + BUILD_ASSERT( \ + size >= (MAX(dcache_align, _PBUF_IDX_SIZE) + _PBUF_IDX_SIZE + _PBUF_MIN_DATA_LEN), \ + "Insufficient size."); \ + static PBUF_MAYBE_CONST struct pbuf_cfg cfg_##name = \ + PBUF_CFG_INIT(mem_addr, size, dcache_align); \ + static struct pbuf name = { \ + .cfg = &cfg_##name, \

/**
* @brief Initialize the packet buffer.
* @brief Initialize the Tx packet buffer.
*
* This function initializes the Tx packet buffer based on provided configuration.
* If the configuration is incorrect, the function will return error.
*
* It is recommended to use PBUF_DEFINE macro for build time initialization.
*
* @param pb Pointer to the packed buffer containing
* configuration and data. Configuration has to be
* fixed before the initialization.
* @retval 0 on success.
* @retval -EINVAL when the input parameter is incorrect.
*/
int pbuf_tx_init(struct pbuf *pb);

/**
* @brief Initialize the Rx packet buffer.
*
* This function initializes the packet buffer based on provided configuration.
* This function initializes the Rx packet buffer.
* If the configuration is incorrect, the function will return error.
*
* It is recommended to use PBUF_DEFINE macro for build time initialization.
Expand All @@ -165,7 +187,7 @@
* @retval 0 on success.
* @retval -EINVAL when the input parameter is incorrect.
*/
int pbuf_init(struct pbuf *pb);
int pbuf_rx_init(struct pbuf *pb);

/**
* @brief Write specified amount of data to the packet buffer.
Expand Down
1 change: 1 addition & 0 deletions samples/subsys/ipc/ipc_service/icmsg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

if(NOT CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP AND
NOT CONFIG_BOARD_NRF5340BSIM_NRF5340_CPUAPP AND
NOT CONFIG_BOARD_STM32H747I_DISCO AND
NOT CONFIG_BOARD_NRF54L15PDK_NRF54L15_CPUAPP)
message(FATAL_ERROR "${BOARD} is not supported for this sample")
Expand Down
1 change: 1 addition & 0 deletions samples/subsys/ipc/ipc_service/icmsg/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ source "share/sysbuild/Kconfig"
config REMOTE_BOARD
string
default "nrf5340dk/nrf5340/cpunet" if $(BOARD) = "nrf5340dk"
default "nrf5340bsim/nrf5340/cpunet" if $(BOARD) = "nrf5340bsim"
default "nrf54l15pdk/nrf54l15/cpuflpr" if $(BOARD) = "nrf54l15pdk"
default "stm32h747i_disco/stm32h747xx/m4" if $(BOARD) = "stm32h747i_disco"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "nrf5340dk_nrf5340_cpuapp.overlay"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "nrf5340dk_nrf5340_cpunet.overlay"
5 changes: 4 additions & 1 deletion samples/subsys/ipc/ipc_service/icmsg/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ sample:
name: IPC Service example integration (icmsg backend)
tests:
sample.ipc.icmsg:
platform_allow: nrf5340dk/nrf5340/cpuapp
platform_allow:
- nrf5340dk/nrf5340/cpuapp
- nrf5340bsim/nrf5340/cpuapp
integration_platforms:
- nrf5340dk/nrf5340/cpuapp
- nrf5340bsim/nrf5340/cpuapp
tags: ipc
sysbuild: true
harness: console
Expand Down
3 changes: 3 additions & 0 deletions samples/subsys/ipc/ipc_service/icmsg/sysbuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ ExternalZephyrProject_Add(
SOURCE_DIR ${APP_DIR}/remote
BOARD ${SB_CONFIG_REMOTE_BOARD}
)

native_simulator_set_child_images(${DEFAULT_IMAGE} remote)
native_simulator_set_final_executable(${DEFAULT_IMAGE})
3 changes: 2 additions & 1 deletion samples/subsys/ipc/ipc_service/multi_endpoint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

if(NOT CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP)
if(NOT CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP AND
NOT CONFIG_BOARD_NRF5340BSIM_NRF5340_CPUAPP )
message(FATAL_ERROR "${BOARD} is not supported for this sample")
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ source "share/sysbuild/Kconfig"
config NET_CORE_BOARD
string
default "nrf5340dk/nrf5340/cpunet" if $(BOARD) = "nrf5340dk"
default "nrf5340bsim/nrf5340/cpunet" if $(BOARD) = "nrf5340bsim"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "nrf5340dk_nrf5340_cpuapp.overlay"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "nrf5340dk_nrf5340_cpunet.overlay"
10 changes: 8 additions & 2 deletions samples/subsys/ipc/ipc_service/multi_endpoint/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,21 @@ common:
- "IPC-service HOST \\[INST 1\\] demo ended\\."
tests:
sample.ipc.multi_endpoint:
platform_allow: nrf5340dk/nrf5340/cpuapp
platform_allow:
- nrf5340dk/nrf5340/cpuapp
- nrf5340bsim/nrf5340/cpuapp
integration_platforms:
- nrf5340dk/nrf5340/cpuapp
- nrf5340bsim/nrf5340/cpuapp
tags: ipc
sysbuild: true
sample.ipc.multi_endpoint.icbmsg:
platform_allow: nrf5340dk/nrf5340/cpuapp
platform_allow:
- nrf5340dk/nrf5340/cpuapp
- nrf5340bsim/nrf5340/cpuapp
integration_platforms:
- nrf5340dk/nrf5340/cpuapp
- nrf5340bsim/nrf5340/cpuapp
tags: ipc
sysbuild: true
extra_args:
Expand Down
3 changes: 3 additions & 0 deletions samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ ExternalZephyrProject_Add(
SOURCE_DIR ${APP_DIR}/remote
BOARD ${SB_CONFIG_NET_CORE_BOARD}
)

native_simulator_set_child_images(${DEFAULT_IMAGE} remote)
native_simulator_set_final_executable(${DEFAULT_IMAGE})
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr)

if(NOT (CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP OR
CONFIG_BOARD_NRF5340BSIM_NRF5340_CPUAPP OR
CONFIG_BOARD_LPCXPRESSO55S69_LPC55S69_CPU0 OR
CONFIG_BOARD_MIMXRT1160_EVK_MIMXRT1166_CM7 OR
CONFIG_BOARD_MIMXRT1170_EVK_MIMXRT1176_CM7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ source "share/sysbuild/Kconfig"
config NET_CORE_BOARD
string
default "nrf5340dk/nrf5340/cpunet" if $(BOARD) = "nrf5340dk"
default "nrf5340bsim/nrf5340/cpunet" if $(BOARD) = "nrf5340bsim"
default "lpcxpresso55s69/lpc55s69/cpu1" if $(BOARD) = "lpcxpresso55s69"
default "mimxrt1160_evk/mimxrt1166/cm4" if $(BOARD) = "mimxrt1160_evk"
default "mimxrt1170_evk/mimxrt1176/cm4" if $(BOARD) = "mimxrt1170_evk"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "nrf5340dk_nrf5340_cpuapp.overlay"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "nrf5340dk_nrf5340_cpunet.overlay"
2 changes: 2 additions & 0 deletions samples/subsys/ipc/ipc_service/static_vrings/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ tests:
sample.ipc.static_vrings:
platform_allow:
- nrf5340dk/nrf5340/cpuapp
- nrf5340bsim/nrf5340/cpuapp
- lpcxpresso55s69/lpc55s69/cpu0
- mimxrt1160_evk/mimxrt1166/cm7
- mimxrt1170_evk/mimxrt1176/cm7
- mimxrt1170_evk@B/mimxrt1176/cm7
integration_platforms:
- nrf5340dk/nrf5340/cpuapp
- nrf5340bsim/nrf5340/cpuapp
tags: ipc
sysbuild: true
harness: console
Expand Down
3 changes: 3 additions & 0 deletions samples/subsys/ipc/ipc_service/static_vrings/sysbuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ ExternalZephyrProject_Add(
# remote core's build, such as the output image's LMA
add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP})
sysbuild_add_dependencies(CONFIGURE ${DEFAULT_IMAGE} ${REMOTE_APP})

native_simulator_set_child_images(${DEFAULT_IMAGE} remote)
native_simulator_set_final_executable(${DEFAULT_IMAGE})
1 change: 1 addition & 0 deletions soc/native/inf_clock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ zephyr_library_compile_definitions(NO_POSIX_CHEATS)
zephyr_library_sources(
soc.c
native_tasks.c
native_remap.c
)

zephyr_library_include_directories(
Expand Down
16 changes: 16 additions & 0 deletions soc/native/inf_clock/native_remap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdbool.h>
#include <zephyr/toolchain.h>

/**
* Dummy version which does nothing
* Boards which do not have a better implementation can use this
*/
__weak bool native_emb_addr_remap(void **addr)
{
return false;
}
15 changes: 15 additions & 0 deletions soc/native/inf_clock/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#ifndef _POSIX_SOC_INF_CLOCK_SOC_H
#define _POSIX_SOC_INF_CLOCK_SOC_H

#include <stdbool.h>
#include <zephyr/toolchain.h>
#include "board_soc.h"
#include "posix_soc.h"
Expand All @@ -18,6 +19,20 @@ extern "C" {

void posix_soc_clean_up(void);

/**
* Remap an embedded device address, into an address which can be used in the simulated native
* board.
*
* If the provided address is not in a range known to this function it will not be modified and the
* function will return false.
* Otherwise the provided address pointer will be modified, and true returned.
*
* Note: The SOC provides a dummy version of this function which does nothing,
* so all boards will have an implementation.
* It is optional for boards to provide one if desired.
*/
bool native_emb_addr_remap(void **addr);

#ifdef __cplusplus
}
#endif
Expand Down
16 changes: 14 additions & 2 deletions subsys/ipc/ipc_service/backends/ipc_icbmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@
#include <zephyr/ipc/ipc_service_backend.h>
#include <zephyr/cache.h>

#if defined(CONFIG_ARCH_POSIX)
#include <soc.h>
#define MAYBE_CONST
#else
#define MAYBE_CONST const
#endif

LOG_MODULE_REGISTER(ipc_icbmsg,
CONFIG_IPC_SERVICE_BACKEND_ICBMSG_LOG_LEVEL);

Expand Down Expand Up @@ -1238,12 +1245,17 @@
*/
static int backend_init(const struct device *instance)
{
const struct icbmsg_config *conf = instance->config;
MAYBE_CONST struct icbmsg_config *conf = (struct icbmsg_config *)instance->config;
struct backend_data *dev_data = instance->data;
#ifdef CONFIG_MULTITHREADING
static K_THREAD_STACK_DEFINE(ep_bound_work_q_stack, EP_BOUND_WORK_Q_STACK_SIZE);
static bool is_work_q_started;

#if defined(CONFIG_ARCH_POSIX)
native_emb_addr_remap((void **)&conf->tx.blocks_ptr);
native_emb_addr_remap((void **)&conf->rx.blocks_ptr);
#endif

if (!is_work_q_started) {
k_work_queue_init(&ep_bound_work_q);
k_work_queue_start(&ep_bound_work_q, ep_bound_work_q_stack,
Expand Down Expand Up @@ -1401,7 +1413,7 @@
.rx_pb = &rx_icbmsg_pb_##i, \
} \
}; \
static const struct icbmsg_config backend_config_##i = \
static MAYBE_CONST struct icbmsg_config backend_config_##i = \
{ \
.control_config = { \
.mbox_tx = MBOX_DT_SPEC_INST_GET(i, tx), \
Expand Down Expand Up @@ -1440,5 +1452,5 @@
POST_KERNEL, \
CONFIG_IPC_SERVICE_REG_BACKEND_PRIORITY, \
&backend_ops);

Check notice on line 1455 in subsys/ipc/ipc_service/backends/ipc_icbmsg.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/ipc/ipc_service/backends/ipc_icbmsg.c:1455 -#define DEFINE_BACKEND_DEVICE(i) \ - SYS_BITARRAY_DEFINE_STATIC(tx_usage_bitmap_##i, DT_INST_PROP(i, tx_blocks)); \ - SYS_BITARRAY_DEFINE_STATIC(rx_hold_bitmap_##i, DT_INST_PROP(i, rx_blocks)); \ - PBUF_DEFINE(tx_icbmsg_pb_##i, \ - GET_MEM_ADDR_INST(i, tx), \ - GET_ICMSG_SIZE_INST(i, tx, rx), \ - GET_CACHE_ALIGNMENT(i)); \ - PBUF_DEFINE(rx_icbmsg_pb_##i, \ - GET_MEM_ADDR_INST(i, rx), \ - GET_ICMSG_SIZE_INST(i, rx, tx), \ - GET_CACHE_ALIGNMENT(i)); \ - static struct backend_data backend_data_##i = { \ - .control_data = { \ - .tx_pb = &tx_icbmsg_pb_##i, \ - .rx_pb = &rx_icbmsg_pb_##i, \ - } \ - }; \ - static MAYBE_CONST struct icbmsg_config backend_config_##i = \ - { \ - .control_config = { \ - .mbox_tx = MBOX_DT_SPEC_INST_GET(i, tx), \ - .mbox_rx = MBOX_DT_SPEC_INST_GET(i, rx), \ - }, \ - .tx = { \ - .blocks_ptr = (uint8_t *)GET_BLOCKS_ADDR_INST(i, tx, rx), \ - .block_count = DT_INST_PROP(i, tx_blocks), \ - .block_size = GET_BLOCK_SIZE_INST(i, tx, rx), \ - }, \ - .rx = { \ - .blocks_ptr = (uint8_t *)GET_BLOCKS_ADDR_INST(i, rx, tx), \ - .block_count = DT_INST_PROP(i, rx_blocks), \ - .block_size = GET_BLOCK_SIZE_INST(i, rx, tx), \ - }, \ - .tx_usage_bitmap = &tx_usage_bitmap_##i, \ - .rx_hold_bitmap = &rx_hold_bitmap_##i, \ - }; \ - BUILD_ASSERT(IS_POWER_OF_TWO(GET_CACHE_ALIGNMENT(i)), \ - "This module supports only power of two cache alignment"); \ - BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, tx, rx) > GET_CACHE_ALIGNMENT(i)) && \ - (GET_BLOCK_SIZE_INST(i, tx, rx) < \ - GET_MEM_SIZE_INST(i, tx)), \ - "TX region is too small for provided number of blocks"); \ - BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, rx, tx) > GET_CACHE_ALIGNMENT(i)) && \ - (GET_BLOCK_SIZE_INST(i, rx, tx) < \ - GET_MEM_SIZE_INST(i, rx)), \ - "RX region is too small for provided number of blocks"); \ - BUILD_ASSERT(DT_INST_PROP(i, rx_blocks) <= 256, "Too many RX blocks"); \ - BUILD_ASSERT(DT_INST_PROP(i, tx_blocks) <= 256, "Too many TX blocks"); \ - DEVICE_DT_INST_DEFINE(i, \ - &backend_init, \ - NULL, \ - &backend_data_##i, \ - &backend_config_##i, \ - POST_KERNEL, \ - CONFIG_IPC_SERVICE_REG_BACKEND_PRIORITY, \ - &backend_ops); +#define DEFINE_BACKEND_DEVICE(i) \ + SYS_BITARRAY_DEFINE_STATIC(tx_usage_bitmap_##i, DT_INST_PROP(i, tx_blocks)); \ + SYS_BITARRAY_DEFINE_STATIC(rx_hold_bitmap_##i, DT_INST_PROP(i, rx_blocks)); \ + PBUF_DEFINE(tx_icbmsg_pb_##i, GET_MEM_ADDR_INST(i, tx), GET_ICMSG_SIZE_INST(i, tx, rx), \ + GET_CACHE_ALIGNMENT(i)); \ + PBUF_DEFINE(rx_icbmsg_pb_##i, GET_MEM_ADDR_INST(i, rx), GET_ICMSG_SIZE_INST(i, rx, tx), \ + GET_CACHE_ALIGNMENT(i)); \ + static struct backend_data backend_data_##i = {.control_data = { \ + .tx_pb = &tx_icbmsg_pb_##i, \ + .rx_pb = &rx_icbmsg_pb_##i, \ + }}; \ + static MAYBE_CONST struct icbmsg_config backend_config_##i = { \ + .control_config = \ + { \ + .mbox_tx = MBOX_DT_SPEC_INST_GET(i, tx), \ + .mbox_rx = MBOX_DT_SPEC_INST_GET(i, rx), \ + }, \ + .tx = \ + {
DT_INST_FOREACH_STATUS_OKAY(DEFINE_BACKEND_DEVICE)
6 changes: 2 additions & 4 deletions subsys/ipc/ipc_service/lib/icmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,14 @@ int icmsg_open(const struct icmsg_config_t *conf,
k_mutex_init(&dev_data->tx_lock);
#endif

int ret = pbuf_init(dev_data->tx_pb);
int ret = pbuf_tx_init(dev_data->tx_pb);

if (ret < 0) {
__ASSERT(false, "Incorrect configuration");
return ret;
}

/* Initialize local copies of rx_pb. */
dev_data->rx_pb->data.wr_idx = 0;
dev_data->rx_pb->data.rd_idx = 0;
(void)pbuf_rx_init(dev_data->rx_pb);

ret = pbuf_write(dev_data->tx_pb, magic, sizeof(magic));

Expand Down
3 changes: 3 additions & 0 deletions subsys/ipc/ipc_service/lib/icmsg_me.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*/

#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L

#include <zephyr/ipc/icmsg_me.h>
#include <zephyr/sys/math_extras.h>

Expand Down
Loading
Loading