Cmake Error "Math cannot parse the expression" with NCS > 2.4.2

Hello,

i'm using nrf connect sdk 2.4.2 to develop the firmware for my custom nrf5340 board without issues. I'm trying to upgrade to the the latest release but both 2.5.0 and 2.5.2 gives me this error when trying to compile:

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).

I found THIS issue on DevZone that is extremely similar to my one and posted there some material to test on, but i didn't get any feedback in few months. For this reason, i'm opening a new issue.

The issue is clearly correlated to the Application versioning, but even reading the docs and making some tests i was not able to solve it.

Any suggestion?

Frax

Parents
  • Hi, I will be looking into your issue

    Can you post your version file? 

    Regards

    Runar

  • Here you go. The file is named "VERSION" (no file extension) and it is placed in the same path of prj.conf file

    VERSION_MAJOR = 0
    VERSION_MINOR = 5
    PATCHLEVEL = 0
    VERSION_TWEAK = 0
    EXTRAVERSION = unstable

    Please note that the generation of this file is the only thing i modified in my project. No other modifications in prj.conf, in source code or whatever.

  • it looks to me like your major and patch version is not set and therefor gives you the error. How is your ncs version/zephyr/version looking? You could try to do a west update to see if it fixes things. you should not need to have a version file in the project folder. 

    Regards

    Runar

  • I tried to generate the VERSION file trying to debug. By the way, i set the path .../ncs/v.2.5.2 on the terminal and run west update. After a lot of time, it started looping endlessly with this:

    warning: unable to unlink '.git/objects/pack/pack-2614ff1bb8a3df13ffb24d04ac2c0f7393e7012c.idx': Invalid argument
    warning: unable to unlink '.git/objects/pack/pack-47dfc7b07a36eac6e49c8189bbc38ea46648b935.idx': Invalid argument
    warning: unable to unlink '.git/objects/pack/pack-b5484cc90f0ffb23eaa284e4521f6aa69eb61fea.idx': Invalid argument
    remote: Enumerating objects: 2020, done.
    remote: Counting objects: 100% (329/329), done.
    remote: Compressing objects: 100% (327/327), done.
    remote: Total 2020 (delta 3), reused 2 (delta 2), pack-reused 1691
    Receiving objects: 100% (2020/2020), 455.98 KiB | 5.30 MiB/s, done.
    Resolving deltas: 100% (18/18), done.
    Auto packing the repository in background for optimum performance.
    See "git help gc" for manual housekeeping.
    Enumerating objects: 33167, done.
    Counting objects: 100% (31151/31151), done.
    Delta compression using up to 8 threads
    Compressing objects: 100% (24103/24103), done.
    Writing objects: 100% (31151/31151), done.
    Total 31151 (delta 6015), reused 31128 (delta 5992), pack-reused 0

    It's more than half an hour now, so i suppose something is not good...

    EDIT:

    I noticed that ncs 2.5.2 folder is HUGE (4+GB). I investigated and i found that the issue is related to this path: ..\ncs\v2.5.2\modules\lib\matter\.git\objects\pack

    where the files of the above loop are saved. What it actually happens is that every iteration those three pack files are downloaded again and again.

    I uninstalled v.2.5.2 and re-download it again (using Vs Code GUI). Nothing changed and the issue is still there

    Regards,

    frax

  • When you changed SDK, did you change toolchain also? 

    4GB + sounds a bit to much, my installs are around 1.7GB. 

    Also how is your ncs version/zephyr/version looking? 

    Regards

    Runar

  • Yes, of course. Both SDK and Toolchain are at version 2.5.2. This is the content of the zephyr version file you required:

    VERSION_MAJOR = 3
    VERSION_MINOR = 4
    PATCHLEVEL = 99
    VERSION_TWEAK = 0
    EXTRAVERSION =

  • Hm that looks fine. A collauge of mine where able to reproduce the error you reported by adding a white space in the generated version file. Could it be a whitespace where added there?

    Regards

    Runar

Reply Children
  • Hi,

    can you be more specific on the action you suggest to do? More precisely, can you provide me the path where i should find the "generated version file" and where i need to add a whitespace?

    I'm asking because the build fails, i'm not sure to have correctly understood what you mean with the term "generated".

    Thank you

  • Sorry for the delay. I have not been able to reproduce it on my machine but there has been some updates in this thread that might help you

    Regards

    Runar

  • Hi runsiv,

    i read the post but unfortunately this does not apply at all to my case. I have no mcuboot.conf on my project. This is the latest update on my situation:

    - I downloaded both toolchain v.2.6.0. and SDK 2.6.0 and set them as ACTIVE

    - I created a new sample project based on "Hello world" sample

    - I tried to build it for nrf5340DK

    Result: always the same error! Disappointed

    Please keep in mind that if i try to build it with v.2.4.2 there are no issues in building it. It should be safe to assume that the difference has to be within the toolchain/SDK code, not on the project, even considering that this happens with hello_world sample too.

Related