AWS FreeRTOS / with/with IP and Microchip Harmony
Hello, I’m hoping that someone can provide me with a little bit of advise on the best way to progress.
I have been using FreeRTOS on PIC32, which is bundled into Microchips Harmony Configuraiton engine. Its worked well for me once i got through the various hoops and learning. I’d now like to use some of the AWS FreeRTOS librarys ( MQQT and OTA ). When i looked at it,the project I discovered that they essnetially had been hand built ( at least the configuration ) for a specific platform. ( in my case the PIC32 Curosity board ).
I have been able to upgrade FreeRTOS from version 9 to 10, and use it with Harmony no problme. ( i used the librarys from the AWS git repo ).
I need/want to be able to take another PIC32 and differnet hardware and configure it ( ideally using harmony ), but the MQTT librarys require FreeRTOS + IP. Harmony of course does not know about how to deal with the freeRTOS stack.
So, my choice is moving away from the Harmony IP stack ( and harmony ), which means loosing the ability to very quickly add / remove new perhials.. ( and also somethign we know very well ), to be able to use the MQTT library. ( but we would possibly loose some features in the microchip IP stack ).. Or I need to be able to figure out if i can modify the MQTT librarys to work with the Microchip Stack.
I hope that my post made some sence.
AWS FreeRTOS / with/with IP and Microchip Harmony
The MQTT implementation includes an MQTT client library suitable for use
in bare metal applications, and an MQTT agent for FreeRTOS. So you
could integrate just the library, but it will be simpler to create an
application if you could also integrate the agent.
The agent (think daemon task) manages the MQTT library on behalf of the
developer, providing the developer with a simple connect, publish, and
subscribe interface, and unburdening the developer from having to do
anything special to manage the MQTT protocol itself – for example there
is no need to periodically call the MQTT library, the agent does that
transparently in the background for you.
As you point out, the agent has a couple of dependencies. Although the
provided examples use the FreeRTOS+TCP stack, it does so through an
abstraction layer (called the ‘secure sockets’ layer, as it also
abstracts away TLS), so you could provide a port of that abstraction
layer to the Harmony TCP/IP stack if you wanted to continue to use that
stack.
So you could update your project to use the FreeRTOS+TCP stack and the
provided secure sockets abstraction layer for that stack, or you could
update your project by providing your own secure sockets abstraction for
the Harmony stack. Alternatively you could use just the MQTT library
component. Let me know which way you think is best.
AWS FreeRTOS / with/with IP and Microchip Harmony
Thanks Richard, that really helped me get somethings sorted out in my head. In my way of thinking the best way forward ( at least for me ), would be to use Harmony and FreeRTOS 10.x ( which works nicely ). This gives me the best of all the worlds. the ‘cost’ to me is having to port the secure sockets layer. This does seem like the best way to move forward.
AWS FreeRTOS / with/with IP and Microchip Harmony
If you are not using TLS and the Harmony stack has a sockets like
interface then there should be a fairly straight forward mapping to the
secure sockets interface – you can just stub or not implement the TLS part.
These are the components you will need from the Amazon FreeRTOS
libraries – hope the formatting comes out ok:
~~~
Amazon FreeRTOS
|
+-lib
|
+-mqtt
| +-awsmqttlib.c [Required to use library and agent]
| +-awsmqttagent.c [Required to use the MQTT agent]
|
+-include
|
+-private [For internal library use only!]
| +-awsdoublylinkedlist.h
| +-awsmqttagentconfigdefaults.h
| +-awsmqttbuffer.h
| +-awsmqttconfigdefaults.h
| +-awsmqttlibprivate.c
| +-awsmqttconfigdefaults.h
|
+-awsmqttagent.h [Include to use the MQTT agent API]
+-awsmqttlib.h [Include to use the MQTT library API]
~~~
You will also need configuration files that you can pull from the
existing AWS examples:
awsmqttlibconfig.h
awsmqttagentconfig.h
awsbufferpoolconfig.h
awssecuresockets_config.h
AWS FreeRTOS / with/with IP and Microchip Harmony
Just formatted the snippet there so it fits better and realised I missed out that you need the buffer pool library too – which supplies buffers to the MQTT library.
AWS FreeRTOS / with/with IP and Microchip Harmony
Thanks, thats really helpful!
using TLS will be required. Data has to transit the interweb!
AWS FreeRTOS / with/with IP and Microchip Harmony
Which TLS library are you using currently?
AWS FreeRTOS / with/with IP and Microchip Harmony
Not using any Library yet. Was thinking ( perhaps badly ) that i shoudl get it standing up without TLS first?
AWS FreeRTOS / with/with IP and Microchip Harmony
The Amazon examples are using mbedTLS, so you could pick that up too.
AWS FreeRTOS / with/with IP and Microchip Harmony
Thats handy. to know. Licencing is helpful as well. Hope to have the bones of a starting project soon.
AWS FreeRTOS / with/with IP and Microchip Harmony
In your list of files, Should
awsmqttlibconfig.h actually be awsmqtt_config.h ?
I can’t find a awsmqttlibconfig.h anywhere; the awsmqtt_config.h made the most sense to me..
Also, awsmqttlibprivate.c only seems to be related to some unit tests ( which are included if AMAZONFREERTOSENABLEUNIT_TESTS is defined. By adding this file to the project it causes errors ( as it has no includes for the .h file )? Is removing the file seems the best thign to do?
AWS FreeRTOS / with/with IP and Microchip Harmony
Apologies- you are correct on both counts.
AWS FreeRTOS / with/with IP and Microchip Harmony
Progress is being made; albeit a bit slowly.
- I’ve decided to go down this path as I to be sensible, i really need encryption ( TLS ) of the messages. there is a MQTT library ( WolfMQQT ) that is supplied with Harmony, but the moment that you use the Wolf Librarys you are into ‘interesting’ licencing territory that is largely incompatible with what I need/want to do.
AWS FreeRTOS / with/with IP and Microchip Harmony
I have removed awssecuresockets.c from my project, and created harmonysecuresockets.c