Trying to understand how to configure nRF Connect SDK/Zephyr/Visual Studio Code to utilise my own "modules" across multiple projects

OK, I'm not entirely sure my title is using the correct terminology, so let me attempt to explain what I'm trying to do.

I've got a bunch of .c and .h files that I am using in a current project for doing various things (converting time to UTC, doing CJSON conversions, storing log file info, etc).  I want to reuse the functions in these files across a bunch of other projects (the other products need these common functions), and have it such that if I update one of these files, all the projects pull in the updated files next time I do a build.  That way, I'm not maintaining the same file across 3 or 4 different projects.

Problem is, I've no idea as to the best way to achieve this.

I'm doing something like this in one of my projects, where I am pulling in someone else's code from GitHub, then having that compiled into my code so I can access the various API's they've written.  That uses an entry in the nrf/west.yml file for my SDK:

    # RTC Driver
    - name: pcf85063a
      url: github.com/.../pcf85063a
      revision: master
      path: pcf85063a

The actual folder pcf85063a sits within the sub-directories for the nRF Connect SDK folder on my local machine.

I could potentially do it that way, but I'm sure there is an alternative way using CMakeLists and path definitions that may be more appropriate.  But I don't understand enough about CMakeLists to fully understand if & how I can leverage them to achieve what I want to do.

Can anyone point me the the right direction of how I might go about achieving my goal?

Thanks and regards,

Mike

Related