error: static assertion failed: Insufficient buffer size for CoAP processing!

I have an OpenThread application that worked on NCS v1.9.1 and after updating to NCS v2.0.0 (nothing in the source code or kconfig was changed), the application fails to build with a handful of the same error: error: static assertion failed: Insufficient buffer size for CoAP processing!. Here is one of the error's (see build_log.txt attached for the complete build):

[60/823] Building CXX object modules/openthread/build/src/cli/CMakeFiles/openthread-cli-ftd.dir/cli_joiner.cpp.obj
FAILED: modules/openthread/build/src/cli/CMakeFiles/openthread-cli-ftd.dir/cli_joiner.cpp.obj 
C:\ncs\toolchains\v2.0.0\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-g++.exe -DKERNEL -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_USER_CONFIG_FILE=\"nrf-config-user.h\" -DNRF5340_XXAA_APPLICATION -DNRF_802154_ACK_TIMEOUT_ENABLED=1 -DNRF_802154_ECB_PRIORITY=-1 -DNRF_802154_ENCRYPTION_ENABLED=1 -DNRF_802154_IE_WRITER_ENABLED=1 -DNRF_802154_INTERNAL_RADIO_IRQ_HANDLING=0 -DNRF_802154_PENDING_EXTENDED_ADDRESSES="" -DNRF_802154_PENDING_SHORT_ADDRESSES="" -DNRF_802154_RX_BUFFERS=16 -DNRF_802154_SECURITY_WRITER_ENABLED=1 -DNRF_802154_SWI_PRIORITY=1 -DNRF_802154_TX_STARTED_NOTIFY_ENABLED=1 -DNRF_802154_USE_RAW_API=1 -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DOPENTHREAD_CONFIG_ASSERT_ENABLE=0 -DOPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=0 -DOPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=0 -DOPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1 -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0 -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0 -DOPENTHREAD_CONFIG_LOG_LEVEL=2 -DOPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=0 -DOPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1 -DOPENTHREAD_CONFIG_PING_SENDER_ENABLE=1 -DOPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_2 -DOPENTHREAD_FTD=1 -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-core-zephyr-config.h\" -DOPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=0 -DPACKAGE_NAME=\"OPENTHREAD\" -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -DPACKAGE_VERSION=\"e2a765599\" -Imodules/openthread/build/etc/cmake -IC:/ncs/v2.0.0/modules/lib/openthread/etc/cmake -IC:/ncs/v2.0.0/modules/lib/openthread/src -IC:/ncs/v2.0.0/modules/lib/openthread/src/core -Imodules/nrfxlib/nrfxlib/nrf_security/src/include/generated -IC:/ncs/v2.0.0/nrfxlib/nrf_security/include -IC:/ncs/v2.0.0/nrfxlib/nrf_security/include/mbedtls -IC:/ncs/v2.0.0/nrfxlib/nrf_security/include/psa -IC:/ncs/v2.0.0/mbedtls/include -IC:/ncs/v2.0.0/mbedtls/include/mbedtls -IC:/ncs/v2.0.0/mbedtls/include/psa -IC:/ncs/v2.0.0/mbedtls/library -IC:/ncs/v2.0.0/nrfxlib/nrf_security/../crypto/nrf_oberon/include -IC:/ncs/v2.0.0/nrfxlib/nrf_security/../crypto/nrf_oberon/include/mbedtls -IC:/ncs/v2.0.0/nrfxlib/nrf_security/../crypto/nrf_oberon/include/psa -IC:/ncs/v2.0.0/nrfxlib/crypto/nrf_cc312_platform/include -IC:/ncs/v2.0.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -IC:/ncs/v2.0.0/nrfxlib/crypto/nrf_oberon/include -IC:/ncs/v2.0.0/modules/lib/openthread/examples/platforms/zephyr -IC:/ncs/v2.0.0/zephyr/include/zephyr -IC:/ncs/v2.0.0/zephyr/include -Izephyr/include/generated -IC:/ncs/v2.0.0/zephyr/soc/arm/nordic_nrf/nrf53 -IC:/ncs/v2.0.0/zephyr/lib/libc/newlib/include -IC:/ncs/v2.0.0/zephyr/lib/util/fnmatch/. -IC:/ncs/v2.0.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.0.0/zephyr/subsys/net/lib/sockets/. -IC:/ncs/v2.0.0/zephyr/subsys/net/lib/openthread/platform/. -IC:/ncs/v2.0.0/zephyr/subsys/settings/include -IC:/ncs/v2.0.0/nrf/include -IC:/ncs/v2.0.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.0.0/modules/hal/nordic/nrfx -IC:/ncs/v2.0.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.0.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.0.0/zephyr/modules/hal_nordic/nrfx/. -Imodules/libmetal/libmetal/lib/include -IC:/ncs/v2.0.0/modules/lib/open-amp/open-amp/lib/include -IC:/ncs/v2.0.0/nrfxlib/nrf_802154/serialization/include -IC:/ncs/v2.0.0/nrfxlib/nrf_802154/serialization/include/platform -IC:/ncs/v2.0.0/nrfxlib/nrf_802154/serialization/include/serialization -IC:/ncs/v2.0.0/nrfxlib/nrf_802154/serialization/include/host -isystem C:/ncs/v2.0.0/modules/lib/openthread/include -isystem C:/ncs/v2.0.0/zephyr/subsys/cpp/include -isystem C:/ncs/v2.0.0/modules/lib/openthread/examples/platforms -Wall -Wextra -Wshadow -Wno-c++14-compat -fno-exceptions -Os -fcheck-new -std=c++11 -Wno-register -fno-rtti -imacros C:/Users/dev/Development/thread-dev/hub-thread-fw/build-nRF5340-DK/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee -imacros C:/ncs/v2.0.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=C:/Users/dev/Development/thread-dev/hub-thread-fw=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.0.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.0.0=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -nostdinc++ -fno-builtin -imacros C:/Users/dev/Development/thread-dev/hub-thread-fw/build-nRF5340-DK/zephyr/include/generated/autoconf.h -std=c++11 -MD -MT modules/openthread/build/src/cli/CMakeFiles/openthread-cli-ftd.dir/cli_joiner.cpp.obj -MF modules\openthread\build\src\cli\CMakeFiles\openthread-cli-ftd.dir\cli_joiner.cpp.obj.d -o modules/openthread/build/src/cli/CMakeFiles/openthread-cli-ftd.dir/cli_joiner.cpp.obj -c C:/ncs/v2.0.0/modules/lib/openthread/src/cli/cli_joiner.cpp
In file included from C:\ncs\v2.0.0\modules\lib\openthread\src\core\coap\coap.hpp:36,
                 from C:\ncs\v2.0.0\modules\lib\openthread\src\core\backbone_router\bbr_leader.hpp:44,
                 from C:\ncs\v2.0.0\modules\lib\openthread\src\core\common\instance.hpp:65,
                 from C:\ncs\v2.0.0\modules\lib\openthread\src\cli\cli.hpp:78,
                 from C:\ncs\v2.0.0\modules\lib\openthread\src\cli\cli_joiner.cpp:38:
