16 ms·
JavaScript right on the hardware
- jevinskie 13y agoNifty! I presume this is running on a Linux kernel? How much memory does node use? I would think that kernel + JS VM would chew up quite a bit of your 32 MB of RAM.
- chinchang 13y agoThere have been many attempts with Node on embedded systems. Nodejs seems to work on as low as 10MiB.
- zokier 13y ago> I presume this is running on a Linux kernel? I doubt that. It has M-series ARM microcontroller, Linux is usually used with A-series ARM CPUs.
- jevinskie 13y agoI assumed it was run using uClinux to deal with the lack of MMU.
- zhemao 13y agoHow would you run Node on it otherwise? If it's not running an operating system that Node already supports, it means they've done the very large amount of work needed to port a Javascript interpreter to a bare-metal environment. I'd be highly impressed if they had actually managed to do that, but I'm doubtful. More likely they are using some stripped-down Linux kernel and userspace. A combination of uCLinux and BusyBox should work rather nicely.
- nawitus 13y agoFrom the title I expected the CPU to actually run JavaScript, like a certain decades old computer (of which name I can't recall).
- phpnode 13y agoyou probably mean a Lisp Machine - http://en.wikipedia.org/wiki/Lisp_machine http://en.wikipedia.org/wiki/Lisp_machine
- nawitus 13y agoFound what I meant: B5000 directly supported higher level languages.
- unwind 13y agoThanks, that (http://en.wikipedia.org/wiki/Burroughs_large_systems#B5000 http://en.wikipedia.org/wiki/Burroughs_large_systems#B5000) seems like a very interesting processor. A few tidbits that caught my eye: - All code automatically reentrant - Partially data-driven tagged and descriptor-based design - First commercial implementation of virtual memory
- theoh 13y agoJava, maybe? http://en.wikipedia.org/wiki/JavaStation http://en.wikipedia.org/wiki/JavaStation
- mbell 13y agoARM tried this with Java, it was called Jazelle and was (is?) a complete disaster.
- drdaeman 13y agoVarious smartcards use subset of Java 2 bytecode (search for "Java Card") although I'm not sure if it's particularly better or worse than running some other kind of instruction set.
- lucian1900 13y agoJazelle basically turned into an extension of Thumb2, where there are few extra instructions for things like bounds checks. It should theoretically help make faster JITs in general (not necessarily just JVM ones).
- chad_oliver 13y agoThis is very cool, but I don't see how it can compete with boards like the BeagleBone Black. The BleagleBone Black is $45 for a 1GHz CPU and 512 MB of memory, yet the access to low-level hardware is just as good.
- deepblueq 13y agoYou forgot the best part: not having to deal with javascript.
- brianpgordon 13y agoLooks like the JavaScript bindings for Tessel are better. Comparing the demo for blinking an LED: var b = require('bonescript'); var state = 0; b.pinMode("USR3", 'out'); setInterval(function() { state = state ? 0 : 1; b.digitalWrite("USR3", state); }, 100); vs var tessel = require('tessel') tessel.led(1).blink() If they can give human-friendly names to stuff like "USR3" and "P9_40" and "P9_36" out of the box, then I'd say they've added some value.
- zhemao 13y agoBut that's a library issue, not a hardware issue. It shouldn't be difficult to write a wrapper for bonescript that turns the first example into the second example.
- wyager 13y agoAnd what happens when you need to specify a pin mode on the Tessel? If you don't have at least tri-state support (which isn't compatible with human-friendly abstractions like "blink"), you're going to burn out a lot of sensors. Most modern microcontrollers have anywhere from 3 to 5 possible pin states, and I don't think it's possible to safely wrap these up in a nice, human-friendly function like "blink". For example, on a lot of ARMs, you have: In, no pull In, pulled up In, pulled down Out, up Out, down and on AVRs, you have In, no pull In, pulled up Out, up Out, down You necessarily have to have ugly secondary functions like "pinMode".
- 13y ago
- farnsworth 13y agoForgive me for not being hip but why try so hard to put JS in new places? It seems to be just an unfortunate historical accident that JS is one of the most popular languages in the world - does anyone actually like it compared to other modern scripting languages? Could we invest in CoffeeScript instead, at the very least?
- bpodgursky 13y agoWhen all you know how to use is a hammer, everything looks like a nail...
- jfb 13y ago"True. When your hammer is C++, everything begins to look like a thumb." [1] [1] http://www.anvari.org/fortune/Quotations_-_Random/3041_quote-324-true-when-your-hammer-is-c-everything-begins-to-look-like-a-thumb.html http://www.anvari.org/fortune/Quotations_-_Random/3041_quote...
- drdaeman 13y agoWhy it's always C/C++ (not even Pascal or Oberon) in another corner of the ring? If hardware is powerful enough to sustain Node.JS, why not use OCaml, Racket or, maybe, some JVM-based language? Or, if the scripting is a requirement, Lua, Tcl or maybe Python.
- tn13 13y agoThis is precisely what I wanted to work with.
- dkuntz2 13y agoWhy? Because it uses JavaScript? I'd rather stick with my Arduino and use C. I don't get the whole "JavaScript Everywhere" meme, I'd rather use almost any other modern language (note the almost).
- Tichy 13y agoYou prefer C over JavaScript? Header files? Pointer arithmetic hell? Precompiler Macros? Manual Memory Management? Seriously? To each their own, though.
- dkuntz2 13y agoNo. I prefer C over JavaScript for embedded devices. And actually in most places, too. I know I'm weird, but I really like pointers, because I really like being able to manually setup data structures, and enjoy the power provided by pointers. Manual memory management isn't horribly fun, but for embedded devices I would rather be in charge of that over the chip having to do it for me. It means that if there's ever a memory overflow, it's my own damn fault, and I have the ability to fix it. JavaScript is an acceptable scripting language. It's not my favorite, but it works. I just don't think scripting languages should really be used on embedded devices.
- marssaxman 13y agoI feel sorry for the people who need this.
- deleted 13y ago[deleted]
- Widdershin 13y agoYou know when people talk about negativity in Hacker News comments? This is what they mean.
- marssaxman 13y agoNot sure what you mean by that. I meant exactly what I said: I feel sorry for anyone whose linguistic toolbox is so limited that Javascript is their best option for writing low-level code for manipulating electronic devices. It is hard to imagine a more profound mismatch between the tool and the problem it is supposed to solve.
- lifeformed 13y agoI just want to program a little thingy to do fun stuff, and this is it. I don't care about languages, I already know js.
- PommeDeTerre 13y agoI think that your "I don't care about languages, I already know js." attitude perfectly describes the problem with many JavaScript programmers. This sort of proud basking in ignorance is shameful, and should be considered unacceptable. It is absurd to limit yourself to learning about just one programming language, especially when that language is so rife with flaws, and perhaps the worst widely-used programming language ever. It is also harmful to create code of any sort when holding such an attitude, even when done as a hobby. It shows a complete lack of care about doing things even remotely correctly. I have to admit, I'm very disappointed to read a sentence like, "I don't care about languages, I already know js." here.
- twog 13y agoSo much negativity in this thread & on HN in general. Not everyone has hardware experience, and this looks great for newcomers.
- pspeter3 13y agoI completely agree. I'm a front end developer recently out of college and I decided recently that I wanted to expand my knowledge and learn hardware. This seems like a good place to start given my knowledge of JavaScript
- dkuntz2 13y agoIf your college education for becoming a developer didn't teach you a lower level language it failed you. Even at my small liberal arts school we use multiple languages (they may all be really, really similar, but they're different languages), and work on low-level things. I'm aghast that a CS education wouldn't include at least Java, especially considering that a large number of schools switched exclusively to Java at one point.
- zhemao 13y agoYou know, he never said he was a CS or engineering major.
- dkuntz2 13y agoYes. But he said he's a professional developer, which implies to me that he should strive to learn new things, like a statically typed language...
- pspeter3 13y agoI learned C++, Java, Scala, Python and Ruby. I just prefer and am most familiar with Scala & JavaScript these days because I use Play. While I could go back and refresh my knowledge of C, it's nice having a device that uses the language I already use on a daily base given I have little to no experience in actually working with hardware. As to your point to zhemao about learning new things, I said in my original post that I wanted to learn new things, in this case, hardware.
- eob 13y agoFirst off, this is cool. It is tremendously exciting to see the bar for hardware hacking getting lower and lower. To the people complaining "Why JS? C is fine!", remember that once the complaint was "Why C? ASM is fine!". At the same time, I can't help but grin that we on the CS side find a way to erase all the gains in performance and efficiency as soon as the EE guys make them. There has to be come kind of universal constant: the limit, as technology proceeds into the future, of the execution time of "Hello World" is some fixed number. Because as soon as we get better hardware, we invent an even weightier runtime environment to slap on it. ;)
- CompelTechnic 13y agoAs it was spoken: Javascript shall conquer all- Atwood's Law: http://www.codinghorror.com/blog/2007/07/the-principle-of-least-power.html http://www.codinghorror.com/blog/2007/07/the-principle-of-le...
- jkscm 13y agoI don't think the language has been the problem. Just look at the Arduino. For me, the main challenges always were getting the program onto a chip and wiring everthing so that is does not break or shortcut.
- zhemao 13y agoErrrrm, if you ever look at the AVR C library that Arduino was based off of, you would probably not be so quick to say that it isn't a language issue. Not having to know the weird unpronounceable mnemonic for a certain register as well as the specific bit in that register that you set in order to trigger the ADC is a huge plus. Greater abstraction is always welcome if the hardware can handle it. Although I agree with you that Arduino C is simple enough for most microcontroller programs and Javascript is a bit overkill.
- WalterSear 13y agoFor now...
- 13y ago
- hardwaresofton 13y agoIt is very rare that I actually put my email into one of those "sign up for updates" things, this is pretty awesome, can't wait to hear back from you guys
- zdw 13y agoI'm curious about performance on this, compared to something like the Arduino YUN, which is basically a OpenWRT MIPS system (which uses a Lua UI by default) and an Arduino tacked on the side: http://arduino.cc/en/Main/ArduinoYUN http://arduino.cc/en/Main/ArduinoYUN The CPU in particular seems quite underpowered assuming that they're clockspeed comparable, but I'm not familiar enough with the M-series ARM cores to give a proper opinion.
- errordeveloper 13y agoThis is way better then Yun, IMO. Yun is an awkward design, I find very few reasons they had to put an 8-bit AVR and AR9 on one board. WTF. I really like this solution with a beefy LPC18xx and CC3000, it's totally cool by me.
- proee 13y agoJavascript doesn't support integers, so it doesn't seem like a good language for programming low level hardware. What about bit manipulation (XOR, AND, Shifting, etc)? This is critical for a lot of serial data communications and I/O controls.
- AntiRush 13y agoJavascript has the normal (C syntax) set of bitwise operations that operate on 32 bit numbers. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- teebrz 13y agoJS supports integers; it just doesn't have an integer type so you can't always store, operate, etc on them efficiently (though a smart engine can do some of that for you). It has bitwise manipulation operations which treat the Number as a 32 bit int. There are also Typed Arrays which make it easier to work on raw binary data. Though yes, it can occasionally get a little finicky trying to interface a high level dynamic language with lower level stuff. Anyway, for this I'm sure there will be a lot of libraries that handle that for you and expose a fairly high level api; like the blinking led in the example.
- esailija 13y agoAnd when the engine cannot do that for you, there is always Math.imul
- rwaldron 13y agoIs this a joke?
- eplanit 13y agoLanguage-specific hardware has been done before, but do these really make sense? I remember excitement at the prospect of "Java CPUs". Did any of them become commercially or even technically important? http://en.wikipedia.org/wiki/Java_processor http://en.wikipedia.org/wiki/Java_processor
- dpweb 13y agowhole world goin JS crazy
- tehwebguy 13y agoThis is cool! If you are a veteran programmer it may seem dumb but there are plenty of people who only know JavaScript (& HTML). Some of those people will be utterly blown away that they can control actual, physical "stuff" with those skills.
- kingmanaz 13y agoIt would be interesting to see scheme implemented in hardware, complete with primitives intended to be wired to low-level pointer manipulation functions. Further, it would be interesting to see someone seasoned in low-level C sit down with a copy of Lion's Unix Commentary and the NetBSD sources and attempt to implement a minimal Unix atop the scheme hardware using only said hardware's scheme dialect ("SysScheme"?).
- bcent 13y agoCertainly an interesting concept ... and I'm sure that will be some cool things that come out of this project. I'm not sure I like the idea of a high level language, trying to control low level hardware. (seems almost counter intuitive)... however, if you wanted such a thing ... Node seems to be the way to do it... from both an accessibility and speed perspective.
- marcamillion 13y agoWow....this is soo cool. Even though I am no fan of JS, I can't wait for Ruby to be embedded on hardware like this. Oh the possibilities!
- knodi 13y agoPlease I don't need more JS in my life, i need less JS in my life.
- smilekzs 13y agoMany others do seem to need more, though.
- ontouchstart 13y agoJavaScript is the most deployed dynamic embedded programming language in the world (consider all the web browsers on desktop computers and mobile devices). If we expland this environment to customer hardware, we also expand our view of UI/UX to a different level. We should thank Moore's law.
- nfoz 13y agoAre you implying that JS developers know more about UI/UX than others? Most websites have horrible usability, ranging from "everything in CSS popups!" to "every site uses a different widget toolkit, deficient in new and exciting ways"..... I hope I just don't understand your comment.
- esailija 13y agoYeah GUI widgets done in js in general for some reason have really poor quality and no attention to subtle details that make up the polished experience on desktop. Well at least they take 2 KB instead of 5 KB gzipped, that's totally a win.
- ontouchstart 13y agoI am not a big fan of the visual UI/UX either. My point is that there is more to the UI/UX than widgets and popups. With JS on hardware, we might have a new way to design HCI other than those pretty wireframes in Photoshop. IMHO, JS is a laguage designed for APIs, which is good for exploring ideas and protyping. There is always a way to push the performance to another layer, like CSS boosted by GPU.
- taurath 13y agoI'll take "most terrifying things you could tell an electrical engineer in 2005" for $2000, Alex.
- kyzyl 13y agoI had this thought was well. As as physics major and an EE major, it's a (somewhat humorously) terrifying concept, at some level. Now this has more or less been discussed to death in the threads above and below, but while I don't necessarily think running JS on a uC is a great idea, I don't see a problem with letting non-hardware-versed folk write low level code. People who know hardware will probably not use it for anything critical, and if it makes someone's life easier without endangering others or utterly diluting the community (knock on wood...) then so be it. There's no reason to be elitist about low level programming. At this moment my workspace consists of a bit of code for an 8bit microcontroller, a FPGA layout + VHDL, and a mixed signal high speed PCB layout I've been laboring over for the better part of two weeks. Take that, "low level" C! Now I could go off about how superior and/or necessary my low level methods are, but my friend who's working on an ASIC design might say something similar to me. There's always a lower level. As always it's a little bit about preference, and a lot about using the appropriate tool for the job. I might have a problem if web developers started cramming JS onto arduinos and calling themselves competent hardware engineers, but (and I think most people in the field would agree with me) I suspect the likelihood of that happening is negligible. It becomes apparent very, very quickly when someone is pretending to know how to hardware.
- mistercow 13y agoHmm, I can see some potential difficulties with making JS work efficiently on that MC. It only has single precision floating point instructions, for one thing, and I can't tell how many cycles those instructions take. I'm guessing they'll just do a variant of JS that uses single precision, but even so, it seems like it would be hard to squeeze any kind of performance out of it.
- diydsp 13y agoI took a brief glance at the LPC1830 and it seems it doesn't have hardware floating-point at all. (None of the mainstream Cortex M3 products that I've seen do). Do you have better info on this? So, I believe its FP support is through software and could be written to be double or greater precision. If this is true and if JS can only do floats, it would be bad news for many basic mathematical operations running on this chip. But hey, as someone pointed out above: People don't want performance. They want libraries. But with no FPU, count me out. I'd rather have my stm32f4. Just sayin'.
- thedufer 13y ago> If this is true and if JS can only do floats, it would be bad news for many basic mathematical operations running on this chip By spec, JS only has double-precision floats. However, since that means that 32-bit integers can be exactly represented, V8 optimizes to integer calculations unless actually using floats becomes necessary. I would guess that on this device floating point operations are done in software, but also that they rarely occur in practice.
- kenster07 13y agoThere will alway be a need for performance beyond what js can be provide, in time and memory. So don't worry, js will not take over...completely.
- malandrew 13y agoSo a lot of people have been complaining: "Why not language X, Y or Z instead of JavaScript?" This to me makes me think that there is a space out there for a board that has some equivalent to vagrant/docker but for microcontrollers, where you can just flash the device with a image supporting a language of your choice. Near as I can tell, there is nothing I read on the product launch page that says that JavaScript is supported at the physical hardware level.
- tambourine_man 13y ago180mhz ARM Cortex-M3 LPC1830 32mb SDRAM I'm amazed that such wimpy hardware can run modern JS satisfactorily.
- smilekzs 13y agoI'm amazed too, considering how I often have to squeeze lots of performance out of my sub-100MHz Cortex-M3 micros, even when I'm using C++.
- test-it 13y agoIt won't run satisfactory. Reminds me of that time Sun made the Java CPU and the JavaStation. A hardware implementation of the JVM. It ran 20 times slower than the Microsoft JVM on an average Windows PC.
- aufreak3 13y agoIt was both a pleasure and a pain for me to read about this! Pleasure - because a language with closures is finally getting "closer to the metal" (even if it means an abstraction layer sitting in between). Pain - because that language is not a Scheme/LisP! This would be so much cooler if I could tap into an REPL remotely and blink out a Morse code on the LEDs :) PS: I have no idea what makes most of us go "cool!" whenever some form of remote control of a hardware device is presented :)
- SlaterVictoroff 13y agoHad the pleasure to try it out last week and I found it incredibly easy to get things up and running. I think it has a lot of potential. Excited to see where this goes.
- dnautics 13y agowill it support asm.js?
- Sealy 13y agoThat looks very very cool. Im really excited to see how this will change the game. I just wanted to ask the readers here... anybody notice the sticky tape holding it together in the second picture?
- ulisesrmzroche 13y agoI for one am really happy the JS era is here. Finally! Also don't listen to the haters. Ya'll know most of us make web apps so stop fronting. Though, I guess now I can make a battlebot too! JS is shaping up to be a great language and environment as more and more people get on board.
- ulisesrmzroche 13y agoActually, on second thought, if anyone wants to join me in starting a HN battlebot league, hit me up!
- oscargrouch 13y agoa good example of hardware hobyism and of the modern days eletronics renaissance.. maybe its not this one.. but the next computer hardware revolution will born like this.. the same way jobs and wozniak did in the 70´s .. from pure passion hope my kids create its own gadgets like we did with legos in our days.. long live to the hacker spirit!
- outside1234 13y agoDid anyone find details (or have an idea) on power consumption? <selfishPlug> I'm the maintainer of nitrogen (http://github.com/nitrogenjs/service http://github.com/nitrogenjs/service), which is a node.js based project to provide web services and client libraries for devices like this. Check it out if you are interested in devices like this! </selfishPlug>
- damian2000 13y agoGreat idea and marketing, but I just wish they'd chosen Go - I would have bought one in a second. Correct me if I'm wrong, but the lack of sane, static typing in JS just seems crazy to me when you come to writing low level code.
- peterwwillis 13y agoThis is the most elaborate troll i've ever seen. Kudos to the team for creating what is literally the physical embodiment of everything I hate about technology.
- delluminatus 13y agoIn contrast, this troll is quite transparent.
- gfwilliams 13y agoI've been working on another embedded JavaScript project - first posted on here almost a year ago, and soon to go on KickStarter: http://www.espruino.com http://www.espruino.com This is really interesting though. It looks like they've got linux and node.js into 32mb RAM, which is seriously impressive. It seemed as if people were trying and failing on Carambola (but that may have been because it didn't use an ARM CPU...)
- K0nserv 13y agoAs far as I understand not having an Android or iOS device will severely cripple the user? Is this the case, are there any plans for Windows Phone?
- smanuel 13y ago"the assembly language for the web" just got renamed to... "the assembly language". Very cool.
- 6ren 13y agoSo, it's not actually JS in silicon (would that add much performance anyway, since JS is so dynamic? at best it would be asm.js-like, I'd guess...), but a supported language for an embedded device. I had a ghastly bizarro moment there: JS strikes me as bash + C syntax (not tsch)... in silicon...
- mcdougle 13y agoVery interesting. I feel like I've been seeing a major trend towards Javascript-based-everything the past few months! I wasn't sure if I should link this here, but this article really sparked a train of thought that brought me to write this: http://blog.mcdougle.net/?p=54 http://blog.mcdougle.net/?p=54