9p2000-Styx server on esp8266 (i ported and it works)

139 views
Skip to first unread message

bhgv

unread,
Jan 11, 2018, 11:25:40 AM1/11/18
to inferno-os
hello.

i have ported/did 9p-Styx server to esp8266. for my os (freeRTOS+Lua, but not nodemcu). i tryed to port inferno (very stripped, but it wants too many RAM). 


what this Styx port can do:


to start the Styx server, run it on the esp8266 board using remote com/tty terminal (using included pc-studio or any other): `thread.start( styx.loop )`. 

or just select `Styx server` from menu on the board, but it should be a board like mine or compatible.

after this Styx should be mounted to the filesystem of Inferno-os: `mount -A tcp!<ip adress of esp8266 IoT boad with my os/styx port>!6701 /n`.

* to list of device's drivers (ex: `ls /n/dev`),
* to list of driver's functions (ex: `cat /n/dev/pwm`),
* to call a driver's function (ex: `echo ch_val -i 5 -n 0.4 > /n/dev/pwm`),
* to read the result of the function's call (ex: `cat /n/dev/pwm` immediatly after the call),
* to read a file/folder list from the fisical filesystem of the device (ex: `ls /n/fs/html/js`),
* to read/write/create files on the device's fisical filesystem (ex: `cat /n/fs/html/js/common.js` or `echo a Text > /n/fs/afile.txt`),
* to create new folders on the device's fisical filesystem (ex: `mkdir /n/fs/new_folder`),
* to remove files or folders from the fisical device's filesystem (ex: `rm /n/fs/html/a_file_or_folder`).

the path to the Styx module with all the necessary libraries here: 


, but now it's pretty tied to the rest of the system. for example, Styx and Lua have a common description of drivers. more precisely, the Styx server simply reads the list of built-in modules of Lua. to add a driver to the `/dev` fs it's enough to add a new built-in module to Lua. (it's really easy. and, it seems to me, the best way).


PS: i think that IoT and the possibilities of inferno/Styx/9p are optimally suited to each other (maybe this was one of the main goals for development. as well as for QNX. styx/9p are very similar to Qnet). they are extremely useful to develop in the IoT direction.

bhgv

unread,
Jan 14, 2018, 8:16:53 AM1/14/18
to inferno-os
added 2 ways to RPC (Remote Procedure Call) on remote devices:

(let the device is mounted to `/n`)

1. RPC channel `/n/rpc`. 
```
<> /n/rpc {echo 'pwm[5] = 0.2; return "adc_1=", adc[1];' >[1=0]; read}
```
2. user's synthetic CGI-like files. 
adding a file with corresponding lua-function to the styx-filesystem on the remote device:
```
styx.addfile("a_file", function(a) return a + 8; end);
```
calling with the parameter (number: 10.9) from the inferno's shell:
```
<> /n/a_file {echo -n 10.9 >[1=0]; read}
```


четверг, 11 января 2018 г., 18:25:40 UTC+2 пользователь bhgv написал:

hiro

unread,
Jan 14, 2018, 8:33:15 AM1/14/18
to bhgv, inferno-os
i like your project's concept.
thanks for writing about it :)

bhgv

unread,
Jan 18, 2018, 9:02:24 AM1/18/18
to inferno-os
@hiro new
@the all

Inferno Os as the Plan9 Os (as the QNX Os) and their internal protocols, their constructions were designed for IoT mainly (yes, for military IoT. tanks, rockets, submarines. but for IoT. ( skynet) )) and they are ideal for this. I think this direction should be the main for Inferno Os growth.

I'm developing this Styx-built-in small Os a little more then halth of year. Including designing of the special board 

Demo video with some features of LuOS9p (including showing of Styx in the work) and the special DIY board for it: 


(currently present IoT boards have no powerful drivers or too expensive. I may propose this board with OLED, keyboard, many necessary ready to use powerful drivers and ports (DC/AC/LED) for as low as $30 with delivery or lower, but for local pickup or for not tracked shipping)

OS and its libraries including Styx is free and opensource. but the board is non-free, it costs for me, sorry. but it is cheaper then any corresponding IoT module with all drivers and power keys.


воскресенье, 14 января 2018 г., 15:33:15 UTC+2 пользователь hiro neu написал:

bhgv

unread,
Jul 24, 2018, 3:03:16 PM7/24/18
to inferno-os
i added a scheme and PCB of the special board (Eagle CAD. [pcb/eagle](https://github.com/bhgv/LuOS9p-ESP8266/tree/master/pcb/eagle)).
to increase the number of outputs and inputs of the esp-07s main processor, cheap and easily accessible chips are used.
also, power keys are included on the board: PWM (DC), On/Off (AC) and current (LED).
also: ADC inputs, a small keyboard and a place to install an OLED screen.
also, ports: SPI, I2S, UART, all voltages, GPIOs, PWMs, ADCs, DAC

many designs with this board may be manufactured without external modules or with a minimum number of them.
Reply all
Reply to author
Forward
0 new messages