WEBVTT

00:00:00.000 --> 00:00:01.480
<v Chris Gammell>This is The Amp Hour Podcast.

00:00:03.220 --> 00:00:05.500
<v Chris Gammell>Released August 14th, 2022.

00:00:07.760 --> 00:00:09.040
<v Chris Gammell>Episode 599.

00:00:11.520 --> 00:00:13.240
<v Chris Gammell>An interview with Uri Shaqed.

00:00:30.000 --> 00:00:32.160
<v Chris Gammell>Welcome to The Amp Hour.

00:00:32.380 --> 00:00:34.000
<v Chris Gammell>I'm Chris Gammell of Contextual Electronics.

00:00:34.640 --> 00:00:35.320
<v Uri Shaked Wokwicom>Hey, Chris.

00:00:35.320 --> 00:00:40.000
<v Uri Shaked Wokwicom>I'm Uri, working on Wokwe.com, and welcome to our podcast.

00:00:40.580 --> 00:00:40.760
<v Uri Shaked Wokwicom>Hi.

00:00:40.840 --> 00:00:41.260
<v Uri Shaked Wokwicom>Thanks, Uri.

00:00:41.320 --> 00:00:41.780
<v Uri Shaked Wokwicom>How are you?

00:00:41.880 --> 00:00:45.300
<v Uri Shaked Wokwicom>A bit under the weather, but very excited to be here.

00:00:45.520 --> 00:00:45.720
<v Chris Gammell>Yeah.

00:00:45.880 --> 00:00:46.540
<v Chris Gammell>I'm glad you're here.

00:00:46.680 --> 00:00:48.000
<v Chris Gammell>So you mentioned Wokwe.

00:00:48.260 --> 00:00:50.100
<v Chris Gammell>So let's start with the important thing.

00:00:50.200 --> 00:00:54.640
<v Chris Gammell>How do you spell Wokwe so people can go and follow along as they're listening right now?

00:00:55.180 --> 00:00:58.500
<v Chris Gammell>W-O-K-W-I.

00:00:58.880 --> 00:00:59.240
<v Chris Gammell>All right.

00:00:59.240 --> 00:01:02.780
<v Chris Gammell>And I do recommend people do it because we actually mentioned this.

00:01:03.100 --> 00:01:03.700
<v Chris Gammell>Actually, you know what?

00:01:03.740 --> 00:01:08.580
<v Chris Gammell>I told Dave about Wokwe at the end of the show, after we were done recording last week,

00:01:08.580 --> 00:01:10.260
<v Chris Gammell>and he started tweeting about it.

00:01:10.300 --> 00:01:14.040
<v Chris Gammell>And he was very excited about it because I mentioned we were talking about the RP2040.

00:01:14.160 --> 00:01:16.960
<v Chris Gammell>And I was like, I know this guy, Uri, is going to be on the show next week.

00:01:17.180 --> 00:01:22.540
<v Chris Gammell>And there is a simulator for the RP2040, among other devices that are out there.

00:01:22.580 --> 00:01:24.960
<v Chris Gammell>And it's super easy to get started.

00:01:25.300 --> 00:01:29.180
<v Chris Gammell>And you can visualize stuff and you can plug in all of these external peripherals.

00:01:29.180 --> 00:01:31.940
<v Chris Gammell>And you can also use the tools that you might have in like an Arduino getting started kit.

00:01:32.520 --> 00:01:35.700
<v Chris Gammell>What is your go-to recommendation when people start with Wokwe?

00:01:36.200 --> 00:01:37.120
<v Uri Shaked Wokwicom>That's a good question.

00:01:37.280 --> 00:01:42.100
<v Uri Shaked Wokwicom>First of all, you forgot to mention there is also free shipping to New Zealand.

00:01:42.660 --> 00:01:43.960
<v Uri Shaked Wokwicom>So Dave's covered.

00:01:44.820 --> 00:01:45.180
<v Chris Gammell>Uh-huh.

00:01:45.400 --> 00:01:45.560
<v Chris Gammell>Yeah.

00:01:45.560 --> 00:01:49.280
<v Uri Shaked Wokwicom>So that's actually something I'm trying to figure out myself.

00:01:49.280 --> 00:01:56.440
<v Uri Shaked Wokwicom>Like, I built it, first of all, a sort of tool that helps to alleviate my own pain.

00:01:57.220 --> 00:02:06.440
<v Uri Shaked Wokwicom>And in pain, I'm talking about endless drawers full of electronic components that just like a pile that just keeps growing.

00:02:06.940 --> 00:02:07.080
<v Chris Gammell>Yep.

00:02:07.240 --> 00:02:07.820
<v Chris Gammell>I know that fear.

00:02:08.020 --> 00:02:09.060
<v Chris Gammell>I know that feeling, right?

00:02:09.060 --> 00:02:11.160
<v Uri Shaked Wokwicom>So, yeah.

00:02:11.160 --> 00:02:14.820
<v Uri Shaked Wokwicom>Right now I'm free from most of my electronics.

00:02:15.520 --> 00:02:17.980
<v Uri Shaked Wokwicom>I can say it out loud.

00:02:18.720 --> 00:02:20.360
<v Uri Shaked Wokwicom>I'm clear, almost.

00:02:21.200 --> 00:02:22.960
<v Uri Shaked Wokwicom>Still fighting this addiction.

00:02:22.960 --> 00:02:33.360
<v Uri Shaked Wokwicom>I really built it as something that tries to just give you everything you need.

00:02:33.740 --> 00:02:40.180
<v Uri Shaked Wokwicom>And I know when people work on products, they always say you should focus, focus, and focus.

00:02:40.180 --> 00:02:43.780
<v Uri Shaked Wokwicom>And you should have a very clear product and everything like that.

00:02:43.780 --> 00:02:49.480
<v Uri Shaked Wokwicom>I'm trying, but it's really like it started off as an Arduino simulator.

00:02:49.820 --> 00:02:58.320
<v Uri Shaked Wokwicom>So if you know Tinkercad or Proteus, it probably compares best to Tinkercad.

00:02:58.740 --> 00:03:05.200
<v Uri Shaked Wokwicom>But then I started adding things that a user asked for and things that I myself was missing.

00:03:05.200 --> 00:03:09.180
<v Uri Shaked Wokwicom>So right now it can do a bunch of stuff.

00:03:09.560 --> 00:03:11.820
<v Uri Shaked Wokwicom>So Arduino, we already mentioned it.

00:03:11.980 --> 00:03:20.360
<v Uri Shaked Wokwicom>And then you have like the Raspberry Pi Pico, which I added in a live stream last year as it was announced.

00:03:20.540 --> 00:03:30.760
<v Uri Shaked Wokwicom>I decided to take on a challenge and just do weekly live coding sessions where I create a simulator for the new Pi Pico from scratch.

00:03:30.760 --> 00:03:31.060
<v Uri Shaked Wokwicom>Yep.

00:03:31.720 --> 00:03:31.920
<v Chris Gammell>Yep.

00:03:32.240 --> 00:03:35.280
<v Uri Shaked Wokwicom>And then we also have now the ESP32.

00:03:35.960 --> 00:03:44.260
<v Uri Shaked Wokwicom>And I think the most important part is that you have a huge library of peripherals that you can connect to all of these chips.

00:03:44.260 --> 00:03:52.980
<v Uri Shaked Wokwicom>So the idea is you don't need your hardware to prototype, at least for some kind of projects, anymore.

00:03:53.360 --> 00:03:53.440
<v Chris Gammell>Yeah.

00:03:53.580 --> 00:03:55.740
<v Chris Gammell>I'd like to just give my personal anecdote.

00:03:55.860 --> 00:03:57.560
<v Chris Gammell>So I had a simulator.

00:03:57.800 --> 00:03:59.940
<v Chris Gammell>I remember it was like a lab bench simulator.

00:03:59.940 --> 00:04:01.360
<v Chris Gammell>It must have been.

00:04:01.700 --> 00:04:03.000
<v Chris Gammell>So it was when I started school.

00:04:03.140 --> 00:04:04.340
<v Chris Gammell>So like early 2000s.

00:04:04.900 --> 00:04:07.120
<v Chris Gammell>And I don't remember why they had us doing it.

00:04:07.160 --> 00:04:09.760
<v Chris Gammell>It was an electronics lab, but it was like more like test equipment.

00:04:09.760 --> 00:04:11.860
<v Chris Gammell>It was like, oh, hook this to that.

00:04:11.920 --> 00:04:15.040
<v Chris Gammell>But it was I think it was like Adobe Flash or something like that.

00:04:15.040 --> 00:04:18.520
<v Chris Gammell>And like that's what that's what my head goes to when I think of a simulator.

00:04:18.740 --> 00:04:22.320
<v Chris Gammell>Now, very, you know, very different, I guess, use case even.

00:04:22.740 --> 00:04:29.160
<v Chris Gammell>But when I think about like electronics and simulation, I think about that because it was like such a it was almost like a choose your own adventure style.

00:04:29.160 --> 00:04:32.760
<v Chris Gammell>Like it was like, you know, it was like you could basically just click around and get the right answer.

00:04:33.080 --> 00:04:35.840
<v Chris Gammell>But that's only because there wasn't any flexibility in it.

00:04:36.380 --> 00:04:42.460
<v Chris Gammell>This is so much closer to reality that it really is actually useful.

00:04:42.460 --> 00:04:47.540
<v Chris Gammell>Like so what does it take to get it to be closer to reality like this?

00:04:48.320 --> 00:04:49.720
<v Uri Shaked Wokwicom>So I will answer that.

00:04:49.780 --> 00:04:57.520
<v Uri Shaked Wokwicom>But first, let me something that I encounter so many times where people are saying, hey, I found a bug in your simulator.

00:04:57.520 --> 00:05:04.020
<v Uri Shaked Wokwicom>Why doesn't the push button register on my digital read when I'm reading for it?

00:05:04.400 --> 00:05:06.400
<v Uri Shaked Wokwicom>Why doesn't it register correctly?

00:05:06.900 --> 00:05:19.380
<v Uri Shaked Wokwicom>And then it turns out they either forgot to turn on the pull up on the input or they got confused by the simulator simulating the bouncing of the pin of the push button.

00:05:19.900 --> 00:05:20.880
<v Uri Shaked Wokwicom>Wow. Yeah.

00:05:20.880 --> 00:05:21.360
<v Chris Gammell>Yeah.

00:05:21.360 --> 00:05:21.920
<v Uri Shaked Wokwicom>Yeah.

00:05:21.920 --> 00:05:22.040
<v Uri Shaked Wokwicom>Yeah.

00:05:22.040 --> 00:05:25.580
<v Uri Shaked Wokwicom>Often or another example, they say like you have a bug.

00:05:25.680 --> 00:05:29.480
<v Uri Shaked Wokwicom>I can't work with this and this library, which works on my computer.

00:05:29.800 --> 00:05:36.880
<v Uri Shaked Wokwicom>And then it turns out that the author of the library included Arduino dot H with without a capital A.

00:05:37.280 --> 00:05:41.040
<v Uri Shaked Wokwicom>So if you compile it on a Windows computer, it works.

00:05:41.380 --> 00:05:43.360
<v Uri Shaked Wokwicom>But when you compile it on Linux, it breaks.

00:05:43.360 --> 00:05:52.720
<v Uri Shaked Wokwicom>So that's like sort of the downside of having realistic simulation where users think there are bugs in the simulator.

00:05:53.000 --> 00:05:55.140
<v Uri Shaked Wokwicom>But it turns out it's actually...

00:05:55.140 --> 00:05:55.540
<v Chris Gammell>It's too real.

00:05:55.740 --> 00:05:56.360
<v Chris Gammell>It's too real.

00:05:56.440 --> 00:05:59.920
<v Chris Gammell>It's too much like the stuff that you might experience in the real world, huh?

00:06:01.580 --> 00:06:01.980
<v Uri Shaked Wokwicom>Yeah.

00:06:02.040 --> 00:06:04.260
<v Uri Shaked Wokwicom>I think the only missing part is the magic smoke.

00:06:05.080 --> 00:06:05.500
<v Chris Gammell>That's right.

00:06:05.700 --> 00:06:05.900
<v Chris Gammell>Right.

00:06:06.040 --> 00:06:09.640
<v Chris Gammell>Also, the jumper wire falling out of the breadboard.

00:06:10.440 --> 00:06:11.680
<v Chris Gammell>That's always the one that got me.

00:06:11.680 --> 00:06:13.100
<v Chris Gammell>It was like, oh, you know what?

00:06:13.120 --> 00:06:18.200
<v Chris Gammell>If I just reshuffle each of the breadboard wires and now it works.

00:06:18.320 --> 00:06:18.460
<v Chris Gammell>Yeah.

00:06:18.520 --> 00:06:20.980
<v Chris Gammell>Just a little bit of, you know, a little touch here and there.

00:06:21.680 --> 00:06:23.560
<v Uri Shaked Wokwicom>Would you pay for such feature?

00:06:24.160 --> 00:06:24.680
<v Uri Shaked Wokwicom>Like...

00:06:24.680 --> 00:06:27.540
<v Uri Shaked Wokwicom>Yeah.

00:06:27.780 --> 00:06:28.220
<v Uri Shaked Wokwicom>So...

00:06:28.220 --> 00:06:29.060
<v Uri Shaked Wokwicom>Hyperreality.

00:06:29.200 --> 00:06:29.740
<v Uri Shaked Wokwicom>Hyperreality.

00:06:31.680 --> 00:06:39.380
<v Uri Shaked Wokwicom>So in terms of technology, the simulation itself is built in several layers.

00:06:39.380 --> 00:06:47.220
<v Uri Shaked Wokwicom>So the basic layer is some sort of digital electronic simulator that gets a netlist.

00:06:47.600 --> 00:06:53.140
<v Uri Shaked Wokwicom>So all the parts and their pins and the connections to the other parts in the pins in the circuit.

00:06:53.140 --> 00:07:00.660
<v Uri Shaked Wokwicom>And it just knows how to sort of resolve the state of all the pins based on the changes.

00:07:00.660 --> 00:07:10.540
<v Uri Shaked Wokwicom>So if something goes high, it knows which pins are connected to it and how they are affected in like the sort of effect cascade.

00:07:10.540 --> 00:07:14.720
<v Uri Shaked Wokwicom>So that's one part, this digital simulator.

00:07:15.000 --> 00:07:18.240
<v Chris Gammell>It's kind of like a schematic almost like because you're setting up wires.

00:07:18.440 --> 00:07:28.360
<v Chris Gammell>And so if I put down like a spy or I squared C based like display element, you have to go and actually hook up the SDA, SCL type of thing, power ground.

00:07:28.360 --> 00:07:40.920
<v Chris Gammell>And actually, so then that creates that netlist between the Arduino megaboard that's shown or the ESP32 board that's shown and what the actual unit is and devices.

00:07:41.920 --> 00:07:42.040
<v Uri Shaked Wokwicom>Right.

00:07:42.220 --> 00:07:52.940
<v Uri Shaked Wokwicom>And then there is also like a logic analyzer that you can hook to these signals and record like the ISP-C protocol as it's going between the parts.

00:07:52.940 --> 00:08:02.300
<v Uri Shaked Wokwicom>So that's like all this netlist or schematic simulation is sort of the base of the engine.

00:08:02.300 --> 00:08:11.840
<v Uri Shaked Wokwicom>And then there is like the microcontroller simulation, which is just loading the binary and running it instruction by instruction.

00:08:12.660 --> 00:08:17.160
<v Uri Shaked Wokwicom>So if it's like Arduino program, it's compiled into a hex file.

00:08:17.160 --> 00:08:23.020
<v Uri Shaked Wokwicom>That hex file is loaded into memory space, which represents the on-chip flesh.

00:08:23.780 --> 00:08:27.160
<v Uri Shaked Wokwicom>And then there is an interpreter written in JavaScript.

00:08:27.580 --> 00:08:36.220
<v Uri Shaked Wokwicom>And by the way, this AVR simulation engine is open source on GitHub, github.com slash walkby slash AVR8JS.

00:08:36.500 --> 00:08:41.580
<v Uri Shaked Wokwicom>And it just runs the code or the machine code instruction by instruction.

00:08:41.580 --> 00:08:53.820
<v Uri Shaked Wokwicom>And on top of that, there is another layer of peripherals because the CPU core itself is not very useful unless you can connect it to the external world.

00:08:54.580 --> 00:09:03.960
<v Uri Shaked Wokwicom>So there is another layer of like UART and ISPERS-C, SPI, timers, EEPROM, whatever you have on the chip.

00:09:03.960 --> 00:09:10.220
<v Uri Shaked Wokwicom>So that's sort of one side of the simulation.

00:09:10.740 --> 00:09:16.960
<v Uri Shaked Wokwicom>And then the other side, there are like the external peripherals, like the LCD displays.

00:09:17.540 --> 00:09:21.260
<v Uri Shaked Wokwicom>And they have their logic implemented in JavaScript.

00:09:21.960 --> 00:09:23.900
<v Chris Gammell>Which is crazy to me, but also it's amazing.

00:09:23.900 --> 00:09:29.240
<v Chris Gammell>Like the fact that all this stuff is like in the browser and running, it's just like, yeah, it's really, really impressive, man.

00:09:29.380 --> 00:09:31.180
<v Chris Gammell>It's like, I'm so impressed.

00:09:32.540 --> 00:09:33.340
<v Uri Shaked Wokwicom>Thank you.

00:09:33.960 --> 00:09:35.600
<v Uri Shaked Wokwicom>It is still a huge undertaking.

00:09:36.220 --> 00:09:46.540
<v Uri Shaked Wokwicom>And a few things that people don't actually realize that are happening behind the scenes are, for instance, we have a FAT file system driver.

00:09:46.540 --> 00:10:01.080
<v Uri Shaked Wokwicom>So if you simulate an SD card and upload files to that simulated SD card, we have FAT file system driver that actually writes those, creates a FAT file system out of those files that you uploaded.

00:10:01.080 --> 00:10:07.960
<v Uri Shaked Wokwicom>Because the simulated code expects to read FAT file system from the SD card.

00:10:08.120 --> 00:10:08.880
<v Chris Gammell>Right, right.

00:10:09.440 --> 00:10:14.520
<v Chris Gammell>Yeah, because it's like you said, you're actually compiling binaries and doing it instruction by instruction.

