Skip to content

Commit df6337a

Browse files
authored
Added Microchip Harmony wolfMQTT support (#11)
Added Microchip Harmony wolfMQTT support (see new README.me in IDE/Microchip-Harmony). Adds non-blocking mode "--enable-nonblock" or "WOLFMQTT_NONBLOCK". Combine duplicate code in the examples into examples/mqttexample.c. Added scripts/azureiothub.test. Added ./commit-tests.sh for testing all configurations. Added git pre-commit hook to run commit-tests.sh.
1 parent 5183fc1 commit df6337a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+8010
-1781
lines changed

IDE/ARDUINO/include.am

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# vim:ft=automake
2+
# included from Top Level Makefile.am
3+
# All paths should be given relative to the root
4+
5+
EXTRA_DIST+= IDE/ARDUINO/README.md
6+
EXTRA_DIST+= IDE/ARDUINO/wolfmqtt-arduino.sh
7+
EXTRA_DIST+= IDE/ARDUINO/wolfmqtt_client.ino

IDE/Microchip-Harmony/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Microchip Harmony wolfMQTT client library and examples
2+
3+
This example IDE project is meant to be used from inside the Microchip Harmony directory. The configuration.xml files uses relative paths based on the following:
4+
5+
* Library located in `third_party/tcpip/wolfmqtt`
6+
* Application examples located in `apps/tcpip/wolfmqtt_client` and `apps/tcpip/wolfmqtt_firmware`
7+
8+
## Using Examples
9+
10+
* Open the example project in your microchip harmony folder under `apps/tcpip/wolfmqtt_client/firmware` or `apps/tcpip/wolfmqtt_firmware/firmware`.
11+
* Set project as main project (Right-click on project and choose "Set as Main Project"
12+
* Goto Tools -> Embedded -> MPLab Harmony Configurator
13+
* Open the default system config.
14+
* Configure your BSP and Ethernet MAC driver.
15+
* Click "Save" button and then "Generate Code" button.
16+
17+
## Setting up Harmony
18+
### To add this library to Harmony
19+
20+
* Copy the entire libraries `wolfmqtt` directory into `third_party/tcpip`.
21+
* Copy `wolfmqtt.hconfig` into `third_party/tcpip/config`.
22+
* Add the `wolfmqtt.hconfig` include into `tcpip.hconfig`
23+
* Add the following lines into `wolfssl.h.ftl`:
24+
25+
```
26+
<#if CONFIG_USE_3RDPARTY_WOLFMQTT>
27+
#define WOLFMQTT_NONBLOCK
28+
29+
<#if CONFIG_WOLFMQTT_USE_TLS>
30+
#define ENABLE_MQTT_TLS
31+
</#if>
32+
</#if>
33+
```
34+
35+
### Adding example apps to Harmony
36+
* Copy the `wolfmqtt_client` and `wolfmqtt_firmware` directories to `apps/tcpip`

IDE/Microchip-Harmony/include.am

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# vim:ft=automake
2+
# included from Top Level Makefile.am
3+
# All paths should be given relative to the root
4+
5+
EXTRA_DIST+= IDE/Microchip-Harmony/README.md
6+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt.hconfig
7+
8+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/mqtt_client.hconfig
9+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/mqtt_client.X/Makefile
10+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/mqtt_client.X/nbproject/configurations.xml
11+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/mqtt_client.X/nbproject/project.xml
12+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/src/app.c
13+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/src/app.h
14+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/src/main.c
15+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/src/system_config/default/default.mhc
16+
17+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/mqtt_firmware.hconfig
18+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/mqtt_firmware.X/Makefile
19+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/mqtt_firmware.X/nbproject/configurations.xml
20+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/mqtt_firmware.X/nbproject/project.xml
21+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/src/app.c
22+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/src/app.h
23+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/src/main.c
24+
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/src/system_config/default/default.mhc
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
menu "wolfMQTT"
2+
---help---
3+
<p><strong>Use wolfMQTT?</strong></p>
4+
<div>
5+
&nbsp;</div>
6+
<p>Refer to the <A HREF="https://wolfmqtt.com/wolfMQTT/Docs-wolfmqtt-manual.html">online documentation.</A></p>
7+
---endhelp---
8+
9+
config USE_3RDPARTY_WOLFMQTT_NEEDED
10+
bool
11+
12+
config USE_3RDPARTY_WOLFMQTT
13+
bool "Use wolfMQTT"
14+
default n if !USE_3RDPARTY_WOLFMQTT_NEEDED
15+
default y if USE_3RDPARTY_WOLFMQTT_NEEDED
16+
---help---
17+
<p><strong>Use wolfMQTT?</strong></p>
18+
<div>
19+
&nbsp;</div>
20+
<p>Refer to the <A HREF="https://wolfmqtt.com/wolfMQTT/Docs-wolfmqtt-manual.html">online documentation.</A></p>
21+
---endhelp---
22+
23+
24+
config WOLFMQTT_USE_TLS
25+
bool "Use TLS?"
26+
depends on USE_3RDPARTY_WOLFMQTT
27+
depends on USE_3RDPARTY_WOLFSSL
28+
select TCPIP_USE_SNTP_CLIENT_NEEDED
29+
select USE_CRYPTO_LIB_NEEDED
30+
select USE_CRYPTO_RSA_NEEDED
31+
default y
32+
---help---
33+
<p><strong>TLS Support</strong></p>
34+
Turns on TLS.
35+
---endhelp---
36+
37+
38+
ifblock USE_3RDPARTY_WOLFMQTT
39+
compiler WOLFMQTT_COMPILER_1 C define "HAVE_CONFIG_H"
40+
compiler WOLFMQTT_COMPILER_2 C includepath "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt"
41+
file WOLFMQTT_HEADER_01 "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_types.h" to "$PROJECT_HEADER_FILES/third_party/tcpip/wolfmqtt/mqtt_types.h"
42+
file WOLFMQTT_HEADER_02 "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_socket.h" to "$PROJECT_HEADER_FILES/third_party/tcpip/wolfmqtt/mqtt_socket.h"
43+
file WOLFMQTT_HEADER_03 "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_packet.h" to "$PROJECT_HEADER_FILES/third_party/tcpip/wolfmqtt/mqtt_packet.h"
44+
file WOLFMQTT_HEADER_04 "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt/wolfmqtt/mqtt_client.h" to "$PROJECT_HEADER_FILES/third_party/tcpip/wolfmqtt/mqtt_client.h"
45+
file WOLFMQTT_HEADER_05 "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt/wolfmqtt/version.h" to "$PROJECT_HEADER_FILES/third_party/tcpip/wolfmqtt/version.h"
46+
file WOLFMQTT_HEADER_06 "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt/wolfmqtt/visibility.h" to "$PROJECT_HEADER_FILES/third_party/tcpip/wolfmqtt/visibility.h"
47+
48+
file WOLFMQTT_SOURCE_01 "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt/src/mqtt_client.c" to "$PROJECT_SOURCE_FILES/third_party/tcpip/wolfmqtt/mqtt_client.c"
49+
file WOLFMQTT_SOURCE_02 "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt/src/mqtt_packet.c" to "$PROJECT_SOURCE_FILES/third_party/tcpip/wolfmqtt/mqtt_packet.c"
50+
file WOLFMQTT_SOURCE_03 "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt/src/mqtt_socket.c" to "$PROJECT_SOURCE_FILES/third_party/tcpip/wolfmqtt/mqtt_socket.c"
51+
52+
template WOLFMQTT_CONFIG_H_TEMPLATE "$HARMONY_VERSION_PATH/third_party/tcpip/config/wolfssl.h.ftl" to "$PROJECT_HEADER_FILES/app/system_config/$CONFIGURATION/config.h"
53+
endif
54+
55+
endmenu

0 commit comments

Comments
 (0)