rustembeddedattiny

Progamming inside a Attiny85 with rust


Introduction

I created a small project that uploads C++ code to an Attiny85, for this I used arduino.

Question

But I would have liked to know if it was possible to download and run rust code in Attiny85 or other Attiny. If we can, how do we do it?

Details

I found this GitHub repo to do this, but it is not explicit on how can export the rust code to Attiny. The GitHub repo in question: https://github.com/q231950/avr-attiny85-rust?ref=https://githubhelp.com


Solution

  • C++ is cross-compiled to AVR machine code on your development host. What you are loading is not C++ code; that is the source code used to generate the machine executable binary code, which is what you load..

    You can develop for AVR using any language for which a cross compiler exists. Rust is certainly such a language. This article discusses using Rust on Arduino Uno hardware.

    Whether ATTiny85 with only 8Kb of Flash and 512 bytes of SRAM will support a Rust runtime environment and any useful code I cannot tell; I am not familiar with Rust's runtime requirements, but it does not seem like an efficient use of limited resources to me, and I would treat it as an academic challenge rather than a practical development approach. I would expect Rust to have a considerably larger run-time footprint than C or even C++.