00:10:14.520 --> 00:10:24.320
<v Chris Gammell>So when it goes to that instruction that says, start reading this file system, it needs to actually simulate the other side of it like an actual micro would have, which is bonkers.

00:10:24.540 --> 00:10:29.200
<v Chris Gammell>So you're basically doing like all of these abstraction layers for reality, basically.

00:10:29.200 --> 00:10:31.640
<v Chris Gammell>It's really, it's crazy.

00:10:32.460 --> 00:10:39.320
<v Uri Shaked Wokwicom>And I think the problem is, it's always hard to know, like where to put the line, where to stop.

00:10:39.540 --> 00:10:45.060
<v Uri Shaked Wokwicom>Because there is always one more thing that you want to simulate to make it more realistic.

00:10:45.060 --> 00:11:02.920
<v Uri Shaked Wokwicom>So one good example is the LEDs, simulating LEDs is such a horror because you would imagine like you have the computer screen and it emits lights and then you have LEDs and they emit light.

00:11:03.060 --> 00:11:04.400
<v Uri Shaked Wokwicom>So it's a perfect match, right?

00:11:05.240 --> 00:11:05.560
<v Chris Gammell>Right.

00:11:05.560 --> 00:11:14.440
<v Uri Shaked Wokwicom>But then your computer screen has a refresh rate of 60 hertz or if you are lucky, I don't know, 120 or 200 hertz.

00:11:14.860 --> 00:11:19.400
<v Uri Shaked Wokwicom>But a physical LED has an infinite refresh rate.

00:11:19.400 --> 00:11:29.180
<v Uri Shaked Wokwicom>And people actually use this to create PWM, like to drive the LEDs to different brightnesses.

00:11:29.180 --> 00:11:40.140
<v Uri Shaked Wokwicom>So if you just wanted to map this LED into like something that you would display on the screen, that would just flicker when you have PWM.

00:11:40.240 --> 00:11:42.580
<v Uri Shaked Wokwicom>You will see it either full on, full off.

00:11:42.720 --> 00:11:48.460
<v Uri Shaked Wokwicom>But since the refresh rate is just 60 frames per second, it won't look smooth.

00:11:48.560 --> 00:11:52.220
<v Uri Shaked Wokwicom>It will look like very jumpy and it won't create the right experience.

00:11:52.220 --> 00:12:03.180
<v Chris Gammell>You don't get the benefit of the low pass filtering of the human cornea or whatever, whatever the physical phenomenon that actually helps smooth out the PWM and make it look like just a dimmer light.

00:12:03.180 --> 00:12:06.540
<v Uri Shaked Wokwicom>You explained it much better than I would have.

00:12:06.620 --> 00:12:07.220
<v Uri Shaked Wokwicom>So thank you.

00:12:08.840 --> 00:12:17.800
<v Uri Shaked Wokwicom>And then on the other hand, when you try to simulate it on a computer monitor, you go and do some kind of averaging.

00:12:17.800 --> 00:12:28.640
<v Uri Shaked Wokwicom>But the sort of larger time span that you take, the more the LED, like there is a noticeable delay.

00:12:28.820 --> 00:12:39.220
<v Uri Shaked Wokwicom>So when you turn the LED off, it actually seems like it fades off because there is like, it's sort of, you can't predict the future.

00:12:39.220 --> 00:12:47.920
<v Uri Shaked Wokwicom>Or if you are trying to simulate things in real time, you can't know what the state of the LED will be in the next few milliseconds.

00:12:48.220 --> 00:12:50.040
<v Uri Shaked Wokwicom>You have to run the simulation to know that.

00:12:50.960 --> 00:12:51.060
<v Chris Gammell>Right.

00:12:51.420 --> 00:13:04.920
<v Uri Shaked Wokwicom>You sort of have to either average the best behavior of the LED to determine the next frame and decide what will be displayed for the next 16 milliseconds.

00:13:04.920 --> 00:13:13.740
<v Uri Shaked Wokwicom>Or just make some educated guess based on delaying the simulation or delaying the visuals of the simulation.

00:13:14.340 --> 00:13:18.820
<v Uri Shaked Wokwicom>And that's just something specific as an LED.

00:13:19.460 --> 00:13:19.600
<v Chris Gammell>Yeah.

00:13:20.000 --> 00:13:31.580
<v Uri Shaked Wokwicom>But if you get it right, then things like PWM or charlie plexing or seven segment display, then they work correctly.

00:13:31.580 --> 00:13:34.200
<v Uri Shaked Wokwicom>If you get it wrong, they are all broken.

00:13:34.200 --> 00:13:34.260
<v Uri Shaked Wokwicom>Yeah.

00:13:34.640 --> 00:13:46.320
<v Chris Gammell>So this actually goes back to, I think, my negative experience with simulators in the past, which was basically they looked at the entire solution space of a thing that was going to happen.

00:13:46.320 --> 00:13:51.860
<v Chris Gammell>They said, you know, instead of infinite things that could happen, there are maybe 100 things that could happen.

00:13:51.960 --> 00:13:54.000
<v Chris Gammell>And they kind of code each of those examples.

00:13:54.000 --> 00:14:06.240
<v Chris Gammell>But it seems like yours is kind of going more towards that infinite solution space because it really is simulating a lot of physical characteristics or the register set inside of a processor, that sort of thing.

00:14:06.240 --> 00:14:10.020
<v Chris Gammell>So you mentioned drawing the line is difficult.

00:14:10.020 --> 00:14:13.160
<v Chris Gammell>But like how deep then does your physics model have to go?

00:14:13.300 --> 00:14:24.060
<v Chris Gammell>Because you have to then, I imagine in this PWM example, you know, you have a model of what an output on a AVR8 microprocessor is.

00:14:24.240 --> 00:14:25.420
<v Chris Gammell>And then you could turn it on.

00:14:25.520 --> 00:14:26.260
<v Chris Gammell>It has characteristics.

00:14:26.400 --> 00:14:28.300
<v Chris Gammell>You can turn it on and off at this certain speed, whatever.

00:14:28.300 --> 00:14:31.020
<v Chris Gammell>But then it's also like current drive characteristics.

00:14:31.020 --> 00:14:36.560
<v Chris Gammell>And it starts getting into how much current are you driving into the LED at these different PWM frequencies.

00:14:36.680 --> 00:14:39.160
<v Chris Gammell>So like where does it stop then?

00:14:40.220 --> 00:14:41.200
<v Uri Shaked Wokwicom>That's a good question.

00:14:41.620 --> 00:14:46.220
<v Uri Shaked Wokwicom>So the answer is when I just feel it's too much.

00:14:47.580 --> 00:14:50.880
<v Chris Gammell>When you have to sleep for the night and you're like, I just can't do anymore right now.

00:14:50.880 --> 00:15:03.180
<v Uri Shaked Wokwicom>So one way to solve this was actually trying to deliver solutions that works with the common use cases, just like you said.

00:15:03.180 --> 00:15:11.480
<v Uri Shaked Wokwicom>So testing against code that does Charlie plexing or drive seven segment displays or does PWM.

00:15:11.480 --> 00:15:24.980
<v Uri Shaked Wokwicom>And seeing that I get a result that looks correct with the current set of like constraints or simulation, physics simulation that I already got in the system.

00:15:25.880 --> 00:15:28.020
<v Uri Shaked Wokwicom>And then I got to this.

00:15:28.880 --> 00:15:35.620
<v Uri Shaked Wokwicom>Initially, I would just listen to users when they asked, hey, I wanted to do this and it doesn't work well in the simulator.

00:15:35.820 --> 00:15:36.560
<v Uri Shaked Wokwicom>Can you edit?

00:15:36.760 --> 00:15:40.060
<v Uri Shaked Wokwicom>So I would just add whatever users asked me for.

00:15:40.060 --> 00:15:45.060
<v Uri Shaked Wokwicom>But then I sort of hit a wall when there were too many requests.

00:15:45.940 --> 00:15:47.080
<v Uri Shaked Wokwicom>Some of them are really big.

00:15:47.300 --> 00:15:51.100
<v Uri Shaked Wokwicom>Like, it would be nice if we have a debugger inside the browser.

00:15:51.420 --> 00:15:51.820
<v Uri Shaked Wokwicom>Why not?

00:15:52.620 --> 00:15:53.060
<v Chris Gammell>Yeah.

00:15:53.220 --> 00:15:55.160
<v Chris Gammell>I may have been asking that at some point too.

00:15:56.140 --> 00:15:56.620
<v Uri Shaked Wokwicom>Sorry.

00:15:57.020 --> 00:15:57.300
<v Uri Shaked Wokwicom>Sorry.

00:15:59.140 --> 00:16:01.160
<v Uri Shaked Wokwicom>I won't hold it up against you.

00:16:01.540 --> 00:16:01.800
<v Chris Gammell>Okay.

00:16:02.060 --> 00:16:02.180
<v Speaker ?>Good.

00:16:02.180 --> 00:16:02.560
<v Uri Shaked Wokwicom>Yeah.

00:16:02.680 --> 00:16:10.040
<v Uri Shaked Wokwicom>But so now I'm trying to prioritize it by letting users vote so they can buy vote powers.

00:16:10.060 --> 00:16:14.580
<v Uri Shaked Wokwicom>And then use those vote powers to vote for features they care about.

00:16:15.280 --> 00:16:18.560
<v Uri Shaked Wokwicom>So right now the debugger is actually at the top of the list.

00:16:18.560 --> 00:16:30.380
<v Uri Shaked Wokwicom>And I've been working long nights to try to get LLDB, the LLVM debugger, to compile into WebAssembly so I can run it in the browser.

00:16:31.140 --> 00:16:31.700
<v Uri Shaked Wokwicom>Wow.

00:16:32.060 --> 00:16:32.260
<v Uri Shaked Wokwicom>Yeah.

00:16:33.220 --> 00:16:34.000
<v Uri Shaked Wokwicom>That's crazy.

00:16:34.000 --> 00:16:34.280
<v Uri Shaked Wokwicom>Yeah.

00:16:34.820 --> 00:16:41.120
<v Uri Shaked Wokwicom>It's, I mean, nobody does debuggers nowadays.

00:16:41.120 --> 00:16:49.200
<v Uri Shaked Wokwicom>I tried to contact some of the people who worked on LLDB and they told me, yeah, we would love to work in debuggers.

00:16:49.340 --> 00:16:52.660
<v Uri Shaked Wokwicom>But apparently nobody's interested in working on it.

00:16:52.660 --> 00:16:54.680
<v Uri Shaked Wokwicom>So we shifted to working on compilers.

00:16:55.780 --> 00:16:56.140
<v Chris Gammell>Yeah.

00:16:56.140 --> 00:16:57.540
<v Chris Gammell>I can imagine there's not a lot of money in it.

00:16:57.780 --> 00:17:04.940
<v Chris Gammell>You know, like there's kind of the established players in the space and then there's GDB and all the, you know, those kind of things as well.

00:17:05.000 --> 00:17:08.700
<v Chris Gammell>And it's just like, I can't imagine there's a lot of greenfield happening there.

00:17:08.700 --> 00:17:18.280
<v Uri Shaked Wokwicom>So yeah, GDB was actually my first attempt to circumvent the need to create my own debugger.

00:17:18.280 --> 00:17:23.160
<v Uri Shaked Wokwicom>So I did something really crazy that should never be done.

00:17:24.200 --> 00:17:45.020
<v Uri Shaked Wokwicom>And that was taking GDB, compiling it as an x86 Linux binary, and then using a simulator for x86 that's called V86 to run a Linux distribution inside the browser.

00:17:45.020 --> 00:17:54.380
<v Uri Shaked Wokwicom>So there's GDB Linux binary that runs on a virtual machine inside a Linux simulator in the browser.

00:17:54.880 --> 00:18:04.460
<v Uri Shaked Wokwicom>And that talks to the Arduino or Raspberry Pi Pico simulator through WebSockets to like establish a GDB debugging session.

00:18:05.480 --> 00:18:05.980
<v Uri Shaked Wokwicom>Oh my gosh.

00:18:06.460 --> 00:18:11.140
<v Chris Gammell>Yeah, that's when I think Leonardo DiCaprio shows up and says, you know, you're too many levels deep.

00:18:11.140 --> 00:18:12.100
<v Chris Gammell>This is going to fall apart.

00:18:15.020 --> 00:18:21.100
<v Uri Shaked Wokwicom>Yeah, and surprisingly, it works.

00:18:21.820 --> 00:18:29.100
<v Uri Shaked Wokwicom>There are a few hiccups, but the amount of effort to get this just to work was incredible.

00:18:30.100 --> 00:18:39.760
<v Uri Shaked Wokwicom>And whenever I have to make like, I want to update a version of GDB, I just keep postponing it because I'm always worried that something, you know, it works.

00:18:39.880 --> 00:18:40.560
<v Uri Shaked Wokwicom>Don't touch it.

00:18:40.560 --> 00:18:40.920
<v Uri Shaked Wokwicom>Right.

00:18:40.920 --> 00:18:41.360
<v Uri Shaked Wokwicom>Right.

00:18:41.560 --> 00:18:42.460
<v Chris Gammell>It's a house of cards, right?

00:18:42.500 --> 00:18:48.300
<v Chris Gammell>It's just like, what might potentially have a dependency that moves away and then you're like screwed.

00:18:48.300 --> 00:18:49.600
<v Chris Gammell>Wow.

00:18:50.740 --> 00:18:51.800
<v Uri Shaked Wokwicom>Well, yeah.

00:18:52.360 --> 00:18:55.300
<v Uri Shaked Wokwicom>There is actually even one more trick that I'm doing.

00:18:55.300 --> 00:19:05.000
<v Uri Shaked Wokwicom>So once you start this VM on your browser, I take a snapshot of the VM and then store it to your browser storage.

00:19:05.500 --> 00:19:09.460
<v Uri Shaked Wokwicom>So the next time that you run it, you don't have to wait like the 10, 20 seconds.

00:19:09.680 --> 00:19:10.760
<v Uri Shaked Wokwicom>It takes Linux to boot.

00:19:11.240 --> 00:19:11.800
<v Uri Shaked Wokwicom>Oh, wow.

00:19:11.800 --> 00:19:12.640
<v Uri Shaked Wokwicom>Yeah.

00:19:12.640 --> 00:19:17.100
<v Uri Shaked Wokwicom>So I actually had to learn how to cut down the Linux boot time.

00:19:17.100 --> 00:19:30.860
<v Uri Shaked Wokwicom>So it's crazy that you have to learn about optimizing the boot time of the Linux kernel and recompiling the kernel with different like options in order to get GDB to run faster in the browser.

00:19:31.960 --> 00:19:32.840
<v Chris Gammell>That's crazy.

00:19:33.540 --> 00:19:34.100
<v Chris Gammell>Wow.

00:19:34.100 --> 00:19:34.140
<v Chris Gammell>Yeah.

00:19:36.140 --> 00:19:37.920
<v Chris Gammell>I'd like to quickly go back.

00:19:38.100 --> 00:19:41.040
<v Chris Gammell>I think the PWM example is really great.

00:19:41.140 --> 00:19:48.680
<v Chris Gammell>Can we do a quick session of kind of follow the packet or follow the code or I guess it's going to be multiple layers here.

00:19:49.460 --> 00:19:55.040
<v Chris Gammell>But just to kind of dive people down through these layers of abstraction and try and visualize where they are.

00:19:56.300 --> 00:19:56.300
<v Speaker ?>

00:19:57.100 --> 00:19:57.340
<v Chris Gammell>Yeah.

00:19:57.760 --> 00:19:58.000
<v Chris Gammell>Yeah.

00:19:58.100 --> 00:19:58.300
<v Chris Gammell>Go ahead.

00:19:58.300 --> 00:20:01.980
<v Uri Shaked Wokwicom>Oh, I thought you would go ahead and then I will tell you.

00:20:02.000 --> 00:20:02.700
<v Chris Gammell>So, well, let's start.

00:20:02.800 --> 00:20:03.480
<v Chris Gammell>Let's start in this.

00:20:03.560 --> 00:20:05.520
<v Chris Gammell>So if you open up walkway.com, right?

00:20:05.600 --> 00:20:08.880
<v Chris Gammell>So basically there's a Arduino left side.

00:20:08.960 --> 00:20:10.560
<v Chris Gammell>There's a editor on the left side.

00:20:10.660 --> 00:20:11.820
<v Chris Gammell>Looks like setup and loop.

00:20:11.880 --> 00:20:15.960
<v Chris Gammell>Very similar to people that have, you know, people that have done it before would probably recognize it.

00:20:15.960 --> 00:20:28.860
<v Chris Gammell>So if you go and you did a PWM sketch and you were driving, you know, you pulled an LED into the right side pane, which is a simulation that actually has you wire things up.

00:20:29.580 --> 00:20:31.040
<v Chris Gammell>And then you hit compile.

00:20:31.800 --> 00:20:33.180
<v Chris Gammell>What happens?

00:20:33.180 --> 00:20:36.540
<v Chris Gammell>So like there's a binary and it goes all the way down.

00:20:36.640 --> 00:20:40.480
<v Chris Gammell>So like what happens under the hood in each of those cases?

00:20:40.820 --> 00:20:47.260
<v Chris Gammell>So we've compiled a binary to say maybe 50% duty cycle on driving LED out of pin.

00:20:48.040 --> 00:20:48.780
<v Chris Gammell>I don't know.

00:20:49.100 --> 00:20:51.840
<v Chris Gammell>A five or can we do PWM on.

00:20:52.240 --> 00:20:55.280
<v Chris Gammell>So on like an Arduino, like a five pin, a five or similar.

00:20:56.100 --> 00:20:58.840
<v Chris Gammell>And then we're going to drive an LED with that.

00:20:58.920 --> 00:21:01.800
<v Chris Gammell>So like what happens under the hood then for each of these cases?

00:21:01.800 --> 00:21:02.200
<v Chris Gammell>Okay.

00:21:02.880 --> 00:21:04.160
<v Uri Shaked Wokwicom>So you hit the play button.

00:21:04.320 --> 00:21:14.120
<v Uri Shaked Wokwicom>The first thing that happens is that your source code is going to send down to a server that is hopefully near where you are.

00:21:14.280 --> 00:21:21.420
<v Uri Shaked Wokwicom>And then it uses the Arduino CLI on that server to compile that source code into a hex file.

00:21:21.760 --> 00:21:29.760
<v Uri Shaked Wokwicom>And it's the same hex file that you would get if you compile the code on your machine and upload it to a physical Arduino board.

