Merging examples together

I have some bare metal experience on other processors, but I am new to Nordic and Zephyr. I was wondering if there are there any good source materials that show the best practices on merging samples? Specifically I would like to create a solution that uses both Peripheral_UART and ICM42605... Pedometer which sends data over BLE.

I've found some older stuff to reference, but before I dive into it I want to make sure I am using the modern/best/easiest way possible with the newest SDK's and VSCode. 

Parents
  • Hi,

    With the two samples you mentioned you may be able to just add them together. It does not look like they conflict in any way. Just merge the overlay and prj.conf files from zephyr/samples/sensor/icm42605 with the same files from peripheral_uart. And copy over the functions etc from the main.c and add the main() functions together.

    For future, more complicated merging, you should look out for conflicts in configs and peripheral instances. For example, if the samples are using spi1 and i2c1. Those can not both be enabled, so then you would for example use i2c2 instead.
    Conflicting configs will give a warning when building that the config was assigned a value, but ended up with a different one. Then you can look the config up in the Kconfig reference to see its dependencies.

Reply
  • Hi,

    With the two samples you mentioned you may be able to just add them together. It does not look like they conflict in any way. Just merge the overlay and prj.conf files from zephyr/samples/sensor/icm42605 with the same files from peripheral_uart. And copy over the functions etc from the main.c and add the main() functions together.

    For future, more complicated merging, you should look out for conflicts in configs and peripheral instances. For example, if the samples are using spi1 and i2c1. Those can not both be enabled, so then you would for example use i2c2 instead.
    Conflicting configs will give a warning when building that the config was assigned a value, but ended up with a different one. Then you can look the config up in the Kconfig reference to see its dependencies.

Children
Related