Тёмный

Rust Runs on EVERYTHING, Including the Arduino | Adventures in Embedded Rust Programming 

Low Level Learning
Подписаться 595 тыс.
Просмотров 122 тыс.
50% 1

LOW LEVEL RUSTACEANS! Welcome back! In today's video we discuss embedded rust. Specifically, we create our own Rust crate that uses the AVR HAL, and we write our own Blink LED code for the Arduino. Rust is an incredible programming language that gives the programmer the power of memory safety and performance on embedded systems.
🏫 COURSES 🏫
www.lowlevel.academy/courses/
LINKS:
LLL Merch: linktr.ee/lowlevellearning
Buy the Arduino Here: amzn.to/3uyLbdO
Learn Rust with this Book!: amzn.to/3upEydx
Embedded Rust: docs.rust-embedded.org/book/
AVR HAL: github.com/Rahix/avr-hal
AVR HAL Cargo Template: github.com/Rahix/avr-hal-temp...
SOCIALS:
Follow me on Twitter: / lowlevellearni1
Follow me on Twitch: / lowlevellearning
Join me on Discord!: / discord

Наука

Опубликовано:

 

5 фев 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 198   
@NoorquackerInd
@NoorquackerInd 2 года назад
How did you say 92d540c wrong twice but type it correctly
@LowLevelLearning
@LowLevelLearning 2 года назад
I just watched this and spat out my coffee XD I have no idea.
@nodge9671
@nodge9671 2 года назад
Muscle memory
@milespiano
@milespiano Год назад
@@nodge9671 Not a real thing
@DevArt59
@DevArt59 Год назад
Blew my fkn mind
@DatMilu2K
@DatMilu2K Год назад
@@milespiano ??? XD
@atalocke
@atalocke 2 года назад
Make sure you’re putting -release on your production builds for optimization,no debug info. I’m sure you know but it could be a good thing to show for anyone watching who hasn’t read the cargo book.
@cerulity32k
@cerulity32k Год назад
Also binary size. For microcontrollers, flash space is critical.
@Cobalt985
@Cobalt985 3 месяца назад
@@cerulity32k yeah he even mentioned that he said "600k wow pretty big" yeah cause it's got all the debug hooks lmao
@electrocuted5010
@electrocuted5010 2 года назад
FYI, an easier way to flash the code onto your board is ravedude. It does most of the magic for you, including detecting the post and such
@LowLevelLearning
@LowLevelLearning 2 года назад
Good to know, thank you!
@jimcrowjoe451
@jimcrowjoe451 2 года назад
Awesome video. Seems that there is just a lot of hacks to be able to get started using Rust on embedded. Hopefully it gets more straightforward as time goes by.
@LowLevelLearning
@LowLevelLearning 2 года назад
Yeah I found the project setup pretty clumsy. Luckily Rahix has a template you all can use for your projects.
@Dygear
@Dygear 2 года назад
I generally agree with this comment. There’s just not as much polish here as there is with other areas of rust. None of the knowledge is all in one place. That’s why I’m so excited for LLL (or L3?) to take on this topic. He’s clearly a bright guy good at explaining things, including the dusty corners.
@jhaand
@jhaand 2 года назад
I'm already glad it's this much clearer. While doing the Rust embedded book in 2019, there was a lot more things to get a hold of. Like for instance the STM32F303 board. Now I can just grab an Uno or Nano that I have lying around and actually use. The source code has also gotten a lot more compact.
@m.sierra5258
@m.sierra5258 2 года назад
The Knurling Project is actually pretty hot. It kind of gives you "compile", "flash", "debug", "forward log/output" and other things out of the box. It still does require an understanding of how embedded rust works in general, of course.
@MarkusBurrer
@MarkusBurrer 2 года назад
Please note: Arduino is not AVR! Yes, most Arduino use AVR controllers, but also ARM. AVR controllers are also used outside the Arduino world.
@HermanWillems
@HermanWillems 2 года назад
Just wondered how Rust would work on AVR (As the CPU is not into the LLVM of the Rust compiler) only ARM-Cortex etc is.
@MarkusBurrer
@MarkusBurrer 2 года назад
@@HermanWillems Rust works on AVR, but as far as I know it uses some parts from the AVR GCC toolchain. At least the linker
@TheChrisey
@TheChrisey Год назад
Arduino is just a a collection of libraries and a simple IDE, like a sandbox for beginners. Of course Arduino didn't make AVR, they're just using the old chip on their branded PCBs
@smnomad9276
@smnomad9276 2 года назад
The content is soooo original! All your videos are great! Thank you and keep doing what you're doing 🙏🏻 This channel will grow FAST 🔥
@DenisD3D
@DenisD3D 2 года назад
I expermiented this myself a few days ago and i found that there isn't enough tutorial / example online for a still beginner in rust to create programm other than blink More video on advanced concept on this would be awesome (Serial, ...)
@randomrandom8944
@randomrandom8944 2 года назад
I wanted to add a note that people don't HAVE to type "rustup override set nightly-2021-01-07" in order to have the code built. The good part about it is that you sure as heck need to have a nightly toolchain, but everything after nightly-2021-01-07 would work, so you could've just ran "rustup override set nightly" which would've instead installed the latest nightly build available and overrided the project with it. Other than that, amazing content
@octoBadger
@octoBadger 10 месяцев назад
Thank you, this was my main question watching the video in 2023 :)
@9SMTM6
@9SMTM6 2 года назад
It does in fact not really run on everything. Yet. The platforms that you can target with the default rustc are limited to at most these supported by LLVM, and many device manufacturers don't provide a LLVM backend. But there's hope that 1) device manufacturers getting better about llvm support and 2) rust is getting a compiler with gcc backend / a gcc frontend, which is in fact getting worked on right now. Other than this yeah, Rust has very much the capability of running on pretty much everything. All that's lacking is tooling at times. Because of the work for the Linux kernel we're even getting fallible allocation APIs, which make using the alloc crate (Box, Vector, Hashmap etc) on top of just core (Result, Option etc) a possibility for many embedded devices.
@saturdaysequalsyouth
@saturdaysequalsyouth 2 года назад
I agree. The title really confused me. Rust isn't a supported target on all the platforms we use at my job.
@acsarda
@acsarda 2 года назад
can you handle interruptions with Rust? Because thinking in something "more complex" than blinking a led, I'd rather use an interruption
@apocalypseio
@apocalypseio 2 года назад
Was neat to have a peek at the avr-hal. Looks like there is some support for the Adfruit Trinket. Will be interesting to see what can fit on that tiny package.
@kenrod6643
@kenrod6643 Год назад
I appreciate the video. I just started learning Rust after hearing so much praise. I got my X86 dev environment up and running without any effort. But I must say I was surprised after running into so many "gotchas" trying to get code onto just an Arduino. By comparison getting golang code to run on all my microcontrollers was much more seamless. I think i'll have to wait until things advance before using Rust for my embedded projects. Good content as always.
@chrisobrien7531
@chrisobrien7531 Год назад
The out/debug will have a compiled binary but without --release it will be significantly bigger
@Wandering_Horse
@Wandering_Horse 2 года назад
Pretty cool. I am looking to get into the embedded automotive space. I have been looking at C, Ada/Spark and Rust. C and Ada are both very mature and well used in the embedded space. But I do see the potential in Rust. I appreciate your videos, thanks!
@erikjvanderveen
@erikjvanderveen Год назад
I don't know much about Rust, but isn't one big advantage that Rust will not have Runtime Errors. All errors are handled by the compiler. Leaves only errors in logic. But in embedded that seems like a big advantage to me, because runtime errors are hard to track afterwards.
@victormikecharlie1596
@victormikecharlie1596 Год назад
C is your best choice.
@zaper2904
@zaper2904 9 месяцев назад
@@erikjvanderveen That is just factually incorrect mate what do you think the panic handler is for?
@erikjvanderveen
@erikjvanderveen 9 месяцев назад
@@zaper2904I was just echoing what I heard in previous video on Rust. Stating that one of the advantages of Rust compared to C(++) would be that it would be nearly impossible to write code that would give a runtime error. How this would be achieved, I don’t know. If you say there is a panic handler, then obviously it’s eiter a useless thing, or it’s there to handle runtime errors. I guess you might just be right. Maybe if there comes a time that I will learn Rust, I will find out. For now I’m to busy writing c# and typescript professionally and doing some c(++) for hobby
@gabiold
@gabiold 3 месяца назад
@@erikjvanderveenDiv by zero? Just to name one very obviously possible one.
@DLSDKING
@DLSDKING 2 года назад
A topic of suggestion would be speed of execution(RUST vs C vs ASM) in the embedded controllers for the rust series.
@Dygear
@Dygear 2 года назад
And for sake of completeness the time it takes to actually write the code as far as programmer time. Because I think you’ll find you will get fairly close to rust for an order of magnitude less time writing it.
@9SMTM6
@9SMTM6 2 года назад
I think benchmarking battery or memory consumption would be a more fitting benchmark. You're rarely ever going to need performance on these chips, if you're driving them to the limit and not currently revising a cheaper version of a well sold device you're probably doing it wrong - and at that point you can afford to rewrite it in assembly or whatever if you need it. Most of the time at worst you send updates a little slower, who cares. Meanwhile running out of memory is a real issue, and if you're trying to run devices on battery, or generally around the clock, energy consumption is very relevant.
@brendanhansknecht4650
@brendanhansknecht4650 2 года назад
@@9SMTM6 I think performance should work as a good proxy for battery usage. Generally speaking, if your code isn't running, the processor can idle/sleep/standby/etc. So that would be a major power savings. Your memory usage comment is 100% accurate. That is the real killer on embedded.
@9SMTM6
@9SMTM6 2 года назад
@@brendanhansknecht4650 probably not the worst, but also not necessarily a perfect indicator, especially with multicore - like the RPi Zero 2 has. But also memory usage tends to influence energy consumption, and unfortunately often not in a linear fashion. Also thinking about it, I think it's easier to measure, well not necessarily battery life, but energy usage correctly and in a realistic environment. For speed though it's harder to measure and might push one to unrealistic scenarios to measure a difference at all.
@crides0
@crides0 2 года назад
@@brendanhansknecht4650 lol try to compare the performance and current for AVR and a simple cortex M0 and you'll have a bad time
@swanandx
@swanandx 2 года назад
Recently discovered your channel and just loved it!
@LowLevelLearning
@LowLevelLearning 2 года назад
Glad you enjoy it!
@nisem0no
@nisem0no 6 месяцев назад
Thanks so much for this! I've been learning Rust as a web dev (so JS/TS/PHP mostly), and it's been quite tough, if rewarding. I came across your video just two days back, and it inspired me to give this a shot as another supplement for learning the language after Advent of Code etc. I'm currently sitting here blown away by all the cool modules in the Arduino kit I got and can't wait to make it do more than blink haha. Maybe a motion sensor by the door that plays a sound. Or making snake on the LED screen. Wish they'd had the newer R4 versions with wi-fi in my country though :/ Thanks again for the great vids! Looking forward to more Rust content 🕺
@y3t_
@y3t_ 2 года назад
Such a small channel with an awesome content. Wish you lots of success
@LowLevelLearning
@LowLevelLearning 2 года назад
Thanks a ton!
@ColaEuphoria
@ColaEuphoria Год назад
If you're on Windows and have Arduino already installed, then you already have avr-gcc and avrdude. Just add it to your PATH. It's usually in C:\Program Files (x86)\Arduino\hardware\tools\avr\bin
@robertpeters9438
@robertpeters9438 Год назад
This reminds me of how we used th threaded list language FORTH to write code for custom military hardware. The ability to construct an arbitrary software architecture for a hardware level architecture and run FORTRAN on top of that was a powerful tool back in the 1980s.
@goowatch
@goowatch 2 года назад
¡Qué buen video introductorio acerca del uso de RUST con AVR/Arduino! Aprovecho para preguntar si has experimentado también con RUST en la plataforma de STM32. Gracias
@arcsine4344
@arcsine4344 2 года назад
Thank for the video. It really helps me a lot.
@johnstanford7240
@johnstanford7240 2 года назад
Love your channel! The Rust Age is coming
@daque1960
@daque1960 2 года назад
Great video. Ever consider a video for the STM32F411 BlackPill? I like it because it has floating point hardware and is pretty cheap too.
@GeekDetour
@GeekDetour 4 месяца назад
Wow! The video is excellent! The whole toolchain to make Arduino programs feels like a nightmare... Once it is all figured out, I can imagine why Rust would be very interesting and productive to use, but, really, I would only use it if there was an IDE that would concentrate and automate the whole thing for me. Arduino IDE will still rule for a while :)
@talhakhalid6302
@talhakhalid6302 Год назад
Good project must try i am learning rust these days
@rockboynton3006
@rockboynton3006 2 года назад
Curious, why did you add the panic-halt dependency (which adds a panic handler), but then implement your own panic handler?
@rallokkcaz
@rallokkcaz 2 года назад
Love the videos!
@shadamethyst1258
@shadamethyst1258 2 года назад
Nice and informative video, although I had a hard time reading the dark magenta text against the equally dark background
@PouriyaJamshidi
@PouriyaJamshidi 2 года назад
I have no experience with Rust nor Arduino but the way you explain things is absolutely comprehensible!
@bluejumpsweater
@bluejumpsweater 2 года назад
Great video!
@SpeedingFlare
@SpeedingFlare 2 года назад
If the binary is 100kb how does it fit on the 32kb flash? Love your content btw!!!
@bubblekill2311
@bubblekill2311 2 года назад
Hello, next could you make a tutorial for screen display or using sensors ?
@cornjulio4033
@cornjulio4033 Год назад
Very interesting. Nice upload speed to the board!
@dwhall256
@dwhall256 2 года назад
In this video, you flashed the AVR. . . did you overwrite the bootloader? did you specify the main() to be put in a section that did not clobber the bootloader?
@LowLevelLearning
@LowLevelLearning 2 года назад
Yup! When you use the Arduino bootloader instead of the ICSP, it doesn’t touch the bootloader section.
@haystackdmilith
@haystackdmilith 2 года назад
I recall it's possible to setup "cargo run" to automatically push the code to the board :)
@activediamond7894
@activediamond7894 2 года назад
Can you please share pointers on how to?
@thegardenofeatin5965
@thegardenofeatin5965 2 года назад
I'm guessing you'd add something to the toml file?
@meanxmeanx1763
@meanxmeanx1763 2 года назад
you should mention something about changing the build options. Especially since you dont have a debugger on the AVR, using vanilla debug yields no benefit except the increased binary size. That's also true for arm &riscv , enabling lto & friends, even for debug builds, makes the code much much smaller.
@meanxmeanx1763
@meanxmeanx1763 2 года назад
and also that using [no_std] means you cannot use 90% of the libraries you may be used to.
@ajdca4331
@ajdca4331 9 месяцев назад
Thanks, the video was awesome!! Do you think I could use Rust for more complex project or a better choise is use C/C++ ?
@RegularFinnishPerson
@RegularFinnishPerson 2 месяца назад
That was a fun ride
@Mike-123
@Mike-123 2 года назад
Thanks for walking through this. I tried doing this very thing probably about a year ago now. With much struggle, I never really got 100% of the way there. I didn't have time to pick it back up since then. Do you, by any chance, have any notes that you could post about how you got your dev environment setup (tools installed, etc)? I never satisfactorily got through all of the "hacks" needed for the Rust toolchain.
@Mike-123
@Mike-123 2 года назад
I guess he has beefed up his readme since I played with it last.
@dillbaggins3291
@dillbaggins3291 2 года назад
Great Stuff!
@LowLevelLearning
@LowLevelLearning 2 года назад
Thanks!
@llf_iran
@llf_iran 2 года назад
It's not really a good idea to override your default toolchain to nightly because you may possibly not need nightly features in most projects. Instead, you can create a file with the name `rust-toolchain` and write your desired toolchain (you can be specific and use the date of the nightly version) in it so it's being used only in that particular project and not every project you may use.
@SF-eg3fq
@SF-eg3fq 2 года назад
glad i found your channel
@zatochiSiberian
@zatochiSiberian 2 года назад
Thanks
@daniel-lb4bh
@daniel-lb4bh Год назад
perfect video You offer rust or C++ as options for someone interested in learning embedded system programming ?
@RetoonHD
@RetoonHD Год назад
Yeah, a very important thing you forgot to mention is --release for a release binary, idk how many takes you did so it's fine but having a pinned comment would be nice.
@conorstewart2214
@conorstewart2214 2 года назад
Just a question about the upload process, at the end it says “5792 bytes of flash verified”, does that mean that that is the total size of the program, because you said the size was 600k before, is that 600k just the elf file and the 5792 bytes the actual size used on the arduino?
@LowLevelLearning
@LowLevelLearning 2 года назад
Exactly! AVRDUDE isn't taking the whole ELF and stuffing it in there, only the necessary program memory.
@matt.loupe.
@matt.loupe. Месяц назад
Can you show us how to run rust on PIC microcontrollers?
@neilfpv
@neilfpv Год назад
The git commit sha you wrote was wrong. Instead of 450c, you wrote 540c. I enjoyed your tutorial. I finished it. How should we prepare the arduino board?
@supersonictumbleweed
@supersonictumbleweed 2 года назад
How does one tell whether a 3rd crate will run with no_std?
@eriklopez996
@eriklopez996 2 года назад
Now with inline assembly update we will be able to seamlessly adapt rust to a greater variety of embedded devices.
@michaeledwardharris
@michaeledwardharris 2 года назад
That was cool.
@lesto12321
@lesto12321 2 года назад
suggestion: use stm32 as they are supported in mainline rust
@jhaand
@jhaand 2 года назад
Great video. I didn't know that Rust for Arduino Uno existed. Unfortunately I couldn't recreate what you built in this video. I gets stuck with: "error: language item required, but not found: `eh_personality`" When I do the cargo build at 08:22. Fortunately the examples by Rahix do compile and upload. Thanks for pointing out this is possible! Keep up the good work.
@sconosciutosconosciuto2196
@sconosciutosconosciuto2196 2 года назад
I have the same problem.. Can you compile your project now?
@sconosciutosconosciuto2196
@sconosciutosconosciuto2196 2 года назад
For anyone wondering I have solved the error 'eh_personality'.. You need to put these lines in your cargo.toml: [profile.dev] panic = "abort" [profile.release] panic = "abort"
@poweriserboy
@poweriserboy 2 года назад
Out of curiosity: A friend of mine is interested in Rust and also has a lot to do with embedded devices, but he hesitates to use Rust there, because he thinks fo his taste there is still way too much C in it. My question would be how it is changing with time or if his argument is already depricated. Love your videos by the way!
@9SMTM6
@9SMTM6 2 года назад
I'm not exactly an expert on embedded, but this sounds very wrong to me. I've admittedly only coded in one "higher-level" language for controllers, that being Micropython, but that one was already showing me the limits. You barely ever have any bindings for compatible libraries (which you need to drive sensors or even networking), and I ran out of memory fast. Python pushes you to a model that is resource intensive. Of you can't find a fitting library with binding for your device you need to use a C library. Rust can do that just fine and easily, Python, and I'm certain most other comparable languages, make that painful. As I said I've got limited experience, but from what I've seen, Rust as a basic language is PERFECT for embedded. Because of no GC or pervasive reference counting it has basically the same memory footprint as C, which is good on memory starved embedded devices (memory costs energy and money... Disproportionately much on embedded). Rust doesnt use exceptions, like C++, but an explicit error model, which can actually run without a heap, and which also means far less debugging, because it's explicit and thus always well documented and easy to spot. Rust has an ecosystem of packages on crates.io that run on "no_std" environments, which is pretty much a necessity on embedded. And because if it's expressive type system libraries have much less gotchas than your typical C library. Even your typical device manufacturer will have a hard time to code a difficult to use Iibrary:).
@roughedge-machineworks
@roughedge-machineworks 2 года назад
Could you strip out the unused parts of the final ELF file here as well?? 600kb is not lightweight for a AVR to be honest. Big reasons I love your Assembler stuff is mainly the final output of it is so damn slimmed down i could just cram extra stuff onto the Pico that the C compiler wouldn't cuz of extra libs it just pulls into support the build.
@LowLevelLearning
@LowLevelLearning 2 года назад
Luckily the whole ELF doesn’t get flashed to the board. Most of that 600Kb is ELF header and debug symbols. AVRDUDE rips out only programmable pages from the ELF and puts them on the AVR.
@nasmmakes
@nasmmakes 2 года назад
Thanks!
@LowLevelLearning
@LowLevelLearning 2 года назад
Thank you!
@PandaEatGRass
@PandaEatGRass Год назад
What os are you using in this video?
@jakemorales7949
@jakemorales7949 2 года назад
Would love to learn next how objects in OOP languages like C++ and Ruby are represented in memory.
@milespiano
@milespiano Год назад
What? How is that even relevant?
@tuxidoyt
@tuxidoyt 2 года назад
Rust Is Winning Me Day by Day.
@Barnardrab
@Barnardrab Месяц назад
Is there a significant performance enhancement by programming directly on the metal instead of on top of Linux or Windows? Can I write a web server that interfaces with PostgreSQL without having an operating system installed?
@dominikkruk5235
@dominikkruk5235 Год назад
Is there any way to do this on windows? Any ide or smthn?
@aldob5681
@aldob5681 2 года назад
where does this json come from? magic....
@dr3d3d
@dr3d3d 2 месяца назад
So... what's in the other 613.12 kb of the elf? Is it all just debug info?
@johnnygotti1568
@johnnygotti1568 2 года назад
After a bit of cussing and carrying on(didn't know about 'profile.release' and 'profile.dev') I finally got it to work. Love your videos man, keep it up!
@bomsh_channel
@bomsh_channel Год назад
Cool video, but i can't compile for some reason it gives me language item required, but not found: `eh_personality` error
@mikeywisniewski
@mikeywisniewski 2 года назад
Excellent.
@LowLevelLearning
@LowLevelLearning 2 года назад
Thank you! Cheers!
@nikos4677
@nikos4677 2 года назад
After dealing with c++ arduino code now i understand why rust is so loved
@amrshatnawi
@amrshatnawi 2 года назад
Is there any reason you didn't do a release build with `cargo build --release`?
@LowLevelLearning
@LowLevelLearning 2 года назад
Not really, I didn't go into the release vs debug for the sake of this video. Wouldn't hurt to do a release!
@Dygear
@Dygear 2 года назад
I do wonder what size the binary would be stripped.
@brendanhansknecht4650
@brendanhansknecht4650 2 года назад
@@Dygear it's 324 bytes for me when building in release. So very reasonable size.
@Dygear
@Dygear 2 года назад
@@brendanhansknecht4650 Wow! That really good!
@NorthEagle
@NorthEagle 2 года назад
Hey bro, love your new Rust videos! Please note that you can make your life way easier if you start using vscode with the Rust plugins. The zooming for recording is also better, since the filetree zooms as well. Keep it up, most of us are new to Rust so what you're doing is great :D Can you maybe explain a bit about the whole memory stack/heap part for embedded?
@deeptangshusaha7793
@deeptangshusaha7793 9 месяцев назад
Help!!!! Trying this on my pc and it just won't compile and I don't even get how to go about debugging it Please create an updated video with latest version of rust. The things on this video does not work anymore. Please!!!!
@hannescamitz8575
@hannescamitz8575 Год назад
Unless I missunderstand that amount of data written, that's insane for such a small function. 5,8KiB for a blinking LED, it's about 800B with Arduinos "C++ thingy" and 300B in C. It's fine on Raspberries and other higher level of embedded systems but not an Atmega 328 or a PIC etc. I get the point of this video that this language can be compiled for enything and it's great in that sense. Keep up the good work.
@vladlu6362
@vladlu6362 Год назад
To clear up your confusion 4 months later, it's just that this youtuber forgot to create a release build and to strip the binary.
@chrisalexthomas
@chrisalexthomas Год назад
But what is the memory use like? since on a microcontroller every byte counts. A binary that is 600KB is a lot of memory for such a small amount of code, so if that has to also be used in memory too. This is way too expensive.
@petermuller608
@petermuller608 2 года назад
Awesome video, struggled with getting rust cross compiling for embedded, too. I don't quite get why we need the gcc-avr Toolchain, isn't rust based on llvm? Or is it used for linking only?
@Polynuttery
@Polynuttery 6 месяцев назад
Still waiting on -release code size.
@InMemoryOfNeo
@InMemoryOfNeo Год назад
awesome 👏👏👏👏👏👏👏
@brianfari9731
@brianfari9731 2 года назад
subscribed!
@talhakhalid6302
@talhakhalid6302 Год назад
Can i do same with python??
@supersonictumbleweed
@supersonictumbleweed 2 года назад
Can confirm, even my grandma's old shed has some rust running in the corner
@CallousCoder
@CallousCoder 2 года назад
I loath the let keyword! Always have in TCL and some Basics. And man, this is fucking involved for such a trivial little thing. It's code is even smaller in bloody assembler! I'd write something this trivial in Assembler with a nice little XOR on the port to toggle it. :D 6K is btw smaller than the 10M you said a runttime would take (as someone in the comments last week also told me). But 600K to toggle a single bit is utterly unacceptable!
@LowLevelLearning
@LowLevelLearning 2 года назад
LOL! Yeah, it was pretty clumsy to get the cargo set up. I highly suggest using the template crate in the description.
@CallousCoder
@CallousCoder 2 года назад
@@LowLevelLearning I highly suggest to use C or Assembler in this case :D
@NormanNodDunbar
@NormanNodDunbar 2 года назад
Nearly 6000 bytes where the Arduino uses around 1000. Seems a tad on the big side to me . Assemnly can do it in 28 bytes! ;-) Still, an interesting series so far, thanks. Cheers, Norm.
@NormanNodDunbar
@NormanNodDunbar 2 года назад
No need to XOR. Just write to the PINx register instead of the PORTx register and it will toggle. Cheers, Norm.
@CallousCoder
@CallousCoder 2 года назад
@@NormanNodDunbar as far as I’m aware there’s no pin operation in avr assembly. There’s just an out opcode that takes a port and a value. Even the sbi and cbi operate on a whole port. It wouldn’t be very RISC if there was either :) Or am I missing something?
@SasteJugaad
@SasteJugaad 2 года назад
I thought you were going to show how I can remove actual rust from my electronics :(
@KangJangkrik
@KangJangkrik 2 года назад
It's now crab rave for rustaceans
@priyammascharak8400
@priyammascharak8400 11 дней назад
Who needs a HAL when you can go bare balls to the metal walls
@metamud8686
@metamud8686 Год назад
I tried to run Rust on my vacuum cleaner, but it didn't work. Perhaps because it's a Microsoft vacuum cleaner: the only product they made that doesn't suck?
@user-hv9pj8lr1r
@user-hv9pj8lr1r 7 месяцев назад
Hi, somebody write Code in RUST for ESP32-2432S08R ? Please share a Example for Display Text / Graphic on the Display please
@disguisedpigeon5465
@disguisedpigeon5465 Год назад
Please, do all of us a favor and set that sublime text border to dark Nice video btw
@gergonagy846
@gergonagy846 2 года назад
This is great and all, and don't get me wrong, this is a really impressive proof of concept project. But isn't the code like... bloated to the Extreme? For me, an embedded project is a challenge, because you have to keep complexity in mind, speed, and yes, code size. Yes, you COULD use a bigger micro, but you also could slap a RPI on and call it a day. What's the challenge in that? Again, this is a great video, and straight to the point tutorial, I just don't see the practicality of it (yet)!
@peircedan
@peircedan Год назад
With only 2K ram I would think one would avoid using the heap. In that case why use Rust?
@basicallybrand
@basicallybrand 2 года назад
I love rust
@thegardenofeatin5965
@thegardenofeatin5965 2 года назад
So, it's hard to tell. Are you going to focus on embedded Rust, or just briefly showcase it and jump to the next thing?
@raptorjesus3396
@raptorjesus3396 2 года назад
I think that rust is a bit problematic on embedded cus because when initializing a rust runtime executable a lot of memory allocated compared to a c rtex. An in-depth analysis of the memory allocations performed can be found under the topic "Investigating Memory Allocations in Rust" by ysantos
@clonkex
@clonkex Год назад
It might do less allocations when you specify no_std... but yeah, it could absolutely cause problems on some small devices.
@devonlamond
@devonlamond 11 месяцев назад
Twice you read the hash revision at 2:55 incorrectly as 45, but wrote it correctly as 54
@devonlamond
@devonlamond 11 месяцев назад
Not judging, just found it interesting.
@E_mosfet
@E_mosfet 11 месяцев назад
i dont get it, i keep getting fetching errors from this repo
@SolathPrime
@SolathPrime 2 года назад
This is absolutely too much effort for something I can do in Arduino c Like why to bother even arduino api is making it too easy that rusting it Is going to be useless
@SALSN
@SALSN 2 года назад
Perhaps if you are making more complicated program and want rusts memory safety features. Or if you are comfortable with rust but not C.
@brandongunnarson7483
@brandongunnarson7483 Год назад
i wish i understood what was going on, maybe someday
@exdcode3369
@exdcode3369 2 года назад
Ahah, low level gang😎
@LabSkaterPussies
@LabSkaterPussies 7 месяцев назад
What's the point? Why would one do this?
@maksimmuruev423
@maksimmuruev423 2 года назад
Why no_main.. but you still have main..crippled one but never the less.. its in there
@metamud8686
@metamud8686 Год назад
You say '450' where it is (and you type) '540'
@joshuaparmenter373
@joshuaparmenter373 2 года назад
Is Rust bloated and slow compared to embedded c? As someone who exclusively uses c for real time embedded applications I am very partial to C compared to anything else, this may just be internal bias but if I see any type of intelligence or memory safety I immediately assume it is going to be slow code.
@mychromebook9935
@mychromebook9935 2 года назад
rust seems like c with safety wheels attached. It probably is much slower
@dynfoxx
@dynfoxx 2 года назад
Rust can be just as fast as c if not faster. Basically its around the same speed depending on application and implementation. Most of rusts checks happen at compile time.
@Sn1per9CZE
@Sn1per9CZE 2 года назад
@@mychromebook9935 What? You haven't really done anything with Rust, have you?
@kurt7020
@kurt7020 Год назад
The runtime performance is same as C or C++. Very often the same exact machine instructions. Memory safety comes from what the compiler refuses to build, not from additional runtime checks.
Далее
malicious javascript injected into 100,000 websites
12:28
когда повзрослела // EVA mash
00:40
Просмотров 1,8 млн
LISA - ROCKSTAR (Official Music Video)
02:48
Просмотров 34 млн
Why i think C++ is better than rust
32:48
Просмотров 275 тыс.
Compiler-Driven Development in Rust
13:11
Просмотров 45 тыс.
Embedded Rust setup explained
23:03
Просмотров 74 тыс.
10 years of embedded coding in 10 minutes
10:02
Просмотров 380 тыс.
All Rust string types explained
22:13
Просмотров 151 тыс.
Rust is not a faster horse
11:37
Просмотров 319 тыс.
YOU can Learn the ESP32 in 15 Minutes:  Hello World!
22:52
Gizli Apple Watch Özelliği😱
0:14
Просмотров 4,1 млн