GRiSP – Erlang-based IoT hardware platform
grisp.org
grisp.org
I have to wonder though, has Peer actually released any code yet? I implored him to release a couple of years ago, and wasn't successful in convincing him. At the time, he was insisting on some drivers to exist before he'd be willing to. I was quite disappointed.
The main work that is done at the moment is the expectedly Wifi driver stack where there was a bit unexpected extra work to do -- longer story but we needed a from scratch new USB driver which needed us to upgrade the FreeBSD network stack to the most current, currently getting Wifi connections but the FreeBSD driver we use needs some adaptions still.
The porting Erlang part is mainly rebasing to the current Erlang version and disentangling of some customer code. But we already know it generally works quite well.
Building this special hardware for it we can offer better user experience than with just a code release. Once we ship the board all of the software will be released
Personally, for connectivity I wouldn't mind using a RFM69HW module or RFM9x [1] (868 Mhz / LoRa)
Creating a mesh-network with supervisors using Erlang seems like aa interesting and feasible idea. It's a good method to introduce actor systems to a new audience.
[1] http://www.hoperf.com/upload/rf/RFM69HW-V1.3.pdf [2] http://www.hoperf.com/upload/rf/RFM95_96_97_98W.pdf
As mentioned in my sub comment, it'd be great to be able to either interface via ports or a nif. However, it gets trickier because the smallest erlang vm is either Grisp or LingVM. So if you want to use micro controllers you're out for erlang/elixir. Since I had another project at work relying on interacting and buidlding mesh networks on nerves devices, I figured starting with a Bert-rpc inspired Arduino library would be good a good start [2].
Let me know if you'd be interested in helping on an erlang/elixir native port of Radiohead or a ports wrapper. I'm thinking a nice BSD/MPL project would be a boon for others too... Plus how would you think OTP supervisors would help setup a mesh network?
[1]: http://www.airspayce.com/mikem/arduino/RadioHead/ [2]: https://github.com/elcritch/NanoBERT
I pine for something that runs in 64KB flash/16K RAM that doesn't suck.
Look at a die microphotograph of an ARM Cortex M4.
The RAM takes up more than half the die area. Flash is about a third of the die area. ALL the functional units and processing cores takes up less than 1/4 of the die area.
Once you have external memory 64MB is the smallest that you can get and be confident that you can obtain it for the next years. Its also not a big cost factor.
Grisp-Base is a evaluation board to get people easily started with Erlang running directly on hardware so not much use artificially limiting memory here. The board size is also larger than minimal to have all these nice PMOD connectors with enough room for the PMODs around them. Normally one would build some prototypes or smaller applications < 100 boards. When this works its fairly easy and cheap to build a customized board only the parts needed for the actual IoT application.
There are new SoC automotive controllers who will be able to run a Erlang VM without connecting any external memory which we plan to target for the future.
64K flash/16K RAM will never be able to run a Erlang VM so its outside of our scope. IoT trends are to move more calculation towards the edge since the cloud can't grow enough.
For many use cases, going to a PIC doesn't make sense if just a few units are to deployed, with the price difference being just a few euros.
though it's a bid of a different mindset. Thinking Forth is great book ( not just in terms of forth ) which really sells the idea.
Sorry, but it is not a production language. It is a puzzle language. Many things which are straightforward in even the worst programming language are a brain teaser to figure out how to organize in the "Forth Way(tm)".
Scheme and Lua come closest to my ideal.
However, I just can't deal with 1-based indexing from Lua. Sorry. Too many things talk to C API's.
Scheme is okay, but almost none of them are truly small anymore. Even the ones like picobit (https://github.com/stamourv/picobit) require quite some grunty support from a desktop machine outside the processor.
http://web.archive.org/web/20101024223709/http://forth.gsfc....
as an aside, The guy who was primarily responsible for that now has a FRP library ( http://sodium.nz/ ) and written a book on FRP using petrol pumps as an example
We plan to use this for the inner loop of the Erlang VM since its much faster than external memory. But thats a optimization for later after we can actually ship boards (QI 2017)
It'd be nice to see what's been built with it, and also get a better idea of what kind of hardware it runs on.
Anyone tried this? Escaping C usually comes with a steep cost...
However! Erlang doesn't have any hard real time guarantees so that may limit applicability. Generally doesn't seem like it'd be an issue for IoT.
But this, from the end of the GRiSP page, is interesting:
* When Erlang is running on RTEMS there is very little latency between something happening on the hardware and a reaction on the Erlang level. There is strict control over what can pre-empt the Erlang VM: only hardware interrupts allowed. In practice, this means Erlang’s soft real-time is not as soft as on normal operating systems.
For the future, we plan to provide hard real-time processes on the Erlang level; GRiSP-Base will be the main test platform for this.
There are plenty of soft and hard real-time GCs though suitable for use with any GC'd language. For instance, the CHICKEN collector in [1] is an absurdly simple copying collector with an observed maximum pause time of 120 microseconds with average pauses of 1 microsecond.
Low-latency GC tends to sacrifice a little throughput though, which is why it's not more widely used. Relative to a standard concurrent MS, CHICKEN adds up to 30% in execution time, although the average seems to hover around 10-15%.
[1] ftp://ftp.inf.ufrgs.br/pub/geyer/PDP-Pos/Artigos/PDP-2011-2-TL1-artigos/PDP-2011-2-TL1-GT-A%20Study%20of%20Concurrent%20Real-Time%20Garbage%20Collectors.pdf
Soft/hard realtime was always a spectrum and basically the point of hard-realtime is never reached in practice (if your hardware dies or glitches you miss your deadline, caches are hard to model but you't want to switch them off etc).
Even without changed VM one can enforce garbage collection at certain points which moves Erlang on the throughput/realtime spectrum more towards realtime. Not worth it if a non realtime OS schedules you but of value when controlling exactly who can preempt you (under RTEMS no-one is feasible)
But Erlang already offers a lot around releases out of the box and in our case The VM + the whole "OS" is just one file to swap so we don't have a lot of problems one has if Linux + Erlang + Application needs to be updated.
FWIW: for larger Embedded systems we use FreeBSD + nanobsd wich solves a lot of the above mentioned problems. Update image verification and running the update is about 200 lines of Erlang code. And nanobsd comes with the normal FreeBSD system (builds disk/flash filesystem images with multiple partitions for easy update -- runs from one swap to the other)
Exactly - that part is not tiny, so I wonder what the two look like in comparison.
RTEMS is an RTOS with a Posix layer. Peer has written a pure-Erlang epmd and ported BEAM to RTEMS.
In practice low power and performance are interchangeable (you try to race as fast as you can to the next point where you sleep as deep as you can). The CPU has decent sleep modes so when the system idles it can be made considerably low power.
So since Erlang is a language running on a VM you give up some sequential performance (power consumption). But in real world embedded systems you see a similar effect than with Erlang on the server: it reacts quite quickly on external events which is what most embedded systems do most of the time.
So the same which can be achieved on a server counterintuitively more performance you would expect looking at the sequential Erlang performance one can get in a embedded system. And this can be translated to power consumption directly and indirectly: quick reaction then sleep longer, possible reduction of clock speed or smaller CPU.
So this is still really cool, conceptually, this brings a very good platform to probably the lowest level that's practical. I've put it on the list of things to consider for one of our new product designs.