00:21:29.760 --> 00:21:39.400
<v Uri Shaked Wokwicom>As a matter of fact, you can even press F1 and look there for download compiled hex file and get this hex file and try it if you want to.

00:21:39.400 --> 00:21:44.440
<v Uri Shaked Wokwicom>So the hex file gets downloaded to your browser.

00:21:44.960 --> 00:21:54.340
<v Uri Shaked Wokwicom>And then the browser starts the AVR simulator, which goes over these hex files and starts executing the instructions.

00:21:54.340 --> 00:22:03.700
<v Uri Shaked Wokwicom>At some point, it will get to the implementation of the function analog write, which sets up the PWM in Arduino.

00:22:03.700 --> 00:22:08.320
<v Uri Shaked Wokwicom>And that function will write to the timer registers.

00:22:08.940 --> 00:22:13.860
<v Uri Shaked Wokwicom>So depending on the pin, that would be timer 0, 1, or 2 on Arduino Uno.

00:22:13.860 --> 00:22:18.760
<v Uri Shaked Wokwicom>And then the timer peripheral gets in action.

00:22:19.020 --> 00:22:26.660
<v Uri Shaked Wokwicom>So once you start writing to those registers, it actually calls functions in the simulation of the timer peripheral,

00:22:27.060 --> 00:22:37.840
<v Uri Shaked Wokwicom>which make all sorts of calculations to know when the next time the timer is going to shoot and what's going to happen then.

00:22:37.840 --> 00:22:48.760
<v Uri Shaked Wokwicom>So after a few simulated microseconds or milliseconds, the timer figures out it's time to toggle the pin.

00:22:48.960 --> 00:22:57.900
<v Uri Shaked Wokwicom>So it tells the simulator, hey, I want to toggle the specific pin of this simulated AVR chip.

00:22:57.900 --> 00:23:05.840
<v Uri Shaked Wokwicom>And then the simulator sees that this pin is now changing the state from, let's say, low to high.

00:23:06.120 --> 00:23:09.720
<v Uri Shaked Wokwicom>It checks everything that is connected to that pin.

00:23:09.720 --> 00:23:18.860
<v Uri Shaked Wokwicom>So all the other pins that are somehow wired to this pin, either directly or resistors or push buttons.

00:23:18.860 --> 00:23:28.700
<v Uri Shaked Wokwicom>And then it sort of tries to calculate the total state of that pin and everything connected to it.

00:23:28.700 --> 00:23:34.160
<v Uri Shaked Wokwicom>So it could be like that you have a few pull-up resistors and pull-down resistors.

00:23:34.420 --> 00:23:40.920
<v Uri Shaked Wokwicom>And you have to sort of see which signal you end up having on that set of pins.

00:23:40.920 --> 00:23:49.440
<v Uri Shaked Wokwicom>And eventually it figures out that, let's say, this whole set of pins is now high.

00:23:49.640 --> 00:23:57.020
<v Uri Shaked Wokwicom>So it goes to all the components that are connected to these pins, in this case, the LED.

00:23:57.560 --> 00:24:04.440
<v Uri Shaked Wokwicom>And it tells the LED, hey, your cathode is now or your anode is now high.

00:24:04.440 --> 00:24:10.840
<v Uri Shaked Wokwicom>And the LED then checks, okay, so my anode is high, my cathode is low.

00:24:11.040 --> 00:24:13.040
<v Uri Shaked Wokwicom>This means that I should turn on.

00:24:14.560 --> 00:24:17.940
<v Uri Shaked Wokwicom>But that's just one point in time.

00:24:17.940 --> 00:24:22.420
<v Uri Shaked Wokwicom>This happens like thousands of times for every second of the simulation.

00:24:23.100 --> 00:24:34.220
<v Uri Shaked Wokwicom>So what the LED does, it sort of takes a moving average of how much time the LED was on for each

00:24:34.440 --> 00:24:36.200
<v Uri Shaked Wokwicom>frame of the screen.

00:24:36.540 --> 00:24:42.320
<v Uri Shaked Wokwicom>And then it uses that moving average to draw the brightness of the LED.

00:24:43.280 --> 00:24:53.580
<v Uri Shaked Wokwicom>So if it sees like it was on 30% of the time, it will set the opacity of the layer that represents

00:24:53.580 --> 00:25:00.160
<v Uri Shaked Wokwicom>the light of the LED, not exactly to 30%, because it also applies gamma calculation.

00:25:00.420 --> 00:25:02.760
<v Uri Shaked Wokwicom>So that would be, I guess, something like 70%.

00:25:03.760 --> 00:25:04.320
<v Chris Gammell>Okay.

00:25:04.440 --> 00:25:11.340
<v Uri Shaked Wokwicom>But the opacity of that layer that represents the light of the LED that you see on the screen

00:25:11.340 --> 00:25:15.280
<v Uri Shaked Wokwicom>correlates to the duty cycle of the PWM.

00:25:15.280 --> 00:25:22.920
<v Uri Shaked Wokwicom>But it has to go through all these mechanisms because you want to simulate it as close as

00:25:22.920 --> 00:25:23.940
<v Uri Shaked Wokwicom>possible to reality.

00:25:24.800 --> 00:25:25.240
<v Chris Gammell>Yeah.

00:25:25.520 --> 00:25:27.280
<v Chris Gammell>That's amazing.

00:25:28.200 --> 00:25:29.140
<v Chris Gammell>That's a lot of stuff in there.

00:25:29.140 --> 00:25:34.040
<v Chris Gammell>That is just like all the way up through the various levels of...

00:25:34.040 --> 00:25:39.020
<v Chris Gammell>And you mentioned like it's happening thousands of times per second.

00:25:39.520 --> 00:25:44.040
<v Chris Gammell>So what is the calculation that's...

00:25:44.040 --> 00:25:47.780
<v Chris Gammell>I guess, what is the layer that's actually handling the...

00:25:47.780 --> 00:25:48.720
<v Chris Gammell>I guess the physical layer?

00:25:48.800 --> 00:25:51.820
<v Chris Gammell>That's probably the thing I'm most interested in this specific example.

00:25:51.820 --> 00:25:57.200
<v Chris Gammell>So you wrote basically like a physics engine that's reevaluating at every...

00:25:57.200 --> 00:25:57.540
<v Chris Gammell>Not really.

00:25:58.220 --> 00:26:02.300
<v Uri Shaked Wokwicom>I have no idea how to write a physics engine.

00:26:02.300 --> 00:26:10.600
<v Uri Shaked Wokwicom>So talking about timescales, the CPU simulator is like the actual simulation of the core is

00:26:10.600 --> 00:26:13.140
<v Uri Shaked Wokwicom>the most compute intensive part.

00:26:13.140 --> 00:26:18.040
<v Uri Shaked Wokwicom>For Arduino, it runs up to 16 million times a second.

00:26:18.400 --> 00:26:20.820
<v Uri Shaked Wokwicom>So it depends which instructions you are writing.

00:26:21.120 --> 00:26:24.420
<v Uri Shaked Wokwicom>You are using some instructions takes only one clock cycle.

00:26:24.700 --> 00:26:27.300
<v Uri Shaked Wokwicom>Some instruction takes multiple clock cycle.

00:26:27.680 --> 00:26:31.580
<v Uri Shaked Wokwicom>And at least with Arduino, the simulation tries to be cycle accurate.

00:26:31.580 --> 00:26:35.140
<v Uri Shaked Wokwicom>And that's really important for libraries like FestLED.

00:26:35.460 --> 00:26:39.580
<v Uri Shaked Wokwicom>Because if you look into the source code of FestLED...

00:26:40.540 --> 00:26:46.160
<v Uri Shaked Wokwicom>And for those who don't know, it's like a library very popular for driving matrices of LEDs,

00:26:46.520 --> 00:26:49.720
<v Uri Shaked Wokwicom>WS12, 08, and that sort.

00:26:50.440 --> 00:26:54.280
<v Uri Shaked Wokwicom>If you look into the source code and don't do it, it's really horrible.

00:26:54.540 --> 00:27:00.160
<v Uri Shaked Wokwicom>They have like handwritten C++ code that uses a lot of macros.

00:27:00.160 --> 00:27:06.880
<v Uri Shaked Wokwicom>And it somehow translates to very specific hand-optimized assembly instructions.

00:27:07.820 --> 00:27:17.480
<v Uri Shaked Wokwicom>So if you don't get the timing super on spot, then the signal that you will get for the NeoPixels

00:27:17.480 --> 00:27:19.920
<v Uri Shaked Wokwicom>will be off and they won't light up.

00:27:21.000 --> 00:27:21.640
<v Chris Gammell>Yeah.

00:27:22.200 --> 00:27:22.800
<v Uri Shaked Wokwicom>Yeah.

00:27:22.980 --> 00:27:24.580
<v Uri Shaked Wokwicom>So it has to be...

00:27:24.580 --> 00:27:27.160
<v Uri Shaked Wokwicom>At least for Arduino, I had to make it cycle accurate.

00:27:27.160 --> 00:27:30.740
<v Uri Shaked Wokwicom>So libraries like FestLED could work.

00:27:32.120 --> 00:27:34.820
<v Uri Shaked Wokwicom>And then there is like the...

00:27:35.660 --> 00:27:40.700
<v Uri Shaked Wokwicom>Whenever you toggle a pin, there is like this layer which tries to figure out what's connected

00:27:40.700 --> 00:27:48.560
<v Uri Shaked Wokwicom>to that pin and calculate the state of this whole like node in the network of the pins.

00:27:48.560 --> 00:27:49.240
<v Uri Shaked Wokwicom>Yeah.

00:27:51.580 --> 00:27:52.100
<v Chris Gammell>That's great.

00:27:52.220 --> 00:27:53.380
<v Chris Gammell>I mean, yeah, that's...

00:27:53.380 --> 00:27:58.520
<v Chris Gammell>I think the cycle accurate stuff, like that's really interesting to me.

00:27:58.600 --> 00:28:05.060
<v Chris Gammell>First off, because I think the FastLED library, it's also a workaround to work within the constraints

00:28:05.060 --> 00:28:07.840
<v Chris Gammell>of the Arduino ecosystem, it feels like, right?

00:28:07.840 --> 00:28:13.180
<v Chris Gammell>So it's like C++ under the hood for this library, but then it's assembly to actually make it so

00:28:13.180 --> 00:28:18.260
<v Chris Gammell>that you can drive microcontroller to hit the specific timings you need.

00:28:18.500 --> 00:28:19.840
<v Chris Gammell>Because it's like a...

00:28:19.840 --> 00:28:22.180
<v Chris Gammell>It's like there's like a...

00:28:22.180 --> 00:28:27.540
<v Chris Gammell>WS2812 I know has like a long pulse, short pulse is like a zero, and then the opposite

00:28:27.540 --> 00:28:28.820
<v Chris Gammell>is a one or something like that.

00:28:28.820 --> 00:28:33.220
<v Chris Gammell>But it's just like how you have to actually go and drive that in the real world ultimately

00:28:33.220 --> 00:28:35.680
<v Chris Gammell>impacts your code.

00:28:35.780 --> 00:28:37.780
<v Chris Gammell>So that then feeds back up the chain in the library.

00:28:38.960 --> 00:28:39.080
<v Uri Shaked Wokwicom>Right.

00:28:39.200 --> 00:28:46.040
<v Uri Shaked Wokwicom>And then when I was trying to debug the program that ran in the simulation using that GDB setup,

00:28:46.260 --> 00:28:52.440
<v Uri Shaked Wokwicom>because it didn't like work initially because I got something wrong with the timings for

00:28:52.440 --> 00:28:55.120
<v Uri Shaked Wokwicom>faster LEDs, it didn't work.

00:28:55.120 --> 00:29:00.640
<v Uri Shaked Wokwicom>And then I ran it again without the debug mode, and it worked.

00:29:00.860 --> 00:29:08.640
<v Uri Shaked Wokwicom>And it turns out that FastLED has such specific optimizations that they only work if you compile

00:29:08.640 --> 00:29:09.780
<v Uri Shaked Wokwicom>it in release mode.

00:29:10.480 --> 00:29:11.360
<v Chris Gammell>Oh, wow.

00:29:12.240 --> 00:29:16.920
<v Chris Gammell>Any kind of like overhead just blows the timing out of the water, huh?

00:29:17.360 --> 00:29:17.720
<v Uri Shaked Wokwicom>Yeah.

00:29:17.980 --> 00:29:24.560
<v Uri Shaked Wokwicom>And at some point I got a report that the code was not working on the ATtiny.

00:29:24.560 --> 00:29:26.540
<v Uri Shaked Wokwicom>And I was like, huh?

00:29:26.880 --> 00:29:28.600
<v Uri Shaked Wokwicom>But it's supposed to work.

00:29:28.980 --> 00:29:32.720
<v Uri Shaked Wokwicom>Like if it works on a physical ATtiny, it's supposed to work in the simulation because

00:29:32.720 --> 00:29:33.720
<v Uri Shaked Wokwicom>it's cycle accurate.

00:29:34.200 --> 00:29:41.940
<v Uri Shaked Wokwicom>So it turns out I measured the timings with my Salae on a physical ATtiny and in the simulator,

00:29:42.160 --> 00:29:43.200
<v Uri Shaked Wokwicom>and they were the same.

00:29:43.200 --> 00:29:52.740
<v Uri Shaked Wokwicom>But what happens is that the ATtiny is not fast enough to deliver the timings that are provided

00:29:52.740 --> 00:29:54.340
<v Uri Shaked Wokwicom>in the datasheet for those LEDs.

00:29:55.100 --> 00:30:01.020
<v Uri Shaked Wokwicom>So it turns out that the physical LEDs has some tolerances that are out of spec of the datasheet.

00:30:01.240 --> 00:30:06.000
<v Uri Shaked Wokwicom>So I had to make my simulation more lex so it would work with ATtiny.

00:30:06.000 --> 00:30:06.220
<v Uri Shaked Wokwicom>Oh, gosh.

00:30:07.660 --> 00:30:12.060
<v Chris Gammell>It's art representing reality, representing art, representing reality sort of thing, huh?

00:30:12.280 --> 00:30:13.360
<v Chris Gammell>It's like, yeah.

00:30:14.280 --> 00:30:14.600
<v Chris Gammell>Yeah.

00:30:14.800 --> 00:30:21.100
<v Uri Shaked Wokwicom>I mean, the datasheet says one thing, but then if you want it to work in reality, you just

00:30:21.100 --> 00:30:23.180
<v Uri Shaked Wokwicom>need to see what works in reality.

00:30:24.120 --> 00:30:24.380
<v Chris Gammell>Yeah.

00:30:24.380 --> 00:30:24.700
<v Chris Gammell>Yeah.

00:30:24.860 --> 00:30:25.220
<v Chris Gammell>Yeah.

00:30:25.220 --> 00:30:30.040
<v Chris Gammell>I think, so you were also on the Embedded.fm podcast, I believe, and you also talked about

00:30:30.040 --> 00:30:32.140
<v Chris Gammell>this simulation of things.

00:30:32.360 --> 00:30:35.460
<v Chris Gammell>We will link people into that so they can go on.

00:30:35.880 --> 00:30:38.000
<v Chris Gammell>You talked about that when you were on with Alicia and Chris, right?

00:30:38.740 --> 00:30:39.020
<v Uri Shaked Wokwicom>Mm-hmm.

00:30:39.900 --> 00:30:41.380
<v Uri Shaked Wokwicom>But another Chris, not you.

00:30:42.180 --> 00:30:42.600
<v Uri Shaked Wokwicom>That's right.

00:30:42.700 --> 00:30:42.840
<v Uri Shaked Wokwicom>Yeah.

00:30:42.840 --> 00:30:43.300
<v Chris Gammell>Different Chris.

00:30:43.400 --> 00:30:44.140
<v Chris Gammell>Lesser Chris, really.

00:30:44.200 --> 00:30:44.720
<v Chris Gammell>Let's be honest.

00:30:45.920 --> 00:30:46.620
<v Chris Gammell>No, I'm just kidding.

00:30:47.660 --> 00:30:50.180
<v Chris Gammell>So I was very interested.

00:30:50.320 --> 00:30:53.180
<v Chris Gammell>So I think that's how I first heard about you.

00:30:53.180 --> 00:30:57.780
<v Chris Gammell>I had also heard when you were on Remoticon, you gave a talk at Hackaday Remoticon.

00:30:58.360 --> 00:31:02.760
<v Chris Gammell>So that's, you know, sometime around then is when I first started learning about Wokwe

00:31:02.760 --> 00:31:03.860
<v Chris Gammell>and your stuff.

00:31:04.520 --> 00:31:08.620
<v Chris Gammell>I think the thing that blew my mind the most, though, about all this stuff, right?

00:31:08.640 --> 00:31:10.040
<v Chris Gammell>This is under the hood.

00:31:10.120 --> 00:31:12.100
<v Chris Gammell>There's so much crazy, awesome stuff going on.

00:31:12.680 --> 00:31:19.160
<v Chris Gammell>But you and I got in touch and you told me that I could just run any generic binary

00:31:19.160 --> 00:31:24.340
<v Chris Gammell>on one of the things that you have here because it's a cycle-accurate CPU.

00:31:24.920 --> 00:31:27.560
<v Chris Gammell>And so I was like, okay, well, I'll try this out.

00:31:27.840 --> 00:31:33.420
<v Chris Gammell>And I took some of the stuff I was doing for my job at Goliath, and I took a Zephyr-based

00:31:33.420 --> 00:31:35.040
<v Chris Gammell>binary that I had built.

00:31:35.040 --> 00:31:38.660
<v Chris Gammell>And the ESP32 thing that you have also has a network connection.

00:31:39.460 --> 00:31:41.060
<v Chris Gammell>And it just worked, man.

00:31:41.160 --> 00:31:42.200
<v Chris Gammell>Like, what?

00:31:43.600 --> 00:31:49.080
<v Chris Gammell>Like, I uploaded a binary for an ESP32, and it connected, and it looked like it was connecting

00:31:49.080 --> 00:31:50.180
<v Chris Gammell>back to the internet.

00:31:50.540 --> 00:31:55.740
<v Chris Gammell>And like, so then you also have an internet portal through this thing for devices as well.

00:31:55.860 --> 00:31:57.060
<v Chris Gammell>Like, how does that work?

