 Sounds good. Hello. I am guessing people can see me now No, there's no one online yet online Wow, what they show offline? Okay? Anyway, so I'm gonna start So my name is Alejandro Hernandez. I am a doctor developer. I've been working on the doctor project for about five years and and the title of my presentation is developing building and testing your very metal applications using the Yachto project and the open embedded infrastructure. I Work in the Azure Sphere team on on Microsoft and Yeah, I'm just gonna go ahead so the The latest changes that we are seeing in the market is that There's more and more embedded devices that have multiple architectures They're they either have multiple Cores or in the same SOC or it could be different regardless We can see that the trend is that we are Distributing the work depending on the application on different processors or the cloud so small things go on a small processor and then you have a sort of like a big processor where you can have an operating system and then you can have things that you have to Need require computing power go to the cloud This is for example the Azure Sphere device it is a multi architecture embedded device and This is just an example, but and while this is a much more complicated device and focus and security The idea of this thing is that you have to start somewhere and you have to start developing your Bermuda applications you can do that on the Yachto project or open embedded. I'm trying to click Okay, so first I'm going to talk about a little bit about the runtime testing infrastructure That's an open embedded already. I'm going to go back and forth a little bit between The what the application is and the In the infrastructure itself the So it might be confusing, but let me know and I can just go back Weirdly, I am not going to try and focus on the application That could because what's important for me the message that I want to pass on is that what the infrastructure? Allows you to do and how you can take advantage of that regardless if you're using Or building a Linux operating system or building a remote application So I'm going to try and focus a little bit more in that part So first of all, how does it work normally right the Open embedded was in the Yachto project where it's self-designed to build a Linux operating system So the way it works Or the way was assigned the testing infrastructure. It's also for a Linux system How do you test a little system here runtime? You inherit the test image class you set the target the test target as QMU which is said by default you don't have to do anything and You define the test suites that you want to run now There are different test targets that you can set an example is this the QMU one There's another one that you have to put a it's called simple remote And you just define the IP of the target and then it sends commands through SSH And then the test suites They're basically that That that's why you actually test a simple in the case in this case, for example, there's being this SSH SCP parts looks are just examples of the test cases that already exist there and they're being tested on a daily basis it's important that the way that the Test suites are defined that there's the order in which their process matters. So the if you're trying run SCP so for example I put an example here if you put the test suites that's SCP ping and SSH SCP would be skipped because it depends on ping and then ping would be run and then SSH would be run because ping run before that The correct way it's ping and then SSH and then SCP Those are just examples. You can take a look at the directory the meta live OI QA runtime cases and those are all the cases that are available. You can certainly define your own if you Have your own application you want to test it You can just put it there So that's how Linux is tested on an everyday basis. So again the the important thing here is that That's the way it was designed and the what we try to do is how can we without breaking what's already there? How can we Modify that to make it work for different applications Whether they are a different Linux operating system a different operating system our to us or something or a very metal application So this is an example of the tests that when you run the test, I don't know if you can see this It's a bit small. But anyway, if you run the test image task for an image for core image minimal in this case you can see that In this case, it's it's complaining the SSH test is complaining because I didn't put drop bear or open SSH on my image So it can't run it. But either way tell me Tells me some sort of report that I have one success and what's one skip no failures in ours So that's how we normally would look like Okay, so the the modifications that I mentioned before are this ones and These are part of the test image class and also of the key on you a runner A script that that we use as a helper I think it might be easier. Those are the commands that are defined. These are commented out on the class just for information and you can set your own depending on your own needs And these on Fiumi runner. They're defined as the default, but if we I think this will make it clear I can barely see myself, but So what happens here is that there's some sort of a communication between the host and the target and it's has to be synchronized So the host tells the target to start booting and then the target at some point reaches a login prompt Then it tells that the host is constantly reading the output of the target once it's That one to the text that the login prompt is there. He tries to log in as route if you have Debug tweaks on on your image features then what happens is that the target prints out a the root at and then the whole name so There's a pattern that's defined on those variables that I showed previously and That's when the holes the text that there was a success logging in right so after that it tries to send some sort of command let's say ping and Then it checks again for another prompt, which means the command already exited and then it checks the if it asserts the The output of that right so again if we go back here. This is what's defined on on this thing If this uses a syntax very similar to the one on package configs and If you're familiar with that, it's a lot easier that way the you can't override certain Patterns and only do you want to because one of the thing is that for example this by default was only able to log in with Root and that was not modifiable. You can do it like that. So in this case if you have your own Linux operating system and you you're not using the root user You can change that right you can just change the send login user and you can put whatever your user is or if you change the The prompt you can also change that and it'll work. The infrastructure will work for your own Application or operating system so the next part of the presentation is the vermin options and applications on the auto project and I'm gonna Go through it a little bit here. So we've had some progress into Allowing the auto project to build different tool chains one of them is a tool chain for vermin applications and since you already have the tool chain, you can just compile your Sources for that and then you can get a running application up for some Architecture, right? So if you want it there is an example on the auto project on meta skeleton That I put in there. It's called their metal. Hello world. It's a very simple example. There's not It's just a hello world But if you wanted to reproduce that you can just do that following the steps that are on the screen Basically you clone it you add the meta skeleton layer and then you set your machine in this case I set it up for a human arm 64 and the TC leaf see I set it up for bare metal I put that on my local account and I try I run a big bake for bare mouth. No work after that After that after your build is done You can just run run QMU and that's integrated with that as well and it'll run a The application on QMU and you'll see hello open embedded on the on your screen Some interesting targets there are The meta tool chain target if you run big big meta tool change you will end up getting a Bare metal tool chain for arm 64 architectures Very mental hello world and then see populate SDK in this case You wouldn't do anything because it wouldn't add anything to meta tool chain But let's say if you have some sort of dependency for some reason or anything else You could create your SDK that will have a an extra dependency that you require for your application and another thing that's interesting is switching the The TC leaf see so instead of using very metal as I put it here somewhere you Can use TC leaf see and for this specific application? It wouldn't do anything. You wouldn't do anything different because TC leaf see sorry. Newly this is capable of running Burma applications, but newly there is a C library that's meant for embedded operating systems or embedded applications and It'll be able to run it But at the same time it will provide you more things than just the Burma one the Burma one just it's it's Pretty much very bones. The the new leaf has a little bit more things on it Okay, so now how do I'm gonna switch a little bit to the application part so How do you create your bare metal application? Well, I I went and poked around the the source code of QMU and was able to get the address of The you are which is how I wanted to print the the hello open embedded part and So I wanted to rate the data sheet for that in your case for every SOC would be different So you kind of have to go and read the data sheet and then see what Registers you have to write on and stuff like that in this case. I was able to get that I got the the UART address the RAM How how we how QMU sets up the RAM and where it puts the kernel so if you pass the dash kernel argument to QMU it QMU puts it in a certain address, right? So that's what I kind of needed Also, I went and looked at the I'm developer manual and The UART uses a PL 0 1 1 driver and From the arm developers manual you can look at the registers that are used for the UART in this case are there are several Registers that are interesting there. The first one says you are the R which is a data register Then the second one would be the receive status and the clear register and also another important one is the FR the flag register so for the I'm gonna go back a little bit for the Let's share my screen a little bit So for the application that I just showed you here This one that one there's not much that's needed there But it just print out something in the in the screen Okay, I hope you guys can see this so this is just a source code of the The vermin application for that the one that you're seeing on your screen it simply prints hello open embedded and as I said I I had to get the address for the UART base Where it's located and all I do is I Basically try to print a It's string and that string basically just checks when When the when it hits the end of the string While it not it doesn't hit the end of the string it starts putting pointing the the character to the The R-register the data that I register now another interesting thing here is that the There's no main function because it's a very well application. So usually on a Linux or something else you have The C runtime that comes from from Lipsy, right? But in this case, we don't have that so we have to tell we have to be able to tell the The compiler in the linker how is it gonna start the application? So for that we have two different things one of them is the startup code Again, normally you would get this from the C library, but this case. It doesn't have it So I have here a simple startup code for for that and I'm not going to go into a lot of details, but the important thing here is that I Defined a an entry function in this case. You can call it whatever you want. It's called C entry But you can call it main if you want to It because it's just wouldn't we're just gonna jump once it starts executing our Application and then the there's also a linker script that you have to define Again, this is very specific to the architecture that you're building for so depending on the SOC you have to kind of go through the The data sheet and see how all of this is defined So for example the RAM on can you start that zero x4 and a thousand zeros and then So when one of the things that I said that oh well poking around and in the community source code You can see that once it gets the kernel Argument it adds another zero x1 zero zero zero So that's how that's the address that I'm actually using then I define the different sections of my binary the text section the data section And stuff like that and in the stack right so that thing you need to pass to the compiler so it knows how to organize your binary basically and again This This is what the code actually looks like but while compiling it has to first assembly the Assemble sorry it has to first assemble the startup code and then compile the application as an object file and then link Link it with the startup code and with using that linker script that you define yourself So this is a very simple one. This is just the hello open embedded and the idea here is That okay, how do I going back a little bit? Yeah, so going back a little bit to the how do I use a test infrastructure from open embedded? This is kind of what my Local.com phase is looking like at this point I set up my machine SPM yarn 64. I changed it the CC leapsy I changed it to new live and as I said before as a bill I was tested Linux. I said inherit and then test image And then the test switch I define my own test switch and I was lazy enough that I just used the one that I already have It's called free art those echoes So I defined a free art those tests just so I know that free art those Gets built every day and it's built correctly with the the new changes in In open embedded. I can actually show you that second So that would be Somewhere for some reason I cannot see that one second there's an application missing from my Skillshare for some reason Okay, I hope you can see that so there's a free art those layer and I just used that I put a A test case here as I said So this is what a tested test case looks like and it's very simple. You just have to put it on the right path I hope you I hope you can see what I'm selecting with the mouse right now So this is what a test case test case looks like it's very simple I in my application I define a special character, which is the distant so that it has a known behavior and I know what I'm gonna get from that when I send that command through this Serial interface, right? So I was lazy and I decided to use the same test case for this one I just defined a different behavior for that. So for example in this case Actually one second so This is a little easier this way Okay, so in this case I define where is this here? I define the following patterns that I wanted to look for again. This is part of the synchronous communication that has to happen the I define the search So I'm gonna check if I reach prompt What I'm just saying I'm gonna check for is ELC 2020 then the login user is gonna be covered 19 the login succeeded so basically when the application tells me that It it knows the user code 19 It's it says not welcome and then the command finished is just a new line. So the new The new workflow or the new flow looks like this So the host tells the target to start booting and then the target at some points prints out ELC 2020 The the target itself. No, sorry the host Sends COVID-19 In the care of return and then the target says not welcome and then the whole says okay So I logged in correctly and then it just looks for different commands every time For every new line and it just reads that that part So I'm gonna go live. It's a little bit weird because I don't have any feedback from I don't know if people are Listening to this or not. Anyway So That's how the pattern is set up like this is oh, this is just how I clone the free articles Layer and then I added it to my baby layers.com and I modified it a little bit I just put a two warnings there of what I was sending in the output that I was getting and I Modified a little bit because I wanted to look for success instead of as you can see from the previous slide instead of The prompt I would get success from the application So if I run that If I run that I can I should be able to get something similar to this This is a screenshot of how that looks like so if I run that I am able to run it says that I run the free articles Test the echo test and then that it passed so it got the command correctly. So it says I send the command that and then I was able to read the output and it said success Which means the application is working and this is something that you would set up for like a CI or something like that that you you want to make sure that your Application it's being built correctly and changes to it if there's several things that are changing it or whatever You have to make sure that it's it's it's working every single way, right? I don't I'm not a huge fan of screenshots. So I will kind of turn my screen right now So you guys can see it running yourselves and I modified it. I hope it works. Um So I just ran test image for there it is so I just ran test image for a bit more hello world and Again, it says it sending command The till the or whatever you call it and then it got a success with a character turned there and then the the test itself passed Just to prove to you that I'm not lying I can go and look at the Layers where my layers layers Meta free articles and then live or if you a runtime cases and then I have two cases there But I'm using the echo one Again, this is just what the test case looks like that's what what's being run by QME runner and The application in this case also I changed the application a little bit I'm gonna show you that right now because the original one was simply printing Hello open embedded, right? So For that I will I'm gonna go into the source code and I'm gonna read some of them So this is this is the new application that I Modified it's based on the same thing, but it has a couple of extras right now Again, as I mentioned before I switch from using Tc-LiPc bare metal to Tc-LiPc new lip and the reason for that was because I wanted this kind of stuff here So I I'm able to get standard in and standard and strength from the C library I defined other registers if you remember on the On the bare metal one, I only needed the data register which was this one So all I needed was this and I only knew what's the point What I was what I wanted to print there But this is a little bit more complicated because I wanted since I wanted to have that synchronous communication to the target and the host I Had to define some of the things and these are the ones I'm gonna go back real quick. These are the ones that I got from Here so from the I'm developers manual from the PL 0 1 you are You can get the correct registers for that in how the offsets are set up so Okay, so the important thing here is that I define a the the flag register it's It's it's offset. It's a fine here It's off that the offset for the received status and clear register offset is defined here And then I've defined some masks because I need it for the specific the flag register You have to get certain bits of it. So That's that's what I used to get those bits. I define a couple of functions here with you are put your you are zero print you are zero and then check command This can easily be a strap, but I wanted to make it clear and define it differently. So Again, so these are these are how the functions are defined I'm gonna go through the end and try to like kind of go through it real quick So first of all, I have my C entry function and I have the same thing as before I have a print the you are zero. Hello ELC 2020 and then I have a while that pretty much just reads the you are whatever it gets from the you are and then It echoes it And at the same time it tries to check if we reach the end of the line If we reach the end of the line, it calls the check command function For the print the print Changed a little bit. So the read the read your function is here and It basically just checks the pointer for the flag register and gets the correct bit From from there, right, and then if if that If it's able to read something from there then It gets it and then it puts it on the on the you are and if not it returns an error For the print itself This function is pretty much the same as the other one. The only difference is the I'm printing our character by character here. And again, I have to read I have to mask the flag register For the bit that I actually want and if I'm able to put something on the data register I can print it and then I print character by character, right? And then the last interesting thing here is the tech command, which is basically just a switch case But you can do that here. So you have to string compare that and this is something also that you get from new live, right? this kind of functions So basically checks the buffer that I define For for the user in this case and then it tells whatever string that I wanted to find So I'm not welcome in this case cover 19 and then not welcome and then it also checks for the known behavior that I mentioned before in the test case and then it says Success otherwise it just says unrecognized command. So I can actually go ahead and test this So if I just run run QMU everything in the application is already defined so it mimics an image a Linux image. So it just sort of Interacts correctly with the OE infrastructure that set up for Linux So in this case as you can see The string that it being printed. It's hello ELC 2020 and then if I put 19 it says not welcome. You're not welcome and then if I was running the test case, I would put this and Hit enter and then I get success, right? So that means that the application itself. It's working and then whatever else I type is gonna say unrecognized command now be This is that the part where I was mentioning that I'm not gonna try and focus on what the application does a lot because that's kind of up to you What you can create is up to you. This is meant to be a some sort of example of How you can create your Or a base, I guess How you can create your bare metal application using either the bare metal toolchain or the new lip toolchain And uh, use the test infrastructure coming from up and embedded to test your application So if you wanted to do something different, uh, and yeah, you wanted a different, uh, Bare metal application all you kind of have to do is, uh modify Uh modify this work scope and then instead of Checking the command and print in that success. You can actually do something interesting like reading some sensor from the adc or You know manipulating some led or or gpio or whatever, right? That that's up to you But the the basis of it it's it's already there. Um, another thing that I'd like to mention is that, um So when you're using new lip, this is this is sort of like a hybrid because it's using Parts of the bare metal one and parts of new lip. Technically you can get the z runtime You can get it from lip gloss. Uh, if your architecture is supported So if you wanted to make it portable and do this Correctly for your specific so see you would patch New lip or lip gloss in this case to get the c runtime correctly for all the applications that are meant to be run on your architecture Uh, that will allow you to get rid of that part for the startup code that would just get you would just get that from new lip and lip gloss and in the The linker script as well um I think that runs it. Um, oh I actually modified it Again, give me one second um so I created a different branch I'm pretty much done if you guys want to ask questions Um, I noticed in the other presentations that the questions take a little bit to get here. So if uh, uh, if you guys can't If I can't see the question feel free to reach out later. Um, so I created a different branch here in your branch and Supposedly I can't scope there. So if I recompile this Um, I'm recompiling the application with a different source code It goes through all the process there I just have to run KMU And then it says hello ELCE and then COVID-19 Not welcome and then if I wanted to test my image Please wear a mask because I'd like to present in person at ELCE and that's it. Uh, I'm going to go through the questions now Let's see. This is a little bit small. I'm going to see you Lots of you are listening cool um So one second It says can the uh Can the vermin recipe depend on other recipes? If yes, can they be built with teammate and should they be built as a static library? Uh, yes, they can depend on Oh, let me show you one more thing um Yes, they can depend on other recipes again, um It it works with the build system itself. That's that's what we try to do We try to integrate it with the build system how it works right now So if you put something on the pens, it's gonna be there, right? So for in this specific case, I I can show you the recipe for Do I think yeah, so I think this is a this is what the recipe looks like and that's a meta skeleton, right? And there is Okay, no, there's no depends there because when when I set up the Uh PC leapsy new leaf you automatically get new live as a dependency, right? But the idea here is that if you both the recipe Oh, this is not correct Um recipe sister and then user live Uh, you can see that I have leave c that a which is new live in this case Uh, so yeah, you can depend on other things as well. And one other thing is that I had to pass Oh, this is it Uh, a new live the noses root does not work. Uh, it's not set up that way So I had to pass somehow in this case. I just hacked it, but I had to pass The search directory for libraries, uh on the recipe the Makefile itself has A Where is this here it is? So these are this is what the makefile looks like and then it it's it's try to I try to set it up in a way that it's understandable Um, so it assembles compiles and links, but the important part here I want to want to show you is this part which is passing, uh, the leapsy that a And it's specifically passing it as a static library So yeah, thanks for your question. Yes um Let's see Uh The I have another question here. It says, uh, is this uh free articles in the yachter project nightly regression testing No, it is not, uh No, it is not, but yes, so I have my own testing For the since it's the free i'm the maintainer of the free articles later. So I sort of uh Tested myself. So Here I have my this is the free articles. No, this is not the free articles later. This is the free articles later. It's on github Um, it says it failed, but don't don't worry about it. I already fixed it Uh, so this is being tested on a nightly basis. Uh, every day it is being tested a master done fail See you as in a wire and actually you can get the artifacts from here um Just to show you that it actually works. So Master next here is master next. I pushed it 14 hours ago So, yeah, this actually tests two things it tests, uh free articles and it also tests the, um Uh multi-config uh belts. So it builds, uh pokey for one architecture and free artists for a different architecture I think it builds, uh, x86 64 pokey and then free articles. I'm not entirely sure Uh, yeah, so so it is being tested on a daily basis. It's not being tested as part of the Out of belter from from the octo project um I don't think I have any other questions So, yeah, uh, if you guys, uh, have more questions, uh, feel free to reach out My email is alejandro.herlanders at microsoft.com. Um, and yeah, uh, anything just see just people to reach out Thank you guys, and I hope you enjoyed it Bye