NCS 2.5.0: CMake Error ... version.cmake:74 (math): math cannot parse the expression

After updating the NCS from 2.4.2 to 2.5.0 my project cannot be created.

The following error occurs:

-- CMake version: 3.20.5
-- Found Python3: D:/Nordic/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: D:/Nordic/v2.5.0/zephyr/.cache
-- Zephyr version: 3.4.99 (D:/Nordic/v2.5.0/zephyr)
CMake Error at D:/Nordic/v2.5.0/zephyr/cmake/modules/version.cmake:74 (math):
  math cannot parse the expression: "( << 16) + ( << 8) + ()": syntax error,
  unexpected exp_SHIFTLEFT (4).
Call Stack (most recent call first):
  D:/Nordic/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
  D:/Nordic/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  D:/Nordic/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:11 (find_package)


CMake Error at D:/Nordic/v2.5.0/zephyr/cmake/modules/version.cmake:75 (math):
  math cannot parse the expression: "( << 24) + ( << 16) + ( << 8) + ()":
  syntax error, unexpected exp_SHIFTLEFT (4).
Call Stack (most recent call first):
  D:/Nordic/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
  D:/Nordic/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  D:/Nordic/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:11 (find_package)

How can I fix this?

Parents Reply
  • I was able to fix the issue by changing how/when my mcuboot.conf was included.

    In previous NCS versions I appended my mcuboot.conf in app/CMakeLists.txt:

    ...
    list(APPEND mcuboot_OVERLAY_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/mcuboot.conf")


    SET(mcuboot_CONFIG_BOOT_SIGNATURE_KEY_FILE "\"${CMAKE_CURRENT_SOURCE_DIR}/keys/private/boot-ecdsa-p256.pem\"")

    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    ...

    It think appending the conf file before finding the Zephyr package was causing the issue. I changed my app/CMakeLists.txt to this:

    ...
    SET(mcuboot_CONFIG_BOOT_SIGNATURE_KEY_FILE "\"${CMAKE_CURRENT_SOURCE_DIR}/keys/private/boot-ecdsa-p256.pem\"")

    SET(mcuboot_CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256 "y")

    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    ...


    and I moved my mcuboot.conf file to app/child_image/mcuboot.conf so West knows it belongs to the MCUBoot child image.

    Now MCUBoot builds without issue.

Children
Related