00:31:57.060 --> 00:31:58.240
<v Uri Shaked Wokwicom>Oh, wow.

00:31:58.400 --> 00:32:03.680
<v Uri Shaked Wokwicom>That's one of the things I'm really excited about because that was the first time that

00:32:03.680 --> 00:32:09.720
<v Uri Shaked Wokwicom>I had to learn how Wi-Fi works, like how the actual protocol works.

00:32:10.180 --> 00:32:15.100
<v Uri Shaked Wokwicom>Because when I wanted to implement the Wi-Fi in the...

00:32:16.180 --> 00:32:17.520
<v Uri Shaked Wokwicom>Or let's take a step back.

00:32:17.720 --> 00:32:23.580
<v Uri Shaked Wokwicom>I started working on simulating the ESP32 because it's a chip that I used in some of my

00:32:23.580 --> 00:32:25.260
<v Uri Shaked Wokwicom>projects, and it's really capable.

00:32:25.260 --> 00:32:33.160
<v Uri Shaked Wokwicom>And I saw many users, especially from the FastLED LED community, which were early adopters

00:32:33.160 --> 00:32:36.140
<v Uri Shaked Wokwicom>of Wi-Fi, and they used ESP32.

00:32:36.660 --> 00:32:39.180
<v Uri Shaked Wokwicom>And I'm like, ESP32 is everywhere.

00:32:39.740 --> 00:32:42.860
<v Uri Shaked Wokwicom>How difficult would it be to support it?

00:32:43.540 --> 00:32:49.940
<v Uri Shaked Wokwicom>You know, just like the way I started originally working on the AVR simulator, the open source

00:32:49.940 --> 00:32:53.900
<v Uri Shaked Wokwicom>AVR simulator that eventually became the basis of Wi-Fi.

00:32:53.900 --> 00:32:59.440
<v Uri Shaked Wokwicom>I started one night hacking on the instruction set for the ESP32.

00:32:59.620 --> 00:33:01.260
<v Uri Shaked Wokwicom>That's the extensa instruction set.

00:33:01.800 --> 00:33:08.860
<v Uri Shaked Wokwicom>And I said, okay, I will just try to get Hello World or some link to sort of, not even run,

00:33:09.000 --> 00:33:12.040
<v Uri Shaked Wokwicom>but sort of give me a sense that something is going on.

00:33:12.040 --> 00:33:17.980
<v Uri Shaked Wokwicom>And gosh, the ESP32 is so much more complex than AVR.

00:33:17.980 --> 00:33:18.500
<v Uri Shaked Wokwicom>Yeah.

00:33:18.500 --> 00:33:18.940
<v Chris Gammell>Yeah.

00:33:18.940 --> 00:33:19.140
<v Chris Gammell>Yeah.

00:33:19.140 --> 00:33:20.260
<v Chris Gammell>Yes.

00:33:20.480 --> 00:33:24.800
<v Chris Gammell>I mean, it's 32-bit, it's dual core, it's extensa.

00:33:24.800 --> 00:33:30.120
<v Chris Gammell>It's like, yeah, it's just, I mean, how much bigger is the instruction set than the AVR

00:33:30.120 --> 00:33:30.400
<v Chris Gammell>stuff?

00:33:30.480 --> 00:33:33.240
<v Chris Gammell>I mean, imagine that that's probably pretty sizable as well.

00:33:33.240 --> 00:33:37.600
<v Uri Shaked Wokwicom>So the good thing about AVR is that they have great documentation.

00:33:38.940 --> 00:33:46.200
<v Uri Shaked Wokwicom>And extensa probably also have great documentation, but the instruction set manual, there is only

00:33:46.200 --> 00:33:49.400
<v Uri Shaked Wokwicom>one version that, as I have heard, it leaked.

00:33:49.600 --> 00:33:52.640
<v Uri Shaked Wokwicom>It's not like something they wanted to be publicly available.

00:33:52.640 --> 00:33:54.280
<v Uri Shaked Wokwicom>And it's good.

00:33:54.380 --> 00:33:55.300
<v Uri Shaked Wokwicom>It's not up to date.

00:33:55.420 --> 00:33:57.720
<v Uri Shaked Wokwicom>Some of the instructions do not even appear there.

00:33:58.360 --> 00:34:03.580
<v Uri Shaked Wokwicom>And there is like, for AVR, there are like all those forums, like AVR Freaks, where you

00:34:03.580 --> 00:34:09.500
<v Uri Shaked Wokwicom>can find answers to your questions because somebody has already asked the same questions millions

00:34:09.500 --> 00:34:10.200
<v Uri Shaked Wokwicom>of times.

00:34:10.820 --> 00:34:14.420
<v Uri Shaked Wokwicom>But for extensa, there isn't such a big community.

00:34:14.420 --> 00:34:20.540
<v Uri Shaked Wokwicom>I mean, even if you check out the compiler tool chain and I like the debugger and everything

00:34:20.540 --> 00:34:24.320
<v Uri Shaked Wokwicom>for the ESP32, Expressive have to maintain them.

00:34:24.640 --> 00:34:30.540
<v Uri Shaked Wokwicom>It's not like Arduino when there is like GCC built-in AVR support.

00:34:30.740 --> 00:34:32.500
<v Uri Shaked Wokwicom>They have to maintain their own form.

00:34:33.340 --> 00:34:37.840
<v Uri Shaked Wokwicom>So it's kind of much smaller and less documented ecosystem.

00:34:38.840 --> 00:34:42.940
<v Uri Shaked Wokwicom>But I think the most complex part for me was the Wi-Fi.

00:34:42.940 --> 00:34:50.420
<v Uri Shaked Wokwicom>When I got the ESP to finally show some signs of working and I uploaded an early prototype,

00:34:51.120 --> 00:34:53.660
<v Uri Shaked Wokwicom>people immediately asked, yeah, but we need Wi-Fi.

00:34:54.040 --> 00:34:56.900
<v Uri Shaked Wokwicom>Like ESP32 is all about Wi-Fi.

00:34:57.580 --> 00:35:02.960
<v Uri Shaked Wokwicom>And I was like, okay, it's going to be hard.

00:35:03.740 --> 00:35:11.040
<v Uri Shaked Wokwicom>And the reason it was hard is because unlike most of the ESP-IDF, most of their application

00:35:11.040 --> 00:35:14.920
<v Uri Shaked Wokwicom>framework, which is open source, the Wi-Fi isn't.

00:35:15.060 --> 00:35:19.940
<v Uri Shaked Wokwicom>It's like some binary that they link into the ESP-IDF.

00:35:20.000 --> 00:35:21.640
<v Chris Gammell>It's like a binary blob.

00:35:22.340 --> 00:35:22.660
<v Chris Gammell>Exactly.

00:35:24.320 --> 00:35:31.280
<v Chris Gammell>So from the perspective of Wi-Fi on this device, I mean, does it get simulated?

00:35:32.220 --> 00:35:33.900
<v Chris Gammell>Is there an instruction for Wi-Fi?

00:35:34.020 --> 00:35:37.520
<v Chris Gammell>I mean, or is it more at a higher level with like registers and such?

00:35:37.520 --> 00:35:45.760
<v Uri Shaked Wokwicom>So it took me a month of sleepless nights to reverse engineer their Wi-Fi driver.

00:35:46.500 --> 00:35:50.740
<v Uri Shaked Wokwicom>It turns out there is a peripheral for the Wi-Fi radio.

00:35:51.460 --> 00:35:53.940
<v Uri Shaked Wokwicom>So you write to certain registers.

00:35:53.940 --> 00:35:58.180
<v Uri Shaked Wokwicom>It uses the DMA to transmit the data.

00:35:58.180 --> 00:36:04.760
<v Uri Shaked Wokwicom>So the driver writes the Wi-Fi frames into a linked list of DMA buffers.

00:36:05.460 --> 00:36:06.600
<v Uri Shaked Wokwicom>And then it tells the driver.

00:36:07.060 --> 00:36:07.520
<v Uri Shaked Wokwicom>Yeah.

00:36:07.600 --> 00:36:10.580
<v Uri Shaked Wokwicom>Then it tells the peripheral, hey, send those out.

00:36:11.140 --> 00:36:16.780
<v Uri Shaked Wokwicom>It gets a bit more complicated because you have channels on Wi-Fi and you have to make sure

00:36:16.780 --> 00:36:20.360
<v Uri Shaked Wokwicom>like the radio is tuned to the right channel.

00:36:20.360 --> 00:36:27.240
<v Uri Shaked Wokwicom>So figuring out like all the magic constants they use there to convert from a Wi-Fi channel

00:36:27.240 --> 00:36:33.520
<v Uri Shaked Wokwicom>to frequency to whatever they use there internally was very tricky.

00:36:35.080 --> 00:36:39.020
<v Chris Gammell>And does this mean that you are doing like disassembly of these binaries in order to find

00:36:39.020 --> 00:36:40.640
<v Chris Gammell>these magic constants and stuff?

00:36:40.720 --> 00:36:42.080
<v Chris Gammell>Like how are you doing this reverse engineering?

00:36:42.080 --> 00:36:44.020
<v Uri Shaked Wokwicom>It's a combination of Gitra.

00:36:44.480 --> 00:36:53.120
<v Uri Shaked Wokwicom>So some guy who also tried to reverse engineer the SP32 Wi-Fi in the past extends a plugin for Gitra.

00:36:53.420 --> 00:36:57.680
<v Uri Shaked Wokwicom>So Gitra, for those who don't know, is a very powerful reverse engineering tool.

00:36:57.940 --> 00:37:03.440
<v Uri Shaked Wokwicom>It can decompile assembly into something that looks like pseudo-C code.

00:37:03.440 --> 00:37:12.200
<v Uri Shaked Wokwicom>Using Gitra, I sort of managed to have a way to look at what the code was doing.

00:37:12.340 --> 00:37:19.480
<v Uri Shaked Wokwicom>But then the other side of this was actually running the code in the simulator and seeing

00:37:19.480 --> 00:37:25.360
<v Uri Shaked Wokwicom>what registers it wrote to or which functions wrote to which registers.

00:37:25.820 --> 00:37:31.460
<v Uri Shaked Wokwicom>And I think the most advanced technique that I used and that was enabled by the simulator

00:37:31.460 --> 00:37:33.920
<v Uri Shaked Wokwicom>was sort of time travel.

00:37:34.600 --> 00:37:40.720
<v Uri Shaked Wokwicom>So I wanted to know what happened before I hit some breakpoint.

00:37:41.360 --> 00:37:47.420
<v Uri Shaked Wokwicom>So I just told the simulator, hey, record like every function call that happens in the simulated

00:37:47.420 --> 00:37:48.260
<v Uri Shaked Wokwicom>binary.

00:37:48.520 --> 00:37:54.260
<v Uri Shaked Wokwicom>And then I had this trace so I could sort of go back in time and figure out the flow that

00:37:54.260 --> 00:37:55.580
<v Uri Shaked Wokwicom>led to the breakpoint.

00:37:55.880 --> 00:38:00.060
<v Chris Gammell>It's like picking up breadcrumbs and putting them on a map or something like that.

00:38:00.060 --> 00:38:05.580
<v Chris Gammell>You know, like you're basically kind of setting up yourself up for all of the mapped streets

00:38:05.580 --> 00:38:10.500
<v Chris Gammell>that you wanted to map in the first place by saying at the stop sign, go tell me where

00:38:10.500 --> 00:38:11.800
<v Chris Gammell>I just came from or something like that.

00:38:11.800 --> 00:38:12.820
<v Chris Gammell>I'm trying to think of an analogy.

00:38:12.980 --> 00:38:14.520
<v Chris Gammell>It's not very good, but...

00:38:14.520 --> 00:38:16.720
<v Chris Gammell>It's better than what I would come up with.

00:38:16.800 --> 00:38:17.560
<v Chris Gammell>It's impressive.

00:38:18.120 --> 00:38:18.520
<v Uri Shaked Wokwicom>Thanks.

00:38:18.520 --> 00:38:27.480
<v Uri Shaked Wokwicom>The other side of that, there are already three, was just using GDB on the physical ESP32 chip.

00:38:27.480 --> 00:38:35.420
<v Uri Shaked Wokwicom>So whenever I got to a function that like indicated that a packet was received, I looked at the

00:38:35.420 --> 00:38:41.220
<v Uri Shaked Wokwicom>backtrace to see where it was, what caused that function to be called and where the packet,

00:38:41.440 --> 00:38:45.040
<v Uri Shaked Wokwicom>the frame was stored, the Wi-Fi frame was stored in memory.

00:38:45.040 --> 00:38:48.140
<v Uri Shaked Wokwicom>And I figured out it had like some weird header.

00:38:48.520 --> 00:38:55.380
<v Uri Shaked Wokwicom>So I could like record the stuff I got on the real device and replay it in the simulator and

00:38:55.380 --> 00:39:01.380
<v Uri Shaked Wokwicom>then see how it's get processed in the simulator and sort of look at the differences between

00:39:01.380 --> 00:39:07.720
<v Uri Shaked Wokwicom>the stack traces I got on the simulator and on the real device to find if a statement I was

00:39:07.720 --> 00:39:11.360
<v Uri Shaked Wokwicom>not hitting in the simulator, but hitting on the real device.

00:39:11.360 --> 00:39:16.360
<v Uri Shaked Wokwicom>It was a very, very stressful period.

00:39:17.240 --> 00:39:18.580
<v Chris Gammell>Super, super iterative.

00:39:18.920 --> 00:39:21.720
<v Chris Gammell>A lot of repeat work, I'm guessing.

00:39:22.040 --> 00:39:22.260
<v Uri Shaked Wokwicom>Yeah.

00:39:22.460 --> 00:39:29.580
<v Uri Shaked Wokwicom>And it's like I was only able to work on it throughout the night because it required a

00:39:29.580 --> 00:39:35.740
<v Uri Shaked Wokwicom>very long time span of focused work with a lot of attention to small details to figure

00:39:35.740 --> 00:39:37.700
<v Uri Shaked Wokwicom>out like all the pieces of the puzzle.

00:39:37.700 --> 00:39:46.900
<v Uri Shaked Wokwicom>So I really changed my schedule at that period when I worked on it so I could just sit whole

00:39:46.900 --> 00:39:48.180
<v Uri Shaked Wokwicom>nights and focus on it.

00:39:48.820 --> 00:39:49.380
<v Chris Gammell>Oh, wow.

00:39:49.480 --> 00:39:50.760
<v Chris Gammell>That's, yeah, that's intense.

00:39:51.180 --> 00:39:52.840
<v Chris Gammell>So then, okay, so you figured this out.

00:39:52.920 --> 00:39:59.540
<v Chris Gammell>You figured out how it communicates with the ESP32 peripherals that represent Wi-Fi.

00:39:59.540 --> 00:40:07.080
<v Chris Gammell>But then it's actually, I mean, Wi-Fi talks to the other side of, so in your simulator,

00:40:07.300 --> 00:40:08.700
<v Chris Gammell>it's talking to the internet somehow.

00:40:09.020 --> 00:40:11.840
<v Chris Gammell>And then does that mean you had to write a Wi-Fi router?

00:40:12.040 --> 00:40:17.500
<v Chris Gammell>Or did you just then say, oh, well, I know that you're trying to do this packet transmission,

00:40:17.500 --> 00:40:20.560
<v Chris Gammell>so I'll just, you know, shove that into an internet connection then?

00:40:20.620 --> 00:40:24.000
<v Chris Gammell>Like, how do you actually rectify then with the actual connection with the internet?

00:40:24.000 --> 00:40:30.480
<v Uri Shaked Wokwicom>Yeah, that was actually something I haven't figured out only, I only figured it out when

00:40:30.480 --> 00:40:34.380
<v Uri Shaked Wokwicom>I finished trying reverse engineering the Wi-Fi and I'm like, okay, now what?

00:40:34.980 --> 00:40:39.320
<v Uri Shaked Wokwicom>So the first step would be to simulate an access point.

00:40:39.600 --> 00:40:47.600
<v Uri Shaked Wokwicom>And that's where I had to learn how all like those Wi-Fi frames work or the association request,

00:40:47.740 --> 00:40:53.340
<v Uri Shaked Wokwicom>association response, because I had no idea about the internals of Wi-Fi before.

00:40:53.340 --> 00:41:01.040
<v Uri Shaked Wokwicom>And thanks to Wireshark and a few tutorials that I found online, I now know a bit better.

00:41:01.720 --> 00:41:08.040
<v Uri Shaked Wokwicom>So the simulator sends a probe request or the code that runs in the simulator,

00:41:08.200 --> 00:41:15.160
<v Uri Shaked Wokwicom>the Wi-Fi driver sends a Wi-Fi probe request and the simulator sends like the correct response

00:41:15.160 --> 00:41:17.740
<v Uri Shaked Wokwicom>and then they start an association process.

00:41:17.740 --> 00:41:22.760
<v Uri Shaked Wokwicom>So I had to write like all this lower layer of Wi-Fi myself.

00:41:23.200 --> 00:41:29.060
<v Uri Shaked Wokwicom>So the connection, the association with the access point would happen.

00:41:29.600 --> 00:41:37.820
<v Uri Shaked Wokwicom>And then for the next layers, which are like internet, TCP, IP, and whatever goes above it,

00:41:38.160 --> 00:41:40.000
<v Uri Shaked Wokwicom>I actually found a cool workaround.

00:41:40.000 --> 00:41:47.560
<v Uri Shaked Wokwicom>So there is network implementation, full network stack implementation written in Go that was published by Google.

00:41:48.820 --> 00:41:58.280
<v Uri Shaked Wokwicom>And what I'm doing, you can't run this in the browser because the browser won't allow you to open arbitrary internet connections to whatever.

00:41:59.100 --> 00:42:00.640
<v Uri Shaked Wokwicom>Yeah, you are pretty limited.

00:42:00.880 --> 00:42:02.780
<v Chris Gammell>That would be bad for other reasons, right?

00:42:02.840 --> 00:42:07.260
<v Chris Gammell>That they don't want random code execution to happen in the browser.

00:42:07.260 --> 00:42:07.680
<v Uri Shaked Wokwicom>Right.

00:42:07.780 --> 00:42:14.600
<v Uri Shaked Wokwicom>They wouldn't want the browser to contact your DNS server and exploit some vulnerabilities that you have there, right?

00:42:15.400 --> 00:42:15.960
<v Uri Shaked Wokwicom>Right.

