Use Azure IoT Plugin for C within Eclipse - c

Very new to C, Eclipse, and basically everything else I am trying to work with in this project. I have an Arduino Feather HUZZAH (ESP8266). I have flashed the firmware with the esp_iot_sdk and installed Eclipse on to machine through the unofficial Espressif Dev Kit in order to write the code for the board.
The code I wrote is working well but now I need to find a way to send the collected data to Azure's IoT Hub. I found this plugin for talking to the Azure IoT Hub but cannot figure out how in the world to get it installed using Eclipse.
Even if someone could show me how to get a simple POST request going in C, using a library or not, that would be awesome! Thanks for your help.

So you want to run azure-iot-sdk on ESP8266 with Tensilica Xtensa LX106 MCU.
The first thing you need to do is to port azure-iot-sdk C library to Xtensa platform, using the Espressif Dev Kit toolchain.
Normally, this is officially done by Microsoft. Unfortunately, Xtensa LX106 might not be on the list(roadmap?) yet.
So I think you can do some porting work yourself, following some tutorials from Microsoft. This link works for Linux host, but given that fact that Xtensa toolchain only supports windows for now, you might end up writing some cmd, bat or generic makefile/cmake file, in which you need to have the cross-compile toolchain(aka xtensa-lx106-elf-gcc) specified.
Hopefully, it's not complicated or cumbersome.
After you have done with this, you need some static or dynamic library assembly depending on your settings, the next step is to specify the library path in your eclipse project, and don't forget to include the azure-iot-sdk header folder to your project, as the snapshot shows.
You should be good to go after the above steps.

Related

Cross-compiling Azure IoT SDK for C

I have successfully managed to cross-compile the C Azure IoT SDK for a target device running embedded Linux. The instructions are here : https://github.com/Azure/azure-iot-sdk-c/blob/master/doc/SDK_cross_compile_example.md
The next step is to get a basic application using the SDK running on the target device.
How would one go about doing this? Where are the generated libraries etc. to copy to the sysroot of the target device.
There seems to be only support for Rasberry Pi and generating a new firmware image.
I would recommend that you use the -DCMAKE_INSTALL_PREFIX=[output path] when you generate your makefiles. Once you have run cmake and make you can then run make install which will copy the generated libraries to the location you chose. You do NOT want to install them into your host's library search path since (presumably) they are built for an incompatible architecture. Having done that the /lib directory will have the libraries that you need to use to build your application. These are static libraries (unless you chose otherwise) so they only need to be linked to your application. They do not need to be on the device. Obviously you will also need to cross compile your application.
There are a couple of things you need to look out for though. Your device will need to have the same version of OpenSSL and curl that you used when you built the SDK. These are dynamic libraries so your application would likely fail at run time if you don't take care of that since there would be a version mismatch.
There is another example of cross-compiling here: https://github.com/Azure/azure-iot-sdk-c/blob/master/doc/Docker_SDK_Cross_Compile.md. This version also builds the prerequisite libraries and has suggestions about how you might also cross compile your application. It uses a Docker container to do this but, even if you don't want to use Docker, it may still help you with your process.

Can you open and edit .c files in the Arduino IDE? And subsequently load them to an Arduino board

I have been trying to open c files in the Arduino IDE (which some people claim is possible).
I have not been able to do so.
How can I program the Arduino in c given that I have a project/files in another IDE? (for example, MPLABX)
I am not sure what you are trying to archive. Is it that you want to open it via the Arduino IDE or also compile the source code?
I am not aware of programming in bare c in the Arduino IDE. But if you're looking into using real c code, it might be a good time start either compiling and uploading via terminal yourself, or use an IDE which is suited for development with micro controllers.
I think you can tell the Arduino IDE to more elaborately log outputs. This would tell you exactly the commands the IDE is using (uses avrdude). Then you can use an IDE/Editor of your choice for coding.
Otherwise, have a look at eg. Atmel Studio. They also support Arduino.
There are two answers in one:
If you really want to use the ArduinoIDE you have to have a basic *.ino file having at least the defines and includes which are in the project file and the reqiured setup() loop() usually whats in main in c goes to loop() in ArduinoIDE. Thats the stoney path because there are some specific issues coming from the philosophy behind ArduinoIDE (help makers with little (no?) programming skills to get started quickly).
If you just need the Arduino tool-chain and want to work more comfortable you have two other options:
EclipseIDE with the Sloeber add-on. Download the Sloeber-AllInOne-Package for an easy start and THEN add the other modules you need (like for web development or similar)
PlatformIO an IDE for micro controller development - there is also a cloud based version for testing around.
All mentioned tools are real open source and available cross PC platform and not a gift from a company like MS for probably later lockin of devs

Where should I put a DLL that is cross-compiled from source?

I really want to use the libpostal library as part of my Java application via the jpostal binding. While I can work around the fact that jpostal uses Gradle instead of Maven, I'm not sure where to proceed after I've cross compiled a libpostal DLL using a Linux machine.
According the answer to this question, the process of installing a DLL on Windows is very convoluted.
If anyone has good idea as to where I can put the DLL so that my Java application using jpostal can find it, please tell me.
P.S: My Java application will run on a CentOS machine in production but for development, testing, and demoing I'm using my laptop and desktop which run Windows. Of course if I can't get libpostal to work on Windows, then I can always go the virtual machine route.

How are C files included in freeSwitch (kind of framework for calls)?

Today I downloaded Freeswitch that (based on what I read) allows me to have a messaging (audio and video calls) server in my computer. I am not very good in programming. When analysing the files contained in its .zip file, I noticed that almost all the files were written in C++.
However based on my knowledge, C files need to be compiled before they can be used (maybe I am wrong). If so, Why C files??
I ask this question because I was building some kind of web messaging app. I implemented text chat, send image, audio, attachment. I did it using simply HTML, JAVASCRIPT, PHP, SQL and a little XML. When it comes to audio call and Video call, I cannot start (because I found it more complex). So I tried to find an easy alternative that took me to freeswitch.
I do not know if it is up to me to compile them or not.
Note: I did not install it.
Thank you!!
FreeSwitch is an open-source software-based PBX written in C. So yes, it needs to be compiled. However, the FreeSwitch website provides precompiled binaries if you just want to use the FreeSwitch software as-is:
https://freeswitch.org/confluence/display/FREESWITCH/Installation
You don't need the source code unless you are planning on modifying it, in which case you will then have to compile it for any changes to take effect.
FreeSwitch is open-source tool written in C. FreeSwitch uses many libraries. So to compile FreeSwitch you have to first install all dependency of FreeSwitch then you have to configure and make, make install the FreeSwitch Source.
I have wrote many custom module in FreeSwitch using C for Callcenter, conference, class4-switch, class5-switch, class4/5 switch.

Building Source Code on Raspberry Pi

This is probably a stupid question, but I have been pouring over forums and google for hours and I can't figure this out.
I recently downloaded the mame4all source repository from here
https://code.google.com/p/mame4all-pi/
and made a few edits to the list of games that are available. Now I am having issues compiling/building the source. In the repository, there is of course the source code (Contained in an src folder). I cannot figure our how to build/install the source code now that I have edited it. In the main folder there is a makefile.rpi file, makefile.gp2x, and makefile.rpi.debug, I feel like there is something that I need to do with these but I am not entirely sure
I am not sure how to build/compile this source code to test the changes, I am on a raspberry pi using Raspbian Wheezy. I feel like I am missing something simple, any help is greatly appreciated!
You need build tools for ARM architecture installed within the Raspbian Wheezy. But compiling in Raspberry Pi is horribly slow and you might want to do it on your PC instead. If you have a Debian on Ubuntu installation on your PC, then get ARM tool chain that can 'cross-compile' from x86 to ARM. I am sure there is a version of GCC out there than can do this. A simple Google search might provide more details regarding that. Once you get the binary compiled, copy it to the raspberry pi either via SFTP or by connecting the SD card to your PC.
http://qt-project.org/wiki/RaspberryPi_Beginners_guide contains a lot of information and links to download tools for this purpose. In fact, Qt creator can automate most of the tasks and you can deploy compiled binary directly to the Pi from Qt creator.

Resources