Re: Some thoughts on Zephyr Console API


Martinez Rodriguez, Sergio <sergio.martinez.rodriguez@...>
 

Hi Flavio,

I wrote a shell based on the original one that uses a similar philosophy to what Paul is describing.
This shell is for zephyr.js to be able to update the javascript code dynamically, execute commands and run JS dynamically.

On this shell you can register callbacks to get the data in raw for later processing
Or just get the raw line so you can do any operation yourself.
https://github.com/jslaunchbox/ihex_uploader/

You can see our use case on this short video working on Arduino 101
https://www.youtube.com/watch?v=L2pF48BOPBc

In the video the shell on the right is the regular shell from Zephyr running in parallel with the shell to run Javascript commands.
You can see how I evaluate Javascript and run commands on that terminal.

The application can register a process to capture data streams and process them in different ways.

My use case for this is:
Maybe you need a Intel HEX parser...
Maybe you need a JSON parser...
Maybe you want to talk to the Bluetooth interface...
...
So you can register dynamically the callbacks for the parser.

Sergio

-----Original Message-----
From: Flavio Santes [mailto:flavio.santes(a)intel.com]
Sent: Wednesday, August 10, 2016 5:13 PM
To: devel(a)lists.zephyrproject.org
Subject: [devel] Re: Re: Re: Some thoughts on Zephyr Console API

Hello Paul,

I was thinking about this a few days ago. It seems fair to ask for that functionality considering your view points. This feature could be very useful for rapid prototyping, on-the-fly updates and debugging, as you comment. So, as soon the user base increases, I think more developers will ask for something similar!

Regards,
Flavio

Hello Flavio,

On Sun, 24 Jul 2016 00:58:45 -0000
"Flavio Santes" <flavio.santes(a)intel.com&gt; wrote:


Thanks for your reply, and sorry for dropping the ball from my side -
vacation time and other tasks. With all the arguments regarding Zephyr
shell, I agree that it's mistake to try to use for generic console
input, and going to close
https://jira.zephyrproject.org/browse/ZEP-532
as invalid.

I'm not sure what you mean by providing a use-case - in the original
mail, I gave 2 examples: porting JerryScript's and MicroPython's REPLs.
Perhaps, you mean why it's important to support REPL (interactive
prompt) for these systems? Well, JS/Lua/Python are interpreted
interactive languages (some less, some more, but every has basic REPL
for sure).

As long as you agree that prospect of running JS/Lua/Python in a
deeply embedded systems sounds interesting, trying to cut off REPL
functionality (and leave e.g. only precompiled bytecode execution)
means cutting off their functionality in half. Perhaps, REPL isn't
useful to ship finished products to classical end users (though
nowadays "makers" emerged as noticeable consumer group), but it's
definitely useful for development/debugging and initial acquaintance
with a system. And even the latter alone is very important - in the
current overcrowded landscape, making it easy for a customer to get
one's initial blinking-led demo up and running fast is what can
influence selection of one product over others.

Hope that wasn't too long and philosophical ;-). I figure, this is a
niche topic for now, and there're many more priority tasks to do in
Zephyr. So, I'm happy that I at least brought up this topic for future
consideration, though now it seems that some adhoc (but reusable)
out-of-tree solution is the way to go. I shaped that up in a github
repo: https://github.com/pfalcon/zephyr_console_helpers .


Thanks for the discussion!

Join devel@lists.zephyrproject.org to automatically receive all group messages.