C:/ncs/v2.0.0/modules/lib/openthread/src/core/coap/coap_message.hpp: In member function 'const ot::Coap::Message::HelpData& ot::Coap::Message::GetHelpData() const':
C:\ncs\v2.0.0\modules\lib\openthread\src\core\coap\coap_message.hpp:953:61: error: static assertion failed: Insufficient buffer size for CoAP processing!
  953 |         static_assert(sizeof(HelpData) + kHelpDataAlignment <= kHeadBufferDataSize,
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~


Note that I was able to build the Thread CLI example, so this issue seems to be only with my application.

 2500.thread.zip
4064.build_log.txt

Parents
  • I found a better solution to remove the max children restriction. All we need to do is add two extra bytes to the CoAP Message Buffer by adding the following line to the Kconfig:

    CONFIG_OPENTHREAD_CUSTOM_PARAMETERS="OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE=130"
    However, if Block-wise operations are enabled, the buffer will need to be larger and should be set to 138. 
    I would argue that the default value set in misc.h for the definition of OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE ought to be changed in a future NCS release to accommodate the worst case Thread/CoAP kconfig options. 
Reply
  • I found a better solution to remove the max children restriction. All we need to do is add two extra bytes to the CoAP Message Buffer by adding the following line to the Kconfig:

    CONFIG_OPENTHREAD_CUSTOM_PARAMETERS="OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE=130"
    However, if Block-wise operations are enabled, the buffer will need to be larger and should be set to 138. 
    I would argue that the default value set in misc.h for the definition of OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE ought to be changed in a future NCS release to accommodate the worst case Thread/CoAP kconfig options. 
Children
No Data
Related