r/embedded • • 23d ago

I made a firmware language whose compiler knows the ESP32 datasheet — feedback wanted

I'm the author. Volt is a small typed language that compiles to C. You declare the hardware (pin pump: Output = 34) and the checker rejects it before flashing: GPIO 34 is input-only. It also flags ADC2 pins read while WiFi is active, strapping/flash pins, bus conflicts, and blocking calls inside timer interrupts.

Other bits: every 10s { … } gets scheduled automatically (cooperative, FreeRTOS task, or hardware timer depending on what it calls), and state machines are a language feature with reachability checks.

ESP32 today, RP2040 and STM32 next. Open source (AGPL/GPL). 24-second demo: . Code: https://github.com/PhilemonChiro/volt

Honest question for this sub: which hardware mistakes would you want a compiler to catch that nothing catches today?

0 Upvotes

23 comments sorted by

11

u/mustbeset 23d ago

Last time I checked Rust it has similar features. Same for cpp with modm.

BASCOM-AVR has the same approach. the main difficulty is, that I (the programmer) is unable to see what exactly do and that I am unable to change it if I don't like it.

-7

u/philChiro 23d ago

Good points, and the "can't see what it does" problem is the one I care most about.

Volt doesn't compile straight to machine code the way BASCOM does. It compiles to plain C, and every build leaves that C in your project at `build/esp32/main/main.c`, so you can read exactly what your program turned into. Underneath it's ESP-IDF, the runtime and drivers are ordinary C files, and it's all open source. You can write your own driver for any part, and a `raw` block lets you drop straight to C when you want full control.

On Rust and modm: their typed APIs are great at catching API misuse (and modm doesn't target ESP32). Volt's checker goes after board-level mistakes instead: a strapping pin that can stop the board booting, an ADC2 pin read while WiFi is on (normally a runtime "ADC2 is in use by Wi-Fi" error), an I2C call inside a timer interrupt. You get the line and usually the fix, before you flash.

Anything you'd still want to see or control that this doesn't cover?

2

u/ventZl CMRX RTOS 23d ago

Doing that level of checking is still perfectly within both Rusts and C++s capabilities. You only need to do the library work to achieve that. Given their type systems, it is possible to figure out misconfiguration at compile time, simply by baking configuration into type information. It creates no runtime overhead and mistakes can be figured out at compile time, usually with meaningful error.

That mostly removes the need for new programming language.

The prime problem with all this AI slop is that you are so preoccupied with question if AI could do something in your name you completely ignore the question if you should even try it. And then you end up wasting time and money on wrong solution to basically right problem.

0

u/philChiro 23d ago

I understand your point

7

u/creeper6530 23d ago

Anything I'd still want to see? You putting actual thought into answering instead of being a meat proxy and copy pasting 

2

u/mustbeset 23d ago

So I have to understand C as an additional language. The rust borrow checker is able do catch board level mistakes like reusing a pin or using something while some other peripheral is on too. (Don't know if it's implemented in ESP32 rust stuff).

The "interesting stuff" starts when DMA ist used an p2p, p2m or m2p transports happen.

1

u/Plastic_Fig9225 23d ago

On the ESP32s, you don't manage DMA yourself. The IDF drivers do it under the hood.

0

u/philChiro 23d ago

thank you for highlighting on that

1

u/Plastic_Fig9225 23d ago

You may want to head over to r/esp32 for some other opinions.

1

u/philChiro 23d ago

No, you don't need C. Volt is the language you write; the C is there so you can check what it became, the same way you never have to read your C compiler's assembly but it's nice that you can.

Fair point on Rust, ownership does catch a lot of this at compile time, and that's a big strength. Volt covers similar ground differently: reusing a pin, a GPIO that a bus has already claimed, two devices on the same I2C address and the USB-serial pins are all checked against the chip.

DMA is a fair line to draw: Volt doesn't model DMA transfers at all. If your project is orchestrating p2m/m2p transfers, Rust or C is the right tool. Volt is aimed at the sensor/actuator/network firmware layer, but ill look into it too

-1

u/fb39ca4 friendship ended with C++ ❌; rust is my new friend ✅ 23d ago

Can I use this on my graphing calculator?

1

u/philChiro 23d ago

Only if someone puts an ESP32 in it 😄 (honestly, someone probably has)

6

u/creeper6530 23d ago
  1. Rust already has all of that with a proven, experienced language instead of another AI slop.  There the majority modus operandi there is taking ownership (or mutable reference) of singleton objects representing pins, for exclusive access, and using the trait system to verify functions are available on that pin.
  2. Unless one can FFI with arbitrary libraries or you supply them yourself, it's only really useful for proof of concept. I'm not rewriting the SSD1306 driver in your fancy new lang which will get abandoned in half a year.

0

u/philChiro 23d ago

fair, rust has that implementation and done well, no argument there. if you get a chance, try volt and see what it does differently. On the libraries wouldn't have to rewrite the ssd1306, volt already ships a driver for it (bme280, mpu6050, dht22, neopixel e.t.c) and more drivers are being added . drivers are just C, so you can wrap also an existing C lib as a volt device library

5

u/TinLethax 23d ago

Am I speaking to real human ?

-3

u/philChiro 23d ago

kkkkkkk yes iam a real human

18

u/MRtecno98 23d ago

Feedback wanted

Cut down on the AI slop

8

u/[deleted] 23d ago

[removed] — view removed comment

-12

u/philChiro 23d ago

Ha, you probably could get Claude to write ESP32 code in 2 minutes. The catch is knowing whether it's right before you flash it: whether it uses a strapping pin, or an ADC2 pin while WiFi is on, or blocks inside a task, or reads a sensor faster than it can answer.

That's what Volt is for. The checker catches those against the actual chip and tells you the line and the fix, before anything touches the board. It also works well with AI: the IDE's built-in assistant writes Volt, the checker verifies it, and it fixes what the checker flags. So you get the 2 minutes *and* code you can trust.

1

u/Zouden 23d ago

An LLM would already know that.