Using flash_img.h in Zephyr boot

I want to include  #include <zephyr/dfu/flash_img.h> in boot/zephyr/main.c  (path: C:\ncs\v2.4.0\bootloader\mcuboot\boot\zephyr\main.c)
And header file path (C:\ncs\v2.4.0\zephyr\include\zephyr\dfu\flash_img.h).

But after adding flash_img.h I get a linker error: collect2.exe: error: ld returned 1 exit status

Also tried by adding path in CmakeList.txt file as "zephyr_include_directories(${ZEPHYR_BASE}/include/zephyr/dfu)"
Still does not solve the issue.

Please can you suggest what else needs to be done in order to use this header?

PS: using nRF52840dk

Thankyou

Parents Reply Children
  •  

    I am trying to implement a logic on nRF52840, to send image file over UART in bootloader mode.
    Please can you suggest what needs to be taken care for this.

    Note: I dont want to use dependencies like mcumgr.

    Thank you

  • Hello,

    Thank you for your patience.

    My colleague has informed that this should be handled through configs and not the cmake.

    He has suggested to add FLASH_MAP config that would include flash_map.c, and would also resolve other dependencies including img-block-size.

    I have updated the proj.conf of the mcuboot accordingly by appending following:

    CONFIG_FLASH_MAP=y
    CONFIG_STREAM_FLASH=y
    CONFIG_IMG_MANAGER=y

    And correspondingly BOOTLOADER_MCUBOOT is enabled in the main project conf.

    I can now use the function that you have mentioned, and project compiles successfully.

    BR, Naeem

Related