 Hello and welcome to how to create a super simple bootloader part 3. So let's do a quick recap. So far we've done the getting started and the linker file hand zone and this time we're going to dive into developing our boot code. And here are the main aspects of the hand zone. So we are going to configure the last demo that we had on the linker script to reduce the overall flash so we can leave some room for the application itself to run. We are also going to declare a define for the vector table so the bootloader knows where the application is going to be stored and this define can actually be placed on any address as long as we respect the flash block size. So now we're also going to create a few things that are part of the building blog to create our function that will jump to the application and that's basically a type that for a function pointer, the define that I've already mentioned and of course our function that will be called go to app. So this is a screenshot for the function. I've added a few pre-nefs so we could monitor the application while executing the bootloader. And inside the main function we are going to add another pre-nef just to tell that the demo has started and inside the main loop we're going to call the go to app function. So let's start switching to the code view so I can basically type down all the information that I just described and gave a major spoiler. So the creation of the pre-nef will require the include for the STDIO and then basically I'm adding the define towards the address of the application and positioning that at the 32K offset of the flash declaring also the prototype for the go to app and here on the linker script I'm also going to reduce the overall size from 96 to 32 so that way our bootloader will reside on this amount of flash at the beginning of the flash. So going back to the code itself, it's time to create the go to app function. The most important thing to have is the function pointer that will actually allow us to go into the position that is defined as the first address of our application. So as we saw on the first screenshot there are a few messages here and there to allow us to understand where we are on the application execution inside the go to app function and then of course we are going to really check if there's something already installed or more precise already written in the flash location that resides our application. So this if is basically checking if there's something written on that position. I'll just assume since this is a very simple bootloader that if there's something there we should jump to there. There's no other check or security check or anything like that. This basically means that as long as there's any code on the first position we should jump to there. And here you can see the message saying that the app is going to start and how to start it. All we have to do is get the function pointer to receive the address of the application plus 4 that way we jump to the first executable address there and once we call the function pointer that's going to be set for the first address of our application so I'm going to use the define that be declared. And then once we call the jump to application which is a pointer the things are going to move from the bootloader to the app itself. And of course if there's nothing written on that position of the flash we're going to just print that no app was found. So under the while loop we should also call of course the go to app so I'm just removing the first piece of code that we had for the first video there and I'm also going to remove the other part as well so that won't interfere in our experimentation right now. And one last note in order to use the printf I need to type the underscore write which is just copy and paste to use the ur to that end so things are going to be really outputted through the ur that is connected through the sd link and open virtual com. Right now I'm going to show you how to use the virtual com that is embedded so I just order here to create a new connection over the serial port and I'm finding the com 92 and I'll give it a name saying it's the sd link com the settings are the standard for the creation and once I type start then we can see the message of no app found mainly because we didn't add any application so far and a very important thing that I didn't add into the code itself is that we should disable the interrupts and restore all the settings before jumping to the application I'm just going with the basics right now but this is a very important thing when you're creating your own bootloader you should make sure that there's nothing going on the bootloader that could cause any side effect on your application so it's really recommended to disable all the interrupts like if there's no panzing interrupt as well and you might also want to reset the sd counter to 0 before jumping so those were the main recommendations for the bootloader very simple ones and that was it for the video thank you guys we're going to see each other on the next one where we're going to create our application and don't forget to like and subscribe if you enjoyed the video and as always have a wonderful day