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

graduating from example to production: project file structure?

I've used Segger Embedded Studio to compile and run a number of example projects -- nicely done!

Now I'm ready to start creating my own projects, with the ultimate goal of releasing one or more supported projects, but it's a challenge to find a project file structure is idiomatically correct for the nRF5 sdk.

The Question

I'd like to know how other people maintain nRF5 projects, or if there are good online examples of same.

Some Specifics

Assume I have a project directory named myWorkspace/myProj/. I want to capture a snapshot of the SDK so I can work from a stable base, and put everything under .git control:

  • Would you copy the SDK components/ directory into myProj/components/? Or would you copy it to myWorkspace/components so it could be used across multiple projects?
  • Ditto for config/: would you copy it to the project directory, or to the workspace directory?
  • I'm using the SEGGER Embedded Studio and want to use SEGGER_RTT for debugging I/O. Would you copy (only) external/segger_rtt/ to the project directory, or to the workspace directory? Or would you copy the entire external/ directory? (Or something else?)
  • What about external_tools/ and svd/?
  • Once everything is in place, what's the best way to create a blank project? (This may be more of a SEGGER question than a Nordic question.)
  • I'm assuming that I'd put 'myWorkspace/' under git control so it can capture the entire state of things. If there's a better approach, I'd like to know.

Thanks in advance!

  • Hi

    The way I do it, and the way many of the examples shared on our Github pages do it, is to simply add a new folder under examples and add new projects there:
    examples/your_name_or_company/

    Then you can just copy an existing example into that folder (including the sdk_config.h file), and you don't have to change any of the includes since they are all relative (assuming your example is at the same folder 'depth'): examples/your_name_or_company/ble_app_uart/

    Then you can change the name of the project folder, and the name of your project files, and you're good to go (technically you don't have to do that, but you probably don't want your project to be named after the original example):
    examples/your_name_or_company/ble_my_application/

    Then you can initialize your Git repo inside the top folder of the example.

    This does mean that the SDK is not a part of your repo, which means you should avoid changing any SDK files, and you have to make sure to use the example with the right SDK if you clone it in the future.

    Whether this is the best way to do it or not I don't know. Maybe someone else has some input :)

    Best regards
    Torbjørn

  • This course of action is not so maintanable when you need to pass code aroun or update the SDK. Is there a more structured way to have your project files outisde the SDK and start a new clean project somewere else? An example or a tutorial will be great.

  • can u share your experience about creating your own projucts

  • Just came back from TI cc2640r2 after about one year I tried nRF52. I have to say, the way TI CCS project structure is way more better than nRF52 SDK.

    Does anyone have a better solution to isolate SDK and own projects?

Related