AWS IoT instead of AirVantage


#1

Has anyone played with the Red to connect to AWS IoT instead of the AirVantage platform? Google was of no great help! Would love to see a tutorial for doing this. Any pointers welcome.

Thanks in advance


#2

We use the Mangoh Red and have an option to connect to AWS IoT using certificates as they specify. We started with WolfSSL and created our own variant of MQTT based off the Paho async clients. Our solution is the result of many months of work and was not a simple exercise, but we have what I believe is one of the most stable and best performing solutions out there. We also have created a second security solution that uses the SIM card to generate TLS security credentials. That is our real product. Our solution is really a reference solution that we’ve created for the automotive market and it includes a complete set of options including very low power operation, secure software update and our patent pending “quick connect” solution. We can connect to an idle device in under 3 seconds without an active data session and without SMS messages.


#3

Hi Thanks for the pointers. I had a look at the WolfSSL and there is a WolfMQTT. Wonder why you created your own variant and not use the WolfMQTT? There is also an example of AWS IOT. Did that work for you? Curious to learn more about your experiences


#4

Hi,

You might also want to check this out as it uses AWS.

https://developer.qualcomm.com/project/mangoh-red-smart-home

Regards

Matt


#5

I am trying to use the AWS IoT SDK as an external build and linking into my app. I know if I build the SDK natively and run the sample test files it is working. But when I bring it into the Legato component I am getting build errors. If anyone can help me unlock would appreciate it

mkapp -v -t wp85
linuxApp.adef
C compiler = /opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
C++ compiler =/opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
Compiler sysroot = /opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi
Linker = /opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-ld
Static lib archiver = /opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-ar
Assembler = /opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-as
Debug symbol stripper = /opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-strip
Object file copier/translator = /opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-objcopy
ELF file info extractor = /opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-readelf
Command-line arguments from previous run not found.
Parsing file: ‘/home/mangoh/mangOH/apps/linuxApp/linuxApp.adef’.
Modelling application: 'linuxApp’
defined in ‘/home/mangoh/mangOH/apps/linuxApp/linuxApp.adef’
Parsing file: ‘/home/mangoh/mangOH/apps/linuxApp/aws/Component.cdef’.
Modelling component: ‘aws’
found at: ‘/home/mangoh/mangOH/apps/linuxApp/aws’
== ‘aws’ component summary ==
Includes files from the build host:
’/home/mangoh/mangOH/apps/AWSIoTSDK/awsIot/samples/linux/subscribe_publish_sample/subscribe_publish_sample’:
appearing inside app as: '/usr/bin’
permissions: execute
Application ‘linuxApp’ contains component ‘aws’ (/home/mangoh/mangOH/apps/linuxApp/aws).
Application ‘linuxApp’ contains executable ‘linuxApp’.
Parsing file: ‘/home/mangoh/mangOH/apps/linuxApp/linuxAppComp/Component.cdef’.
Modelling component: 'linuxAppComp’
found at: ‘/home/mangoh/mangOH/apps/linuxApp/linuxAppComp’
Parsing file: ‘/home/mangoh/mangOH/apps/AWSIoTSDK/awsIot/samples/linux/subscribe_publish_sample/Component.cdef’.
Modelling component: ‘subscribe_publish_sample’
found at: ‘/home/mangoh/mangOH/apps/AWSIoTSDK/awsIot/samples/linux/subscribe_publish_sample’
== ‘subscribe_publish_sample’ component summary ==
Includes files from the build host:
’/home/mangoh/mangOH/apps/AWSIoTSDK/awsIot/samples/linux/subscribe_publish_sample/subscribe_publish_sample’:
appearing inside app as: ‘/usr/bin’
permissions: execute
== ‘linuxAppComp’ component summary ==
C sources:
’/home/mangoh/mangOH/apps/linuxApp/linuxAppComp/linuxAppComp.c’
Depends on components:
'subscribe_publish_sample’
Executable ‘linuxApp’ in application ‘linuxApp’ contains component ‘linuxAppComp’ (/home/mangoh/mangOH/apps/linuxApp/linuxAppComp).

