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

  • Hello,

    after some tests i think that something is off. Let's proceed schematically. This is my folder structure (the relevant folders at least):

    C
    ->ncs
      ->downloads
      ->tmp
      ->toolchains
      ->v2.4.2
      ->v2.6.0
    ->nrf5340_PASTO
      ->boards
      ->Glass_firmware
        ->build-DK
        ->src
    ->nrf5340dk_projects
      ->PASTO
        ->hello_world
          ->build
          ->src
        

    Here you can find a short description of each folder:

    - ncs -> It's the folder where toolchains and SDK are

    - nrf5340_PASTO -> It's my main project folder (the one i want to work with at the end of this story). You can notice custom board, source code and build folder.

    - nrf5340dk_projects -> This is the folder where i load sample projects to test on. The "hello_world" you see in it is the one you're supporting me on to test.

    Now, given this structure:

    1) When i open the terminal and digit "cd nrf" i get error because "C:/nrf5340_PASTO/nrf" path does not exist;

    2) If i type "git branch" staying in "C:/nrf5340_PASTO" folder i get "main" as answer

    3) If i manually go to "C:/ncs/v2.6.0" and type "git branch" i get "not a git repository" error

    4) If i manually go to "C:/ncs/v2.4.2" and type "git branch" i get "not a git repository" error

    5) About 3) and 4) please notice that if i try to build using nrf connect 2.4.2 it builds correctly, while if i try to build using nrf connect 2.6.0 i get the error at the origin of the post.

    I hope this helps. Waiting for your feedback,

    Frax

  • Hello,

    In which directory does the terminal open when you execute the 'nRF Connect SDK: Open Toolchain Terminal Profile' command? I expected it to open in C:/ncs/v2.6.0. I wanted you to run git branch followed by west update in C:/ncs/v2.6.0/nrf.

  • In which directory does the terminal open when you execute the 'nRF Connect SDK: Open Toolchain Terminal Profile' command?

     C:\nrf5340_PASTO

    I wanted you to run git branch followed by west update in C:/ncs/v2.6.0/nrf.

    If i go manually in this directory and run git branch i get "no branch" answer.

  • Thanks for confirming. In that case, from the nrf directory, please run 'git checkout v2.6.0 && west update'

  • Done. Unfortunately, after a while the process started, it loops on these lines undefinitely (and the folder becomes bigger and bigger):

    warning: unable to unlink '.git/objects/pack/pack-3a6b1c941c640cde49d28a9838e829dbf4516c5a.idx': Invalid argument
    warning: unable to unlink '.git/objects/pack/pack-bb8654a1220392c6412891f2b648eee79e2b60bc.idx': Invalid argument
    remote: Enumerating objects: 206, done.
    remote: Counting objects: 100% (55/55), done.
    remote: Compressing objects: 100% (55/55), done.
    Receiving objects:  96% (198/206)ed 0 (delta 0), pack-reused 151
    Receiving objects: 100% (206/206), 32.37 KiB | 1.70 MiB/s, done.
    Auto packing the repository in background for optimum performance.
    See "git help gc" for manual housekeeping.
    Enumerating objects: 5020, done.
    Counting objects: 100% (4819/4819), done.
    Delta compression using up to 8 threads
    Compressing objects: 100% (3896/3896), done.
    Writing objects: 100% (4819/4819), done.
    Total 4819 (delta 836), reused 4812 (delta 829), pack-reused 0

    With the "Total" count (on the last row here above) that slowly increases (together with the size of the folder). To stop this loop i need to close VS Code

Related