diff --git a/drivers/bluetooth/hci/rpmsg_nrf53.c b/drivers/bluetooth/hci/rpmsg_nrf53.c index 04d90f25f5d..6a5d497981d 100644 --- a/drivers/bluetooth/hci/rpmsg_nrf53.c +++ b/drivers/bluetooth/hci/rpmsg_nrf53.c @@ -36,6 +36,10 @@ static struct device *ipm_rx_handle; #define SHM_SIZE 0x7c00 #define SHM_DEVICE_NAME "sram0.shm" +BUILD_ASSERT((SHM_START_ADDR + SHM_SIZE - SHM_BASE_ADDRESS) + <= DT_REG_SIZE(SHM_NODE), + "Allocated size exceeds available shared memory reserved for IPC"); + #define VRING_COUNT 2 #define VRING_TX_ADDRESS (SHM_START_ADDR + SHM_SIZE - 0x400) #define VRING_RX_ADDRESS (VRING_TX_ADDRESS - 0x400) diff --git a/samples/bluetooth/hci_rpmsg/src/main.c b/samples/bluetooth/hci_rpmsg/src/main.c index 8815b49f43a..26f6abc4297 100644 --- a/samples/bluetooth/hci_rpmsg/src/main.c +++ b/samples/bluetooth/hci_rpmsg/src/main.c @@ -43,6 +43,10 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define SHM_SIZE 0x7c00 #define SHM_DEVICE_NAME "sram0.shm" +BUILD_ASSERT((SHM_START_ADDR + SHM_SIZE - SHM_BASE_ADDRESS) + <= DT_REG_SIZE(SHM_NODE), + "Allocated size exceeds available shared memory reserved for IPC"); + #define VRING_COUNT 2 #define VRING_TX_ADDRESS (SHM_START_ADDR + SHM_SIZE - 0x400) #define VRING_RX_ADDRESS (VRING_TX_ADDRESS - 0x400)