== ‘linuxApp’ application summary ==

Uses components:
‘aws’
‘linuxAppComp’
'subscribe_publish_sample’
Builds executables:
'linuxApp’
Instantiates components:
‘subscribe_publish_sample’
'linuxAppComp’
Runs inside a sandbox.
Has the following limits:
maxSecureStorageBytes: 8192
maxThreads: 20
maxMQueueBytes: 512
maxQueuedSignals: 100
maxMemoryBytes: 40960000
cpuShare: 1024
maxFileSystemBytes: 131072
Has access to the following configuration trees:
Its own tree: read + write
Will only start when requested to start.
When started, will run process: 'linuxApp’
Executing file: 'linuxApp’
Without any command line arguments.
With the following environment variables:
PATH=/usr/local/bin:/usr/bin:/bin
Fault recovery action: ignore (default)
Watchdog timeout: disabled
With the following limits:
Max. core dump file size: 102400 bytes
Max. file size: 102400 bytes
Max. locked memory size: 8192 bytes
Max. number of file descriptors: 256
Executable ‘linuxApp’:

Generating interfaces.h for component ‘linuxAppComp’ in ‘_build_linuxApp/wp85/component/89207388a079506e6139546b7bd788c8/src/interfaces.h’.
Generating component-specific IPC code for component ‘linuxAppComp’ in ‘_build_linuxApp/wp85/component/89207388a079506e6139546b7bd788c8/src/_componentMain.c’.
Generating system configuration data for app ‘linuxApp’ in file ‘_build_linuxApp/wp85/app/linuxApp/staging/root.cfg’.
Generating startup code for executable ‘linuxApp’ (app/linuxApp/staging/read-only/bin/linuxApp) in ‘_build_linuxApp/wp85/app/linuxApp/src/linuxApp/_main.c’.
Generating ninja build script: ‘_build_linuxApp/wp85/build.ninja’.
Executing ninja build system…
$ ninja -v -d explain -f _build_linuxApp/wp85/build.ninja
ninja: warning: multiple rules generate /home/mangoh/mangOH/apps/AWSIoTSDK/awsIot/samples/linux/subscribe_publish_sample/subscribe_publish_sample. builds involving this target will not be correct; continuing anyway
ninja explain: output awsExternalBuild_line0 doesn’t exist
ninja explain: awsExternalBuild_line0 is dirty
ninja explain: depfile ‘_build_linuxApp/wp85/component/89207388a079506e6139546b7bd788c8/obj/ae347cb872d52c8c76f8c392dba5558c.o.d’ is missing
ninja explain: output subscribe_publish_sampleExternalBuild_line0 doesn’t exist
ninja explain: subscribe_publish_sampleExternalBuild_line0 is dirty
ninja explain: subscribe_publish_sampleExternalBuild is dirty
ninja explain: _build_linuxApp/wp85/component/89207388a079506e6139546b7bd788c8/obj/ae347cb872d52c8c76f8c392dba5558c.o is dirty
ninja explain: depfile ‘_build_linuxApp/wp85/component/89207388a079506e6139546b7bd788c8/obj/_componentMain.c.o.d’ is missing
ninja explain: _build_linuxApp/wp85/component/89207388a079506e6139546b7bd788c8/obj/_componentMain.c.o is dirty
ninja explain: subscribe_publish_sampleExternalBuild is dirty
ninja explain: subscribe_publish_sampleExternalBuild is dirty
ninja explain: _build_linuxApp/wp85/staging/read-only/lib/libComponent_linuxAppComp.so is dirty
ninja explain: _build_linuxApp/wp85/app/linuxApp/staging/read-only/lib/libComponent_linuxAppComp.so is dirty
ninja explain: /home/mangoh/mangOH/apps/AWSIoTSDK/awsIot/samples/linux/subscribe_publish_sample/subscribe_publish_sample is dirty
ninja explain: _build_linuxApp/wp85/app/linuxApp/staging/read-only/usr/bin is dirty
ninja explain: depfile ‘_build_linuxApp/wp85/app/linuxApp/obj/linuxApp/_main.c.o.d’ is missing
ninja explain: _build_linuxApp/wp85/app/linuxApp/obj/linuxApp/_main.c.o is dirty
ninja explain: _build_linuxApp/wp85/staging/read-only/lib/libComponent_linuxAppComp.so is dirty
ninja explain: _build_linuxApp/wp85/app/linuxApp/staging/read-only/bin/linuxApp is dirty
ninja explain: _build_linuxApp/wp85/app/linuxApp/staging/info.properties is dirty
[1/11] cd ./_build_linuxApp/wp85/component/82a06889c6b3cf01d0a01301c07f2c57; env CFLAGS="–sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -I ./_build_linuxApp/wp85 -I/home/mangoh/legato_framework/legato/interfaces -I/home/mangoh/legato_framework/legato/framework/c/inc -I/home/mangoh/mangOH/apps/linuxApp" CXXFLAGS="–sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -I ./_build_linuxApp/wp85 -I/home/mangoh/legato_framework/legato/interfaces -I/home/mangoh/legato_framework/legato/framework/c/inc -I/home/mangoh/mangOH/apps/linuxApp" LDFLAGS="–sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi " PATH="/opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$PATH" sh -c ‘make’
[2/11] /opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -MMD -MF _build_linuxApp/wp85/component/89207388a079506e6139546b7bd788c8/obj/_componentMain.c.o.d -c _build_linuxApp/wp85/component/89207388a079506e6139546b7bd788c8/src/_componentMain.c -o _build_linuxApp/wp85/component/89207388a079506e6139546b7bd788c8/obj/_componentMain.c.o -DLE_FILENAME=basename _build_linuxApp/wp85/component/89207388a079506e6139546b7bd788c8/src/_componentMain.c -Wall -fPIC -Werror -fvisibility=hidden -DMK_TOOLS_BUILD -DLEGATO_EMBEDDED -I ./_build_linuxApp/wp85 -I/home/mangoh/legato_framework/legato/interfaces -I/home/mangoh/legato_framework/legato/framework/c/inc -I/home/mangoh/mangOH/apps/linuxApp -I./_build_linuxApp/wp85/component/89207388a079506e6139546b7bd788c8/src -I/home/mangoh/mangOH/apps/AWSIoTSDK/awsIot/samples/linux/subscribe_publish_sample -I./_build_linuxApp/wp85/component/7b588f83d063b84d1da636a389259450 -DLE_COMPONENT_NAME=linuxAppComp -DLE_LOG_SESSION=linuxAppComp_LogSession -DLE_LOG_LEVEL_FILTER_PTR=linuxAppComp_LogLevelFilterPtr “-DCOMPONENT_INIT=LE_CI_LINKAGE LE_SHARED void _linuxAppComp_COMPONENT_INIT()”
[3/11] cd ./_build_linuxApp/wp85/component/7b588f83d063b84d1da636a389259450; env CFLAGS="–sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -I ./_build_linuxApp/wp85 -I/home/mangoh/legato_framework/legato/interfaces -I/home/mangoh/legato_framework/legato/framework/c/inc -I/home/mangoh/mangOH/apps/linuxApp" CXXFLAGS="–sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -I ./_build_linuxApp/wp85 -I/home/mangoh/legato_framework/legato/interfaces -I/home/mangoh/legato_framework/legato/framework/c/inc -I/home/mangoh/mangOH/apps/linuxApp" LDFLAGS="–sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi " PATH="/opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$PATH" sh -c 'make’
FAILED: cd ./_build_linuxApp/wp85/component/7b588f83d063b84d1da636a389259450; env CFLAGS="–sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -I ./_build_linuxApp/wp85 -I/home/mangoh/legato_framework/legato/interfaces -I/home/mangoh/legato_framework/legato/framework/c/inc -I/home/mangoh/mangOH/apps/linuxApp" CXXFLAGS="–sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -I ./_build_linuxApp/wp85 -I/home/mangoh/legato_framework/legato/interfaces -I/home/mangoh/legato_framework/legato/framework/c/inc -I/home/mangoh/mangOH/apps/linuxApp" LDFLAGS="–sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi " PATH="/opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$PATH" sh -c 'make’
make[1]: Entering directory '/home/mangoh/mangOH/apps/linuxApp/_build_linuxApp/wp85/component/7b588f83d063b84d1da636a389259450’
make[1]: *** No targets specified and no makefile found. Stop.
make[1]: Leaving directory '/home/mangoh/mangOH/apps/linuxApp/_build_linuxApp/wp85/component/7b588f83d063b84d1da636a389259450’
FAILED: cd ./_build_linuxApp/wp85/component/82a06889c6b3cf01d0a01301c07f2c57; env CFLAGS="–sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -I ./_build_linuxApp/wp85 -I/home/mangoh/legato_framework/legato/interfaces -I/home/mangoh/legato_framework/legato/framework/c/inc -I/home/mangoh/mangOH/apps/linuxApp" CXXFLAGS="–sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -I ./_build_linuxApp/wp85 -I/home/mangoh/legato_framework/legato/interfaces -I/home/mangoh/legato_framework/legato/framework/c/inc -I/home/mangoh/mangOH/apps/linuxApp" LDFLAGS="–sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi " PATH="/opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$PATH" sh -c 'make’
make[1]: Entering directory '/home/mangoh/mangOH/apps/linuxApp/_build_linuxApp/wp85/component/82a06889c6b3cf01d0a01301c07f2c57’
make[1]: *** No targets specified and no makefile found. Stop.
make[1]: Leaving directory '/home/mangoh/mangOH/apps/linuxApp/_build_linuxApp/wp85/component/82a06889c6b3cf01d0a01301c07f2c57’
ninja: build stopped: subcommand failed.
Makefile:7: recipe for target ‘wp85’ failed
make: *** [wp85] Error 1


