Setting CONFIG_NRFX_PWM1=y causes compilation error for MCUMGR_BT_OTA

Hi,

I am running into a really strange issue where setting both CONFIG_NRFX_PWM0=y and CONFIG_NRFX_PWM1=y in prj.conf gives me the following build errors while using mcuboot.

n file included from /Users/puffin/Desktop/project/deps/bootloader/mcuboot/boot/bootutil/src/bootutil_public.c:47:
/Users/puffin/Desktop/project/deps/bootloader/mcuboot/boot/bootutil/src/bootutil_public.c: In function 'boot_write_swap_info':
/Users/puffin/Desktop/project/deps/bootloader/mcuboot/boot/bootutil/include/bootutil/bootutil_public.h:134:53: warning: implicit declaration of function 'assert' [-Wimplicit-function-declaration]
  134 |                                                     assert((image) < 0xF);     \
      |                                                     ^~~~~~
/Users/puffin/Desktop/project/deps/bootloader/mcuboot/boot/bootutil/src/bootutil_public.c:386:5: note: in expansion of macro 'BOOT_SET_SWAP_INFO'
  386 |     BOOT_SET_SWAP_INFO(swap_info, image_num, swap_type);
      |     ^~~~~~~~~~~~~~~~~~
/Users/puffin/Desktop/project/deps/bootloader/mcuboot/boot/bootutil/src/bootutil_public.c:53:1: note: 'assert' is defined in header '<assert.h>'; did you forget to '#include <assert.h>'?
   52 | #include "bootutil_misc.h"
  +++ |+#include <assert.h>
   53 | 
[214/345] Building C object zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/CMakeFiles/subsys__mgmt__mcumgr__grp__img_mgmt.dir/src/zephyr_img_mgmt.c.obj
/Users/puffin/Desktop/project/deps/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c: In function 'img_mgmt_flash_check_empty_inner':
/Users/puffin/Desktop/project/deps/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c:72:9: warning: implicit declaration of function 'assert' [-Wimplicit-function-declaration]
   72 |         assert(fa->fa_size % 4 == 0);
      |         ^~~~~~
/Users/puffin/Desktop/project/deps/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c:21:1: note: 'assert' is defined in header '<assert.h>'; did you forget to '#include <assert.h>'?
   20 | #include <mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h>
  +++ |+#include <assert.h>
   21 | 

The errors occur when enabling

CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y
 
I am using an nRF52dk board and on NCS2.9.0
  • Ok I figured out the issue. Turns out this is entirely my fault. I have a custom "assert.h" that I am using in my library code which previously uses the incorrect CMake method `zephry_include_directories`. This causes "assert.h" to get mixed up with the SDK's own "assert.h" files in libc. To fix this, I changed it to target_include_directories and include the header files only to my library target.

Related