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

Developing an application with the mesh SDK

It is very easy to build the example applications in the nRF mesh SDK (v2.2.0), but what is the official way to structure the build system when developing an application with the SDK?

The quick and dirty way would be to add a new directory for the application inside the SDK itself, and change the SDK's cmake files so it gets built. There are several issues with this, such as difficulties keeping my app and SDK code separate, tracking changes to SDK files, painful SDK upgrades, etc. But the SDK can't be built as a cmake subproject (with add_subdirectory) because it uses CMAKE_SOURCE_DIR, and the SDK doesn't seem to be able to build a mesh library that I can simply link to from an external project. So I'm struggling to find a sane way to do this — have I missed something?

Parents
  • Hello Jonas,

    I guess the "correct" way to develop a project in the Mesh SDK is to leave the "normal" SDK (SDK15, which is in the same root folder as your mesh SDK) )unchanged. If you want your project to be easily upgraded when new Mesh SDKs are released, you wouldn't want to change any of the files outside your project folder.

    So if you want to get a running start, copy one of the example folders that look most like what you want to do, e.g. the MeshSDK\examples\light_switch, and name it for your project. Don't change any files outside this project. If you want to add new, or modify files from the SDK, create a copy of it, and place it within this folder. If you want to, you can place the project folder that you are working on outside the SDK, but you would have to modify all the paths for your project to match your Mesh_SDK root folder.

    If you place your project outside the SDK, you can enable write protection to the SDK, so that you are sure you are not changing any of the SDK files.

    I usually (when I want to modify a project) place a copy of the project folder inside a folder in the mesh SDK that I created:

    nrf5_SDK_for_Mesh_v2.1.1_src\test_projects\

    So that I e.g. get the path:

    nrf5_SDK_for_Mesh_v2.1.1_src\test_projects\light_switch_test

    Keeping the same number of steps up to the SDK root means I can compile without changing the paths for the project.

    Best regards,

    Edvin

Reply
  • Hello Jonas,

    I guess the "correct" way to develop a project in the Mesh SDK is to leave the "normal" SDK (SDK15, which is in the same root folder as your mesh SDK) )unchanged. If you want your project to be easily upgraded when new Mesh SDKs are released, you wouldn't want to change any of the files outside your project folder.

    So if you want to get a running start, copy one of the example folders that look most like what you want to do, e.g. the MeshSDK\examples\light_switch, and name it for your project. Don't change any files outside this project. If you want to add new, or modify files from the SDK, create a copy of it, and place it within this folder. If you want to, you can place the project folder that you are working on outside the SDK, but you would have to modify all the paths for your project to match your Mesh_SDK root folder.

    If you place your project outside the SDK, you can enable write protection to the SDK, so that you are sure you are not changing any of the SDK files.

    I usually (when I want to modify a project) place a copy of the project folder inside a folder in the mesh SDK that I created:

    nrf5_SDK_for_Mesh_v2.1.1_src\test_projects\

    So that I e.g. get the path:

    nrf5_SDK_for_Mesh_v2.1.1_src\test_projects\light_switch_test

    Keeping the same number of steps up to the SDK root means I can compile without changing the paths for the project.

    Best regards,

    Edvin

Children
Related