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
  • Hello

    What you are trying to do ?

    Bootloader, or Mcuboot are not the sample codes.

    You typically start with the sample code and then add your changes into it.

    So, what you are trying to build actually? are you using some example code and want to include the bootloader?

    If I search for mcuboot in the NCS VS Code extension, then I can see NSIB sample, also note that all samples are either in the nrf/samples or zephyr/samples.

    Please let me know what project / sample you want to build and then what changes you to incorporate.

    BR,

    Naeem

  •  I am trying to implement some changes in the MCUboot, where I can send image file over UART and then the files are written in the specified partition.

    In that case I want to use flash_img.h, where I can specify the slot where the image needs to be flashed.

  • Hello,

    I tried to build an application with the mcuboot, and then applied the change which you wanted to do (that is adding flash_img header in the source code of mcuboot).

    I was able to see that the build was unsuccessful, and it mentioned the error "FATAL ERROR: command exited with status 1:"

    However, the reason of the failure was that a symbol "CONFIG_IMG_BLOCK_BUF_SIZE" in undefined.

    This symbol is used in the FLASH_IMG.H file, and it is not defined there.

    I tried to configure this symbol but it was giving the same error (maybe I was not able to satisfy all its dependencies, or even further 2nd level dependencies).

    As the default value of symbol is 512 Bytes, I replaced the symbol in the file with 512, and it was able to compile correctly.

    BR,

    Naeem

Reply
  • Hello,

    I tried to build an application with the mcuboot, and then applied the change which you wanted to do (that is adding flash_img header in the source code of mcuboot).

    I was able to see that the build was unsuccessful, and it mentioned the error "FATAL ERROR: command exited with status 1:"

    However, the reason of the failure was that a symbol "CONFIG_IMG_BLOCK_BUF_SIZE" in undefined.

    This symbol is used in the FLASH_IMG.H file, and it is not defined there.

    I tried to configure this symbol but it was giving the same error (maybe I was not able to satisfy all its dependencies, or even further 2nd level dependencies).

    As the default value of symbol is 512 Bytes, I replaced the symbol in the file with 512, and it was able to compile correctly.

    BR,

    Naeem

Children
Related