34 ms·
That's pretty cool. Been learning a lot of rust recently. Can't say it'd be my first choice for application or web server stuff when there's GC'd langs availab
by LAC-Tech 5y ago
That's pretty cool.
Been learning a lot of rust recently. Can't say it'd be my first choice for application or web server stuff when there's GC'd langs available. But I'm over enough of the learning curve that I prefer it to C or C++.
- elcritch 5y agoYah if this had been out a few years ago I probably would've gone with Rust on the embedded route. Instead I tried Nim since it could compile to the ESP32's. Turned out that I found it more pleasant to read and write and easier to integrate with ESP-IDF. Nim's ARC is fast enough to not be a hindrance 99.5% of the time on the ESP32's -- heap allocation is the real performance/latency killer. Rust can bite you there as well (its easy to forget about free's at the end of a block!). Still Rust seems nicer than C/C++ for a lot of applications. I'm glad there's a couple of options for better safety / security in embedded.
- girvo 5y agoJust to add to this, I use Nesper (your project) extensively :) And the experience is exactly as you’ve described
- elcritch 5y agoGreat to hear!
- girvo 5y agoI'm putting together some pull requests at some point in the near-ish future to bring it up to date with ESP-IDF 4.3 and add some more interfaces for some modules (esp_pthread.h and some others). It's working quite well on Nim v1.6.4 -- though I set my project up with PlatformIO and adjusted the CMakeLists.txt to read nimcache, and wrote my own nim.cfg I'll likely setup a new template project for all of that, as I think PlatformIO's lib folder allowing people to add C libraries (including their own they write) and manage, build, and flash their boards is quite nice. Its a bit different to how Nesper sets up its project, so I reckon a secondary template project is the way to go. Wrote my own tasks too, just to be sure. Honestly one thing I'd love to do is see if I can get Nim calling the ESP32 toolchain itself: compile out to object files and just have CMake link them, rather than the current --compileOnly:on approach. Might be more trouble than it's worth though! Also, I have full JTAG debugging (including breakpoints in the Nim source) working remarkably well!
- elcritch 5y agoThat's awesome! I'd definitely be open to PRs for Nesper. Long term I think even a pure Nim RTOS would be awesome too complete with cross compiling and linking. Let me know if you ever get a chance to do a writeup for using JTAG with Nim and ESP32's. I've never tried it, but it'd be cool to show it to people.
- randyrand 5y agoFor desktop definitely, but for ESP32 GC is ofc pretty rare. You have ~350KB of ram, and usually 100-200 of that is for the wifi stack, bluetooth stack etc. Normally you want direct control of memory.
- krasin 5y agoMicropython is actually great on ESP32 despite having GC and unless heavy number crunching / camera stuff happening, it feels to be the a really good tool for the job.
- tyingq 5y agoThere are also the ones with PSRAM, where you seem to be able to ps_malloc() about 4MB of it.
- girvo 5y agoDepends on the “GC”. Reference counting (plus actual memory management) has worked really well for me on the ESP32
- pjmlp 5y agoMore than enough when compared with an IBM 704 mainframe.
- the__alchemist 5y agoI'm with you - I think it's a great fit for low-level things where you'd normally use C. (including embedded), but don't see a compelling reason to use it for a web server.