llvm-project
avr-hal
Our great sponsors
- Onboard AI - Learn any GitHub repo in 59 seconds
- InfluxDB - Collect and Analyze Billions of Data Points in Real Time
- SaaSHub - Software Alternatives and Reviews
llvm-project | avr-hal | |
---|---|---|
331 | 30 | |
23,127 | 1,061 | |
2.9% | - | |
9.5 | 0.0 | |
3 days ago | 1 day ago | |
C++ | Rust | |
GNU General Public License v3.0 or later | 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.
llvm-project
-
Why don't these two functions get optimized the same way?
I just reported this one, for instance! https://github.com/llvm/llvm-project/issues/73999
-
Why do lifetimes need to be leaky?
C++ compiler which compiles the Rust as if it were C++ (LLVM).
-
Codebases to read
If you want something much larger, getting the gist of https://github.com/llvm/llvm-project could be useful. Not only is it cleanly written, but then you'll understand your compiler better!
-
Potential of the Julia programming language for high energy physics computing
> OTOH, the existence of an ISO standard with multiple implementations can benefit the portability and longevity of code.
This is true for ISO standards that actually standardize features. Fortran's standard, since F'90, has instead been inventing features, and doing so without prototyping in actual implementations. And without supplying standardized test suites to guide those implementations. The results, in actual practice, have been at best mixed. There are features that are "standard" but not at all portable, due to spotty and divergent implementations, and there are portable features that are not standard. Some features have been in the language for >=20 years without yet appearing in popular compilers.
So yes, standardization (ISO or otherwise) can be a good thing. But it hasn't really been so for Fortran. And I think things are getting worse; F'2023 has changes in it that actually silently change the behavior of existing standard-conforming code, which would have been viewed as an abomination in earlier days.
References: see the LLVM Flang documentation on extensions, non-standard features, &c. in https://github.com/llvm/llvm-project/blob/main/flang/docs/Ex... and a suite of various incompatible feature tests in https://github.com/klausler/fortran-wringer-tests .
-
Fortran 2023 has been published
flang [1], it's part of the LLVM project.
- C++ Specification vs Implementation
-
Bring garbage collected programming languages efficiently to WebAssembly
LLVM isn't a virtual machine, but WASM is.
That's obviously a common misconception given the name -- LLVM was meant to be a VM early in its life, but never was, and isn't now. It's clarified in the first sentence of a home page - https://llvm.org/
It's basically a bunch of C++ libraries that implements an IR that changes over time, which help you write compilers.
Curiously, I think a decade or more ago there was a project at Google targeting the same space as WASM which made this mistake. They thought LLVM was a virtual machine! That was PNaCl or something.
I guess it's a little like LuaJIT freezing Lua at Lua 5.1 -- Lua was never a standard, but for the purposes of re-implementation, a specific version of it can be frozen. (But there are obvious problems with that approach, namely that the re-implementers don't know about all the bugs they're also freezing in time.)
---
I have raised some eyebrows at the "compromises" of WASM, but the once thing that you can't doubt is that it is in fact a virtual machine !!!
I watched a talk on the WASM GC, and the creators were up front about the compromises (e.g. you will need runtime casts at first, with the measured overhead being reasonable), which gives me more confidence in it:
https://old.reddit.com/r/ProgrammingLanguages/comments/17crk...
-
Glibc Dynamic Loader Hit by a Nasty Local Privilege Escalation Vulnerability
The fact that they haven't rewritten glibc's string parsing wouldn't make their criticism wrong.
If all of glibc had been written in assembly for every single target triplet, one wouldn't be wrong to point out that there was no benefit to doing that instead of writing it in C, and that it probably took more work and was more error-prone, even if they weren't willing to help port said code to C.
Just the same, they could have written this in C++.
Much of LLVM's libc is written in C++ with exposed C bindings (or all, I haven't checked 100%). For example, their libc stdio implementation is completely in C++.
https://github.com/llvm/llvm-project/tree/main/libc/src/stdi...
You could say the same thing about Rust and Relibc, but it seems much less likely that a C project would incorporate Rust than that it would incorporate C++.
-
Fiber in C++: Understanding the Basics
C++ ABI has some per-thread globals: the number that is returned from std::uncaught_exceptions(), and the chain of currently caught exceptions. For example in llvm this is available with a cxa_get_globals call:
https://github.com/llvm/llvm-project/blob/b05f1d93469fbd6451...
These need to be saved/restored when switching fibers, otherwise fiber switches from catch clauses (and destructors!) are unsafe, throw without argument may rethrow incorrect exception, code that commits/rollbacks based on uncaught exceptions counter will not work correctly, etc.
One example I know where this save/restore is implemented is the userver framework, but it seems to be unexpectedly rare in fiber implementations last time I looked.
-
Changing the Rules of Rust
I think you're correct that it's a big problem that the serious compilers don't actually have coherent internal behaviour, but I think that's a distinct problem which has been masked by the provenance problem in C and thus C++. It meant that real bugs in their software can be argued as "Works as intended" pointing to DR260 rather than anybody needing to fix the compiler.
For LLVM the effect of Rust has been to drag some of these issues into the sunlight, as it did for aliasing problems previously. https://github.com/llvm/llvm-project/issues/45725
Once the GCC work is closer to finished, I expect we'll see the same there.
I disagree that you need to solve the C problem first to solve the compiler problem, and I think it was misguided to start there. You seem to have focused on the fact that exposure is even an option in Aria's implementation, but let me quote: "The goal of the Strict Provenance experiment is to determine whether it is possible to use Rust without expose_addr and from_exposed_addr". Setting PNVI-ae-udi as "the" provenance rule is your end goal for C, but there's a reason it's called the "Strict Provenance" experiment in Rust, the goal is something like what you call PNVI-plain.
APIs like map are key to that goal, Rust has them and N3005 does not.
So like I said, rather than just being a "translation" I think the most that can be said is you've got the same problem albeit in a very different context, and your solutions are related in the way we'd expect when competent people attack similar problems.
avr-hal
-
Arduino Uno issue with interfacing with a dht11 sensor.
/* * For examples (and inspiration), head to * * https://github.com/Rahix/avr-hal/tree/main/examples * * NOTE: Not all examples were ported to all boards! There is a good chance though, that code * for a different board can be adapted for yours. The Arduino Uno currently has the most * examples available. */ #![no_std] #![no_main] use dht_sensor::*; use panic_halt as _; #[arduino_hal::entry] fn main() -> ! { let dp = arduino_hal::Peripherals::take().unwrap(); let pins = arduino_hal::pins!(dp); let mut serial = arduino_hal::default_serial!(dp, pins, 57200); let mut pin3 = pins.d3.into_opendrain_high(); let mut delay = arduino_hal::Delay::new(); ufmt::uwriteln!(serial, "{}", "waiting for sensor...").unwrap(); arduino_hal::delay_ms(2000); loop { match dht11::Reading::read(&mut delay, &mut pin3) { Ok(dht11::Reading { temperature, relative_humidity, }) => ufmt::uwriteln!(serial, "{}°, {}% RH", temperature, relative_humidity).unwrap(), Err(_e) => ufmt::uwriteln!(serial, "Error {}", "Unable to read").unwrap(), } arduino_hal::delay_ms(2000); } }
-
What are the scenarios where "Rewrite it in Rust" didn't meet your expectations or couldn't be successfully implemented?
I found the generics a lot less of a problem when I realized I could parametrize on things like embedded_hal::serial::Write instead of UsartOps https://github.com/Rahix/avr-hal/pull/264/commits/17ed15321cb8fcf8aedb1f8133be1f189eb06a6f
-
not entirely new to rust, but very new to rust+arduino,.... eli5 the differences between these projects?
I've come across avr-rust, avr-hal and both seem to have arduino stuff, wondering which is the most beginner friendly? (I have a bit of experience with the regular arduino IDE but want to switch over to doing all the stuff in rust for a challenge)
-
Hey Rustaceans! Got a question? Ask here (1/2023)!
fyi, a minor follow-up at https://github.com/Rahix/avr-hal/issues/388
-
Rust and arduino?
I have contributed a little to this. avr-hal I have done a couple little hobby projects with it as well, but I can't say it's the best thing out there.
-
Learning Embedded rust
All you need is in the documentation: https://rahix.github.io/avr-hal/arduino_hal/index.html even though reading the documentation without knowing what you're looking for can be quite difficult, so looking at some examples might be more helpful.
Embedded rust for the arduino boards: https://github.com/Rahix/avr-hal
-
Five simple steps to use any Arduino C++ library in a Rust project 🦀
Rust language shares all advantages of efficient C++ code. With the rust community growing year after year, more and more people try using rust to program their Arduino boards. Consequently, the Arduino Rust ecosystem have significantly developed in the last couple of years. The Hardware Abstraction Layer for AVR microcontrollers avr-hal, Rudino library and ravedude CLI utility to make Rust development for AVR microcontrollers easier are just a few examples of the solid foundation developed so far.
-
From arduino to rust via avr-hal
There's a blink example in the repo for the avr-hal crate.
What are some alternatives?
zig - General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
avrd - AVR device definitions
gcc
rust - Rust for the xtensa architecture. Built in targets for the ESP32 and ESP8266
Lark - Lark is a parsing toolkit for Python, built with a focus on ergonomics, performance and modularity.
SDL - Simple Directmedia Layer
cosmopolitan - build-once run-anywhere c library
ruduino - Reusable components for the Arduino Uno.
STL - MSVC's implementation of the C++ Standard Library.
Graal - GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
skia - Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.
windmill - Open-source developer platform to turn scripts into workflows and UIs. Fastest workflow engine (5x vs Airflow). Open-source alternative to Airplane and Retool.