Unable to parse JSON String when opening project

OS: Ubuntu 20.04.6
NCS SDK: 1.6.1
Segger: 5.50c

I recently got a new laptop, which I installed using the following guide:

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/v1.6-branch/nrf/gs_installing.html

I'm in the process of porting to NCS 2, but I still need access to 1.6.1.

When I open the project in Nordic Segger, I get:

Unable to parse JSON String.

I've seen many other people with the same error on the forums, but most had also NCS 2 installed. I did a fresh install of 1.6.1 to prevent this error message.

After some troubleshooting I got this:

I modified html/import_nordic_project_dialog.htm to print more verbose information regarding this problem.

It seems that the JSON contains this error message, of course it would be unable to parse.

This is the javascript that causes the error:

  // CMake print the json string to std error, this is due to the nature of `message()` function.
  var releasesJson = cmake.readStandardError();
  releases = JSON.parse(releasesJson);

I have nRF for Desktop installed, with the toolchain manager. But as you might know, NCS 1.x is not listed because of Linux limitations.

So I firstly source ncs/zephyr/zephyr_env.sh before I start Segger from the commandline.

I hope someone can give me a solution. Maybe do a hard coded JSON string with the 1.6.1 version in it would suffice? But I need to know how the JSON should look like.

Parents
  • Hi,

    Are you able to build and program the application on the command line? If so, I recommend doing this instead of using SEGGER Embedded Studio.

    Best regards,
    Marte

  • I'm sure I could get it to work from the commandline.
    But I prefer to have the IDE for debugging purposes.

    Do you know why the CMake includes ~/git/zephyr ?
    It seems that this causes the import to fail, but I have set ZEPHYR_BASE to ~/ncs/zephyr

    If I remove ~/git/zephyr, the problem is solved.

  • Hi,

    ephimee said:
    It seems that this causes the import to fail, but I have set ZEPHYR_BASE to ~/ncs/zephyr

    Did you set Zephyr base to ~/ncs/zephyr in the SES environment settings as well? See step 3 in 7. Set up the build environment in SES.

    Best regards,
    Marte

  • Hi,

    I have tried to look into this, but I have not been able to find any explanation for why CMake included ~/git/zephyr instead of ~/ncs/zephyr when you had set the Zephyr base.
    Since we no longer officially support SES, we will not be able to allocate resources to investigate this issue. However, as you have stated, deleting ~/git/zephyr seems to solve the issue.

    Best regards,
    Marte

  • Because I'm doing more projects with NCS 2, I still have this issue because Nordic Segger keeps on finding my NCS 2 toolchains and breaks.

    To solve this I have modified the file arm_segger_embedded_studio_v550c_linux_x64_nordic/cmake/find_ncs_releases.cmake

    The problem is located in Zephyr_CONSIDERED_CONFIGS, it contains multiple paths to both NCS 1 and NCS 2 toolchains.

    So search for the following code fragment:

    if(DEFINED Zephyr_CONSIDERED_CONFIGS)
      list(REMOVE_DUPLICATES Zephyr_CONSIDERED_CONFIGS)
    endif()
    

    As you might already have guessed, this piece of code already removes duplicates from the list. The next step would be to remove all NCS 2 toolchain related. I did this with the following code which you can add after the above:

    if(DEFINED Zephyr_CONSIDERED_CONFIGS)
      list(REMOVE_DUPLICATES Zephyr_CONSIDERED_CONFIGS)
    
      # Create a new list to hold the filtered results
      set(filtered_configs)
    
      # Set the substring that you want to filter by
      set(filter_string "/home/ephimee/ncs/")
    
      # Loop through all items in Zephyr_CONSIDERED_CONFIGS
      foreach(config IN LISTS Zephyr_CONSIDERED_CONFIGS)
        # Check if the config contains the filter_string
        if(config MATCHES "${filter_string}")
          # If it matches, append it to the filtered_configs list
          list(APPEND filtered_configs ${config})
        endif()
      endforeach()
    
      # Replace the original list with the filtered one
      set(Zephyr_CONSIDERED_CONFIGS ${filtered_configs})
    endif()
    

Reply
  • Because I'm doing more projects with NCS 2, I still have this issue because Nordic Segger keeps on finding my NCS 2 toolchains and breaks.

    To solve this I have modified the file arm_segger_embedded_studio_v550c_linux_x64_nordic/cmake/find_ncs_releases.cmake

    The problem is located in Zephyr_CONSIDERED_CONFIGS, it contains multiple paths to both NCS 1 and NCS 2 toolchains.

    So search for the following code fragment:

    if(DEFINED Zephyr_CONSIDERED_CONFIGS)
      list(REMOVE_DUPLICATES Zephyr_CONSIDERED_CONFIGS)
    endif()
    

    As you might already have guessed, this piece of code already removes duplicates from the list. The next step would be to remove all NCS 2 toolchain related. I did this with the following code which you can add after the above:

    if(DEFINED Zephyr_CONSIDERED_CONFIGS)
      list(REMOVE_DUPLICATES Zephyr_CONSIDERED_CONFIGS)
    
      # Create a new list to hold the filtered results
      set(filtered_configs)
    
      # Set the substring that you want to filter by
      set(filter_string "/home/ephimee/ncs/")
    
      # Loop through all items in Zephyr_CONSIDERED_CONFIGS
      foreach(config IN LISTS Zephyr_CONSIDERED_CONFIGS)
        # Check if the config contains the filter_string
        if(config MATCHES "${filter_string}")
          # If it matches, append it to the filtered_configs list
          list(APPEND filtered_configs ${config})
        endif()
      endforeach()
    
      # Replace the original list with the filtered one
      set(Zephyr_CONSIDERED_CONFIGS ${filtered_configs})
    endif()
    

Children
No Data
Related