Skip to content

Commit

Permalink
Added Microchip Harmony wolfMQTT support (#11)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dgarske committed Aug 22, 2016
1 parent 5183fc1 commit df6337a
Show file tree
Hide file tree
Showing 55 changed files with 8,010 additions and 1,781 deletions.
7 changes: 7 additions & 0 deletions IDE/ARDUINO/include.am
@@ -0,0 +1,7 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root

EXTRA_DIST+= IDE/ARDUINO/README.md
EXTRA_DIST+= IDE/ARDUINO/wolfmqtt-arduino.sh
EXTRA_DIST+= IDE/ARDUINO/wolfmqtt_client.ino
36 changes: 36 additions & 0 deletions IDE/Microchip-Harmony/README.md
@@ -0,0 +1,36 @@
# Microchip Harmony wolfMQTT client library and examples

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:

* Library located in `third_party/tcpip/wolfmqtt`
* Application examples located in `apps/tcpip/wolfmqtt_client` and `apps/tcpip/wolfmqtt_firmware`

## Using Examples

* Open the example project in your microchip harmony folder under `apps/tcpip/wolfmqtt_client/firmware` or `apps/tcpip/wolfmqtt_firmware/firmware`.
* Set project as main project (Right-click on project and choose "Set as Main Project"
* Goto Tools -> Embedded -> MPLab Harmony Configurator
* Open the default system config.
* Configure your BSP and Ethernet MAC driver.
* Click "Save" button and then "Generate Code" button.

## Setting up Harmony
### To add this library to Harmony

* Copy the entire libraries `wolfmqtt` directory into `third_party/tcpip`.
* Copy `wolfmqtt.hconfig` into `third_party/tcpip/config`.
* Add the `wolfmqtt.hconfig` include into `tcpip.hconfig`
* Add the following lines into `wolfssl.h.ftl`:

```
<#if CONFIG_USE_3RDPARTY_WOLFMQTT>
#define WOLFMQTT_NONBLOCK
<#if CONFIG_WOLFMQTT_USE_TLS>
#define ENABLE_MQTT_TLS
</#if>
</#if>
```

### Adding example apps to Harmony
* Copy the `wolfmqtt_client` and `wolfmqtt_firmware` directories to `apps/tcpip`
24 changes: 24 additions & 0 deletions IDE/Microchip-Harmony/include.am
@@ -0,0 +1,24 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root

EXTRA_DIST+= IDE/Microchip-Harmony/README.md
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt.hconfig

EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/mqtt_client.hconfig
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/mqtt_client.X/Makefile
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/mqtt_client.X/nbproject/configurations.xml
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/mqtt_client.X/nbproject/project.xml
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/src/app.c
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/src/app.h
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/src/main.c
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_client/firmware/src/system_config/default/default.mhc

EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/mqtt_firmware.hconfig
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/mqtt_firmware.X/Makefile
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/mqtt_firmware.X/nbproject/configurations.xml
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/mqtt_firmware.X/nbproject/project.xml
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/src/app.c
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/src/app.h
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/src/main.c
EXTRA_DIST+= IDE/Microchip-Harmony/wolfmqtt_firmware/firmware/src/system_config/default/default.mhc
55 changes: 55 additions & 0 deletions IDE/Microchip-Harmony/wolfmqtt.hconfig
@@ -0,0 +1,55 @@
menu "wolfMQTT"
---help---
<p><strong>Use wolfMQTT?</strong></p>
<div>
&nbsp;</div>
<p>Refer to the <A HREF="https://wolfmqtt.com/wolfMQTT/Docs-wolfmqtt-manual.html">online documentation.</A></p>
---endhelp---

config USE_3RDPARTY_WOLFMQTT_NEEDED
bool

config USE_3RDPARTY_WOLFMQTT
bool "Use wolfMQTT"
default n if !USE_3RDPARTY_WOLFMQTT_NEEDED
default y if USE_3RDPARTY_WOLFMQTT_NEEDED
---help---
<p><strong>Use wolfMQTT?</strong></p>
<div>
&nbsp;</div>
<p>Refer to the <A HREF="https://wolfmqtt.com/wolfMQTT/Docs-wolfmqtt-manual.html">online documentation.</A></p>
---endhelp---


config WOLFMQTT_USE_TLS
bool "Use TLS?"
depends on USE_3RDPARTY_WOLFMQTT
depends on USE_3RDPARTY_WOLFSSL
select TCPIP_USE_SNTP_CLIENT_NEEDED
select USE_CRYPTO_LIB_NEEDED
select USE_CRYPTO_RSA_NEEDED
default y
---help---
<p><strong>TLS Support</strong></p>
Turns on TLS.
---endhelp---


ifblock USE_3RDPARTY_WOLFMQTT
compiler WOLFMQTT_COMPILER_1 C define "HAVE_CONFIG_H"
compiler WOLFMQTT_COMPILER_2 C includepath "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt"
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"
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"
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"
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"
file WOLFMQTT_HEADER_05 "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt/wolfmqtt/version.h" to "$PROJECT_HEADER_FILES/third_party/tcpip/wolfmqtt/version.h"
file WOLFMQTT_HEADER_06 "$HARMONY_VERSION_PATH/third_party/tcpip/wolfmqtt/wolfmqtt/visibility.h" to "$PROJECT_HEADER_FILES/third_party/tcpip/wolfmqtt/visibility.h"

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"
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"
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"

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"
endif

endmenu

0 comments on commit df6337a

Please sign in to comment.