Zephyr Project Port
July 26, 2024 ยท View on GitHub
Overview
This port is for the Zephyr RTOS Project, available here.
It provides the following zephyr code.
- modules/lib/wolfmqtt
- wolfMQTT library code
- modules/lib/wolfmqtt/zephyr/
- Configuration and CMake files for wolfMQTT as a Zephyr module
- modules/lib/wolfmqtt/zephyr/samples/client
- wolfMQTT client test application
- modules/lib/wolfmqtt/zephyr/samples/client_tls
- wolfMQTT client test application over TLS
How to setup as a Zephyr Module
Follow the instructions to setup a zephyr project.
Modify your project's west manifest
Add wolfMQTT as a project to your west.yml:
manifest:
remotes:
# <your other remotes>
- name: wolfmqtt
url-base: https://github.com/wolfssl
projects:
# <your other projects>
- name: wolfmqtt
path: modules/lib/wolfmqtt
revision: master
remote: wolfmqtt
Update west's modules:
west update
Now west recognizes 'wolfmqtt' as a module, and will include it's Kconfig and CMakeFiles.txt in the build system.
Build and Run Samples
Follow the instructions to setup the infratructure to enable networking in QEMU. Run the following commands in parallel in this order in the net-tools directory to allow communication between the QEMU instance and the host. Make sure to disable any software that modifies the local network like VPN's.
./loop-socat.sh
sudo ./loop-slip-tap.sh
Run the following commands in parallel in this order in the zephyrproject directory to setup a MQTT broker and subscriber (on port 11883 as defined in the mosquitto config).
cd modules/lib/wolfmqtt && mosquitto -c scripts/broker_test/mosquitto.conf
mosquitto_sub -p 11883 -t sensors
Build and Run client Test Application
build and execute client
cd [zephyrproject]
west build -p auto -b qemu_x86 modules/lib/wolfmqtt/zephyr/samples/client
west build -t run
Build and Run client TLS Test Application
Prerequisite: Add wolfSSL Zephyr module: https://github.com/wolfSSL/wolfssl/blob/master/zephyr/README.md
build and execute client TLS
cd [zephyrproject]
west build -p auto -b qemu_x86 modules/lib/wolfmqtt/zephyr/samples/client_tls
west build -t run
Debugging using QEMU
To attach a debugger to the QEMU instance run:
west build -t debugserver_qemu
And attach gdb with:
$ gdb path/to/zephyr.elf
(gdb) target remote localhost:1234