 Hello and welcome to how to create a super simple bootloader last part congratulations for making this far So this last part is going to be a bonus track in order to demonstrate how to actually create a static library That can be placed in the memory region that we've been using so far Again, I'm Bruno and I'll be your host for this video Without further ado, let's move to the code side So here we can see that I already have a folder called my static library and within it I do have two simple files one source and one header and on this source file I just created one simple function called add which adds one number with the other and that is prototype and extern with the header file that comes along with it So how did I create this static library? So it's very simple all you have to do is right-click, click new, c slash c plus plus project and then go to the c Progress, c-minage build and then instead of using the executable We can actually select the empty project for our static library Just make sure you select the proper GCC version again. We are doing for microcontrollers So the MCU arm GCC is the preferred one and you can create the name that you want for the library I'm just adding the number two at the end. So you see how that can be added and Expected the project pretty much comes empty and we can just create new either header or source files as we want to So you can see and understand how I did the first one So I'll just go ahead and delete this one and these Static libraries the one that I'll be using from here for foot print to the end of the video and once that is compiled We can see that it has created a dot a Which is a version that is Protected and no one can actually see the code that's within it Which is really useful if you are sharing part of your application with your end customer And you don't want him to get access to your IPs one other interesting details that within the build other fact You can actually select if it's just a static library or an executed library and you can also change the extension for it All right So now since these libraries is also connected into the same workspace getting the reference for the actual projects that we want It's quite simple All we have to do is go into the properties of the given project in this case the bootloader one and Go into the path and symbols and the reference tab will all already be Set with the static library that you want to use If this wasn't the case the library was outside of the current workspace The process would be roughly the same, but you will need to point the dot a into your Project sign instead of just using the reference for the same workspace. And here is the most interesting part You can see that I forced the add function to be placed into my main region And this is quite interesting because now these Part of the API is into the shared API so I can use the add Into both projects that are currently being used. So I'll just go ahead and create the Include for the static leap into the bootloader main.c file go down into the main loop and Add a very small usage for the function just to demonstrate that it's going to work So you can see here I added the variable sum and it's going to print one plus two Hopefully it's going to show three for us And I can save the main and move to the other Part of the project that's currently under use as well the application I'll do the exactly same process just to make sure that under the path and symbols the reference for the static library is also there And once that is done I can go into the main.c for the application called this time and also add the static leap to the edge And go down to the main loop and create a very simple use again where this time Again doing the sum and keeping that sum Recorded and preening that so I should see for every interaction of the main loop the increasing account The increasing number going up I'll just enter in the debug mode starting from the bootloader which is voting both ELF so the application and the bootloader are being loaded at the same time in the memory Even though the entry point of the debug is going to be the bootloader project Both are loaded into the flash memory So the very first thing that I want to do is Renable the comport we can see the previous message from the last video And I added this very simple break point Just before the add function to take into account just to demonstrate that this address right here Is the my memory region just to prove it. I was just going to open the Linker script and we can recall the address of my memory region And if you pay close attention, you'll see that the actual position for the add function Is not the very first one into the api share and that's because we do have other three functions that are located Already there. So the compiler is just putting inside the region, but not In the very first position because we already took that address for the first time And whenever we are executing we can see that number three and then the Putloader start the application start in the interaction starting remaining as we would expect for the function to demonstrating that the Library was properly shared between bootloader and the code That's allowing us to create our own library and share between the Putloader application and whatever other position you might need So here are other very useful information This was a series to create a very simple bootloader But it's not taking into account on how to actually program the flash and we do have few offers So first we have the xq For in application programming, which doesn't include the security features So you have those two examples and we do have the xcube sps fu Which stands for secure boot and secure firmware update So I do recommend for you to check those and we have awesome video zones as well And as the takeaway for this entire video series that you saw I hope you managed to understand a little bit more about how the linker file works how to create Functional segments and even libraries How to develop your own super simple bootloader and application make the jump between those Share apis and share also libraries among those two to save flash memory So I hope you have enjoyed the video Please like and subscribe if you enjoyed the video check our latest content on those links below and as always Have a wonderful day