00:42:16.180 --> 00:42:22.780
<v Uri Shaked Wokwicom>So the browser uses, opens a web socket to a gateway that I've written in Go.

00:42:23.000 --> 00:42:30.160
<v Uri Shaked Wokwicom>And that gateway uses that, I think it's called GVisor tab proxy or something like that, that package that Google published.

00:42:30.160 --> 00:42:35.880
<v Uri Shaked Wokwicom>And that package implements the entire like TCP, IP networking stack.

00:42:36.000 --> 00:42:38.120
<v Uri Shaked Wokwicom>And it has the HTTP server.

00:42:39.020 --> 00:42:44.080
<v Uri Shaked Wokwicom>If any of the listeners are interested, that part is also like open on GitHub.

00:42:44.440 --> 00:42:49.180
<v Uri Shaked Wokwicom>I think it's github.com slash walkway slash walkway GW, GW for gateway.

00:42:49.180 --> 00:43:01.800
<v Uri Shaked Wokwicom>So whenever you connect to the Wi-Fi, we open this web socket from your browser to either my server, or you can also run it on your local machine to this gateway.

00:43:02.240 --> 00:43:13.380
<v Uri Shaked Wokwicom>And that gateway implements kind of a NAT router that connects you to the internet or connects the internet to you if you want to go the other way around.

00:43:13.380 --> 00:43:15.340
<v Chris Gammell>That's amazing.

00:43:15.480 --> 00:43:17.800
<v Chris Gammell>I mean, like there's so much stuff under the hood here, man.

00:43:17.920 --> 00:43:20.340
<v Chris Gammell>Like it's just like, holy crap.

00:43:21.980 --> 00:43:24.000
<v Uri Shaked Wokwicom>And it's all connected with duct tape.

00:43:24.860 --> 00:43:25.160
<v Chris Gammell>Yeah.

00:43:25.240 --> 00:43:25.380
<v Chris Gammell>Yeah.

00:43:25.380 --> 00:43:26.220
<v Chris Gammell>I mean, that's fine.

00:43:26.320 --> 00:43:28.180
<v Chris Gammell>But it's, you know, it's also free.

00:43:28.360 --> 00:43:31.600
<v Chris Gammell>Like that's, I don't know if I mentioned that yet, but like it's also free.

00:43:31.600 --> 00:43:34.240
<v Chris Gammell>Like all of this stuff, the fact that you're giving away for free.

00:43:34.320 --> 00:43:42.300
<v Chris Gammell>Like, so, you know, feel free to ignore this question, but like, it doesn't seem like this would be a small processing load.

00:43:42.300 --> 00:43:45.840
<v Chris Gammell>You know, you mentioned virtual machines and, you know, all of these different libraries that you're running, whatever.

00:43:46.560 --> 00:43:52.320
<v Chris Gammell>Does my using it as an individual user cost you a significant amount of money?

00:43:53.340 --> 00:43:55.100
<v Chris Gammell>Maybe we get into the business side of things too.

00:43:55.280 --> 00:43:55.280
<v Speaker ?>

00:43:55.300 --> 00:43:57.960
<v Uri Shaked Wokwicom>I mean, that's a question that people always ask.

00:43:58.160 --> 00:44:00.440
<v Uri Shaked Wokwicom>So it depends how you define significant.

00:44:00.900 --> 00:44:07.820
<v Uri Shaked Wokwicom>Most people think that the cost of the operation right now is a few hundred bucks a month.

00:44:07.820 --> 00:44:14.120
<v Uri Shaked Wokwicom>Everything, including the Wi-Fi gateway and the database and everything it runs on.

00:44:14.780 --> 00:44:17.540
<v Uri Shaked Wokwicom>And I've been working pretty hard to optimize that.

00:44:17.800 --> 00:44:22.780
<v Uri Shaked Wokwicom>Like if I was just spurring resources, it could get to a few thousand a month.

00:44:23.540 --> 00:44:24.620
<v Uri Shaked Wokwicom>But I think the real.

00:44:24.880 --> 00:44:25.220
<v Uri Shaked Wokwicom>Yeah.

00:44:25.560 --> 00:44:25.720
<v Uri Shaked Wokwicom>Right.

00:44:25.720 --> 00:44:29.860
<v Uri Shaked Wokwicom>I think the real cost is actually the engineering that goes into this.

00:44:30.240 --> 00:44:42.160
<v Uri Shaked Wokwicom>Like it's a lot of hard engineering work to build all those pieces and to put them together and then to make them easy to consume for the users.

00:44:42.800 --> 00:44:43.660
<v Chris Gammell>Yes, totally.

00:44:43.780 --> 00:44:44.860
<v Chris Gammell>I mean, your time is definitely.

00:44:45.020 --> 00:44:45.860
<v Chris Gammell>And it's just you.

00:44:46.020 --> 00:44:46.340
<v Chris Gammell>Is that right?

00:44:46.340 --> 00:44:52.200
<v Uri Shaked Wokwicom>So I started this project and right now it's on the technical side.

00:44:52.420 --> 00:44:55.220
<v Uri Shaked Wokwicom>It's me and Ariella, my life partner.

00:44:55.480 --> 00:44:57.420
<v Uri Shaked Wokwicom>We are working on the product.

00:44:57.920 --> 00:45:06.820
<v Uri Shaked Wokwicom>And then we have a few freelancers that help with content like blog posts and documentation and graphics.

00:45:06.820 --> 00:45:14.880
<v Uri Shaked Wokwicom>And I hope to at some point in time be able to hire additional engineers.

00:45:14.880 --> 00:45:22.280
<v Uri Shaked Wokwicom>But because like I've been doing engineering for so long, it's really hard to me to outsource that part.

00:45:22.900 --> 00:45:23.340
<v Chris Gammell>Right.

00:45:23.560 --> 00:45:23.820
<v Chris Gammell>Right.

00:45:23.880 --> 00:45:28.040
<v Chris Gammell>Like splitting out the work and, you know, letting go of some of the control, all that kind of stuff.

00:45:28.160 --> 00:45:29.340
<v Chris Gammell>That's understandable.

00:45:29.340 --> 00:45:35.260
<v Uri Shaked Wokwicom>I heard a podcast you had with Simone Yach and I think she had like the same problem, right?

00:45:35.260 --> 00:45:38.620
<v Chris Gammell>Yeah, she talked about it from a video perspective.

00:45:38.840 --> 00:45:45.120
<v Chris Gammell>Like, so, you know, Simone has a lot of video type of work, but she's still like very involved with it.

00:45:45.180 --> 00:45:48.040
<v Chris Gammell>And I think that, and Dave, you know, Dave's mentioned that in the past too, right?

00:45:48.280 --> 00:45:54.520
<v Chris Gammell>Of like, you know, just kind of letting go of creative control or really, you know, any engineering control as well.

00:45:54.580 --> 00:46:00.100
<v Chris Gammell>Like it's just so you have to kind of trust people a little bit more and it changes the nature of your operation.

00:46:00.280 --> 00:46:02.920
<v Chris Gammell>And, you know, distributed work becomes less efficient, right?

00:46:02.920 --> 00:46:09.320
<v Chris Gammell>The most efficient thing is a one person team, but then you're limited by how many hours you have available to your work.

00:46:09.320 --> 00:46:11.600
<v Chris Gammell>So like, yeah, there's, there's always that trade-off.

00:46:11.660 --> 00:46:12.300
<v Chris Gammell>It sucks.

00:46:12.300 --> 00:46:12.920
<v Uri Shaked Wokwicom>I know.

00:46:15.120 --> 00:46:15.560
<v Chris Gammell>Okay.

00:46:15.680 --> 00:46:17.100
<v Chris Gammell>Well, people can join the club.

00:46:17.280 --> 00:46:19.020
<v Chris Gammell>I think that's a good start.

00:46:19.160 --> 00:46:24.940
<v Chris Gammell>So the WalkWeek club, basically, we already mentioned, like, if you join that, you get to help support the site.

00:46:25.040 --> 00:46:27.560
<v Chris Gammell>You can also vote on features.

00:46:27.560 --> 00:46:32.700
<v Chris Gammell>You can get faster and more stable internet access through the Wi-Fi.

00:46:32.900 --> 00:46:33.960
<v Chris Gammell>What is, what is that piece?

00:46:33.960 --> 00:46:44.580
<v Uri Shaked Wokwicom>So as I mentioned, the Wi-Fi gateway runs on some server and then you're using that to get the ESP32 to connect to the internet.

00:46:45.020 --> 00:46:48.980
<v Uri Shaked Wokwicom>But for club users, we'll let you run this server locally.

00:46:49.260 --> 00:46:53.280
<v Uri Shaked Wokwicom>So it doesn't have to go through another place.

00:46:53.280 --> 00:47:03.280
<v Uri Shaked Wokwicom>And then it also means you can connect from your web browser to a web server running inside the ESP32 because the gateway is running locally.

00:47:03.500 --> 00:47:12.120
<v Uri Shaked Wokwicom>So you can do everything that you would be able or almost everything you would be able to do with an ESP32 that sits on your local network.

00:47:12.380 --> 00:47:15.900
<v Uri Shaked Wokwicom>It's like the ESP32 is on your local network.

00:47:16.520 --> 00:47:17.120
<v Chris Gammell>That's super cool.

00:47:17.460 --> 00:47:18.660
<v Chris Gammell>Yeah, that's great.

00:47:18.660 --> 00:47:24.120
<v Chris Gammell>And so then that's like a, so that's the GW that you mentioned, like the WalkWeek-GW.

00:47:24.620 --> 00:47:27.620
<v Chris Gammell>That's like a daemon that would run on your local machine or in the browser?

00:47:27.760 --> 00:47:28.520
<v Chris Gammell>How does that run?

00:47:28.600 --> 00:47:35.620
<v Uri Shaked Wokwicom>Yeah, it's just like a command line application that you run independent of the browser and then the browser connects to it.

00:47:36.400 --> 00:47:45.080
<v Uri Shaked Wokwicom>And then you can enjoy the Wi-Fi locally without having to rely on distant service and you can connect to your local network.

00:47:45.080 --> 00:48:00.080
<v Uri Shaked Wokwicom>And I think if there are like listeners who are more into like reverse engineering and protocols and that stuff, another interesting feature of the Wi-Fi is that you can actually download a packet capture file that you can open in Wireshark.

00:48:00.920 --> 00:48:13.140
<v Uri Shaked Wokwicom>So you can see like all the association requests and the association process and then all the DHCP handshake and basically everything that goes into network stack of the simulator.

00:48:13.420 --> 00:48:14.420
<v Uri Shaked Wokwicom>You can see it.

00:48:14.420 --> 00:48:14.860
<v Chris Gammell>Yeah.

00:48:15.640 --> 00:48:21.620
<v Chris Gammell>So you mentioned the compiler, sorry, the debugger might be on the way or you're kind of grinding through that now.

00:48:22.120 --> 00:48:25.360
<v Chris Gammell>But what about other, you have other parts coming as well?

00:48:25.440 --> 00:48:26.900
<v Chris Gammell>I mean, like all of these things.

00:48:27.700 --> 00:48:33.320
<v Chris Gammell>One thing that's interesting to me is that, so you mentioned the ESP32 and the Extensa core and stuff like that.

00:48:33.420 --> 00:48:41.020
<v Chris Gammell>And then just like, ho-hum, then there's also the S2 and the C3, which means that you also have a RISC-V simulator on here as well.

00:48:41.460 --> 00:48:43.320
<v Uri Shaked Wokwicom>Yeah, that's true.

00:48:43.320 --> 00:48:45.500
<v Uri Shaked Wokwicom>Oh, finally somebody noticed.

00:48:47.340 --> 00:48:47.740
<v Chris Gammell>Yeah.

00:48:50.140 --> 00:48:51.080
<v Chris Gammell>That's non-trivial.

00:48:51.340 --> 00:48:57.060
<v Chris Gammell>So that means you have, so let's see, Arduino, so there's the AVR simulator, there's the Extensa simulator.

00:48:57.140 --> 00:49:00.100
<v Chris Gammell>You must have an ARM Cortex-M0 simulator.

00:49:00.500 --> 00:49:01.780
<v Chris Gammell>You have a RISC-V simulator.

00:49:01.920 --> 00:49:02.520
<v Chris Gammell>What else is on here?

00:49:02.540 --> 00:49:03.000
<v Chris Gammell>Anything else?

00:49:03.460 --> 00:49:04.320
<v Chris Gammell>I mean, that's a lot.

00:49:04.460 --> 00:49:04.920
<v Chris Gammell>Don't get me wrong.

00:49:04.920 --> 00:49:10.700
<v Uri Shaked Wokwicom>There is also an Cortex-M4 simulator that is on the way.

00:49:11.540 --> 00:49:13.800
<v Uri Shaked Wokwicom>It's sort of working already.

00:49:13.940 --> 00:49:16.500
<v Chris Gammell>That's the early access list that I signed up for.

00:49:16.600 --> 00:49:16.660
<v Chris Gammell>Yeah.

00:49:16.660 --> 00:49:17.100
<v Chris Gammell>Yeah.

00:49:18.100 --> 00:49:30.940
<v Uri Shaked Wokwicom>I mean, the first chips we are trying to use that core with are the STM32, even though I'm actively looking for interesting chips that use the Cortex-M4 to simulate.

00:49:30.940 --> 00:49:38.020
<v Uri Shaked Wokwicom>So if there are any people who have a good business reason for me to add those chips, I would love to talk to them.

00:49:38.020 --> 00:49:39.660
<v Chris Gammell>Oh, man.

00:49:40.080 --> 00:49:42.820
<v Chris Gammell>I, you know, I love the NRF52840.

00:49:43.300 --> 00:49:46.640
<v Chris Gammell>That's a Cortex-M4, but that would be a whole nother.

00:49:47.300 --> 00:49:51.640
<v Chris Gammell>You want to go do another protocol stack and Bluetooth or Thread?

00:49:52.160 --> 00:49:53.660
<v Chris Gammell>Oh, I don't think that's bad.

00:49:53.660 --> 00:49:58.260
<v Uri Shaked Wokwicom>Well, give me a good business reason and we'll figure out how to make it work.

00:49:59.120 --> 00:50:04.340
<v Uri Shaked Wokwicom>I mean, it's fun working on this stuff, but it's just a lot of work.

00:50:04.340 --> 00:50:07.520
<v Uri Shaked Wokwicom>So I have to find a way to justify it.

00:50:07.720 --> 00:50:07.880
<v Chris Gammell>Totally.

00:50:08.020 --> 00:50:25.460
<v Uri Shaked Wokwicom>And I think in terms of what's coming to WorkWe, the part I'm most excited about right now is, and this is also like in prototype, so people can come and play around with it, is the ability of users to create their own custom parts in the simulator.

00:50:26.740 --> 00:50:34.300
<v Uri Shaked Wokwicom>So it's called custom chips and there is a C API that you can use to implement your own chip.

00:50:34.300 --> 00:50:39.300
<v Uri Shaked Wokwicom>And it feels like writing sort of embedded code.

00:50:39.860 --> 00:50:49.280
<v Uri Shaked Wokwicom>But it's kind of from a weird perspective because you are not running embedded code that implements a firmware for an application.

00:50:49.280 --> 00:50:56.340
<v Uri Shaked Wokwicom>You are running an embedded code that sort of simulates peripheral like an ISC or C-express.

00:50:56.500 --> 00:50:59.960
<v Chris Gammell>Yeah, you're like writing a mock basically for physical hardware, right?

00:51:00.000 --> 00:51:03.060
<v Chris Gammell>It's like you're writing the UART driver or whatever.

00:51:03.200 --> 00:51:03.660
<v Chris Gammell>It's crazy.

00:51:03.940 --> 00:51:04.160
<v Uri Shaked Wokwicom>Yeah.

00:51:04.160 --> 00:51:09.460
<v Uri Shaked Wokwicom>And I've seen like some stuff that people created with it, with just a prototype.

00:51:10.000 --> 00:51:15.140
<v Uri Shaked Wokwicom>And I'm like, wow, I'm really starting to like where this is going.

00:51:15.140 --> 00:51:20.060
<v Chris Gammell>Yeah, because then, so then the idea would be like, so now, okay, so I mentioned NRF 52.840.

00:51:20.180 --> 00:51:24.160
<v Chris Gammell>That's got a bunch of custom peripherals that don't exist in the STM32, for example.

00:51:24.620 --> 00:51:32.200
<v Chris Gammell>So now basically a community member could be like, you know what, I want to tweak this so that it's a little bit more accurate towards the NRF 52.840.

00:51:32.300 --> 00:51:38.700
<v Chris Gammell>They could go and write this kind of meta C code that could go and target the ADC that's a little bit closer to the actual behavior.

00:51:38.840 --> 00:51:40.160
<v Chris Gammell>Is that the thought process there?

00:51:41.040 --> 00:51:43.200
<v Uri Shaked Wokwicom>It could get into that as well.

00:51:43.200 --> 00:51:48.100
<v Uri Shaked Wokwicom>Well, right now the idea is that you write parts that are not parts of the processor.

00:51:48.340 --> 00:51:52.740
<v Uri Shaked Wokwicom>So for instance, you want to implement some I2C expended chip.

00:51:53.100 --> 00:51:53.300
<v Uri Shaked Wokwicom>Got it.

00:51:53.540 --> 00:52:02.100
<v Uri Shaked Wokwicom>Or I think a few cool examples that users have already implemented is I2C keypad driver.

00:52:02.100 --> 00:52:05.960
<v Uri Shaked Wokwicom>So you have like these keypads that you have to scan continuously.

00:52:06.500 --> 00:52:10.760
<v Uri Shaked Wokwicom>What if you wanted just to have a chip that you can speak to through I2C?

00:52:10.760 --> 00:52:16.020
<v Uri Shaked Wokwicom>And specifically, I think there are a few chips that already do that.

00:52:16.100 --> 00:52:19.480
<v Uri Shaked Wokwicom>So you can just take the data sheet and simulate that.

00:52:19.940 --> 00:52:26.760
<v Uri Shaked Wokwicom>Or if you wanted to add some, I don't know, custom ePaper display to the simulator, you could do that.

00:52:27.500 --> 00:52:27.940
<v Chris Gammell>Huh.

00:52:28.740 --> 00:52:29.180
<v Chris Gammell>Yeah.

