Hi,
I want to port an existing C/C++ library and develop an own library for use with Arduino C / Wiring. What tools, compiler, ... do I need?
Thanks.
Hi,
I want to port an existing C/C++ library and develop an own library for use with Arduino C / Wiring. What tools, compiler, ... do I need?
Thanks.
Tools? Just use the Arduino IDE.
You will need to supply more details if you run into problems. Post your code, or this will have to be moved to Project Guidance.
Sorry if I posted to the wrong forum. So please move to Project Guidance. The only thing I want is a starting point as how I can "transform" existing C/C++ source libraries and develop new libraries for use in/with Arduino C/Wiring.
I'm not sure what you mean by "transform". The compiler is a C/C++ compiler, so if you add .c or .cpp files to your project they will compile in the usual way.
As to "how to write libraries" there is a link on this site:
If i'm right the link you mention shows standard available Arduino C commands/instructions that are placed in a separate library.
I have a C source code library (that's not part of the standard Arduino C libraries) I can import as a git repo and would like using. Can I do this in the Arduino IDE?
Thanks.
Can I do this in the Arduino IDE?
You can put the library in the libraries folder, and include it in a sketch created using the IDE.
It's time, though, for you to take off the tap dancing shoes and talk about the SPECIFIC library. It may, or may not, be possible to us that library as is on the Arduino, and it may, or may not, be possible to modify it to work on the Arduino.
If it processed jpeg files, does 128 bit encryption, etc. forget it.
Sorry, but what's the problem with asking a more general question? What if I would like developing one or the other library and how I can do this (I don't ask to develop a library I only ask how I can integrate it with the Arduino IDE)? I thought this forum is for all Arduino related questions, if not please tell me! But anyway if you like I would like using the Eclipse Paho MQTT client.
Sorry, but what's the problem with asking a more general question?
Nothing, unless you keep replying "No, no, that's not what I'm asking".
What if I would like developing one or the other library and how I can do this (I don't ask to develop a library I only ask how I can integrate it with the Arduino IDE)?
Nick's link answers that question, and yet you still replied "No, no, that's not what I meant".
I thought this forum is for all Arduino related questions
It is, though sometimes I forget which part of the forum I'm reading. Some parts, like this one, are for more general questions. Others are for more specific questions.
But anyway if you like I would like using the Eclipse Paho MQTT client.
A link would be far more useful.
I never said: "No no etc", but I will not comment further on this.
This is the link: http://www.eclipse.org/paho/clients/c/embedded/
gdillen:
I never said: "No no etc", but I will not comment further on this.This is the link: http://www.eclipse.org/paho/clients/c/embedded/
According to the web page it says "The library can be used on desktop operating systems, but is primarily aimed for environments such as mbed and FreeRTOS", but looking at the git source, it appears to have support for Linux and Mbed so far.
So as it stands, the answer is it will not work on Arduino. If they provide support for FreeRTOS, it might work on Arduino with a suitable FreeRTOS port. There are quite likely some other changes required to run on Arduino.
The library seems to be under active development, it might be worth asking the developers what their plans are regarding an Arduino port.
@bobcousins: thanks for the answer.
We could also ask why you need to do port this library, as MTQQ clients for Arduino already exist
http://lmgtfy.com/?q=mqtt+client+arduino
Returned 22700 results
gdillen:
What if I would like developing one or the other library and how I can do this (I don't ask to develop a library I only ask how I can integrate it with the Arduino IDE)?
All you have to do, as I have done many times now, is make a .cpp and a .h file (or more than one of each), put them in a folder, put that folder into the "libraries" folder (under where your sketches are, wherever that is) and you are done. Restart the IDE so it notices the new folder.
If i'm right the link you mention shows standard available Arduino C commands/instructions that are placed in a separate library.
I have a C source code library (that's not part of the standard Arduino C libraries) I can import as a git repo and would like using. Can I do this in the Arduino IDE?
I'm really not clear what you mean by this. Any C function (I hesitate to refer to them as "Arduino C commands/instructions") can be used in a library you write. You may or may not use existing functions if you wish. Just as an example I ported the Lua regular expression library (which happened to be written in C), added a C++ wrapper class, and stuffed the whole lot into a library.
Here it is, if you want to see the details:
If you happen to want to use the processor registers (and not via an existing library) you can do that too.
As PaulS points out, you have some limitations, due to the nature of the processor (not the Arduino IDE). For example, depending on the processor you are targeting, you may only have 2 kB of RAM (or less). You also do not have pre-emptive multi-tasking as there is no hardware support for that.
From the link http://www.eclipse.org/paho/clients/c/embedded/ :
The "full" Paho MQTT C client library was written with Linux and Windows in mind. It assumes the existence of Posix or Windows libraries for networking (sockets), threads and memory allocation.
The Arduino is not exactly Linux/Windows. It doesn't have threads, nor does it have the standard libraries for networking.
From one of their examples:
#include <sys/socket.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
You will be struggling to find all those include files, and even if you did, you would probably be struggling with memory usage.
This thread sounds like another instance of the XY problem:
http://mywiki.wooledge.org/XyProblem
Question asked (Y):
I want to port an existing C/C++ library and develop an own library for use with Arduino C / Wiring.
(Note the vagueness of the question, for example it doesn't mention which library.).
What is really wanted (X):
I want to run an MTQQ client on the Arduino, possibly using http://www.eclipse.org/paho/clients/c/embedded/
Can anyone suggest how this library might be ported, or is there an existing port of it?
And even that doesn't mention why the MTQQ library is wanted which is probably the real X.