diff --git a/modules/nanopb/CMakeLists.txt b/modules/nanopb/CMakeLists.txt index 2520595cf94f28..0e7ea4c793d3c2 100644 --- a/modules/nanopb/CMakeLists.txt +++ b/modules/nanopb/CMakeLists.txt @@ -38,6 +38,11 @@ if(CONFIG_NANOPB) PB_WITHOUT_64BIT ) + zephyr_compile_definitions_ifdef( + CONFIG_NANOPB_NO_ENCODE_SIZE_CHECK + PB_NO_ENCODE_SIZE_CHECK + ) + zephyr_compile_definitions_ifdef( CONFIG_NANOPB_ENCODE_ARRAYS_UNPACKED PB_ENCODE_ARRAYS_UNPACKED diff --git a/modules/nanopb/Kconfig b/modules/nanopb/Kconfig index 41030eac6b3e7a..5c415657ca07aa 100644 --- a/modules/nanopb/Kconfig +++ b/modules/nanopb/Kconfig @@ -42,6 +42,12 @@ config NANOPB_WITHOUT_64BIT Disable support of 64-bit integer fields, for old compilers or for a slight speedup on 8-bit platforms. +config NANOPB_NO_ENCODE_SIZE_CHECK + bool "Disable size checks when encoding sub-messages" + help + Disable checking the size of encoded submessages between initial sizing + encoding and final encoding to the stream. + config NANOPB_ENCODE_ARRAYS_UNPACKED bool "Encode arrays unpacked" help