Custom UUID for SMP service

Hi, 

I am using NCS. 

I am using SMP service through BLE, and for security reason I would like to have a custom UUID for the BLE service.

UUID is defined in zephyr\include\zephyr\mgmt\mcumgr\transport\smp_bt.h.

Is there a way, without modifying zephyr repo, to have a custom UUID ?

I have created on app side, the same path : \include\zephyr\mgmt\mcumgr\transport\smp_bt.h and created a copy of smp_bt.h, with only a difference on UUID.

I think, by modifying CmakeLists.txt, or prj.conf, it is possible to indicate that this file should be taken instead of the one in zephyr. 

Can you help on that ?

  • Hi Antoine,

    This is indeed possible. Mirror the include path inside your application and place your version there. Your app’s include directory is searched before the SDK’s, so the compiler will choose the one inside your application instead of the default SDK header file.

    In your application directory, create:

    include/zephyr/mgmt/mcumgr/transport/smp_bt.h

    You also need to ensure the include directory is added in CMake. In your CMakeLists.txt add:

    target_include_directories(app PRIVATE
        ${CMAKE_CURRENT_SOURCE_DIR}/include
    )


    Best regards,
    Benjamin

     

  • Hi Benjamin,

    I searched on my side too and did that too.

    at first i had the same line as you in Cmakelists but my file was not taken in priority, so i changed it like that, and it worked.

    target_include_directories(zephyr_interface BEFORE INTERFACE 
        ${CMAKE_CURRENT_SOURCE_DIR}/include)

Related