1 (edited by smitthhyy 2018-01-12 20:37:36)

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.

Share

Re: [SOLVED] WolfMQTT with MPLab Harmony - How to guide?

Hi smitthhyy,

In the wolfMQTT download you will find a directory:

wolfMQTT/IDE/Microchip-Harmony

That directory contains a detailed README that will get you started. You can also view it online in our github repository here:
https://github.com/wolfSSL/wolfMQTT/blo … /README.md

Let us know if you have any further issues getting setup with Microchip Harmony.


Cheers,

Kaleb

Re: [SOLVED] WolfMQTT with MPLab Harmony - How to guide?

Hi smitthhyy,

I am the author of the wolfMQTT library and did the integration into Harmony. I just downloaded the Harmony v2.05 to test it out. You must be having some include issues. The build error doesn't make sense to me since `mqtt_packet.h`defines `MqttMessage`, which is included just above in mqtt_client.h.

As for v0.10 in Harmony it looks like Microchip hasn't been updating the library, so I will ping them about getting it updated.

For now the best solution is to download the latest from us directly and replace it inside the Harmony `third_party/tcpip/wolfmqtt`.
https://github.com/wolfSSL/wolfMQTT
Then you'll have to re-generate your Harmony code. The README.md Kaleb provided explains how to do this.

Let me know if that is helpful or not. If you continue to get errors please email us at support@wolfssl.com and include the project for reference.

Thanks,
David Garske, wolfSSL

Share

Re: [SOLVED] WolfMQTT with MPLab Harmony - How to guide?

Hi smitthhyy & dgarske

Even I'm working on the similar task where I'm using PIC32MX370F512H custom target board communicating with wifi chip MRF24WN0MB. By following the online tutorials and sample example codes under harmony I could connect to access point.I've used  "wifi_easy_configuration" example project under "C:\microchip\harmony\v2_04\apps\tcpip" path as reference. My end goal is to add MQTT feature to this project and send data to the server.

Please help me in - How to proceed with implemening the use case and test it from the scratch.

I am new to MQTT, just know the theoretical basics.Please help me to go ahead by providing me necessary documents and sample projects in harmony for my use case.

Warm Regards
Jitendra

Share

Re: [SOLVED] WolfMQTT with MPLab Harmony - How to guide?

Hi Kaleb
Can you please let me know briefly what  ''wolfmqtt_client" and "wolfmqtt_firmware" projects are individually meant for. If suppose I'm running ''wolfmqtt_client" where can I check if data is sent to the server? Under Mplab Harmony help I couldnt find explanation on these two projects. Please provide me that information.

Thanks & Regards
Jitendra

Share

Re: [SOLVED] WolfMQTT with MPLab Harmony - How to guide?

Followed the instructions above and tried to build the 'wolfmqtt_client' project both in Mplab Harmony v2_04 and v2_05. Getting the build error below:

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/microchip/harmony/v2_04/apps/tcpip/wolfmqtt_client/firmware/mqtt_client.X'
make  -f nbproject/Makefile-default.mk dist/default/production/mqtt_client.X.production.hex
make[2]: Entering directory 'C:/microchip/harmony/v2_04/apps/tcpip/wolfmqtt_client/firmware/mqtt_client.X'
make[2]: Leaving directory 'C:/microchip/harmony/v2_04/apps/tcpip/wolfmqtt_client/firmware/mqtt_client.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/microchip/harmony/v2_04/apps/tcpip/wolfmqtt_client/firmware/mqtt_client.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** No rule to make target '../src/system_config/default/framework/net/pres/net_pres_enc_glue.c', needed by 'build/default/production/_ext/1278673032/net_pres_enc_glue.o'.  Stop.
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 843ms)


Please let me know what went wrong.

Share

Re: [SOLVED] WolfMQTT with MPLab Harmony - How to guide?

Hi zoomto.jitendra,

The net_pres_enc_glue.c is a generated file from the Harmony tool. Under the networking section you will find a net presentation checkbox.

The wolfmqtt_client example demonstrates your basic MQTT client features such as connect, subscribe and publish. The `wolfmqtt_firmware` project demonstrates using MQTT for a firmware update example.

Thanks,
David Garske, wolfSSL

Share

Re: [SOLVED] WolfMQTT with MPLab Harmony - How to guide?

Hi dgarske

I'm still getting errors. I guess there is an issue in BSP. I tried to compare the example projects directory tree of "mqtt_client"and "wolf_tcp_client"given under harmony. I'm attaching those files. Below is the project loading error which I'm getting in the IDE initially. Of course, there are other errors too. But, I believe they will be fixed if system_config directory is properly aligned which deals with BSP and framework under it. Please let me know what is the BSP you have chosen for successful building.

I believe example projects should never give build errors. Why is it so happening. Later on I need to implement this MQTT on PIC32MX370F512H custom target board communicating with wifi chip MRF24WN0MB as mentioned earlier. But I'm struck at running example projects itself.

Please help me in this regards.