00:52:29.180 --> 00:52:29.220
<v Chris Gammell>Yeah.

00:52:29.540 --> 00:52:34.680
<v Chris Gammell>So then this would be, so you're mentioning this is C code, but like all of the visualization piece, that's all JavaScript.

00:52:35.020 --> 00:52:38.020
<v Chris Gammell>So then would you then need to write the layer on top?

00:52:38.100 --> 00:52:39.740
<v Chris Gammell>So like the ePaper is a good example, right?

00:52:39.820 --> 00:52:42.680
<v Chris Gammell>So ePaper is going to have some display element to it.

00:52:42.680 --> 00:52:49.360
<v Chris Gammell>It's going to show some, you know, you write to the registers and then it flips the required bits and it says hello world on it.

00:52:49.360 --> 00:52:49.580
<v Chris Gammell>Right.

00:52:50.120 --> 00:52:50.440
<v Chris Gammell>Right.

00:52:50.440 --> 00:52:57.580
<v Chris Gammell>When does that code written for displaying hello world on the actual browser, how do you get that involved?

00:52:58.280 --> 00:53:13.720
<v Uri Shaked Wokwicom>So with display there is, or with chips that implement display drivers, they have what I call frame buffer API where they can supply pixel image like a bitmap to the JavaScript code.

00:53:13.720 --> 00:53:16.180
<v Uri Shaked Wokwicom>And then the JavaScript code rolls out to the script.

00:53:16.340 --> 00:53:17.180
<v Uri Shaked Wokwicom>Ah, okay.

00:53:17.180 --> 00:53:24.080
<v Uri Shaked Wokwicom>And the way this works behind the scenes, your custom chip code gets compiled from C to WebAssembly.

00:53:24.840 --> 00:53:37.400
<v Uri Shaked Wokwicom>So it's something native to the browser and the browser just internally translate this WebAssembly into efficient machine code for the machine you are running on.

00:53:37.400 --> 00:53:44.240
<v Uri Shaked Wokwicom>So whether it's a PC or new M2 laptop, it would translate it to the correct instruction set.

00:53:44.400 --> 00:53:46.460
<v Uri Shaked Wokwicom>So it should run pretty fast.

00:53:47.020 --> 00:53:49.900
<v Uri Shaked Wokwicom>So it's sort of a strange hybrid.

00:53:50.180 --> 00:54:03.960
<v Uri Shaked Wokwicom>It feels like you are programming, you're writing a firmware, but you're actually writing code in WebAssembly that implement some peripheral, which is something that I don't think there is.

00:54:04.640 --> 00:54:06.080
<v Uri Shaked Wokwicom>This concept doesn't really exist.

00:54:06.080 --> 00:54:16.320
<v Uri Shaked Wokwicom>Like, I think for the most part, people are used to use Verilog for writing simulation models for specific pieces of hardware.

00:54:17.160 --> 00:54:21.220
<v Chris Gammell>So then do the people that are writing this code, they don't need to know WebAssembly?

00:54:21.560 --> 00:54:22.580
<v Chris Gammell>They just need to know C?

00:54:22.580 --> 00:54:41.040
<v Uri Shaked Wokwicom>Yeah, it's like, I mean, the API for, it's still very much in flux, but the API for like, if you want to implement I2C peripheral is like I2C in it, and then you pass it like a structure that includes a list of callbacks.

00:54:41.040 --> 00:54:55.280
<v Uri Shaked Wokwicom>So whenever somebody connects to your profile, whenever they read a byte, and whenever they disconnect, you give it like the, you also have like fields where you can specify the STL and SDA pins.

00:54:55.280 --> 00:54:58.280
<v Uri Shaked Wokwicom>And you give it like context.

00:54:58.280 --> 00:55:04.600
<v Uri Shaked Wokwicom>And then whenever it calls those callbacks, it passes those, this context, so you can pass additional information.

00:55:04.600 --> 00:55:13.960
<v Uri Shaked Wokwicom>So it's very similar, I think, for how you would write firmware code that implements an I2C peripheral.

00:55:14.560 --> 00:55:14.760
<v Chris Gammell>Yeah.

00:55:14.860 --> 00:55:15.180
<v Chris Gammell>You can see.

00:55:15.180 --> 00:55:16.240
<v Chris Gammell>That's great.

00:55:16.460 --> 00:55:16.900
<v Chris Gammell>That's great.

00:55:16.980 --> 00:55:24.120
<v Chris Gammell>I think that definitely, because that is probably going to be the people that are most interested in getting close to the hardware, that's kind of like the world they live in.

00:55:24.180 --> 00:55:28.360
<v Chris Gammell>Instead of being like, well, go learn JavaScript or WebAssembly and come back when you're ready.

00:55:28.360 --> 00:55:28.600
<v Chris Gammell>Yeah.

00:55:28.700 --> 00:55:33.420
<v Uri Shaked Wokwicom>So the first iteration of this custom chip API was in JavaScript.

00:55:33.800 --> 00:55:37.820
<v Uri Shaked Wokwicom>And then the feedback I got from developers is, we don't want JavaScript, we want C.

00:55:38.000 --> 00:55:41.500
<v Uri Shaked Wokwicom>And that's why I switched to use C that compiles to WebAssembly.

00:55:42.120 --> 00:55:45.040
<v Chris Gammell>And could you explain WebAssembly for, I've heard of it.

00:55:45.040 --> 00:55:46.640
<v Chris Gammell>I don't quite get it, though.

00:55:46.760 --> 00:55:47.000
<v Uri Shaked Wokwicom>Okay.

00:55:47.500 --> 00:55:47.720
<v Uri Shaked Wokwicom>Cool.

00:55:47.720 --> 00:55:58.300
<v Uri Shaked Wokwicom>So if you know the JVM, the Java virtual machine, or the CLR, the .NET runtime, it's pretty similar in nature.

00:55:58.620 --> 00:56:06.100
<v Uri Shaked Wokwicom>It's sort of a virtual machine, stack-based virtual machine that you can compile a variety of languages to.

00:56:06.100 --> 00:56:22.800
<v Uri Shaked Wokwicom>So I think C++ and Rust are the most common languages that are compiled to WebAssembly, but you can also compile Go, and you can also compile a specific dialect of JavaScript that's called AssemblyScript.

00:56:22.800 --> 00:56:30.620
<v Uri Shaked Wokwicom>And there are a few other niche languages that you can, I think Zig also compiles to WebAssembly, if you heard about that language.

00:56:30.620 --> 00:56:39.940
<v Uri Shaked Wokwicom>And then this WebAssembly is sort of binary that has this virtual machine.

00:56:39.940 --> 00:56:48.760
<v Uri Shaked Wokwicom>So what happens is that the browser loads this WebAssembly binary, and it does two things.

00:56:48.840 --> 00:57:00.660
<v Uri Shaked Wokwicom>First of all, it does a bunch of validations to make sure that the code in the virtual machine is never reading from a memory that does not belong to that piece of code.

00:57:00.660 --> 00:57:04.380
<v Uri Shaked Wokwicom>So to ensure the sandbox security of the browser.

00:57:05.200 --> 00:57:08.180
<v Uri Shaked Wokwicom>And then once, so it's a stack-based virtual machine.

00:57:08.380 --> 00:57:14.400
<v Uri Shaked Wokwicom>So the browser has like all these checks to make sure that you never overflow or underflow the stack.

00:57:15.340 --> 00:57:26.300
<v Uri Shaked Wokwicom>And after it ensures everything is balanced, it translates the WebAssembly instructions into machine instructions like of your architecture.

00:57:26.520 --> 00:57:28.820
<v Uri Shaked Wokwicom>So x86 or ARM or whatever.

00:57:28.820 --> 00:57:36.080
<v Uri Shaked Wokwicom>So when the code runs, it ends up running not as interpreted code, but as translated code.

00:57:36.180 --> 00:57:37.140
<v Uri Shaked Wokwicom>So that's much faster.

00:57:37.920 --> 00:57:40.820
<v Chris Gammell>Basically because it's doing that translate.

00:57:40.920 --> 00:57:47.680
<v Chris Gammell>It's like a universal translator for your actual processor on board instead of doing like an interpreted language that's at a very high level.

00:57:47.820 --> 00:57:48.000
<v Uri Shaked Wokwicom>Yeah.

00:57:48.200 --> 00:57:51.260
<v Uri Shaked Wokwicom>Similar to what you have with .NET and the CLR.

00:57:51.260 --> 00:58:01.640
<v Uri Shaked Wokwicom>I think one of the most common misconceptions about WebAssembly is that it's faster than JavaScript because people think about JavaScript as interpreted language.

00:58:02.480 --> 00:58:03.860
<v Uri Shaked Wokwicom>Which used to be true.

00:58:04.100 --> 00:58:08.900
<v Uri Shaked Wokwicom>But nowadays there is a very powerful just-in-time compiler.

00:58:08.900 --> 00:58:19.660
<v Uri Shaked Wokwicom>And I actually spent a week trying to convert the extensa core simulator for the ESP32 from JavaScript to WebAssembly.

00:58:19.660 --> 00:58:23.980
<v Uri Shaked Wokwicom>And it turns out they run roughly at the same speed.

00:58:23.980 --> 00:58:40.740
<v Uri Shaked Wokwicom>Because for some payloads where you have, I would say for stuff like command line tools where you have a lot of code that is running and has to be translated from JavaScript to optimized machine code.

00:58:40.740 --> 00:58:48.160
<v Uri Shaked Wokwicom>So then the price you pay for doing that translation every time you're running the command line tool is pretty big.

00:58:48.960 --> 00:58:56.460
<v Uri Shaked Wokwicom>But if you think about it, the simulator for extensa is a bunch of functions that just run repeatedly.

00:58:57.300 --> 00:59:08.240
<v Uri Shaked Wokwicom>So after a few milliseconds, the CPU or the JavaScript runtime realizes that this is like the host code and translates those few functions.

00:59:08.240 --> 00:59:14.300
<v Uri Shaked Wokwicom>So you sort of pay a penalty at the beginning of the simulation.

00:59:15.120 --> 00:59:20.740
<v Uri Shaked Wokwicom>Like, I don't know, a few hundred milliseconds until that code gets translated.

00:59:21.140 --> 00:59:31.040
<v Uri Shaked Wokwicom>But once it's translated from JavaScript to optimized assembly code, then it's basically the same result as you would get from WebAssembly.

00:59:31.480 --> 00:59:34.700
<v Uri Shaked Wokwicom>And that was something really surprising for me.

00:59:34.700 --> 00:59:40.300
<v Uri Shaked Wokwicom>I hope that I would be able to speed up the simulation once I translated the engine to WebAssembly.

00:59:40.800 --> 00:59:41.400
<v Uri Shaked Wokwicom>Not happy.

00:59:42.080 --> 00:59:43.640
<v Chris Gammell>No. Yeah. Okay. Interesting.

00:59:44.300 --> 00:59:45.580
<v Chris Gammell>How much of it...

00:59:45.580 --> 00:59:47.500
<v Chris Gammell>So this is all running in the browser, obviously.

00:59:48.200 --> 00:59:54.300
<v Chris Gammell>And I know this is going to sound stupid, but my question earlier about server costs and stuff like that, too.

00:59:54.300 --> 00:59:59.120
<v Chris Gammell>I always thought Wordle, you know, Wordle is like this global phenomenon around like...

00:59:59.120 --> 01:00:00.800
<v Chris Gammell>And I was like, oh, man, he's got like millions of users.

01:00:00.900 --> 01:00:01.300
<v Chris Gammell>He sold it.

01:00:01.380 --> 01:00:03.380
<v Chris Gammell>He must have had like crazy server costs.

01:00:03.600 --> 01:00:04.900
<v Chris Gammell>But then I was reading an article about it.

01:00:04.920 --> 01:00:08.800
<v Chris Gammell>And he's like, well, actually, it's a really small program, but it runs actually completely in the browser.

01:00:08.800 --> 01:00:10.420
<v Chris Gammell>And there's very little like server interaction.

01:00:10.580 --> 01:00:15.540
<v Chris Gammell>So the server cost was just delivering new downloads of the software itself.

01:00:15.540 --> 01:00:19.920
<v Chris Gammell>And so like how much of this is actually running...

01:00:19.920 --> 01:00:23.800
<v Chris Gammell>I guess this is a lack of knowledge of how JavaScript and browsers work anyways.

01:00:23.940 --> 01:00:30.520
<v Chris Gammell>But like how much of what the simulator is doing is running in the browser versus like talking back to the server?

01:00:30.640 --> 01:00:31.640
<v Chris Gammell>Is it mostly in the browser?

01:00:31.940 --> 01:00:34.480
<v Uri Shaked Wokwicom>So this is a question I get asked all the time.

01:00:34.560 --> 01:00:35.340
<v Uri Shaked Wokwicom>It's a great question.

01:00:35.540 --> 01:00:41.060
<v Uri Shaked Wokwicom>Because people tend to think that this can't be done in the browser.

01:00:41.060 --> 01:00:45.940
<v Uri Shaked Wokwicom>So they tend to think there is like some process that is running the simulator on a server.

01:00:45.940 --> 01:00:52.920
<v Uri Shaked Wokwicom>But no, once the hex file or the compiled file gets into a browser, everything runs in the browser.

01:00:53.840 --> 01:00:53.840
<v Speaker ?>

01:00:53.980 --> 01:01:00.820
<v Uri Shaked Wokwicom>Or if you load a MicroPython program or a local hex file, then nothing goes through the server.

01:01:01.040 --> 01:01:02.180
<v Uri Shaked Wokwicom>It's all in your browser.

01:01:02.780 --> 01:01:09.060
<v Uri Shaked Wokwicom>So when you start like a MicroPython project in WorkWi, WorkWi goes to the server,

01:01:09.060 --> 01:01:13.240
<v Uri Shaked Wokwicom>downloads the pre-compiled MicroPython firmware, loads it.

01:01:13.900 --> 01:01:15.200
<v Uri Shaked Wokwicom>And then it just...

01:01:15.200 --> 01:01:17.180
<v Uri Shaked Wokwicom>After that, it did it once.

01:01:17.500 --> 01:01:22.420
<v Uri Shaked Wokwicom>Whenever you run a Python project, it just loads that firmware into the simulator.

01:01:22.880 --> 01:01:25.380
<v Uri Shaked Wokwicom>And everything is happening in a browser.

01:01:25.700 --> 01:01:27.600
<v Uri Shaked Wokwicom>There is nothing that involves the server.

01:01:27.940 --> 01:01:27.960
<v Chris Gammell>Huh.

01:01:28.380 --> 01:01:29.200
<v Chris Gammell>So is that...

01:01:29.200 --> 01:01:32.540
<v Chris Gammell>That's just true for MicroPython because it's interpreted versus something else?

01:01:32.680 --> 01:01:35.920
<v Chris Gammell>Or why did you call out MicroPython specifically in that case?

01:01:35.920 --> 01:01:37.000
<v Chris Gammell>Is it...

01:01:37.000 --> 01:01:39.340
<v Chris Gammell>Do some other ones have more server interaction?

01:01:40.300 --> 01:01:43.920
<v Uri Shaked Wokwicom>Just because MicroPython is interpreted, then you just need...

01:01:44.920 --> 01:01:45.920
<v Uri Shaked Wokwicom>Think of it...

01:01:46.460 --> 01:01:49.920
<v Uri Shaked Wokwicom>I would say the best way to think of it would be to think...

01:01:49.920 --> 01:01:57.600
<v Uri Shaked Wokwicom>When you develop locally with Arduino, you have to compile and upload the code each time, right?

01:01:57.660 --> 01:02:11.040
<v Uri Shaked Wokwicom>But when you use MicroPython, you just load MicroPython once into the board, and then you can interact with MicroPython and update your program without re-uploading MicroPython itself every time.

01:02:11.040 --> 01:02:19.280
<v Uri Shaked Wokwicom>And more importantly, for the purpose of server costs without recompiling MicroPython every time.

01:02:20.080 --> 01:02:20.620
<v Uri Shaked Wokwicom>Right, right.

01:02:20.880 --> 01:02:21.080
<v Uri Shaked Wokwicom>Okay.

01:02:21.120 --> 01:02:22.420
<v Uri Shaked Wokwicom>So another good example...

01:02:22.420 --> 01:02:27.180
<v Chris Gammell>So it's just that single binary download, like you said, and then it all just happens...

01:02:27.180 --> 01:02:28.660
<v Uri Shaked Wokwicom>In the browser, yeah.

01:02:29.200 --> 01:02:35.040
<v Uri Shaked Wokwicom>Or another example is now we started working on adding Rust support for the ESP32.

01:02:35.040 --> 01:02:40.580
<v Uri Shaked Wokwicom>And Rust is a compiled language, and the compiler is pretty demanding.

01:02:41.180 --> 01:02:45.080
<v Uri Shaked Wokwicom>So that one actually adds a lot of...

01:02:45.080 --> 01:02:47.420
<v Uri Shaked Wokwicom>Like has a lot of potential server costs.

01:02:47.540 --> 01:02:54.220
<v Uri Shaked Wokwicom>If people started compiling heavy Rust binaries to run in the simulation, that would cost a lot.

01:02:54.300 --> 01:03:00.000
<v Uri Shaked Wokwicom>Because we have to run those compiler processes and pay for the resources.

01:03:00.000 --> 01:03:02.260
<v Chris Gammell>Yeah, and this is actually...

01:03:02.260 --> 01:03:04.400
<v Chris Gammell>So I had asked you at one point about like Zephyr as well.

01:03:04.500 --> 01:03:11.960
<v Chris Gammell>I was doing some Zephyr stuff, and I think you even did an experiment where you had like a containerized Zephyr where you were showing a compiling.

01:03:12.280 --> 01:03:15.560
<v Chris Gammell>And it was like very slow because the Zephyr toolchain is monstrous.

01:03:15.660 --> 01:03:17.140
<v Chris Gammell>But it was in that same scenario.

01:03:17.140 --> 01:03:18.320
<v Chris Gammell>It was running remotely.

01:03:18.480 --> 01:03:19.860
<v Chris Gammell>It wasn't running in the browser.

01:03:19.940 --> 01:03:22.180
<v Chris Gammell>It was running on some like remote container, right?

01:03:22.440 --> 01:03:27.880
<v Uri Shaked Wokwicom>So the compilation was running at the remote container, but once it's compiled, it runs in the browser.

