Build failing with sysbuild enabled (math cannot parse the expression: " * 1024")

Hello,

I'm trying to add MCUBoot with sysbuild to my application (nRF Connect SDK 2.9.1). I have added sysbuild.conf (in the project's root directory), with single line to enable mcuboot:

SB_CONFIG_BOOTLOADER_MCUBOOT=y


but I have noticed, that my project cannot compile if I don't use --no-sysbuild in the build command. I'm getting following errors:

CMake Error at (...)/zephyr/cmake/modules/extensions.cmake:1890 (file):
file STRINGS file

(...)/zephyr/.config" cannot be read.

Call Stack (most recent call first):
cmake/modules/sysbuild_extensions.cmake:520 (import_kconfig)
cmake/modules/sysbuild_images.cmake:20 (ExternalZephyrProject_Cmake)
cmake/modules/sysbuild_default.cmake:20 (include)

(...)/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)

(...)/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)

(...)/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)

template/CMakeLists.txt:10 (find_package)

CMake Error at (...)/nrf/cmake/sysbuild/partition_manager.cmake:562 (math):
math cannot parse the expression: " * 1024": syntax error, unexpected exp_TIMES (2).

Call Stack (most recent call first):
(...)/nrf/sysbuild/CMakeLists.txt:703 (include)
cmake/modules/sysbuild_extensions.cmake:583 (nrf_POST_CMAKE)
cmake/modules/sysbuild_extensions.cmake:583 (cmake_language)
cmake/modules/sysbuild_images.cmake:23 (sysbuild_module_call)
cmake/modules/sysbuild_default.cmake:20 (include)
(...)/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)
(...)/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
(...)/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)
template/CMakeLists.txt:10 (find_package)

CMake Warning at (...)/nrf/cmake/sysbuild/partition_manager.cmake:106 (message):

---------------------------------------------------------------------
--- WARNING: Using a bootloader without pm_static.yml. ---
--- There are cases where a deployed product can consist of ---
--- multiple images, and only a subset of these images can be ---
--- upgraded through a firmware update mechanism. In such cases, ---
--- the upgradable images must have partitions that are static ---
--- and are matching the partition map used by the bootloader ---
--- programmed onto the device. ---
---------------------------------------------------------------------

Call Stack (most recent call first):
(...)/nrf/cmake/sysbuild/partition_manager.cmake:634 (partition_manager)
(...)/nrf/sysbuild/CMakeLists.txt:703 (include)
cmake/modules/sysbuild_extensions.cmake:583 (nrf_POST_CMAKE)
cmake/modules/sysbuild_extensions.cmake:583 (cmake_language)
cmake/modules/sysbuild_images.cmake:23 (sysbuild_module_call)
cmake/modules/sysbuild_default.cmake:20 (include)
(...)/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)
(...)/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
(...)/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)
template/CMakeLists.txt:10 (find_package)



usage: partition_manager.py [-h] --sram_primary-size SRAM_PRIMARY_SIZE

[--sram_primary-base-address SRAM_PRIMARY_BASE_ADDRESS]
[--sram_primary-placement-strategy {start_to_end,end_to_start,complex}]
[--sram_primary-device SRAM_PRIMARY_DEVICE]
[--sram_primary-default-driver-kconfig SRAM_PRIMARY_DEFAULT_DRIVER_KCONFIG]
[--sram_primary-dynamic-partition SRAM_PRIMARY_DYNAMIC_PARTITION]
--flash_primary-size FLASH_PRIMARY_SIZE
[--flash_primary-base-address FLASH_PRIMARY_BASE_ADDRESS]
[--flash_primary-placement-strategy {start_to_end,end_to_start,complex}]
[--flash_primary-device FLASH_PRIMARY_DEVICE]
[--flash_primary-default-driver-kconfig FLASH_PRIMARY_DEFAULT_DRIVER_KCONFIG]
[--flash_primary-dynamic-partition FLASH_PRIMARY_DYNAMIC_PARTITION]
partition_manager.py: error: argument --sram_primary-size: expected one argument

CMake Error at (...)/nrf/cmake/sysbuild/partition_manager.cmake:167 (message):
Partition Manager failed, aborting.

Call Stack (most recent call first):

(...)/nrf/cmake/sysbuild/partition_manager.cmake:634 (partition_manager)

(...)/nrf/sysbuild/CMakeLists.txt:703 (include)

cmake/modules/sysbuild_extensions.cmake:583 (nrf_POST_CMAKE)
cmake/modules/sysbuild_extensions.cmake:583 (cmake_language)
cmake/modules/sysbuild_images.cmake:23 (sysbuild_module_call)
cmake/modules/sysbuild_default.cmake:20 (include)

(...)/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)

(...)/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)

(...)/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)

template/CMakeLists.txt:10 (find_package)


Could you advise what can be the possible reason? I've been trying to add pm_static.yml with the partitions' definition, but it did not help, it seems as if it did not take it into account, since 'size' was not missing for any of the partitions.

I have tested this on Blinky sample and it compiled correctly with enabled sysbuild, but for some reason it's failing with my project

I will be grateful for any advice that you could provide.

Jacob

Parents Reply Children
  • Hi, I have checked this and this could be (probably indirect) reason for this issue, when I'm adding the log to print the CONFIG_FLASH_SIZE in the partition or ${${image_name}_CONFIG_FLASH_SIZE}, it seems to be empty. When I'm building with --no-sysbuild parameter, in the build/zephyr/.config file there is a parameter CONFIG_FLASH_SIZE=1024. I'm not changing this value anywhere in my config files as it should not be changed in the project .conf file, right? Where is it taken from?

    I'm using the nRF9151 DK board, but I could not find this config parameter anywhere in the config files for this board in the SDK files (there is FLASH_LOAD_SIZE, but not FLASH_SIZE)

  • Hi, just an additional note to clear that out - in case of failed build (with partition_manager error) the .config file in the build/zephyr directory is not created at all, therefore to check it's value I had to print it in the partition_manager CMake script.

    Best regards,
    Jacob

  • Hello,

    Sorry for getting back to you a bit late on this. I had to finish some other tasks last week and only worked limited hours, which caused the delay in responding. Have you been able to make any progress on this issue?

    Jacob W said:
    CONFIG_FLASH_SIZE in the partition or ${${image_name}_CONFIG_FLASH_SIZE}, it seems to be empty. When I'm building with --no-sysbuild parameter, in the build/zephyr/.config file there is a parameter CONFIG_FLASH_SIZE=1024. I'm not changing this value anywhere in my config files as it should not be changed in the project .conf file, right? Where is it taken from?

    It’s not recommended to modify this config value. It’s not taken from prj.conf; instead, it is derived from the devicetree. The property zephyr,flash in the /chosen node refers to the flash device node, and its reg property is used to set the defaults for both CONFIG_FLASH_BASE_ADDRESS and CONFIG_FLASH_SIZE Kconfig options. See the Zephyr-specific /chosen node. Do you have any overlay which touches the flash? Check the overlays for both the application and MCUboot.

    Kind Regards,

    Abhijith

Related