nng
nng copied to clipboard
Porting nng to NuttX
NuttX is a partial POSIX-compliant OS that is extensively used in the robotics community. Actually I have already started the work of porting but I think it is better to have a place to post the issues that I encountered in the process :)
Currently the biggest problems are:
- NuttX is not entirely POSIX-compliant, i.e.
- it does not distinguish between threads and processes
- NuttX does not have a complete local socket system
- NuttX uses a
Makefile
based build system- Trying to make one myself
You can generate a Makefile by using cmake -G "Unix Makefiles" -- that should be a good step in the right direction.
We might want to stub out the IPC transport for NuttX if NuttX cannot support UNIX domain sockets (or something like it).
As to processes vs. threads -- many systems don't differentiate here, they just aren't mainstream. I don't think this is a significant concern, provided that the unit of scheduling runs in the same address space. (Meaning provided that these behave more like threads than like processes.) There may be API changes needed -- for example, if we have to use fork() or a similar API to create these "threads". What's most important is that the semantic is correct.)
Its likely the case that a coroutine library like libdill could be used to assist porting to platforms that do not support in-process threads at all. There may still be porting challenges here, but I'm interested in helping. I'll do a little research to see if there are things I can discover which might facilitate this work.
NutX does support Unix domain sockets and has for many years. Perhaps you do not have CONFIG_NET_LOCAL enabled?
NuttX builds in many different configurations, if the hardware supports an MMU, then it does support true processes. Without an MMU it has the same limitations as does uClinux (no for(), no mmap(), etc).
Without an MMU is supports a similar model of a main thread and child pthreads, but that is not the same as processes since the threads exits in a FLAT address environment. You should post your questions at https://groups.google.com/forum/#!forum/nuttx if you want a timely response.
@nuttx Thanks. I have never used NuttX, but it sounds like NNG should Just Work(tm) there. We have no requirement about processes vs. threads -- we do search for and use pthreads. One possible consideration would be whether CMake works there?
No, I don't use CMake. I must limit the number of tools used to build NuttX for easy portibility across all platforms so CMake will never be supported upstream. You can look at the PX4/Nuttx version. They have a parallel CMake system that uses NuttX with CMake.
But that will never come upstream. You are on your own with that one.
Why couldn't nng just be linked to Nuttx like an ordinary library?
I've thought Nuttx would be a good host for nng for a while now, glad to hear I'm not alone... :-)
On Thu, Dec 13, 2018, 5:59 PM Greg Nutt [email protected] wrote:
No, I don't use CMake. I must limit the number of tools used to build NuttX for easy portibility across all platforms so CMake will never be supported upstream. You can look at the PX4/Nuttx version. They have a parallel CMake system that uses NuttX with CMake.
But that will never come upstream. You are on your own with that one.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nanomsg/nng/issues/614#issuecomment-447164903, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWp8AmPJgeuvdhwhvBP3OmkCcPFYR9Rks5u4unsgaJpZM4Vsaga .
--
Bill Gatliff Embedded Linux training and consulting [email protected] (309) 453-3421
So CMake isn't something you should worry about... just CMake configuration needs to be done to ensure that things like compilers, platform detection, etc. work properly. If someone else is already using cmake with NuttX, then it should be fine.
Btw, I'm assuming that most people are cross building for NuttX rather than using compilers hosted on NuttX itself. Is that correct? (If it is, then cmake just has to exist for the "host" platform, not the "target", and you just need to teach cmake where your compiler and headers are... which is easily done with a cmake configuration file.)
@gdamore That is correct. NuttX comes with its own buildable toolchain in https://bitbucket.org/nuttx/buildroot . Also the guys in PX4 have hacked a way to use CMake with normal gcc-arm-embedded toolchain, though I think only themselves can understand how it works :(
Why couldn't nng just be linked to Nuttx like an ordinary library? I've thought Nuttx would be a good host for nng for a while now, glad to hear I'm not alone... :-)
Yes, you can do that too. There is make target 'make export' that builds an export package containing libraries, header files, start up files. You do still have to be careful building the final FLASH image because you have to correctly position the interrupt vectors and start-up code.
There is a good example using an export package here: https://bitbucket.org/patacongo/w3mbuild/src/master/
I was attempting to port w3m to NuttX making only minimal changes to w3m. As a warning, I could not do it without make more substantial changes for (1) certain signal actions not supported by NuttX and (2) for Linux permissions and security stuff that is not supported in NuttX. You can see the changes that I did make to get that far here: https://bitbucket.org/patacongo/w3m/src/master/
You may find some missing networking APIs (I know of one, shutdown()).
I would like to know if there is any update about porting nng to NuttX. Can we have a status about this issue ?
我需要在arm-linux下如何编译libnng.a库?
FYI
https://github.com/apache/nuttx-apps/pull/1625
and
https://github.com/apache/nuttx-apps/pull/1648
It looks like it's been done. I'm closing this as it doesn't appear at the moment actionable for me.