01:03:27.880 --> 01:03:32.760
<v Uri Shaked Wokwicom>So even for Rust, there are like ways to speed up the compilation.

01:03:34.040 --> 01:03:39.180
<v Uri Shaked Wokwicom>And at some point, I even looked into running the compilation inside the browser.

01:03:40.060 --> 01:03:43.500
<v Uri Shaked Wokwicom>The thing is, I tried going two ways.

01:03:43.500 --> 01:03:52.140
<v Uri Shaked Wokwicom>First of all, the way I did with GDB, which is running a virtual machine in the browser and then running the toolchain inside that virtual machine.

01:03:52.140 --> 01:04:01.800
<v Uri Shaked Wokwicom>But then it's super slow because you're running the x86 simulator and compiler is resourceful.

01:04:02.160 --> 01:04:09.200
<v Uri Shaked Wokwicom>So for instance, just compiling link for Arduino takes around two minutes.

01:04:09.200 --> 01:04:18.240
<v Uri Shaked Wokwicom>If you go with a virtual machine approach, virtual machine in the browser, and it also takes like 20 megabytes of downloads.

01:04:18.760 --> 01:04:20.420
<v Uri Shaked Wokwicom>And that's the other problem.

01:04:20.800 --> 01:04:26.820
<v Uri Shaked Wokwicom>Usually those build systems and containers are really heavy in terms of download.

01:04:27.100 --> 01:04:33.440
<v Uri Shaked Wokwicom>You wouldn't want the user to download like half a gigabyte and running in their browser.

01:04:33.680 --> 01:04:34.600
<v Uri Shaked Wokwicom>It doesn't make sense.

01:04:34.760 --> 01:04:35.940
<v Uri Shaked Wokwicom>It doesn't work.

01:04:35.940 --> 01:04:39.940
<v Chris Gammell>Yeah, this is something that so like I've been working on some like trainings.

01:04:40.080 --> 01:04:42.940
<v Chris Gammell>I think I sent you that article I wrote, but like I've been working on some training stuff.

01:04:42.940 --> 01:04:47.920
<v Chris Gammell>And like I have like a remote container where I actually have the toolchain pre-installed.

01:04:48.600 --> 01:04:50.480
<v Chris Gammell>And it pops out a binary.

01:04:50.480 --> 01:04:53.460
<v Chris Gammell>So that actually is like really beneficial to work with WalkWe, right?

01:04:53.480 --> 01:04:57.080
<v Chris Gammell>So I could like download the binary, load it up into the local browser, that sort of thing.

01:04:57.080 --> 01:05:04.540
<v Chris Gammell>But still, it's like the remote resources are on some like random ass server who knows where.

01:05:04.780 --> 01:05:10.200
<v Chris Gammell>You know, it's like some digital ocean server that I pay for and you get what you get then, you know.

01:05:10.440 --> 01:05:13.660
<v Chris Gammell>But there is a significant cost associated with that sort of thing.

01:05:13.800 --> 01:05:15.960
<v Chris Gammell>And that's at a single scale versus what you're talking about.

01:05:16.260 --> 01:05:21.460
<v Chris Gammell>If you have now 10,000 Rust users that want to do that sort of thing, it could really start to add up in terms of cost.

01:05:21.460 --> 01:05:25.060
<v Uri Shaked Wokwicom>Yeah, so there are a few tricks that can really help.

01:05:25.240 --> 01:05:26.180
<v Uri Shaked Wokwicom>One of them is caching.

01:05:26.400 --> 01:05:34.380
<v Uri Shaked Wokwicom>Most of the people who are using the simulator will probably start by opening a link to an existing project and just running it.

01:05:34.480 --> 01:05:36.860
<v Uri Shaked Wokwicom>So there is no reason to recompile it every time.

01:05:37.460 --> 01:05:41.640
<v Uri Shaked Wokwicom>And then also caching at the compiler level.

01:05:41.640 --> 01:05:51.680
<v Uri Shaked Wokwicom>And we're partially doing it because if you are compiling an ESP IDF project, that's around 1,000 files that you have to compile.

01:05:52.820 --> 01:05:59.200
<v Uri Shaked Wokwicom>But you don't have to recompile the entire ESP IDF every time you make a change, right?

01:05:59.280 --> 01:06:01.660
<v Uri Shaked Wokwicom>You can just compile the files that you changed.

01:06:02.340 --> 01:06:02.940
<v Chris Gammell>That's right.

01:06:03.260 --> 01:06:04.200
<v Chris Gammell>Yeah, just the incrementals.

01:06:04.300 --> 01:06:04.680
<v Chris Gammell>Yep, totally.

01:06:05.040 --> 01:06:05.260
<v Chris Gammell>Yeah.

01:06:05.520 --> 01:06:10.260
<v Chris Gammell>As long as you don't say clean build or whatever the command is on the ESP command line, right?

01:06:10.260 --> 01:06:18.100
<v Uri Shaked Wokwicom>Yeah, and then it also adds another layer of complexity because you have to manage this cache and make sure the right user gets the right cache.

01:06:18.460 --> 01:06:27.900
<v Uri Shaked Wokwicom>So sometimes I do wish that I only made a simulator and not the entire platform because then I wouldn't have to worry about compiling and about scale.

01:06:27.900 --> 01:06:32.500
<v Uri Shaked Wokwicom>But then there are already numerous simulators out there.

01:06:32.880 --> 01:06:37.240
<v Uri Shaked Wokwicom>I don't know if you are familiar with Pixim Lab, which is quite impressive.

01:06:37.560 --> 01:06:38.220
<v Chris Gammell>I don't think so.

01:06:38.220 --> 01:06:44.400
<v Uri Shaked Wokwicom>It's a Brazilian guy called Luis Gamboa and he has made a pretty impressive simulator.

01:06:44.640 --> 01:06:52.120
<v Uri Shaked Wokwicom>You can run AVR, PIC, STM32, and ESP32 through QEMU.

01:06:52.840 --> 01:06:57.940
<v Uri Shaked Wokwicom>But then the user experience is still that you have to download the software to your computer.

01:06:58.220 --> 01:07:00.300
<v Uri Shaked Wokwicom>You have to install the toolchain locally.

01:07:00.560 --> 01:07:02.000
<v Uri Shaked Wokwicom>You build your own binary.

01:07:02.000 --> 01:07:06.620
<v Chris Gammell>You have to trust downloaded stuff from SourceForge.net.

01:07:07.840 --> 01:07:09.380
<v Chris Gammell>I was like, oh, wow, SourceForge.

01:07:09.700 --> 01:07:09.880
<v Chris Gammell>Yeah.

01:07:10.300 --> 01:07:12.040
<v Chris Gammell>There is a name I haven't heard in a long time.

01:07:12.360 --> 01:07:12.900
<v Chris Gammell>That's true.

01:07:13.040 --> 01:07:13.420
<v Chris Gammell>That's true.

01:07:13.480 --> 01:07:15.900
<v Uri Shaked Wokwicom>How many projects do you have on SourceForge, Chris?

01:07:15.980 --> 01:07:16.800
<v Uri Shaked Wokwicom>Your own projects?

01:07:17.400 --> 01:07:19.420
<v Chris Gammell>I have no SourceForge projects.

01:07:19.420 --> 01:07:25.580
<v Chris Gammell>I just download shady Windows binaries from there and just cross my fingers and be like,

01:07:25.660 --> 01:07:27.140
<v Chris Gammell>you know, is this the one that's going to get me?

01:07:27.340 --> 01:07:27.880
<v Chris Gammell>Who knows, Uri?

01:07:28.200 --> 01:07:28.720
<v Chris Gammell>Who knows?

01:07:31.800 --> 01:07:32.280
<v Uri Shaked Wokwicom>Yeah.

01:07:32.520 --> 01:07:42.720
<v Uri Shaked Wokwicom>I think the kind of people who upload stuff to SourceForge, I think they are too niche to be malicious.

01:07:42.720 --> 01:07:43.920
<v Uri Shaked Wokwicom>But who knows?

01:07:45.020 --> 01:07:45.640
<v Chris Gammell>Yeah, probably.

01:07:45.960 --> 01:07:46.240
<v Chris Gammell>Probably.

01:07:46.560 --> 01:07:46.700
<v Chris Gammell>Yeah.

01:07:47.400 --> 01:07:47.680
<v Chris Gammell>Yep.

01:07:49.080 --> 01:07:50.700
<v Chris Gammell>Downloaded some shady software in my time.

01:07:50.860 --> 01:07:52.380
<v Chris Gammell>That's all I'm really trying to get at.

01:07:54.600 --> 01:07:55.340
<v Uri Shaked Wokwicom>So, yeah.

01:07:55.440 --> 01:08:01.120
<v Uri Shaked Wokwicom>So, I would say it's, again, it's like engineering is always about trade-offs.

01:08:01.120 --> 01:08:08.600
<v Uri Shaked Wokwicom>And I always have this trade-off whether I want to implement more of the development environment,

01:08:09.140 --> 01:08:15.100
<v Uri Shaked Wokwicom>add a debugger, implement better editor, and make the browser environment better,

01:08:15.340 --> 01:08:18.080
<v Uri Shaked Wokwicom>or spend my time improving the simulator.

01:08:18.740 --> 01:08:26.000
<v Uri Shaked Wokwicom>But the feedback I've been gathering so far shows that there is a lot of value in this integrated solution

01:08:26.000 --> 01:08:30.800
<v Uri Shaked Wokwicom>where you can just send a link to somebody and they hit play and it just works.

01:08:31.120 --> 01:08:34.700
<v Uri Shaked Wokwicom>They don't have to worry about downloading, setting up things.

01:08:35.580 --> 01:08:36.460
<v Uri Shaked Wokwicom>It simply works.

01:08:37.040 --> 01:08:37.220
<v Chris Gammell>Totally.

01:08:37.820 --> 01:08:43.300
<v Chris Gammell>I had an interesting interaction with someone recently who was working at a big chip company

01:08:43.300 --> 01:08:46.180
<v Chris Gammell>and they're like, look, we can't get dev boards right now.

01:08:46.180 --> 01:08:53.340
<v Chris Gammell>How do we showcase our product when there's a 10-week lead time on a dev board

01:08:53.340 --> 01:08:56.960
<v Chris Gammell>and I need to be able to send them something else?

01:08:57.060 --> 01:08:57.940
<v Chris Gammell>And it's like, oh, yeah.

01:08:58.200 --> 01:09:00.580
<v Chris Gammell>That's how they make sales at chip companies.

01:09:00.580 --> 01:09:02.040
<v Chris Gammell>So, yeah.

01:09:02.260 --> 01:09:03.120
<v Uri Shaked Wokwicom>Make an intro.

01:09:03.340 --> 01:09:04.700
<v Uri Shaked Wokwicom>I would love to talk to that person.

01:09:05.620 --> 01:09:05.760
<v Chris Gammell>Yeah.

01:09:05.860 --> 01:09:06.040
<v Chris Gammell>Right.

01:09:06.180 --> 01:09:06.700
<v Chris Gammell>Yes, I will.

01:09:06.760 --> 01:09:10.240
<v Chris Gammell>That's still on the to-do list with that one specifically.

01:09:11.400 --> 01:09:11.540
<v Chris Gammell>Yeah.

01:09:11.960 --> 01:09:17.300
<v Chris Gammell>I think some of it is going to be grumpy hardware engineers who are like,

01:09:17.360 --> 01:09:19.980
<v Chris Gammell>oh, it's not real hardware, blah, blah, blah, blah, blah, blah.

01:09:19.980 --> 01:09:26.320
<v Chris Gammell>But I think once they try it, I think they'll see the accuracy piece.

01:09:26.460 --> 01:09:33.440
<v Chris Gammell>And I think the important thing with simulations too is the most accurate simulator is never

01:09:33.440 --> 01:09:36.340
<v Chris Gammell>going to cover 100% of all test cases in the real world.

01:09:36.340 --> 01:09:40.280
<v Chris Gammell>It's impractical and it just doesn't make sense.

01:09:40.720 --> 01:09:44.360
<v Chris Gammell>And I think one part of the engineering discipline is understanding where some of those limitations

01:09:44.360 --> 01:09:45.900
<v Chris Gammell>are, what you're willing to accept.

01:09:46.400 --> 01:09:50.780
<v Chris Gammell>And then some of the risk mitigation around like, oh, well, what if it is different?

01:09:50.780 --> 01:09:56.960
<v Chris Gammell>And so I think about my early days with LT Spice and just kind of learning what I should be

01:09:56.960 --> 01:09:57.340
<v Chris Gammell>simulating.

01:09:57.480 --> 01:10:02.740
<v Chris Gammell>How much should I try and simulate a precise part versus kind of a more generic, just a

01:10:02.740 --> 01:10:05.520
<v Chris Gammell>diode or just an end channel MOSFET.

01:10:06.060 --> 01:10:11.380
<v Chris Gammell>That was a big shift for me, but it's pretty important, I feel like, in my engineering evolution.

01:10:12.140 --> 01:10:12.260
<v Uri Shaked Wokwicom>Yeah.

01:10:12.260 --> 01:10:18.600
<v Uri Shaked Wokwicom>I think if I had to draw the line in Walkwee, I'm trying to make it, at least that's my focus

01:10:18.600 --> 01:10:26.080
<v Uri Shaked Wokwicom>right now, to make it so if you wanted to check or to work on the software part, then Walkwee

01:10:26.080 --> 01:10:27.160
<v Uri Shaked Wokwicom>would be a good fit.

01:10:27.440 --> 01:10:33.960
<v Uri Shaked Wokwicom>If you wanted to work on the electronics part, you would probably want to use a spy simulator

01:10:33.960 --> 01:10:43.220
<v Uri Shaked Wokwicom>or some more specific tools because I wish we could do everything, but it's just impractical.

01:10:43.520 --> 01:10:48.940
<v Uri Shaked Wokwicom>So Walkwee is great for simulating the software part and for the electronics.

01:10:49.260 --> 01:10:50.440
<v Uri Shaked Wokwicom>Well, good luck with that.

01:10:52.180 --> 01:10:52.980
<v Chris Gammell>Right, right.

01:10:53.040 --> 01:10:58.500
<v Chris Gammell>But I think that there's so much of like, you know, so if I go and have a generic I2C device

01:10:58.500 --> 01:11:03.840
<v Chris Gammell>or spy device, you know, maybe you don't have every specific sensor that's available in

01:11:03.840 --> 01:11:08.580
<v Chris Gammell>the world and don't have everything, you know, obviously a growing list now with this new

01:11:08.580 --> 01:11:14.440
<v Chris Gammell>feature, but, you know, maybe you don't have every sensor available, but I could go stick

01:11:14.440 --> 01:11:20.280
<v Chris Gammell>in a logic analyzer on the I2C and be like, oh, that's the expected, you know, write this

01:11:20.280 --> 01:11:25.320
<v Chris Gammell>value to go and access a register, go and access the register, get readback, that sort of thing,

01:11:25.320 --> 01:11:28.300
<v Chris Gammell>and having like a generic logic analyzer readback.

01:11:28.300 --> 01:11:32.460
<v Chris Gammell>And you could start to generate pretty interesting.

01:11:32.720 --> 01:11:36.420
<v Chris Gammell>You could, you could do some interesting testing on the software piece, which is like you said,

01:11:36.600 --> 01:11:43.300
<v Chris Gammell>is the kind of the target, the target use case and still see what the output will approximate

01:11:43.300 --> 01:11:43.940
<v Chris Gammell>in the real world.

01:11:44.700 --> 01:11:45.140
<v Uri Shaked Wokwicom>Right.

01:11:45.480 --> 01:11:52.980
<v Uri Shaked Wokwicom>And one other thing I'm sort of trying to figure out is the use case of automated testing.

01:11:52.980 --> 01:11:59.380
<v Uri Shaked Wokwicom>So what if you wanted to, then you have like written a piece of code and you want to automate

01:11:59.380 --> 01:12:00.780
<v Uri Shaked Wokwicom>testing it right now.

01:12:00.960 --> 01:12:07.400
<v Uri Shaked Wokwicom>I know most people just don't do it because it's pretty complicated to do with real hardware.

01:12:07.960 --> 01:12:08.320
<v Chris Gammell>Yeah.

01:12:08.380 --> 01:12:11.740
<v Chris Gammell>And so instead of like setting up a, you know, you could do like, so we've had past guests

01:12:11.740 --> 01:12:16.000
<v Chris Gammell>on the show, like blue clover and, uh, uh, crap.

01:12:16.060 --> 01:12:16.540
<v Chris Gammell>What's the other one?

01:12:16.540 --> 01:12:22.280
<v Chris Gammell>Uh, I was just, just thinking of the other one, but basically, you know, hardware in the

01:12:22.280 --> 01:12:23.120
<v Chris Gammell>loop style testing.

01:12:23.480 --> 01:12:26.160
<v Chris Gammell>I'll see if I can remember who it was and.

01:12:26.540 --> 01:12:31.060
<v Chris Gammell>You know, you could actually go and like run your code on an actual real world device, but

01:12:31.060 --> 01:12:36.280
<v Chris Gammell>maybe a walk, we, you know, end, end device and testing your code.

01:12:36.280 --> 01:12:40.220
<v Chris Gammell>When you, when you do a new build that might get you 98% of the way there.

01:12:40.220 --> 01:12:44.920
<v Chris Gammell>And that's, that's enough for before you take it to a integration level test.

01:12:45.660 --> 01:12:45.780
<v Uri Shaked Wokwicom>Exactly.

01:12:45.960 --> 01:12:48.160
<v Uri Shaked Wokwicom>That's where I'm trying to aim.

01:12:48.360 --> 01:12:51.280
<v Uri Shaked Wokwicom>I can give one example from my personal experience.

01:12:51.280 --> 01:12:58.960
<v Uri Shaked Wokwicom>So two years ago, I worked on a pretty mean hardware riddle called the skull.

01:12:59.420 --> 01:13:05.440
<v Uri Shaked Wokwicom>And it had an 80 tiny, uh, 45 chip that runs an open source framework.

01:13:05.440 --> 01:13:11.860
<v Uri Shaked Wokwicom>And despite the firmware being open source, it had a secret hidden inside.

01:13:12.080 --> 01:13:19.000
<v Uri Shaked Wokwicom>And you had to figure out a way to extract this secret from the skull and, uh, reprogram

01:13:19.000 --> 01:13:24.280
<v Uri Shaked Wokwicom>the skull through a mysterious interface to do things it wasn't supposed to do.