#6

I’m not sure what the problem is. Can you provide the source code for the project you are trying to build? If you can do that, then I will try to build it myself and try to work through any errors.


#7

Hello David

Its not the same error any more, but I am still getting errors. Also I’m not sure if I am using the DataServices call le_data correctly. Happy to receive your input. The file is attached
ThanksMo

RedToAWS.zip (857 KB)


#8

I have made some progress and now able to load the software on the board but coming across with some stability issues.

So seeing a number of issues here.

First I packaged the application within the system build. When I installed the Red system package, my app didn’t show up with “app status”. Also when I make clean the files don’t get removed. I’m guessing may be a sdef configuration issue.

Second, When I didn’t see any activity on the log from the app, I then attempted to update the app, but the software informs me that this is already installed and won’t do anything more.

Third, I am attempting to load by the App certain certificate files. On my development environment this is easily detected, but when I try to replicate the same structure, it doesn’t work. So I then try to specify a location on the target and it appears that application doesn’t find these files.

Fourth I can see that the application doesn’t like my attempt to establish a data connection. I’m at a loss as to why and I can’t get to the AWS servers.

Lastly I haven’t been able to trace why the application is closed down.

Any suggestions on how to move forward would be most appreciated as I have exhausted all thoughts

If this is a tools/versions mismatch issue please help with links to matching software versions as I have spent the best part of 2 days trying combinations to get past various uid mismatch errors

I have highlighted the concerning areas on the attached log file.
Log dump 1812.pdf (267.4 KB)


#9

OK I have progressed now and able to subscribe and publish but at some expense. I wanted to sandbox the application so that it has access to whatever data connection that already exist. For whatever reason the application doesn’t like being sandboxed and doesn’t show up on the app list. My other problem is that the app wont auto start. The app also doesn’t like being a standalone App. That is it won’t start a data connection which is still puzzling me. Perhaps its because its a legacy App and not a Legato App, but I do get connectivity if I have another Legato App not sandboxed started before the legacy App. It means I have to manually start both apps now. Any suggestions to automate the process and also work inside the sandbox is welcome.


#10

Hi @mohamid, can you publish a tutorial/wiki page so others can follow what you did? Other members who are interested might be able to provide more insights as well.


#11

Hello chucklink,

I would like to know if you can share with me the code of the connectivity for the MangOH RED with the AWS IOT.

Thank you