openthread-mqttsn icon indicating copy to clipboard operation
openthread-mqttsn copied to clipboard

How to build examples?

Open nikolac opened this issue 2 years ago • 5 comments

First of all, thank you for all of the great work you've done. Of all the Nordic sdk examples, other tutorials, your MQTTSN over docker is the only example that I've been able to get to working consistently.

I was hoping to explore your SED mqttsn cpp example, but I'm not exactly sure what the build and flash process is. For context, I'm using the NRF52840 dongles (PCA10059).

I tried a few shots in the dark: make/cmake from the openthread/src directory, gcc the .cpp, but the build references seem off. Not sure what the build context is supposed to be.

nikolac avatar Feb 27 '22 00:02 nikolac

Hi @nikolac. Unfortunately, I don't have easy answer for you. You could follow these options:

  • Take referenced OpenThread fork and replace examples/apps/cli/main.c code with example code. Then build OpenThread as usual and flash CLI example binary. It is more or less described in this guide.
  • Build referenced OpenThread fork for your platform as described in official guide. Then create new project for your NRF (use some example project) and just refence required header files in compiler flags and link OpenThread ".a" files. You can get inspiration from this project where I build MQTT-SN application with HTU21 sensor for NRF52840 dongle. Makefiles were generated by Eclipse, project also contains already built libraries. I'm just not sure now which bootloader type I've used.

Also keep in mind that examples were tested with this reference of my OpenThread fork with MQTT-SN feature: https://github.com/kyberpunk/openthread/tree/ac5d8364a6d3cf479409d261efb162091e276dd0. It could work also with latest master, but OpenThread API may have changed slightly.

kyberpunk avatar Mar 01 '22 21:03 kyberpunk

Thanks for the info, solid options. I will play around and post an update for closure.

nikolac avatar Mar 01 '22 21:03 nikolac

Thanks will give it a go

ajlennon avatar Jul 27 '23 10:07 ajlennon

I've put some code to build a publication example in a fork here @kyberpunk. Am in the middle of soak testing but happy to provide a PR if you're interested

https://github.com/DynamicDevices/openthread/tree/ajl/adding-examples

ajlennon avatar Jul 28 '23 09:07 ajlennon

Hi @ajlennon thanks, will check it.

kyberpunk avatar Jul 31 '23 20:07 kyberpunk