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

zephyr: Compilation fails when CONFIG_FLASH_PAGE_LAYOUT is disabled #1565

Open
de-nordic opened this issue Jan 4, 2023 · 2 comments
Open
Labels
area: zephyr Affects the Zephyr port bug

Comments

@de-nordic
Copy link
Collaborator

The MCUboot support code provides the flash_area_get_sectors implementation in https://github.com/mcu-tools/mcuboot/blob/main/boot/zephyr/flash_map_legacy.c for devices that does not have support for "flash pages layout",
Devices that provide support for pages layout select CONFIG_FLASH_HAS_PAGE_LAYOUT that enables option CONFIG_FLASH_PAGE_LAYOUT; this option is selected (enforced) when available by the CONFIG_MCUBOOT_DEVICE_SETTINGS, so to test this a device that does not select CONFIG_FLASH_HAS_PAGE_LAYOUT needs to be selected or

mcuboot/boot/zephyr/Kconfig

Lines 612 to 621 in 46e554e

config MCUBOOT_DEVICE_SETTINGS
# Hidden selector for device-specific settings
bool
default y
# CPU options
select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
# Enable flash page layout if available
select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
# Enable flash_map module as flash I/O back-end
select FLASH_MAP

has to be modified in line 613 to not select the option.
After such configuration is prepared, the below command executed from Zephyr root:

west build -d voot -b nrf52840dk_nrf52840 bootloader/mcuboot/boot/zephyr/ -DCONFIG_FLASH_PAGE_LAYOUT=n

causes following warnings and errors (and a lot more):

...
<redacted>mcuboot-fixes/bootloader/mcuboot/boot/zephyr/flash_map_legacy.c:49:38: note: each undeclared identifier is reported only once for each function it appears in
   49 | #define FLASH_AREA_IMAGE_SECTOR_SIZE FLASH_AREA_IMAGE_SCRATCH_SIZE
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<redacted>mcuboot-fixes/bootloader/mcuboot/boot/zephyr/flash_map_legacy.c:81:23: note: in expansion of macro 'FLASH_AREA_IMAGE_SECTOR_SIZE'
   81 |         if (rem_len < FLASH_AREA_IMAGE_SECTOR_SIZE) {
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from <redacted>mcuboot-fixes/zephyr/include/zephyr/sys/util_macro.h:34,
                 from <redacted>mcuboot-fixes/zephyr/include/zephyr/sys/util.h:17,
                 from <redacted>mcuboot-fixes/zephyr/include/zephyr/devicetree.h:21,
                 from <redacted>mcuboot-fixes/bootloader/mcuboot/boot/zephyr/include/mcuboot_config/mcuboot_config.h:12,
                 from <redacted>mcuboot-fixes/bootloader/mcuboot/boot/bootutil/include/bootutil/bootutil_log.h:28:
<redacted>mcuboot-fixes/zephyr/include/zephyr/logging/log_msg.h:442:65: error: '_v3' undeclared (first use in this function); did you mean '_v2'?
  442 | #define Z_LOG_LOCAL_ARG_NAME(idx, arg) COND_CODE_0(idx, (arg), (_v##idx))
      |                                                                 ^~
<redacted>mcuboot-fixes/zephyr/include/zephyr/sys/util_internal.h:72:26: note: in definition of macro '__DEBRACKET'
   72 | #define __DEBRACKET(...) __VA_ARGS__
      |                          ^~~~~~~~~~~
<redacted>mcuboot-fixes/zephyr/include/zephyr/sys/util_internal.h:64:9: note: in expansion of macro '__GET_ARG2_DEBRACKET'
...
redacted>mcuboot-fixes/bootloader/mcuboot/boot/bootutil/include/bootutil/bootutil_log.h:33:27: note: in expansion of macro 'MCUBOOT_LOG_ERR'
   33 | #define BOOT_LOG_ERR(...) MCUBOOT_LOG_ERR(__VA_ARGS__)
      |                           ^~~~~~~~~~~~~~~
<redacted>mcuboot-fixes/bootloader/mcuboot/boot/zephyr/flash_map_legacy.c:82:13: note: in expansion of macro 'BOOT_LOG_ERR'
   82 |             BOOT_LOG_ERR("area %d size 0x%x not divisible by sector size 0x%x",
      |             ^~~~~~~~~~~~
In file included from <redacted>mcuboot-fixes/zephyr/include/zephyr/toolchain.h:50,
                 from <redacted>mcuboot-fixes/zephyr/include/zephyr/sys/__assert.h:11,
                 from <redacted>mcuboot-fixes/zephyr/modules/hal_nordic/nrfx/./nrfx_glue.h:10,
                 from <redacted>mcuboot-fixes/modules/hal/nordic/nrfx/nrfx.h:39,
                 from <redacted>mcuboot-fixes/modules/hal/nordic/nrfx/drivers/include/nrfx_wdt.h:37,
                 from <redacted>mcuboot-fixes/bootloader/mcuboot/boot/zephyr/include/mcuboot_config/mcuboot_config.h:262:
<redacted>mcuboot-fixes/zephyr/include/zephyr/sys/cbprintf_internal.h:300:22: error: expression in static assertion is not an integer
  300 |         BUILD_ASSERT(!((sizeof(double) < VA_STACK_ALIGN(long double)) && \
      |                      ^
<redacted>mcuboot-fixes/zephyr/include/zephyr/toolchain/gcc.h:78:51: note: in definition of macro 'BUILD_ASSERT'
   78 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
      |                                                   ^~~~
<redacted>mcuboot-fixes/zephyr/include/zephyr/sys/cbprintf_internal.h:345:9: note: in expansion of macro 'Z_CBPRINTF_PACK_ARG2'
...
@de-nordic de-nordic added area: zephyr Affects the Zephyr port bug labels Jan 5, 2023
@github-actions
Copy link

github-actions bot commented Jul 5, 2023

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the stale label Jul 5, 2023
@de-nordic de-nordic removed the stale label Jul 10, 2023
Copy link

github-actions bot commented Jan 7, 2024

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the stale label Jan 7, 2024
@de-nordic de-nordic removed the stale label Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: zephyr Affects the Zephyr port bug
Projects
None yet
Development

No branches or pull requests

1 participant