01:13:25.420 --> 01:13:30.760
<v Chris Gammell>And skull, you're saying, you're saying skull, like a human skull, like, like the bone structure

01:13:30.760 --> 01:13:31.200
<v Chris Gammell>inside my head.

01:13:31.280 --> 01:13:31.760
<v Chris Gammell>Exactly.

01:13:31.760 --> 01:13:40.320
<v Uri Shaked Wokwicom>And I don't want to do any spoilers, but when I had to develop the firmware from the skull,

01:13:40.320 --> 01:13:47.900
<v Uri Shaked Wokwicom>I had a thing where I didn't have the option to do field updates because once somebody gets

01:13:47.900 --> 01:13:52.660
<v Uri Shaked Wokwicom>the riddle, it already has like the firmware inside with the secret.

01:13:53.140 --> 01:13:57.600
<v Uri Shaked Wokwicom>And if you like had to re-upload the firmware, then you would override the secret.

01:13:57.820 --> 01:14:00.200
<v Uri Shaked Wokwicom>You would have to erase the chip and remove the secret.

01:14:00.200 --> 01:14:02.660
<v Uri Shaked Wokwicom>So I had to get it right.

01:14:03.040 --> 01:14:06.120
<v Uri Shaked Wokwicom>And there is some analog stuff going there.

01:14:06.580 --> 01:14:09.700
<v Uri Shaked Wokwicom>And the firmware had to do a bunch of calculations.

01:14:11.080 --> 01:14:19.120
<v Uri Shaked Wokwicom>And again, I'm trying to find a way to tell the story without too many spoilers, but I had

01:14:19.120 --> 01:14:22.760
<v Uri Shaked Wokwicom>to test this in a lot of different, uh, conditions.

01:14:22.760 --> 01:14:30.120
<v Uri Shaked Wokwicom>I would say I ended up having a list of 40 different test cases.

01:14:30.760 --> 01:14:35.400
<v Uri Shaked Wokwicom>And each of those tests took like, uh, two minutes to perform.

01:14:35.400 --> 01:14:40.360
<v Uri Shaked Wokwicom>And you can imagine like doing this manually.

01:14:40.360 --> 01:14:46.560
<v Uri Shaked Wokwicom>So what I ended up doing, I just performed each of the tests once in the physical environment

01:14:46.560 --> 01:14:55.780
<v Uri Shaked Wokwicom>with, uh, my, uh, Sully logic analyzer, recorded that, and then use the simulator to just simulate

01:14:55.780 --> 01:14:58.500
<v Uri Shaked Wokwicom>all the 40 test cases.

01:14:58.500 --> 01:15:06.320
<v Uri Shaked Wokwicom>So I had a setup where whenever I made a firmware, a change to the firmware code, I would get a

01:15:06.320 --> 01:15:08.440
<v Uri Shaked Wokwicom>result in five seconds.

01:15:08.760 --> 01:15:15.300
<v Uri Shaked Wokwicom>So imagine like 40 tests that take two to three minutes manually to perform each.

01:15:15.300 --> 01:15:18.280
<v Uri Shaked Wokwicom>All of that compressed into five seconds.

01:15:18.600 --> 01:15:25.600
<v Uri Shaked Wokwicom>How, how, like the feedback cycle went from half a day to a few seconds.

01:15:26.120 --> 01:15:32.300
<v Chris Gammell>And like each, each individual, so you said two to three minutes times 40, but some of the,

01:15:32.420 --> 01:15:34.540
<v Chris Gammell>was there setup time in between each test as well?

01:15:34.540 --> 01:15:38.280
<v Chris Gammell>Like even just like hitting a key or something like that, or like moving wires around?

01:15:38.280 --> 01:15:45.740
<v Uri Shaked Wokwicom>Uh, it's even, uh, moving to different rooms and waiting for different, for different times

01:15:45.740 --> 01:15:46.320
<v Uri Shaked Wokwicom>of the day.

01:15:46.320 --> 01:15:48.140
<v Uri Shaked Wokwicom>So at day at night.

01:15:48.140 --> 01:15:55.800
<v Uri Shaked Wokwicom>So, and all I wanted to do was just tweak a few numbers in the firmware to find a combination

01:15:55.800 --> 01:15:58.060
<v Uri Shaked Wokwicom>that works best in all the scenarios.

01:15:58.060 --> 01:16:06.120
<v Uri Shaked Wokwicom>So you can imagine like the, how happy I was that I had this tool to just simulate everything

01:16:06.120 --> 01:16:08.220
<v Uri Shaked Wokwicom>instead of manual labor.

01:16:08.840 --> 01:16:09.040
<v Chris Gammell>Yeah.

01:16:09.480 --> 01:16:09.840
<v Chris Gammell>Yeah.

01:16:10.000 --> 01:16:14.140
<v Chris Gammell>I think, uh, it's okay to do it once or twice, but then, you know, I think the other thing

01:16:14.140 --> 01:16:17.500
<v Chris Gammell>is that like, there's human error that like comes into there.

01:16:17.560 --> 01:16:19.820
<v Chris Gammell>So like, this is just a perfect place for automation.

01:16:20.060 --> 01:16:22.120
<v Uri Shaked Wokwicom>And I'm really good at human error.

01:16:22.400 --> 01:16:23.780
<v Uri Shaked Wokwicom>Like I'm very bad at.

01:16:24.220 --> 01:16:25.120
<v Chris Gammell>Yeah, me too.

01:16:26.600 --> 01:16:27.000
<v Uri Shaked Wokwicom>Yeah.

01:16:27.120 --> 01:16:31.660
<v Uri Shaked Wokwicom>I'm very bad at like working, uh, with like documenting each step.

01:16:31.720 --> 01:16:34.080
<v Uri Shaked Wokwicom>I'm just doing something and then, yeah, I will remember it.

01:16:34.120 --> 01:16:36.080
<v Uri Shaked Wokwicom>I will write it down and then I forget.

01:16:36.420 --> 01:16:37.820
<v Uri Shaked Wokwicom>And then I have to redo it.

01:16:37.820 --> 01:16:44.180
<v Uri Shaked Wokwicom>And then even if I like follow some method, I'm always unsure whether I did it right.

01:16:44.260 --> 01:16:46.620
<v Uri Shaked Wokwicom>Maybe I got the numbers wrong.

01:16:46.620 --> 01:16:46.940
<v Uri Shaked Wokwicom>Maybe.

01:16:47.740 --> 01:16:48.380
<v Uri Shaked Wokwicom>So, yeah.

01:16:48.380 --> 01:16:49.940
<v Uri Shaked Wokwicom>So it's so error prone.

01:16:49.940 --> 01:16:55.820
<v Uri Shaked Wokwicom>And I think without the simulation, I would have never delivered the scale in time.

01:16:56.140 --> 01:16:56.720
<v Chris Gammell>That's crazy.

01:16:56.720 --> 01:16:59.620
<v Chris Gammell>I did look up the other person.

01:16:59.620 --> 01:17:01.720
<v Chris Gammell>I was thinking it was Akbar from logger data.

01:17:01.880 --> 01:17:04.940
<v Chris Gammell>So that's another people that are doing hardware in the loop, similar kind of stuff.

01:17:05.000 --> 01:17:08.900
<v Chris Gammell>We've also had the Salier guys on here, but I think I'm not sure how much they were doing

01:17:08.900 --> 01:17:10.140
<v Chris Gammell>back when we had Mark and Joe on.

01:17:10.220 --> 01:17:13.220
<v Chris Gammell>I'm not sure that they were doing a lot of like capture type stuff like that.

01:17:13.280 --> 01:17:18.820
<v Chris Gammell>They've introduced their, like their ecosystem where they have plugins for Salier stuff now

01:17:18.820 --> 01:17:22.740
<v Chris Gammell>as well that I'm not sure they had that when they were on the show, but I'll, I'll link

01:17:22.740 --> 01:17:23.480
<v Chris Gammell>that in as well.

01:17:24.480 --> 01:17:27.160
<v Chris Gammell>Rui, this is an amazing tool that you've built.

01:17:27.280 --> 01:17:29.380
<v Chris Gammell>I am really excited for this and the future of it.

01:17:29.840 --> 01:17:32.440
<v Chris Gammell>How can people sign up for it?

01:17:32.500 --> 01:17:33.660
<v Chris Gammell>How can they support you?

01:17:33.980 --> 01:17:34.820
<v Chris Gammell>Where should they get started?

01:17:35.360 --> 01:17:36.520
<v Chris Gammell>How can they reach you?

01:17:36.600 --> 01:17:37.380
<v Chris Gammell>All of the things.

01:17:37.380 --> 01:17:38.700
<v Uri Shaked Wokwicom>All of the things.

01:17:39.180 --> 01:17:40.300
<v Uri Shaked Wokwicom>All the things.

01:17:40.780 --> 01:17:44.220
<v Uri Shaked Wokwicom>To play around with the tool, go to walkway.com.

01:17:44.840 --> 01:17:52.140
<v Uri Shaked Wokwicom>And then once you figure out it's confusing or hard, or you don't know where to go, or you

01:17:52.140 --> 01:17:58.480
<v Uri Shaked Wokwicom>just feel that the UX is crappy, hit me on the Discord server, walkway.com slash Discord

01:17:58.480 --> 01:18:00.240
<v Uri Shaked Wokwicom>and tell me what to improve.

01:18:00.240 --> 01:18:08.640
<v Uri Shaked Wokwicom>I'm really looking for feedback, especially, especially if it's actionable feedback that

01:18:08.640 --> 01:18:10.320
<v Uri Shaked Wokwicom>is delivered in a good way.

01:18:11.000 --> 01:18:16.540
<v Uri Shaked Wokwicom>I'm sort of like you mentioned Dave, Dave's tweet the other day.

01:18:16.680 --> 01:18:22.840
<v Uri Shaked Wokwicom>So I was really happy to see his tweet and how we found Walkway charming, but it seems

01:18:22.840 --> 01:18:29.080
<v Uri Shaked Wokwicom>to me like it's always hard to get people to tell you about the things that they really

01:18:29.080 --> 01:18:31.720
<v Uri Shaked Wokwicom>don't like, or they feel that could be better.

01:18:32.260 --> 01:18:37.680
<v Uri Shaked Wokwicom>I don't promise to act on every piece of feedback, but I want to at least have this feedback.

01:18:37.680 --> 01:18:42.720
<v Uri Shaked Wokwicom>So I have the chance to understand how other people see it.

01:18:42.920 --> 01:18:50.040
<v Uri Shaked Wokwicom>Because from my point of view, there is a lot of work and a lot of rough edges that should

01:18:50.040 --> 01:18:52.920
<v Uri Shaked Wokwicom>be improved, but maybe other people see it differently.

01:18:53.300 --> 01:18:54.420
<v Uri Shaked Wokwicom>And I just don't know.

01:18:54.920 --> 01:18:55.060
<v Chris Gammell>Yeah.

01:18:55.100 --> 01:18:58.800
<v Chris Gammell>I think a thousand people are told about a thing, you know, like what is the percentage that

01:18:58.800 --> 01:19:01.680
<v Chris Gammell>are actually going to click through and actually try it and give it a real try?

01:19:01.760 --> 01:19:05.580
<v Chris Gammell>And then like of that, there's going to be some vocal group that actually like gives you

01:19:05.580 --> 01:19:05.920
<v Chris Gammell>feedback.

01:19:05.920 --> 01:19:11.160
<v Chris Gammell>And so it's just about like getting the maximum number to take a fair shot at it at the beginning.

01:19:11.300 --> 01:19:12.840
<v Chris Gammell>I feel like that's a really important thing.

01:19:13.560 --> 01:19:17.700
<v Chris Gammell>Actually, I was thinking about, I was asking at the beginning about where people should start.

01:19:18.300 --> 01:19:23.380
<v Chris Gammell>And I think my eye always goes towards the boards that are at the top, which are basically

01:19:23.380 --> 01:19:24.540
<v Chris Gammell>kind of like blank slates.

01:19:24.760 --> 01:19:29.240
<v Chris Gammell>But I would actually recommend that people click more Arduino library examples, because

01:19:29.240 --> 01:19:33.860
<v Chris Gammell>that usually calls out the library and has a pre-configured piece of hardware, something

01:19:33.860 --> 01:19:37.440
<v Chris Gammell>like a DHT sensor library, which is a temperature and humidity sensor.

01:19:37.640 --> 01:19:39.460
<v Chris Gammell>And basically it will already be hooked up.

01:19:39.540 --> 01:19:43.240
<v Chris Gammell>And then you can just immediately run the code that's like the test code that's there.

01:19:43.300 --> 01:19:47.200
<v Chris Gammell>I feel like that's an important thing for really getting people started quickly.

01:19:47.200 --> 01:19:53.120
<v Uri Shaked Wokwicom>Okay, so I take that feedback and there is a good chance that by the time the episode

01:19:53.120 --> 01:19:56.800
<v Uri Shaked Wokwicom>will be up, the homepage layout will change a bit.

01:19:57.760 --> 01:19:58.920
<v Chris Gammell>Okay, look at that.

01:20:00.060 --> 01:20:05.200
<v Chris Gammell>Yuri is incredibly fast with feedback in general, like you said, when it makes sense.

01:20:05.980 --> 01:20:09.200
<v Chris Gammell>You do a lot of work, it sounds like, like a lot, a lot, a lot.

01:20:09.200 --> 01:20:14.100
<v Uri Shaked Wokwicom>I try to keep it as fun as possible.

01:20:14.320 --> 01:20:22.060
<v Uri Shaked Wokwicom>So I try to avoid the parts that I less like or find a way to make them more fun to me.

01:20:22.480 --> 01:20:32.200
<v Uri Shaked Wokwicom>I think that's my approach to this, like how to stay on top of things, except for the SP32

01:20:32.200 --> 01:20:32.680
<v Uri Shaked Wokwicom>Wi-Fi.

01:20:32.780 --> 01:20:36.080
<v Uri Shaked Wokwicom>That was a crazy story, but usually I try to stay sane.

01:20:36.080 --> 01:20:39.360
<v Uri Shaked Wokwicom>Yeah, that's good.

01:20:39.800 --> 01:20:43.680
<v Chris Gammell>Yeah, I think, and you know, I think the way people can help out as well is make examples,

01:20:43.880 --> 01:20:44.740
<v Chris Gammell>share them with other people.

01:20:44.860 --> 01:20:47.940
<v Chris Gammell>You can share the links, you can just share links to things that you've built.

01:20:48.080 --> 01:20:52.360
<v Chris Gammell>And that kind of helps Yuri and Walkwe to, you know, spread the word of it.

01:20:52.440 --> 01:20:54.180
<v Chris Gammell>So as you're building things, share them with other people.

01:20:54.260 --> 01:20:59.640
<v Chris Gammell>And that will also help for people to understand what Walkwe is and how you're using it.

01:20:59.940 --> 01:21:04.640
<v Uri Shaked Wokwicom>Also share them with me because I'm always amazed to see what people are doing

01:21:04.640 --> 01:21:06.900
<v Uri Shaked Wokwicom>with Walkwe.

01:21:07.260 --> 01:21:13.540
<v Uri Shaked Wokwicom>And especially, like, I see so many projects that are yet another blink or yet another

01:21:13.540 --> 01:21:15.340
<v Uri Shaked Wokwicom>print hello world to LCD.

01:21:15.780 --> 01:21:19.120
<v Uri Shaked Wokwicom>But every once in a while, somebody sends me something remarkable.

01:21:19.500 --> 01:21:21.660
<v Uri Shaked Wokwicom>And I'm like, yeah, I want more of this.

01:21:21.800 --> 01:21:24.440
<v Uri Shaked Wokwicom>So do remarkable things and send them to me, please.

01:21:25.280 --> 01:21:26.260
<v Chris Gammell>Okay, that sounds good.

01:21:26.420 --> 01:21:31.160
<v Chris Gammell>That is a good way for people to, a good task for people listening here.

01:21:31.160 --> 01:21:35.880
<v Chris Gammell>So go try out Walkwe, do interesting things and send them to Yuri on Discord or otherwise.

01:21:35.880 --> 01:21:36.520
<v Chris Gammell>Yeah, break it.

01:21:36.700 --> 01:21:39.540
<v Chris Gammell>Yuri, thanks so much for, yeah, break it.

01:21:39.640 --> 01:21:39.960
<v Chris Gammell>Break it all.

01:21:40.380 --> 01:21:41.620
<v Chris Gammell>Thank you for being here today.

01:21:41.760 --> 01:21:44.800
<v Chris Gammell>I really, I really appreciate it and taking the time to talk to us.

01:21:44.980 --> 01:21:47.020
<v Chris Gammell>And I'm looking forward to seeing more of what you built.

01:21:47.120 --> 01:21:47.720
<v Uri Shaked Wokwicom>Thank you, Chris.

01:21:47.800 --> 01:21:49.520
<v Uri Shaked Wokwicom>Thank you for joining your podcast today.

01:21:50.240 --> 01:21:50.620
<v Uri Shaked Wokwicom>Bye-bye.

01:21:50.620 --> 01:21:51.360
<v Uri Shaked Wokwicom>Thanks.

01:21:51.860 --> 01:21:52.500
<v Chris Gammell>We'll chat soon.

01:21:52.500 --> 01:21:52.500
<v Speaker ?>

01:21:52.500 --> 01:21:54.500
<v Chris Gammell>Bye-bye.

01:21:54.500 --> 01:21:56.500
<v Speaker ?>Bye-bye.

01:21:56.500 --> 01:21:58.500
<v Speaker ?>Bye-bye.

01:21:58.500 --> 01:21:58.500
<v Speaker ?>

01:21:58.500 --> 01:22:00.500
<v Speaker ?>Bye-bye.

01:22:00.500 --> 01:22:00.500
<v Speaker ?>

01:22:00.500 --> 01:22:00.500
<v Speaker ?>

01:22:00.500 --> 01:22:00.500
<v Speaker ?>

01:22:00.500 --> 01:22:00.500
<v Speaker ?>

01:22:00.500 --> 01:22:00.500
<v Speaker ?>

01:22:00.500 --> 01:22:00.500
<v Speaker ?>

01:22:00.500 --> 01:22:09.840
<v Speaker ?>Bye-bye.

01:22:09.840 --> 01:22:10.840
<v Speaker ?>Bye-bye.
