This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Generate emProject from commandline

Dear Support

I'm new on ncs.

Now I've read nrf-connect-sdk-tutorial and I can build a project with SES.

I want to automate the build,

So I test 

west build -b nrf9160dk_nrf9160ns -d dstpath srcpath

This build my project but there is no *.emProject to open and debug with SES.

How can I automate "Open nRF Connect SDK Project ..." from SES?

Thanks for support.

  • Hi,

    West does not create a SES project. To do so, you must open SES and use "Open nRF Connect SDK Project".

    If you want to build on command line with west, and the only reason you want SES is for debugging, I would recommend instead using Segger Ozone for debugging. A nice feature in Ozone is that it makes thread aware debugging possible. You can find the NCS documentation for Ozone here, and if you are interested, you can check out our guide for Thread aware debugging with nRF Connect SDK.

    It might be possible to add something to CMake to create a SES project, but it is not something that has been done in NCS before, and there is no simple way to do this. Something similar has been made in the nRF5 SDK for Mesh, but the build process for nRF5 SDK and NCS are very different. They also use different editions of SES, with nRF5 SDK using the general SEGGER Embedded Studio for ARM microcontrollers, and NCS using a specific Nordic Edition. If you still want to try and create something like this, you can take a look at how it is done in nRF5 SDK for Mesh, but be aware that this will not work in NCS. In the SDK root folder you can find the folder "CMake", which has the file GenerateSESProject.cmake and a folder called SES with files related to this. It would also be a good idea to read about the build process in Zephyr, especially the configuration phase, as this is done by SES when you open/create a NCS project using "Open nRF Connect SDK Project". You can see this by looking at the output in SES (with Transcript and Output selected in the output terminal) after you have opened a project, for example "Found devicetree overlay", "Generated zephyr.dts", etc.

    Best regards,

    Marte

  • Hi,

    This sound very complicated.

    I can't reverse engineer nRF5 SDK for Mesh.

    I would like to use SES to create and edit new files.

    The only way I found to add a new file to the project tree is to

    • edit CMakeLists.txt
    • close SES
    • delete the build folder
    • open SES
    • run "Open nRF Connect SDK Project"

    This takes a lot of time to add one source file.

    It would be simpler when this can be done with a script.

    Do you know a simpler way?

    Reto

  • Hi,

    After adding the file to CMakeLists.txt it should be enough to reopen the project or rerun CMake in some way for the changes to take effect. You can do this in multiple ways:

    • Open the project again using "Open nRF Connect SDK Project"
    • Reload the project with Project -> Reload <project_name>
    • Re-run CMake with Project -> Run CMake

    This is because changes made to files that are used to generate the project does not take effect unless you run CMake, such as CMakeLists.txt and prj.conf. There is no other way of automating this process, as SES does not run CMake when it builds the project, only when it creates, opens or reloads the project. The only other option is to use another code editor to view, create and edit files, for example Visual Studio Code, and then use west to build on the command line, since the command west build both runs CMake and builds the project.

    Best regards,

    Marte

Related