Skip to content

Commit 8f4f1fa

Browse files
dssengnashif
authored andcommitted
ipc: icmsg: fix unbound for POSIX
Make sure unbound works on nrf5340bsim. Signed-off-by: Dmitrii Sharshakov <[email protected]>
1 parent 3411fac commit 8f4f1fa

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

include/zephyr/ipc/pbuf.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,18 @@ void pbuf_handshake_write(struct pbuf *pb, uint32_t value);
269269
*/
270270
int pbuf_get_initial_buf(struct pbuf *pb, volatile char **buf, uint16_t *len);
271271

272+
/**
273+
* @brief Remap embedded addresses to native addresses.
274+
*
275+
* This function is to be used only with native simulator based targets and
276+
* remaps addresses of a pbuf from devicetree addesses to
277+
* allocated native memory address ranges.
278+
* This is only used in the IPC backend implementations.
279+
*
280+
* @param pb A buffer to be remapped.
281+
*/
282+
void pbuf_native_addr_remap(struct pbuf *pb);
283+
272284
/**
273285
* @}
274286
*/

subsys/ipc/ipc_service/lib/icmsg.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,10 @@ int icmsg_open(const struct icmsg_config_t *conf,
412412
k_mutex_init(&dev_data->tx_lock);
413413
#endif
414414

415+
#if defined(CONFIG_ARCH_POSIX)
416+
pbuf_native_addr_remap(dev_data->tx_pb);
417+
#endif
418+
415419
ret = pbuf_rx_init(dev_data->rx_pb);
416420

417421
if (ret < 0) {

subsys/ipc/ipc_service/lib/pbuf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ static int validate_cfg(const struct pbuf_cfg *cfg)
6565
void pbuf_native_addr_remap(struct pbuf *pb)
6666
{
6767
native_emb_addr_remap((void **)&pb->cfg->rd_idx_loc);
68+
native_emb_addr_remap((void **)&pb->cfg->handshake_loc);
6869
native_emb_addr_remap((void **)&pb->cfg->wr_idx_loc);
6970
native_emb_addr_remap((void **)&pb->cfg->data_loc);
7071
}

0 commit comments

Comments
 (0)