8 ms·
Rust on RTL8710 running FreeRTOS
- orthecreedence 10y agoIt's going to be really great as Rust spreads further and further into the embedded world. I know enough C to get by, but I'm always second guessing myself when things start to get complicated, and Rust has really made lowish-level programming a lot easier for me. The safety features in addition to exposing a C ABI make it a great language for build once, run everywhere (everywhere that LLVM supports, anyway). Exciting times.
- lacampbell 10y agoIs rust actually used in the embedded world, anywhere? All sorts of languages have been made to run on micro controllers, from Pascal to Scheme.
- scandox 10y agoGot talking to a dude on the phone (random call about something totally non-technical). Turned out he was an embedded systems engineer in the Nuclear industry. Uses Forth for everything. He strongly encouraged me to use it for any embedded hobby project.
- jlewallen 10y agoJeeLabs has some stuff on Forth in the uC world: http://jeelabs.org/2016/02/dive-into-forth/ http://jeelabs.org/2016/02/dive-into-forth/
- lacampbell 10y agodamn that looks fun. as if I didn't already have enough things I want to learn...
- swah 10y agoI love that jeelabs blog.. Also, some languages running on esp8266: https://github.com/yesco/esp-lisp https://github.com/yesco/esp-lisp https://github.com/zeroflag/punyforth https://github.com/zeroflag/punyforth https://micropython.org/ https://micropython.org/ (and of course lua which i didn't try because its official... https://github.com/nodemcu/nodemcu-firmware https://github.com/nodemcu/nodemcu-firmware)
- swah 10y agoCharles Moore?
- nine_k 10y agoNot many languages can be made to run efficiently on a 83 MHz core with few kbytes of RAM. Pascal, maybe, but it's about the same thing as C. Scheme would be nice, but it's both more resource-hungry and the static checking is sort of bolted on. With Rust's security features I hope we'll have fewer crashing or crackable embedded devices.
- pjmlp 10y agoPascal, these guys have options for almost all relevant processors. http://www.mikroe.com/mikropascal/ http://www.mikroe.com/mikropascal/ Scheme, do people actually know how powerful RTL8710 is in regards to the computers used to create Scheme? RTL8710 has a ARM Cortex M3 @ 166 MHz with 48KB available to user and 1MB flash. Scheme was developed on the ITS OS, running on PDP-10, which could have up to 256 kilowords (not KB), and ran at about 30 MHz. I am with you on Rust. The majority of these tiny devices have more resources than 70's mainframes, that used safer systems programming languages.
- TickleSteve 10y agoUnfortunately, there's little chance for Rust to make inroads into the embedded market, tho I wish it were otherwise. C++ has had many benefits over C for embedded s/w for many years and has similarly failed. Note that contrary to popular belief, C++ does not result in larger, more inefficient s/w than C (for the correct C++ subset). The momentum behind the C ecosystem is so overwhelming that Rust simply will not get a foothold anytime soon.
- nine_k 10y agoWhat makes the ecosystem so unfriendly to languages that link to C easily, either way?
- nickpsecurity 10y agoThe ecosystem... from people to compilers to libraries to tutorials... is all C and its style of doing things. Gotta be as close to it as possible to have a chance. It's why the successful languages in enterprise, system space used C-like syntax. Still took a huge company basically dictating it.
- pjmlp 10y agoThe culture, the outdated compilers (expect C89 and C++98) and software designed by hardware engineers.
- petra 10y agoWhat about ARM's mbed bet(and ARM know their stuff) , written in c++ ? no chance for it sucseeding in the IOT , yet ARM claim a large ecosystem ?
- TickleSteve 10y agombed is not a large ecosystem, its large in the 'IoT' world, but no one doing real embedded work (more than say half a million units) would use mbed.
- 10y ago
- diimdeep 10y agoNice, didn't know about this chip.
- MrBuddyCasino 10y agoTl;dr: this works because the RTL8710 is an ARM core, which is supported by LLVM and thus Rust anyway. Its a nice how-to for working with the chip though.
- axman6 10y agoJust because something uses ARM doesn't mean it'll be easy to target, there's a hell of a lot more to getting something running on an embedded system than just what basic architecture it supports.
- alkonaut 10y agoWhat is an example use for this chip on its own? Can it be made to run on low enough power to run on a battery?
- voltagex_ 10y agohttp://aitendo3.sakura.ne.jp/aitendo_data/product_img/wireless/2.4G/RTL-00/RTL8710%20wifi%20module%20specification.pdf http://aitendo3.sakura.ne.jp/aitendo_data/product_img/wirele... says 180mAh when actively transmitting, so probably.
- polyfractal 10y agoMost people use these little things for sensor/data loggers (weather stations, power monitoring, indoor temperature, etc) or little widgets that need connectivity and can be tethered to a power outlet (small display showing the weather outside, etc) The specs say it has 0.9 mA light sleep, and a 10 uA deep sleep. Assuming the specs are correct (I haven't test it yet... not sure anyone else has either) you could definitely run it off a battery if you aren't waking it up too often. The real problem with the RTL8710 (and ESP8266, and any other chip that uses WiFi) is that WiFi is very energy intensive. It takes a lot of juice to blast out a 2.4Ghz signal. I don't know what the numbers are for the RTL8710, but the ESP8266 uses 50-170mA when receiving/transmitting data, which will drain a battery very quickly. (Source: http://bbs.espressif.com/viewtopic.php?t=133 http://bbs.espressif.com/viewtopic.php?t=133)
- alkonaut 10y agothank you. I suppose the critical factor is, how long and how often does it have to wake up, and more importantly, how many milliseconds of wifi power is needed to transmit whatever data was gathered.
- aexaey 10y agoPretty much all WiFi transceivers are indeed power-intensive, but it is actually receiving that often takes more juice. ESP8266 consumes ~70mA with both CPU and WiFi running but idle, and 15mA with CPU idling and WiFi powered down [1]. That's 55mA or (@3.3v) ~180mW for _idle_ (i.e. receiving) WiFi circuitry. Again - that's WiFi only, with exactly zero RF power transmitted. Now transmit. EU restricts amount of RF power radiated by a WiFi station/AP to 100mW. In US and few other places you can go slightly higher, but then other challenges arise, so for practical purpose most WiFi chipsets top out at 100 mW (a.k.a. 20dBm). Assuming RF power amplifier has efficiency of 32% [2], transmit duty cycle of 50% (that's transmitting half of the time and receiving for another half - pretty intense traffic here), we get: (100/32%)*50% = just 156mW consumed towards "blasting out" some RF. Clearly, receiving WiFi takes more. And there is a good reason for that. Most modern designs implement Rx as: Low-noise amplifier with some bandpass filtering -> Zero-IF mixer -> quadrature ADC -> DSP. It's the latter that does FFT, I/Q constellation tracking, demodulation, forward error correction, etc. essentially in software. And that takes a lot of power. [1] http://bbs.espressif.com/viewtopic.php?t=133 http://bbs.espressif.com/viewtopic.php?t=133 [2] http://ww1.microchip.com/downloads/en/DeviceDoc/75003C.pdf http://ww1.microchip.com/downloads/en/DeviceDoc/75003C.pdf
- joezydeco 10y agoSoldering tip: tack a pin down on opposing corners of the chip before attacking the rest.
- tomcam 10y agoPainfully obvious – and I never thought of it myself! Thank you
- polyfractal 10y agoAh, yeah, I can see how that would have helped tremendously. Thanks for the tip! :) I cringed when I saw this at the top of HN because I knew the shame that is my soldering skill would be seen by a few hundred people :)
- joezydeco 10y agoBeen there done that myself. My early works are masterpieces of kapton-tape strain relief because the joints were so bad.
- dikaiosune 10y agoIf you have analytics on your blog you'll probably find a bit more than a few hundred. Front page #1 stories often accumulate thousands of views an hour.
- robohamburger 10y agoThis is cool, though not having the standard library would be painful. Hopefully, there is some middle ground than jettisoning the entire std crate.
- Manishearth 10y agoThat's what libcore is; you still get a lot of the useful bits. Most of the rest of libstd requires a known OS abstraction to exist. Most of the algorithmy stuff (e.g. regex) has been moved out of the stdlib so you can pull it in separately if the crate supports no_std. Not perfect, and a lot more crates could support no_std, but it's sometimes good enough.
- richchurcher 10y agoDelighted to see this tidy summary! I've been wading through four or five documentation sources over the past few days getting everything hooked up. I'm working on a project that uses SPI and would love to use Rust... I may pick your brains further. Strongly recommend you post a link to this at the PADI Stamp forums, I'm sure others will appreciate it. http://forum.pine64.org/forumdisplay.php?fid=57 http://forum.pine64.org/forumdisplay.php?fid=57
- polyfractal 10y agoWill do, thanks for the link! Didn't realize the Pine64 folks had a forum setup. Fair warning, my hardware skills are shoddy at best, but I may be able to help with the Rust side :)