Hello. Yes, I use it in a similar embedded environment.
Let us know how you proceed. Perhaps some of our findings
can go into a future version of NanoMsg that is even more generic
to allow other non linux OS types to work with minimal changes.
Our Altera NIOS 2 based embedded device with MicroC/OS-2 OS,
that uses a slightly non standard posix tcp
implementation (sockets are referenced as long type vs int for example) and I
needed to
change some of the nanomsg code to comply with it. Also, we have no pthread,
socketpair() or poll() support. We do however have MicroC/OS-2 Tasks and
select().
I was able to code around these to use or create equivalents in our
environment. I did this by creating s new folder under the NanoMsg tree named
“sys”
where my OS specific wrappers reside. This limits the amount of code that
needed to change.
Regards, John
Here’s an example:
// from ostaskwrap.h
#ifndef _OSTASK_WRAP_H
#define _OSTASK_WRAP_H
#ifdef __cplusplus
#define EXTERNC extern "C"
#else
#define EXTERNC
#endif
typedef void* ostask_t;
EXTERNC ostask_t ostask_init(void (*func)(void *), void* pUserData, char* name);
EXTERNC void ostask_term(ostask_t pVoid);
#undef EXTERNC
#endif /* _OSTASK_WRAP_H */
// from ostaskwrap.cpp
#include "OsTaskWrap.h"
#include "Task.h"
ostask_t ostask_init(void (*func)(void *), void* pUserData, char* name)
{
Task* pTask;
pTask = new Task(name, func, pUserData, APPLICATION_DEFAULT_PRIORITY,
DEFAULT_STACKSIZE, FALSE);
return pTask;
}
void ostask_term(ostask_t pVoid)
{
Task* pTask = static_cast<Task*>(pVoid);
pTask->Suspend();
delete(pTask);
pTask = NULL;
}
From: Charles McParland
Sent: Thursday, May 21, 2015 10:56 AM
To: nanomsg@xxxxxxxxxxxxx
Subject: [nanomsg] Nanomsg on lightweight platforms
I've been following nanomsg for a few months and finally have a
project that it would fit into nicely. Unfortunately, one side of
the comm. link is a very lightweight platform running freeRTOS.
It has a good WiFi stack and a reasonable amount of memory - for
a small part. But, it can't support linux.
So, I don't have pthreads or BSD sockets. I don't need all
the comm. models, but it would be great to have one or two of
the models common across sensor platforms and higher
archive/analysis nodes.
Has anyone looked into nanomsg on embedded systems?
Any hints or suggestions would be appreciated.
Thanks,
Chuck