 Hello and welcome to how to create a super simple bootloader part for I'm Bruno and I'll be your host for this video This time we're going to focus on developing the application code So we're gonna basically use the same content that we had created on the previous video of the bootloader as Again, it started off if we recall the message that appear was showing that the bootloader was started But there was no way up install So a very simple way to create your application is to use control C plus control V and Copy and paste from the bootloader and then apply a few changes to make the application works as we expected by adding Prints here and there and also changing the linker script So we can locate the flash position that the application is going to be running from all right, so let's get into the code itself So here we can see the bootloader and pressing control C and control V changing the project name to your application And once that is done the copy will be made One thing that is very important to detail is that the IOC file the one that used to create the first project You keep the same name as bootloader and we need to tie those two together by changing the name Meeting the same as the workspace itself. All right, so now that we have the code I'm just going to start cleaning everything starting from the main.c file So here on our code we are going to scroll down to the parts that we have to first remove In order to make the application works. So the first one that I'll remove is the go-to-wap and Some others such as the link function that we won't be using on the application at this point in time All right, we can also clean here the prototypes for those functions to avoid the warnings on the code and And finally we can go down to the main loop and instead of using the go-to-wap We can actually go and replace it with a printf just so we know that we are running the application So right now it's gonna be a very simple print just saying hey the app is running Now this should do the trick for the application side of things in terms of code execution But we also need to change the linker script So I'm going to enter on the dot LED file and make sure that the flash region is On the same position that I want it to be so I'll just change here to 8 and Also keep the length to 64k instead of 32 so I can use a larger portion of the flash for the application And the last thing is actually tell the application that the interrupt vector should be With an offset that meets the very first position of the flash So as we can remember from this linker script we added 8.0.0.0 as Deposition so those two are all set since they have the same position now I can build the application and enter in debug mode as the usual method But instead I'm gonna use the bootloader as the entry point So I'll tie those two binaries on the same debug session in here down below We can actually see that the ELF or the application does come with the three memory regions that we specified So now I'll just click on the bootloader Project to enter in the debug session, but since we copied it for the first time We're gonna see two bootloaders and that's not desirable So I'm gonna have to delete one and just use the other one All right, so by entering the debug configuration I can simply delete any one of those they are copy of each other and Once this is deleted I can configure the proper one So to do that we can again enter into the debug configuration But this time we can actually go to the start tab and through there We can add a different ELF so I can decide if I want to load two or more ELFs at the same time selecting the application project over the debug one and just hitting okay So we're gonna see that both are going to be presented and one is the main and the other one It's just part of the entire debug session Which is nice because we're going to enter through the bootloader and whenever that jumps into the application We can see and debug the code from the application as well as long as the two Projects are on the same workspace, which is very nice feature from the QBuyDE So as we can see I just entered in debug mode from the bootloader Here there's no surprise. I'm just going to enable the console so we can see the serial port And we can see that there's some message from the previous session that we were exploring on the third video Let's just ignore for the time being and one thing that's very interesting to do on before starting the debug session And the code execution is actually to go to show view and then go to the memory region Just to prove that the application was actually loaded on this process by using the combination of the two binaries So by typing the first address of the application itself We can see that there are some cold and I'm just scrolling down back and forth on the memory region So we know it's not blank and now finally, let's do the code execution and also show on the console Because we do expect to see the message from the bootloader and then finally go into the app running So there we have it the boot start app start and the app running on the cycle And a very interesting thing is that if we do pause here We can see that the code was executing from this main But this is not the main from the bootloader itself This is the main from our application and since both projects are combined into the same workspace We can actually check both codes at the same time with this methodology, which is quite nice for the QBID All right, I think this concludes the steps that I wanted to cover during this video Thanks for watching up until this point. I do hope to see you guys on the fifth video and Again, please check our wiki page for more content and also a github and as always have a wonderful day. Thank you guys