Тёмный

Embedded Rust's logging sorcery 

The Rusty Bits
Подписаться 18 тыс.
Просмотров 6 тыс.
50% 1

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

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 36   
День назад
you have a great presenting style!
@jaopredoramires
@jaopredoramires День назад
Amazingly presented, love the editing and storytelling and the pace
@jan_the_man
@jan_the_man День назад
Would love to see a non debug probe setup for this. Great video as always!
@MaxWeninger
@MaxWeninger День назад
That's hands down the best beginners tutorial about defmt I have seen so far! Well done
@mikkelens
@mikkelens День назад
I was looking at both ufmt and defmt a few months ago and was wondering what made them so much lighter than std-based options, and this explains it pretty well!
@robonator2945
@robonator2945 День назад
One thing that'd be interesting is hosting the dfmt dictionary on the device itself. You'd lose some of the space savings, but the dfmt dictionary wouldn't need to stay in-ram, and it'd only need to be transfered to the client once. I.e. if you have a microcontroller with 32kb of memory and 512kb of ROM, with each one log message by default being 800 bytes long, each dfmt-ed log message being 4 bytes long, 5000 different log messages, and a 128kb dfmt dictionary, then your usage figures would look like this A : no dfmt - can't run Executable uses at 5000*800 bytes, aka 4,000,000 byes, aka 4mb. Since you only have 32kb of memory, you cannot run this program. (or, more accurately you can't store the entire executable in active memory, which generally means it's a pain in the ass to run) Rom is also using at least 4mb just to store the program. So this hypothetical program wouldn't fit in either your RAM or ROM. B : dfmt - can run Executable uses only 4*5000 bytes since it only needs to operate over dfmt-encoded strings. I.e. it needs 20,000bytes, aka 20kb. So the logging uses 20/32 of your kb of memory. Your rom also only needs to store 20kb of dfmt encoded text data. The device can also theoretically run faster since it spends less time and resources managing longer lengths of memory. HOWEVER, if you don't have the dfmt dictionary the logs are gibberish C : dfmt with included dfmt dictionary on-device - can run Executable sitll only uses 20kb, requriing 20/32kb of your memory. Your rom also needs to store that 20kb of the executable. HOWEVER, you're also storing the 128kb dfmt dictionary, meaning in total you are using 148/512kb of your ROM for dfmt strings. This setup also achieves the theoretical runtime benefits of dfmt by not needing to send entire strings. HOWEVER, unlike the previous case, since the entire dfmt dictionary is stored in ROM anyone can request the device give them it's dictionary to read it's logs. These are obviously fabricated numbers, but it illustrates the general principle. Storing a dictionary AND the compressed data can very well be smaller than the full, uncompressed data. This should be obvious since it's how literally all modern data compression works, but this is a youtube comment section so assuming that anything is 'obvious' is a fatal error.
@PeterKrull1
@PeterKrull1 День назад
These videos are great! After coming from Arduino serial printing, using defmt for the first time straight up blew my mind. I am also at the point now where I would benefit greatly from being able to transmit my defmt logs wirelessly, and have also wondered about the versioning issue. Looking forward to your next video!
@pedromartinspersonalemail5100
@pedromartinspersonalemail5100 3 часа назад
I was wondering about how to accomplish that. Do you have any ideas about how to actually accomplish that?
@hermannpaschulke1583
@hermannpaschulke1583 День назад
Now I finally understand what defmt does differently, thank you
@RiwenX
@RiwenX День назад
Can't wait for that future video now!
@fromeijn
@fromeijn День назад
Nicely explained, can't wait for the follow up video about this topic!
@Themreg9
@Themreg9 День назад
Neat! I almost feel a bit worried by how seemless that was. This crate is definitely on my reading list now.
@xTatsuran
@xTatsuran День назад
I've read the thumbnail as "Deform your legs". Insert "instructions unclear" meme
@slash.9882
@slash.9882 День назад
Very nice. rust seams amazing compared to c
@prestonmlangford
@prestonmlangford 22 часа назад
You could implement the same server side formatting trick in c.
@slash.9882
@slash.9882 21 час назад
@@prestonmlangford yes, but it seems way simpler on rust, it’s basically baked into a container
@meiramshunshalin6915
@meiramshunshalin6915 День назад
Good video
@meiramshunshalin6915
@meiramshunshalin6915 День назад
Keep going, you deserve more subs
@MrMassaraksh
@MrMassaraksh 20 часов назад
Thank you for your videos!😊
@SteveM0732
@SteveM0732 День назад
I'm going to have to try defmt a bit more then. I was testing Embassy on an STM32 with nothing more than an LED that turns on when a button is pressed and the debug build wouldn't fit into 64k of flash. I may not have been doing it correctly now that I see how you setup and used defmt. Thanks.
@googelstevejobs21
@googelstevejobs21 День назад
rule of thumb: always do a release build for embedded. Debug is just too big.
@NotherPleb
@NotherPleb День назад
​@@googelstevejobs21it's better to tweak the dev profile. For example, using [profile.dev.package."*"] opt-level = "z", will optimize all your dependencies for size while keeping your crate unoptimized and fast to compile
@tomekmgr
@tomekmgr День назад
Wow, love that defmt after what I've seen here😆
@namr2000
@namr2000 День назад
Great work as always!
@wall_k
@wall_k 5 часов назад
Oh, I think I have a nice usecase for this Having a tiny MCU in a device and bigger wi-fi enabled mcu as an addon will allow me to keep firmware tiny and have formatting happen on big MCU if it's connected
@macho512
@macho512 День назад
I love your videos, quality over quantity is appreciated. As a starting embedded software engineer it is useful to get these tips & insights. I'm messing around with the 'blue pill' (STM32F103C8T6) and Rust in my private time, got some trouble flashing with probe-rs. Have you tried experimenting with the ESP32 platform and their Rust implementation? That is also very interesting to look into (and FRTOS)
@therustybits
@therustybits 23 часа назад
I have an ESP32 sitting on my desk, but haven't done anything with it quite yet. It is a pretty popular target for embedded Rust so I imagine there will be a video/project with it in the future...
@JamEngulfer
@JamEngulfer День назад
Why does float formatting grow the binary size so much?
@MaxWeninger
@MaxWeninger День назад
Just a suggestion. But do you plan to also cover the tracing crate from the Tokio team? Similar topic but especially useful once you start working with multiple tasks. I know this is not primarily an embedded topic then but maybe
@therustybits
@therustybits 23 часа назад
Possibly? The channel is still young so I wouldn't rule anything out at the point. That said, I feel like I have enough embedded content to fill out my schedule into the foreseeable future.
@vikaspoddar001
@vikaspoddar001 День назад
He is back 🔌
@NotherPleb
@NotherPleb День назад
What about the tracing crate, is it used in embedded?
@therustybits
@therustybits 17 часов назад
AFAIK tracing isn’t used in embedded/no-std systems
@canofpulp
@canofpulp День назад
Isn't this basically like protocol buffers
@pedromartinspersonalemail5100
@pedromartinspersonalemail5100 3 часа назад
It does give the same vibe. There's a crate called postcard-rpc that implements that for embedded systems (but your PC would need to run postcard-rpc too to decide the messages)
Далее
How A Steam Bug Deleted Someone’s Entire PC
11:49
Be CAREFUL With Removing Code Duplication
19:42
Просмотров 16 тыс.
Только ЕМУ это удалось
01:00
Просмотров 2,5 млн
A New Pattern in Nature
7:11
Просмотров 386 тыс.
Embedded Rust setup explained
23:03
Просмотров 88 тыс.
The Only Database Abstraction You Need | Prime Reacts
21:42
[1606] Soviet Era “Rack Locks”
4:02
Просмотров 187 тыс.
Why I Chose Rust Over Zig
33:18
Просмотров 197 тыс.
Linus's Laws of Writing Readable Code
4:02
Просмотров 11 тыс.
Только ЕМУ это удалось
01:00
Просмотров 2,5 млн