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

Create a new project in Segger Embedded Stuido

Hello.

Actually I have two qustions, but they are related with the same challenge.

So, I want to develop application using SDK (libararies and config), but starting from empty project. To create empty buildable project for nRF52DK I need to include a lot of necessery files, such as sdk_config.h, boards.c ... etc. So, can you give list of all files, which I need to include in project, to be able to correctly build it, and also which configuration I need to do? For example what I need to do to create project the same as examples/peripheral/template_project?

I also want to know, how to change folder of existing project? For example if I change directory of template_project from examples, how can I repair links to necessery files?

  • Hey Arsenii,

    Take a look at our Introduction to SES videos

    You should also use one of our example projects as a template. 

    Cheers,

    Håkon.

  • I watched the tutorials and they don't really talk about creating a new project either from scratch or from an existing project.

    I tried opening one of the examples and then doing Save As on the solution. It let me save it, but then all of the files in the project would not open. For example when I double click on the main.c file it says it can't fine C:\main.c. That is not where I saved the solution. When I double clicked on another files it said it couldn't find a file at some path like ..\..\components\ etc.

    It looks like all of the paths are relative to the project solution file.

    You see, the main thing is that I don't want to be saving my own project files inside of the examples folder inside of the SDK folder. That doesn't seem like a very good idea since someday I might want to update / upgrade the sdk and having my own projects files inside of it doesn't make sense.

    So the big question everyone wants to know is what is the proper way to start a new project and save it in your own location and have all of the relative paths get fixed without having to do that all myself?

  • I also want to say that one of the main reasons to want to do this is because I don't want to be modifying the existing examples and saving them in place. I want to make sure the examples stay the way they are and copy them to my new project.

    It would also be nice if I could reference files in another place that I won't be changing, but ensure that any files I will be modifying will be my own copies and not the originals.

  • Coming from the Eclipse / workspace view of the world, I second this question!  Like Tony, I'd like to start with a copy of an example project rather than modify the example code in place.  The video series is helpful, but it doesn't address this key question.

  • One technique that works for me is described here:

       https://devzone.nordicsemi.com/f/nordic-q-a/28196/graduating-from-example-to-production-project-file-structure

    It's a little bit cheating, but here's the summary.  (Below, I'm using $SDK as a shorthand for the directory containing the SDK of your choice):

    1. Create a "myprojects/" directory under the example directory of your SDK:

    $ mkdir $SDK/examples/myprojects

    2. Copy an example project of your choice into the myprojects directory, renaming it if you wish:

    $ cp -rp $SDK/examples/peripheral/timer $SDK/examples/myprojects/test_a

    3. Open the .emProject inside that directory, e.g.:

    $ open $SDK/examples/myprojects/test_a/pca10040/blank/ses/timer_pca10040.emProject

    Now you can modify, compile and run the app according to your needs.

    I only call this "cheating" because you're still building inside the SDK directory rather than a sandboxed directory of your choosing, but it works.  The biggest advantage of this approach is that you don't need to update all the links to the include files and libraries and whatnot (which is really tedious).  A few points:

    • Theoretically, you could create a symbolic link from $SDK/examples/myprojects into a sandboxed directory of your choosing.  (I haven't tried this).  
    • One advantage of this approach is that myprojects and all code under it is tied to the SDK that its built on.  If you update the SDK, it will be obvious that you need to re-build your code.
    • You might wish to rename your .emProject file (and some of the references inside that file) to your actual project name, e.g. `test_a` in the above example.

    The above approach works for me.  Its quick and easy.  Your mileage may vary.

Related