Due to the rewrite of the DSM persistent storage layer the DSM_VIRTUAL_ADDR_MAX define can no longer be set to 0. This has changed since 3.2.0 where it could be 0.
During compilation the following static assert is hit.
nrf5-sdk-mesh/mesh/core/api/mesh_config_entry.h:105:5: note: in expansion of macro 'NRF_MESH_STATIC_ASSERT'
105 | NRF_MESH_STATIC_ASSERT((MAX_COUNT) > 0); \
| ^~~~~~~~~~~~~~~~~~~~~~
nrf5-sdk-mesh/mesh/access/src/device_state_manager.c:1598:1: note: in expansion of macro 'MESH_CONFIG_ENTRY'
1598 | MESH_CONFIG_ENTRY(dsm_virtual_addr,
| ^~~~~~~~~~~~~~~~~
This happens since Mesh Config doesn't allow for 0 count.
The following patch restores the old possibility to disable virtual addresses if they aren't required.
diff --git a/mesh/access/src/device_state_manager.c b/mesh/access/src/device_state_manager.c
index 1447e9e..b87d708 100644
--- a/mesh/access/src/device_state_manager.c
+++ b/mesh/access/src/device_state_manager.c
@@ -1356,6 +1356,7 @@ static void dsm_nonvirtual_addr_getter(mesh_config_entry_id_t id, void * p_entry
p_dst->addr = m_addresses[idx].address;
}
+#if DSM_VIRTUAL_ADDR_MAX
static uint32_t dsm_virtual_addr_setter(mesh_config_entry_id_t id, const void * p_entry)
{
if (!IS_IN_RANGE(id.record, MESH_OPT_DSM_VIRTUAL_ADDR_RECORD,
@@ -1388,6 +1389,7 @@ static void dsm_virtual_addr_getter(mesh_config_entry_id_t id, void * p_entry)
dsm_entry_addr_virtual_t * p_dst = (dsm_entry_addr_virtual_t *)p_entry;
memcpy(p_dst->uuid, m_virtual_addresses[idx].uuid, NRF_MESH_UUID_SIZE);
}
+#endif /* DSM_VIRTUAL_ADDR_MAX */
static uint32_t dsm_subnet_setter(mesh_config_entry_id_t id, const void * p_entry)
{
@@ -1595,6 +1597,7 @@ MESH_CONFIG_ENTRY(dsm_nonvirtual_addr,
NULL,
NULL);
+#if DSM_VIRTUAL_ADDR_MAX
MESH_CONFIG_ENTRY(dsm_virtual_addr,
MESH_OPT_DSM_VIRTUAL_ADDR_RECORD_EID,
DSM_VIRTUAL_ADDR_MAX,
@@ -1603,6 +1606,7 @@ MESH_CONFIG_ENTRY(dsm_virtual_addr,
dsm_virtual_addr_getter,
NULL,
NULL);
+#endif /* DSM_VIRTUAL_ADDR_MAX */
MESH_CONFIG_ENTRY(dsm_subnet,
MESH_OPT_DSM_SUBNETS_RECORD_EID,
Thanks.