Topic: [SOLVED] WolfMQTT with MPLab Harmony - How to guide?
Does anyone know of a guide or how to on using WolfMQTT within Harmony that steps through how to use it. There is an example in the wolfmqtt examples folder but that's a very generic one that works on Windows within visual studio and has no references to harmony except for a couple of compiler if's.
I follow the lab1 guide in Introduction to the MPLAB® Harmony TCP/IP Stack which gets the TCP/IP stack running and connected and able to ping the PIC32MZ EF Starter Kit. (I'm using PIC32MZ20148EFM144 which is the only thing I need to change from the lab guide). MPLAB X IDE v4.05 on Windows with XC32(v1.42) and Harmony 2.0.5. The MHC is from the harmony 2.0.5 folder.
I use MHC to add wolfMQTT (in the Third Party Libraries section) and without doing anything else, it does compile. WolfMQTT version included with Harmony 2.0.5 is version 0.10 (version.h - #define LIBWOLFMQTT_VERSION_STRING "0.10"). EDIT: Change to use v0.14.0 has same result.
As soon as I add #include "wolfmqtt/mqtt_client.h" to app.h I get a plethora of errors where the compiler can't find things, for example (just a few):
"C:\Program Files (x86)\Microchip\xc32\v1.44\bin\xc32-gcc.exe" -g -x c -c -mprocessor=32MZ2048EFM144 -ffunction-sections -O1 -DHAVE_CONFIG_H -I../src -I../src/system_config/pic32mz_ef_m_sk -I../src/pic32mz_ef_m_sk -I../../../../framework -I../src/system_config/pic32mz_ef_m_sk/framework -I../src/system_config/pic32mz_ef_m_sk/bsp -I../../../../third_party/tcpip/wolfmqtt -MMD -MF build/pic32mz_ef_m_sk/production/_ext/1029000301/mqtt_packet.o.d -o build/pic32mz_ef_m_sk/production/_ext/1029000301/mqtt_packet.o ../../../../third_party/tcpip/wolfmqtt/src/mqtt_packet.c -DXPRJ_pic32mz_ef_m_sk=pic32mz_ef_m_sk -no-legacy-libc
nbproject/Makefile-pic32mz_ef_m_sk.mk:679: recipe for target 'build/pic32mz_ef_m_sk/production/_ext/1029000301/mqtt_packet.o' failed
In file included from ../src/app.h:61:0,
from ../src/system_config/pic32mz_ef_m_sk/system_definitions.h:68,
from ../../../../third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_types.h:50,
from ../../../../third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_packet.h:34,
from ../../../../third_party/tcpip/wolfmqtt/src/mqtt_packet.c:27:
../../../../third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_client.h:61:54: error: unknown type name 'MqttMessage'
typedef int (*MqttMsgCb)(struct _MqttClient *client, MqttMessage *message,
^
../../../../third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_client.h:91:5: error: unknown type name 'word32'
word32 flags; /* MqttClientFlags */
^
../../../../third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_client.h:109:5: error: unknown type name 'MqttMsgCb'
MqttMsgCb msg_cb;
I've tried just calling functions from within app.c, but that also fails.
Also tried including all of the wolfmqtt files, but that doesn't help either (which I didn't expect it to)
Any guidance is greatly appreciated.
End goal is subscribe to a topic on a MQTT server (mosquitto) and publish to that topic from the PIC32.