zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.44k stars 6.4k forks source link

mcuboot with enabled serial recovery does not compile #35048

Closed de-nordic closed 3 years ago

de-nordic commented 3 years ago

Describe the bug The mcuboot, selected by west, does not compile since b85250108cef66033cdb0bdbecea5d3e7926c62f commit to Zephyr.

To Reproduce

  1. Download overlay file and replace with the download dir
  2. Go to zephyr root
  3. west build -b nrf52840dk_nrf52840 --build-dir voot bootloader/mcuboot/boot/zephyr/ -t menuconfig -- -DOVERLAY_CONFIG=/serial-recovery.overlay.txt
  4. See linker error

Expected behavior A clear and concise description of what you expected to happen.

Impact Not able to compile mcuboot for serial recovery.

Environment (please complete the following information):

serial-recovery.overlay.txt

nordic-krch commented 3 years ago

The issue is MULTITHREADING is off so kernel files for scheduling are not included but there are modules fetched that are using multithreading essentially making it multithreading app.

Is see 2 ways:

de-nordic commented 3 years ago

Is see 2 ways:

* removed `CONFIG_MULTITHREADING=n`

* fix module to not use multithreading stuff (`k_sleep`) by replacing it with no-multithreading friendly `k_busy_wait`.

The removal significantly increase the binary size (4k)

The problem is with z_impl_k_sleep and z_pm_save_idle_exit and and one seems to be reported from zephyr/drivers/serial/libdrivers__serial.a(uart_nrfx_uarte.c.obj) and the other from zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a(isr_wrapper.S.obj)

nordic-krch commented 3 years ago

I will make PR to fix it in uarte driver. As for z_pm_save_idle_exit can you check if CONFIG_PM=n helps? Power management is not supported when multithreading is off.

nordic-krch commented 3 years ago

Actually, there is already a fix in uarte: https://github.com/zephyrproject-rtos/zephyr/blob/977aba6d02c87f884ecc79672690befcbcfd0186/drivers/serial/uart_nrfx_uarte.c#L494 can you check if that is not working in this case?

nvlsianpu commented 3 years ago

@nordic-krch

Actually, there is already a fix in uarte: ...

Yes, but it is compiled-out using complier, and now need to use preprocessor instead. Easy to fix then :D

nvlsianpu commented 3 years ago

MCUboot upstream fix: https://github.com/mcu-tools/mcuboot/pull/1009