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

    I’m not sure what the cause of the issue you’re seeing is. The files you’ve shared look fine to me, and I don’t think they would be the source of the problem. What I would recommend is to try building the application without defining a pm_static file. This will generate a dynamic partition file inside the build folder. You can use that as a reference and, based on it, create a static partition file to see if that resolves the issue.

    If you can share the generated partition file, I would be happy to take a look.

    Kind regards,
    Abhijith

Reply
  • Hello,

    I’m not sure what the cause of the issue you’re seeing is. The files you’ve shared look fine to me, and I don’t think they would be the source of the problem. What I would recommend is to try building the application without defining a pm_static file. This will generate a dynamic partition file inside the build folder. You can use that as a reference and, based on it, create a static partition file to see if that resolves the issue.

    If you can share the generated partition file, I would be happy to take a look.

    Kind regards,
    Abhijith

Children
  • Hi,

    I'm sorry for a late reply. I was trying both ways, also without defining static partition file (and expecting to have one generated in the build directory), but it's failing on the same step. Based on reading the logs it seems to be failing on this line from the partition_manager.cmake in this line:

    math(EXPR flash_size "${${image_name}_CONFIG_FLASH_SIZE} * 1024" OUTPUT_FORMAT HEXADECIMAL)


    (the error: 'math cannot parse the expression: " * 1024": syntax error, unexpected'). So it seems as if it cannot evaluate variable: '${${image_name}_CONFIG_FLASH_SIZE}', but I don't know why.
    I have noticed that in case of Blinky sample (which I am able to build using sysbuild) the build starts with running the CMake for mcuboot, and later with CMake for the project (Blinky). In my case (in which I'm getting the partition_manager issue) it starts at once with running the CMake for the project. I'm pointing this out since I'm not sure if this might not be something that makes the difference.

    Could you advise what could be the possible reason for this issue?

    Best regards,
    Jacob
Related