Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dfu: mcuboot: fail to build with CONFIG_BOOTLOADER_MCUBOOT=n and CONFIG_IMG_MANAGER=y #30075

Closed
mniestroj opened this issue Nov 16, 2020 · 5 comments
Assignees
Labels
area: MCUBoot bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@mniestroj
Copy link
Member

Describe the bug
Using CONFIG_IMG_MANAGER without CONFIG_BOOTLOADER_MCUBOOT is not longer possible. This is most likely introduced with 5cfafb0.

To Reproduce
Steps to reproduce the behavior:

  1. west build -b nrf52840dk_nrf52840 samples/hello_world/ -- -DCONFIG_IMG_MANAGER=y -DCONFIG_FLASH=y
  2. See error

Expected behavior
It is possible to use functionality provided by IMG_MANAGER without building firmware for chain-loading with mcuboot.

Impact
Annoyance.

Logs and console output

zephyr/subsys/dfu/boot/mcuboot.c: In function 'boot_magic_write':
zephyr/subsys/dfu/boot/mcuboot.c:390:34: error: 'boot_img_magic' undeclared (first use in this function)
  390 |  rc = flash_area_write(fa, offs, boot_img_magic, BOOT_MAGIC_SZ);
      |                                  ^~~~~~~~~~~~~~
zephyr/subsys/dfu/boot/mcuboot.c:390:34: note: each undeclared identifier is reported only once for each function it appears in

Environment (please complete the following information):

  • OS: Linux
  • Toolchain: Zephyr SDK v0.12.0-beta-1
  • Commit SHA: 4d93005 (tip of master)

Additional context
Add any other context about the problem here.

@de-nordic
Copy link
Collaborator

It is possible to use functionality provided by IMG_MANAGER without building firmware for chain-loading with mcuboot.

Shouldn't then the mcuboot.c be taken out of compilation for such case?

@utzig
Copy link
Member

utzig commented Nov 17, 2020

I am curious about what would be purpose of using CONFIG_IMG_MANAGER without CONFIG_BOOTLOADER_MCUBOOT. I agree with @de-nordic that removing mcuboot.c from the build is the correct solution, but I think the image manager module in mcumgr is very tied to mcuboot, for commands like image test, etc and won't build without mcuboot.c out of the box.

@mniestroj
Copy link
Member Author

I am curious about what would be purpose of using CONFIG_IMG_MANAGER without CONFIG_BOOTLOADER_MCUBOOT.

I use that case for development all the time. It allows me to debug firmware that boots from 0x0 and without bootloader. I use it for both real hw (such as nrf52840dk_nrf52840) and emulated targets (such as qemu_x86) to develop and test features related to firmware upgrade. This is (was) possible, because all the APIs provided by CONFIG_IMG_MANAGER (so flash_img.c and mcuboot.c) are accessible. After finding out that everything there was working (e.g. firmware download and flash) I was building bootloader and application with CONFIG_BOOTLOADER_MCUBOOT and do final tests of the feature being developed (which was just seeing if bootloader does the switch correctly).

@nashif nashif added the priority: medium Medium impact/importance bug label Nov 17, 2020
@nvlsianpu nvlsianpu assigned nvlsianpu and unassigned de-nordic Dec 18, 2020
@nvlsianpu
Copy link
Collaborator

assigned to me, #30370 fixes this issue.

@nvlsianpu
Copy link
Collaborator

#30370 merge fixes the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: MCUBoot bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants