Toolchain manager issues: Cleaning the build files / moving code to another folder

I'm using NCS 1.9.1 and Segger SES

Following Nordic's recommendation I first made a copy of BLE/peripheral_uart in order to preserve the original code and then used the toolchain manager to open the project. I selected nrf52DK_52832 as target and so far, things are working not bad.

1.) when the code is properly built, the project folder contains approx 1600 files with 40 MB size - my actual code is less than 30 kB. It is not clear to me which files can easily be deleted because they are rebuilt - I tried once to delete "build_nrf52dk_nrf52832" which is a most stupid idea, because all my project settings regarding BLE GATT were gone.

"Clean Zephyr" or "clean solution" does not really help too much, still 37 MB and if even fails with
"...ncs/v1.9.1/nrf/samples/bluetooth/peripheral_uart/build_nrf52dk_nrf52832/zephyr/dev_handles.c does not exist."

I find it very strange that I'm not able to peroperly clean a project, get rid of temprorary files - and I found no documentation so far on the Nordic system.

2.) the other issue is the location of sources: it seems that the full path to all files goes somewhere into the build process, which means, I'm not able to rename my project folder or move it to another location / harddisk / server and build there.

Is there any strategy how to handle this ?

As example lets look at c:/ncs/v1.9.1/nrf/samples/bluetooth/peripheral_uart - this is the sample I'm referring to. What is necessary to move this to : f:\customerXYZ\BLE-development\product1

thanks, Matthias

  • Hi Matthias,

    You can always just copy the contents of the NCS folder to have a "clean" version. This way you will keep a "untouched" version. 

    As example lets look at c:/ncs/v1.9.1/nrf/samples/bluetooth/peripheral_uart - this is the sample I'm referring to. What is necessary to move this to : f:\customerXYZ\BLE-development\product1

    When you create the project you should be bale to select whatever path you want it in. 

    You can move you configs outside of the build folder, this way you want delete them when you remove the build folder. 

    Regards,
    Jonathan

  • I'm not talking about a copy of the whole NCS folder sub-structure, I'm referring to one single project. Also, I dont want to "create" a project - I already have a project, but I want to copy it to another destination on my harddisk.

    When I'm developing (other) code I very often have parallel project folders like "test-v1" and "test-v2" etc - which is sort of versioning system as long as I work with code. For Microsoft tools (eg VS/C++) or code which relies on GNU-makefiles the folder name and location doesn't matter, as long as the content and subdirs are ok I can put the folders wherever I like and it compiles without any trouble - this seems not to work with NCS. It appears to me as if the NCS folder structure forces me to store my project files in a particular place because of the stored paths.

    The whole NCS build process only seems to work when I start SES via "nRF connect for desktop / toolchain manager". This seems to limit me to use only projects which are stored under "samples/bluetooth" - I'm not able to navigate to another folder.

    Although there is an .emProject-File in the project's build folder, this SES project file will open the project, but I'm not able to compile the code because it results in errors.

    You say I can copy config files outside the build folder : how would I know which config files I need ? and what I needs to be changed or configured then in order to match the new location ?

  • Ok : I was trying to create a copy of peripheral_uart and place it into f:\ncs\v1.9.1\myProjects\test1

    then use SES : File > open nrf connect sdk project

    I clicked on projects "..." to select the folder as explained above and then an error box appeared:

    "cannot create project - create_nordic_project.py failed (1)"

  • Hi Jonathan

    just to mention this, so far I never created a "clean" NCS project from scratch - people from Nordic recommended to me to use an existing sample code and modify it to my needs, and that worked so far not too bad.

    I made some tests : I started to work with a virgin copy of "peripheral_uart". Since my target is PCA10040 compatible I selected "nrf52dk_nrf52832" so the build folder was created, including the zephyr-folder and a .config file.

    I used the Kconfig tool (Segger SES > Menu > Project > Configure NCS project) and modified some settings to my needs, such as bluetooth device name, some GATT services etc. Hit "configure" and then compile the code, so far so good.

    I copied the whole folder "peripheral_uart" into something like "test_uart" and tried to open this project through SES "open nRF connect SDK project", but then the error pos up "cannot create project - create_nordic_project.py failed (1)"

    When I try to "clean the build directory" all the build folder is gone, including all my .config settings

    I tried this and then replaced the .config file manually from the original working version - and rebuild the solution : this seems to work.

    What I dont understand: how is prj.conf used ? Is .config derived from prj.conf ? and, am I supposed to modify prj.conf ?

    thanks for helping me, Matthias

    PS. I found another Q&A post about "Use of Pristine Build on VScode..." and I guess this is a similar issue ... It's not clear to me which files in the build folders are important to generate the code I want.

    PPS. I tried yesterday an upgrade to NCS 2.0.0 - I don't like being forced to using VS code, but hey, I tried it. After 4 crazy hours I downgraded everything because I even was not longer able to compile NCS 1.9.1 code and had suddenly issues with my Segger J-Link+

  • MDF said:
    What I dont understand: how is prj.conf used ? Is .config derived from prj.conf ? and, am I supposed to modify prj.conf ?

    To move the configurations out of the build folder, so that it does not get deleted when you do a clean build then you need to ad them manually in the prj.conf file. So yes, use the prj.conf to keep the settings you want permanently.  


    We do have some tutorials and videos on how to get started with VS code. VS code will be the default editor going forward from NCS v2.0.0 as SEGGER will no longer be supported. It is possible to use SEGGER but it will not be tested by us and getting it to work properly will most lily be even greater hassle. 


    I would recommend to check out the DevAcadamy for a  better tutorial. 

    As for the issues you have with NCS 2.0.0 there seem to have been a issue that broke previous installations when using SEGGER, so sorry about that. I hadde to remove the contents of the NCS folder and redownload, then previous versions worked with SEGGER again. It also caused issues with the manual insulation i have separately so if you also have manual installation that could cause som extra hassle.

    AS for what is important or not, i would recommend that you check out our guide on NCS, it is a built outdated but i goes over all the different parts of the projects. 
    nRF Connect SDK Tutorial - Part 1 | v1.5.0 - Getting Started - nRF Connect SDK guides - Nordic DevZone (nordicsemi.com) 

    Then there is the new docs, Features - nRF Connect for VS Code , it is more intuitive in the VS code IDE, as the Konfig is structured in a more direct way and not hidden in menus as it is in SEGGER, this also removes the issue where removing the build folder brakes the project. 

    Regards,
    Jonathan

Related