project loading error:
=============
warning: Configuration "default" builds with "XC32", but indicates no toolchain directory.
info: Configuration "default" will build with toolchain "XC32" at "C:\Program Files (x86)\Microchip\xc32\v1.44\bin".
warning: Configuration "default" refers to file "C:\microchip\harmony\v2_05_01\apps\wolfmqtt_client\firmware\src\system_config\default\framework\net\pres\net_pres_enc_glue.h" which does not exist in the disk. The make process might not build correctly.
warning: Configuration "default" refers to file "C:\microchip\harmony\v2_05_01\apps\wolfmqtt_client\firmware\src\system_config\default\framework\system\clk\sys_clk_static.h" which does not exist in the disk. The make process might not build correctly.
warning: Configuration "default" refers to file "C:\microchip\harmony\v2_05_01\apps\wolfmqtt_client\firmware\src\system_config\default\config.h" which does not exist in the disk. The make process might not build correctly.
warning: Configuration "default" refers to file "C:\microchip\harmony\v2_05_01\apps\wolfmqtt_client\firmware\src\system_config\default\system_config.h" which does not exist in the disk. The make process might not build correctly.
warning: Configuration "default" refers to file "C:\microchip\harmony\v2_05_01\apps\wolfmqtt_client\firmware\src\system_config\default\system_definitions.h" which does not exist in the disk. The make process might not build correctly.
warning: Configuration "default" refers to file "C:\microchip\harmony\bsp\pic32mx_eth_sk2\bsp_config.h" which does not exist in the disk. The make process might not build correctly.

Thanks & Regards
Jitendra

Post's attachments

wolf_tcp_client.PNG
wolf_tcp_client.PNG 16.99 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Share

Re: [SOLVED] WolfMQTT with MPLab Harmony - How to guide?

Other file could not be attached earlier. I'm attaching it here.

Post's attachments

mqtt_client.PNG
mqtt_client.PNG 19.79 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Share

Re: [SOLVED] WolfMQTT with MPLab Harmony - How to guide?

@smitthhyy and @zoomto.jitendra - did either of you figure out a solution to your compile failures with wolfMQTT and MPLAB Harmony? I'm having some very similar issues and I'd like to throw my hat in the ring with you two to figure this out and get a solution posted once and for all!

@dgarske - thank you for all of the awesome work you've done with wolfMQTT to date! You may have some insight on my problem...

Setup:

I developed a hardware device that was originally based on the IoT Ethernet Kit (DM990004) by Microchip. The kit came with example firmware for MPLAB Harmony which used wolfMQTT v0.6. This was before wolfMQTT was officially integrated with MPLAB Harmony.

I'm currently making some firmware updates to my product and I wanted to update my MPLAB Harmony Project to:

1.) take advantage of the fact that wolfMQTT is now integrated into MPLAB Harmony and
2.) utilize the latest version of wolfMQTT (v1.2)

I created a new MPLAB Harmony Project, imported my previous MPLAB Harmony Configurator (.mhc) file,  added my selection for wolfMQTT from the MHC list (now that it's integrated), and clicked 'Generate Code.'

Next I downloaded the latest version of wolfMQTT (v1.2) and followed these instructions to be sure this updated version was added to my Project.

Finally, I copied my application specific source files from my old Project to the new Project. I also had to replace a few Harmony generated files with versions from my original project that were slightly modified by //DCG (David Garske, I suspect):

- net_pres_enc_glue.c
- net_pres_cert_store.c
- system_interrupt.c

Problem:

When I attempted to compile this new Project, it failed with errors that are similar to what @smithhyy described - results that look like #include errors but they don't make sense because it seems like all of the appropriate #include statements are where they belong for the wolfMQTT files (see attachment).

For example, mqtt_socket.h seems to not understand what word16 means, but word16 is defined in mqtt_types.h and mqtt_types.h is #included at the top of mqtt_socket.h - so it should have access to that information.

New Information:

On my PC, the wolfMQTT folder is located here:

C:\microchip\harmony\v2_06\third_party\tcpip\wolfMQTT

Just for kicks, I closed MPLAB, then replaced the contents of this folder (currently containing the v1.2 files) with the v0.6 files. I reopened MPLAB and compiled the Project again -  success! So the Project is setup fine, but there's something about the differences in the wolfMQTT files between v0.6 and v1.2 that's causing the compile errors.

I started repeating this process to step through the wolfMQTT versions to see where the compile errors start:

- v0.6: compiled
- v0.8: compiled
- v0.9: failed
- v0.10: failed (version currently included in Harmony v2.06)
[did not test the versions between here]
- v1.2: failed

wolfMQTT v0.9 is the first version that "Added Microchip Harmony support" and it's the first version that breaks my project on compile. So the first version of wolfMQTT that is setup for Harmony integration doesn't work with my Project/code that was written prior to integration.

I know @dgarske said he tested one of the later versions of wolfMQTT with Harmony v2.05 and did not get the errors that @smittthhyy saw. I'm wondering if there's something else related to the IDE or Project that might be causing this for some of us, but not for David?

Post's attachments

wolfmqtt-compile-errors1.png
wolfmqtt-compile-errors1.png 83.29 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Share

11 (edited by Kaleb J. Himes 2019-07-15 14:48:08)

Re: [SOLVED] WolfMQTT with MPLab Harmony - How to guide?

SOLVED!

David Garske helped me out and tracked down the issue that was preventing my project from compiling with wolfMQTT v0.9 or above:

I was able to reproduce the issue and tracked it down to a circular include issue where mqtt_types.h was including system_definitions.h, which included app.h, which included mqtt_client.h. Without the remainder of mqtt_types.h defined it was causing the errors. With the patch below I am able to build your project.

David provided a patch to wolfMQTT v1.2 that is now merged and can be seen here:

https://github.com/wolfSSL/wolfMQTT/pull/98/files

Share