nesper
embedded-hal
Our great sponsors
nesper | embedded-hal | |
---|---|---|
9 | 11 | |
179 | 1,775 | |
- | 4.5% | |
2.8 | 8.7 | |
about 1 month ago | 3 days ago | |
C | Rust | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
nesper
- Show HN: Program ESP32s in Nim
-
Microsoft DeviceScript – TypeScript for Tiny IoT Devices
I use Nim on embedded precisely for that reason: https://github.com/elcritch/nesper
I wtapped much of zephyr as well but that ones less used: https://github.com/embeddednim/nephyr
-
Nim 2.0.0 RC2
Nim supports both since it compiles with pretty much any C89 C compiler. Also https://github.com/elcritch/nesper :)
-
Introduction to Embedded Systems Programming (Ada)
Checkout Nim! I've used it to great effect for embedded programming. It has memory management system based on non-atomic reference counting (arc) so its fast and deterministic. It has optional cycle collection too (orc). Its easy to mixin manual memory as well.
I used F# a bit and learned a lot from it, and the same with Elixir. Nim is procedural it has an "enlightened procedural" take that feels like functional programming in some ways. Partly thats due to the very powerful type system - for example Nim lets you define custom distinct (not aliased) number types just like F#. Nim also inherits a fair bit from Pascal and so shares points with Ada like ints with custom ranges. Theres some rough points, but largely its made me enjoy programming again.
The esp32 is a good route since they're easy to setup. I wrote a wrapper for esp-idf which is used in production in at least two embedded shops: https://github.com/elcritch/nesper
You can run it on Arduinos as well. Theres a pure Nim setup called Ratel and a rp2040 wrapper too. :)
-
Ask HN: Who is using C++ as the main language for new project?
You should checkout Nim! I use it extensively on embedded. Nim is fantastic to program in if you're an experienced C/C++ developer. Its safer and smarter but not not pedantic about it.
Nim compiles to C or C++ so its easy to use on any embedded platform and compiler suite. Thats still huge for embedded. Rust forces a type-trait centric programming style which makes interfacing hardware/embedded harder as you have to make type heavy HALs everywhere -- hence the lack of rtos & library support despite its relative popularity).
Its pretty trivial to re-use any C/C++ libraries which gives a big boost to the native ecosystem. I wrapped most of the esp32 idf in a few weeks: https://github.com/elcritch/nesper
The new GC (ARC) is basically a built in `shared_ptr` or `Rc`. You can also do stack-based programming too and the compiler enforces a safe memory accesses. The performance is great and can match or beat C/C++ if you do a few hours of tuning. Though its easy kill performance if you're lazy (e.g. parse json into a bunch of heaps objects), but that can have its place.
-
Launching the 2021 Nim Community Survey
I would really like to see more work on improving the use of Nim for programming microcontrollers. I stumbled on to https://github.com/elcritch/nesper recently and it looks neat, but I had issues getting my code to compile. Improved support for other MCUs like the esp8266 and atmega32u4 would be really cool and useful. It would be nice to have Nim as a higher level alternative to micropython or lua in the embedded world (your only other real alternatives being C/C++ or Rust).
I also found this https://disconnected.systems/blog/nim-on-adruino
-
Nim Version 1.6 Released
Well no language is perfect, but Nim can be used in almost every domain because of it's compilation targets(C, C++, JS) and it's fast compile times(who needs interpretation when compile times are that fast!):
* Shell scripting, I still assume most people will just use Bash tho: https://github.com/Vindaar/shell
* Frontend: https://github.com/karaxnim/karax or you could bind to an existing JS library.
* Backend: For something Flask-like: https://github.com/dom96/jester or something with more defaults https://github.com/planety/prologue
* Scientific computing: the wonderful SciNim https://github.com/SciNim
* Blockchain: Status has some of the biggest Nim codebases currently in production https://github.com/status-im?q=&type=&language=nim&sort=
* Gamedev: Also used in production: https://github.com/pragmagic/godot-nim and due to easy C and C++ interop, you get access to a lot of gamedev libraries!
* Embedded: this is a domain I know very little about but for example https://github.com/elcritch/nesper or https://github.com/PMunch/badger for fun Nim+embedded stuff!
Most of the disadvantages come from tooling and lack of $$$ support.
-
Why doesn’t V8 fit on my microcontroller?
Not quite sure if I follow what you're saying. As in Tasmota/Berry do or do not do more than provide I2C/SPI?
> If one wants to do serious stuff they would use an appropriate RTOS and program it in C.
It's unfortunate, but still largely appears to be the case. I find C very time consuming to program, so I ported Nim to FreeRTOS [1]. It's _very_ nice being able to go from writing highly optimized ISR functions to high level JSON parsing in one language. Add in defaulting to memory safety but with no pause-the-world GC. I tried Rust but it seems more difficult to integrate into existing world RTOS'es, flashers, Swagger debuggers, etc.
Though, I've been curious what running a WASM VM would be like? One could integrate any language: C++, C, Nim, Rust, etc. Would be interesting.
> MongooseOS does more than this if we're talking ESP32, also other devices, Javascript, C, C++, commercial support, cloud based OTA upgrades and integration with AWS, Azure, Google and IBM Watson IoT cloud services.
MongooseOS does seem interesting, but very targeting a niche market with prebuilt needs? For future RTOS'es I think ZephyrOS [2] has a lot of potential given it's now supported by NXP [3], TI, and others but is independent of any given (cloud) vendors or other IoT companies. Some might not like the CMake based build system, but in my view all the RTOS build systems are terrible in their own special way.
1: https://github.com/elcritch/nesper
- uLisp
embedded-hal
-
Announcing the new async-hal! Featuring embedded IO traits and new interrupt-based executor
What is the difference between this and https://github.com/rust-embedded/embedded-hal/tree/master/embedded-hal-async?
-
Introducing async-hal! A hardware abstraction layer for embedded devices with futures
Maybe worth mentioning if you (or someone else) hasn't seen it before, the embedded-wg is also working on an async version of the embedded-hal traits, embedded-hal-async.
-
Microsoft is rewriting core Windows libraries in Rust
In that case you want to keep most of the unsafe in the HAL crate, and expose an interface as safe as possible. To give you an idea, is it since 2018 that a "generic" DMA safe implementation is in discussion https://github.com/rust-embedded/embedded-hal/issues/37
-
Stop Comparing Rust to Old C++
Does something like embedded hal exist in the C/C++ world? ( https://github.com/rust-embedded/embedded-hal )
-
not entirely new to rust, but very new to rust+arduino,.... eli5 the differences between these projects?
worth mentioning also is embedded-hal but my understanding is this has absolutely nothing to do with arduino, so despite being embedded probably not what I want.
-
Google announce secure Rust-based OS for embedded system
The ecosystem is great and growing, It really benefits from a language-standard embedded HAL which makes writing cross-platform drivers a cinch - e.g., you can write a bit-banged MDIO driver and use it on anything that has a timer and a two IO pins, from a Zynq Ultrascale to an arduino. Sure, this is possible in C - but Rust really benefits from a less fragmented ecosystem here.
-
Want to volunteer for your projects
Have you thought about writing/contributing to embedded-hal compatible crates (a sensor module driver for example)? It's always good to contribute to an eco system.
-
STM32F4 Embedded Rust at the HAL: GPIO Button Controlled Blinking
📝 At the time of writing this post, it came to my attention that there is an additional HAL that targets STM32 device families (the stm32-hal). From what I figure, right now there seem to be two approaches for developing HALs. The first approach is trait driven so to speak where the embedded-hal is used as a foundation. The second approach is more application-driven and provides a high-level API that targets several families of a device. However, this exists only for the stm32 through the stm32-hal. Right now, the first approach is what I found to be more widespread as it covers different microcontrollers and what this post is based on.
-
Why doesn’t V8 fit on my microcontroller?
I can write a library for an OLED device that is driven by an platform agnostic I2C device that will run on any microcontroller that implements the necessary abstractions.
The `embedded-hal` (https://github.com/rust-embedded/embedded-hal) are these abstractions that allow this to happen
-
Hands-On: The RISC-V ESP32-C3 Will Be Your New ESP8266
Yes but there needs to be appropriate libraries available such as HAL. Well it doesn't have to but it makes my life as a beginner in both much easier. But its probably matter of time because i predict that this chip will be very popular in Rust embedded.
What are some alternatives?
quickjs-esp32 - QuickJS port for ESP32
nim-esp8266-sdk - Nim wrapper for the ESP8266 NON-OS SDK
microzig - Unified abstraction layer and HAL for several microcontrollers
ecl
bl602-hal - Hardware Abstract Layer for BL602 RISC-V WiFi + BLE SoC in embedded Rust
ulisp - A version of the Lisp programming language for ATmega-based Arduino boards.
esp8266-quickjs - An attempt on getting QuickJS working on ESP8266 hardware
Nim - Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
embassy - Modern embedded framework, using Rust and async.
Lua-RTOS-ESP32 - Lua RTOS for ESP32
qemu_esp32 - Add tensilica esp32 cpu and a board to qemu and dump the rom to learn more about esp-idf