Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.electronics.design > #465837
| Newsgroups | sci.electronics.design |
|---|---|
| From | bitrex <bitrex@de.lete.earthlink.net> |
| Subject | Hardware scripting (a better Arduino) |
| Message-ID | <LEt4B.72469$9S6.22388@fx02.iad> (permalink) |
| Organization | frugalusenet - www.frugalusenet.com |
| Date | 2017-06-27 10:07 -0400 |
As someone pointed out a while back while the Arduino toolchain seems to
be very popular for developing hobbyist embedded applications for
AVR/ARM, but the API and IDE is kind of a mess. The API is a bastardized
subset of C++ where a lot of things don't work and which most users only
use to write kludgey, procedural C-like code; you have C-like global
functions such as "digitalWrite" which under the hood use 40 or 50
assembly instructions just to write a bit to a GPIO port.
I think it's certainly possible to make something better that allows
someone who doesn't want to fight with the tools get real work done.
I was thinking that since little uPs are really more like programmable
hardware rather than general purpose computers, if one's looking to make
a microcontroller language for the everyman it doesn't really make sense
to derive it directly from a general purpose systems programming
language like C/C++.
In modern computer games the graphics and physics engines are written in
high-performance compiled languages like C/C++. But the whole product
doesn't use those languages to define its behavior; usually all the
plot, mechanics, and other stuff that make a video game a game is
fleshed out in some kind of scripting language at a much higher level of
abstraction. This allows people other than rockstar systems programmers
to contribute to the design and avoids needing to recompile the whole
codebase every time someone decides this enemy spaceship should fire
purple lasers instead of green.
I think even 8 bit processors with modern architectures are fast enough
that one could adapt a similar paradigm to writing embedded apps. The
high-performance stuff, like interfacing with external hardware through
GPIO can be written in C/C++, in something like the "policy-based
design" paradigm where you have an abstract type of device, like
"Display" or "TemperatureSensor" which defines an interface to the basic
functions any device of that type should be able to do, and then
"policies" or "plug-ins" which handle the logic requirements of some
particular type of TemperatureSensor from some manufacturer. If you want
to change the sensor you don't rewrite the entire codebase, you just
rewrite the plug-in.
And then the logic for how the external hardware interacts could be
written in a very abstract stack machine language, similar to Forth or
PostScript, or a programmable RPN calculator. An example stack machine
implementation for Arduino I saw would blink an LED on and off like this:
13 output
{
13 digitalToggle 1000 delay
true
} while
These scripts aren't compiled, but actually stored as plaintext strings
(in compressed mnemonic form) in Flash or EEPROM and then interpreted on
the fly by the stack machine.
Back to sci.electronics.design | Previous | Next — Next in thread | Find similar | Unroll thread
Hardware scripting (a better Arduino) bitrex <bitrex@de.lete.earthlink.net> - 2017-06-27 10:07 -0400
Re: Hardware scripting (a better Arduino) Rob <nomail@example.com> - 2017-06-27 16:25 +0000
Re: Hardware scripting (a better Arduino) Don Y <blockedofcourse@foo.invalid> - 2017-06-27 10:12 -0700
Re: Hardware scripting (a better Arduino) Clifford Heath <no.spam@please.net> - 2017-06-28 11:01 +1000
Re: Hardware scripting (a better Arduino) bitrex <bitrex@de.lete.earthlink.net> - 2017-06-28 11:08 -0400
Re: Hardware scripting (a better Arduino) Don Y <blockedofcourse@foo.invalid> - 2017-06-28 10:51 -0700
Re: Hardware scripting (a better Arduino) bitrex <bitrex@de.lete.earthlink.net> - 2017-06-28 15:56 -0400
Re: Hardware scripting (a better Arduino) Don Y <blockedofcourse@foo.invalid> - 2017-06-28 14:04 -0700
Re: Hardware scripting (a better Arduino) Don Y <blockedofcourse@foo.invalid> - 2017-06-28 22:15 -0700
Re: Hardware scripting (a better Arduino) Don Y <blockedofcourse@foo.invalid> - 2017-06-30 12:23 -0700
Re: Hardware scripting (a better Arduino) David Brown <david.brown@hesbynett.no> - 2017-06-30 10:43 +0200
Re: Hardware scripting (a better Arduino) Clifford Heath <no.spam@please.net> - 2017-06-29 09:52 +1000
Re: Hardware scripting (a better Arduino) Clifford Heath <no.spam@please.net> - 2017-06-30 16:49 +1000
Re: Hardware scripting (a better Arduino) Clifford Heath <no.spam@please.net> - 2017-06-29 09:42 +1000
Re: Hardware scripting (a better Arduino) Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-06-28 16:30 +0100
Re: Hardware scripting (a better Arduino) Clifford Heath <no.spam@please.net> - 2017-06-29 09:55 +1000
Re: Hardware scripting (a better Arduino) Les Cargill <lcargill99@comcast.com> - 2017-07-02 12:50 -0500
csiph-web