I have a project that consists of nodes in a mesh, that will communicate between each other wirelessly and will identify each other with a use of addresses.
Nodes will be equivalent in their responsibilities so the source code for each them will be identical, except for address which I would like to be specific and unique for each.
This project will be a kind of demo, or technology demonstration so for simplicity I do not want to introduce some address negotiations or anything complex like that.
I was researching and found some suggestions to use target_compile_definitions in CMake but I am not really sure how to apply it to generic Zephyr CMakeLists.txt:
set(BOARD qemu_x86)
find_package(Zephyr)
project(my_zephyr_app)
target_sources(app PRIVATE src/main.c)
So I was wondering what is the best way to do that? Is there a way to do that in CMake (I am quite a noob yet when it comes to CMake)? Or should I tinker with some Python script?
EDIT: And I was thinking if maybe doing something like #define <device_addr> from level of CMake is possible, and then repeating that X times for the rest of the devices. So in the end I would have X binaries that will differ only in regard to that #define <device_addr>.
Thank You for responses in advance.