 Let's look at the difference between the HAL and the LL. So the HAL, which is the hardware abstraction layer, this offers a high level of APIs, which makes it very high portable and also will hide the complexity. Here are some features about the LL, so the low layer library. So the LL offers the following services, set of static inline functions for direct register access. One-shot operation that can be used by the HAL drivers or from the application level, independent from the HAL and can be used standalone. Full features coverage of the supported peripherals. So on the other hand, the LL APIs are not fully compatible or portable across the SM52 families. So the availability of some macros depends on the physical availability of the feature on the products. Most of the SM52 peripherals are covered, so not all of them. And we get the same standard compliancy as the HAL, so for MISRAC and NCC. The low layer is available in SM52 Cubamex. So that means that the user can choose between using the HAL or the LL, so the low layer drivers. And we're going to do a lab about this later. This is the SM52 Cube firmware package block diagram. So as we can see, we are talking here about the SM52 G0 package for the Cube. Here are the low layer drivers, so in the driver sections right there. We offer some low layer examples and also some mixed examples between the HAL and the LL. We also have the SM52 Cubamex that supports the LL. So the low layer drivers. So we can generate code using the LL drivers. And we're going to do that in the hands-on that comes right after that. Here is a benchmark. So for one example, which is a user-transmit example. And we're showing here, in this table, I listed basically in this column the code size and the RAM size using the HAL drivers and using the low layer drivers. So what we are seeing is that in terms of code size, we are dividing by four the code size. So we go from 7.2 kilobytes to 2.1 kilobytes. We see the same differences, you know, for the RAM size. So we see a RAM size reduction. So note that this RAM size includes the heap and the stack. So there is actually a big differences in terms of RAM size. Here, I'm also listing the read-only data memory. So this is the constant, for example, in your code. So you are seeing also differences between, you know, the two, using the HAL driver and using the low-layer driver. Before we start the lab, I want to give you a summary about the usage of the LL and the HAL. So the LL offers small footprints and high performance, but is less portable and requires expertise about the products and the peripherals that you use. The HAL offer high-level APIs, so and is very portable, but it has higher footprints and less performance. Now we're going to do a lab using the low-layer drivers, so the LL. The objective of this lab is to generate a project using the SMPH2-QMX using the low-layer drivers, so the LL. And we're going to check how much improvements we're going to get compared to using a HAL project with the same functionality in term of flash and RAM size. If you have Kaila Microvision 5 open, please close it. And then in SMPH2-QMX, open the Blinky project and save it with a different name. So, for example, as Blinky underscore LL. I'm going to close Kail. Now in SMPH2-QMX, from the previous projects, recent projects, I'm going to open the Blinky project. Or, if you can find it in the list here, just open the project file, open or load project. Now I'm going to save it with a different name. So save as, save project as. And instead of Blinky, I'm going to rename it Blinky underscore LL for low-layer. And save it. We're going to click in the Project Manager tab and then press on Advanced Settings right here. In the Advanced Settings, we are going to select LL instead of HAL for RCC and GPIO. I'm going to the Project Manager tab and click on Advanced Settings right here at the bottom. Now, instead of HAL for RCC and GPIO, I'm going to select, with the left click of the mouse, LL for both. So low-layer drivers instead of HAL. We can now generate the code and open the project. Generer the code right here by clicking Generate Code. And I'm going to open the project. In the ID, so in Calmy Corision 5, what you can see is that in the driver's section, in the driver's folders, you will see that the driver a now a mention about the underscore LL. So this means we are using the low-layer drivers and not the HAL anymore. So now we're going to add some code to the main.c. So in the main function, so you're going to look for the main.c, which is in the Application User section. In Cal, double-click on main.c, look for the section, which is User Code while. So this is the while one loop. So you will find that in your main.c. And we're going to add two lines of code, like we added in the Blinky example previously. So in the Blinky example, we add the HAL function to toggle the pin. So now we have a function called using the low-layer drivers for doing the same thing. Then we're going to call another function from the LL to create a delay about 100 milliseconds. So it will have the same functionality, exactly the same functionality as the Blinky code we used before using the HAL. And we're going to see the differences in terms of code size for RAM and for Flash. So in Cal, I'm going to expand the project. First, look at the drivers. So you can see that now the drivers call have the mention underscore LL. So that means we are using the low-layer drivers. Now let's add the code to the main.c. So in the main functions, look for the while loop, so right there, and add the code that we mentioned previously to toggle the LD. So this code can be found in the description of the video, as usual, like we did before. So I'm adding one line of code to toggle the LD and one line of code to do a delay of 100 milliseconds in the while loop. So it's going to execute indefinitely. We can now build a project, so f7, or using the icon, the arrow down. Then enter the debug session with the D icon in red. And in debug session, run the code with this icon and or let's say f5. So what you should see is that the green LED should be blinking, so LD4, should be blinking as the blinking example we used before using the HAL. So we have the same functionality as using the HAL. Now we're going to build the project. So f7, or once the code is built, I'm going to enter debug session with the D icon D. I can now run the code so using this icon and I have my LD4 blinking. So we have the green LED that is blinking as expected. So we have the same functionality as using the HAL driver. Let's compare the map files between the HAL and the LL projects. So the map files contains informations about the RAM usage and the flash usage. So this is what we're going to compare. So we're going to compare the blinky map file to the blinky underscore LL map file. First, we're going to open the blinky map file. So the blinky map files are listed here at C, STM42G0 workshop, Hands On, Blinky, MDK-arm, Blinky. And then in the project or all the files that are listed here, please open and double click on blinky.map. Let's open the blinky map file. So to this, go on my C drive, STM42G0 workshop, Hands On, Blinky, MDK-arm, Blinky again. And look for blinky.map. Now double click on it to open the file. And we're going to expand it. Now we're going to open the blinky underscore LL map file. So this is the project that is using the low layer drivers. So this is going to be located here. So we're looking for blinky underscore LL.map. So it's located here. C drive, STM42G0 workshop, Hands On, Blinky underscore LL, MDK-arm, Blinky underscore LL. And then look for blinky underscore LL.map. And double click on it to open the file. Now we're going to open the blinky.score LL.map. So we're going to go to Hands On, Blinky underscore LL, MDK-arm, Blinky underscore LL. And look for the Blinky underscore LL map file. And double click on it. Now let's compare the RAM and flash size between both of the HAL and the LL projects. So what you're going to do is you have your blinky.map. So this is the project using the HAL. You're going to scroll all the way down and look at the total numbers. Just two numbers is the one we're interested in. The total RO is the flash size and the total RW is the RAM size. So please note on a piece of paper, take notes about these two numbers. So total RO, in my case, I have 2816 and total RW size, so that's RAM size, 1040 bytes. Now on the LL site, so that's in my blinky underscore LL.map, scroll all the way down and check the total size for total RO, total RW. So same thing, flash and RAM size. And here I have 900 bytes and for the RAM 1032. In the blinky.map file, we're going to scroll all the way down and look for the total RO size. So I have 2924 and also the total RW size. So I have 1040 bytes. Same thing for the blinky underscore.map. So I'm scrolling all the way down and write down the total RO size. So that's the flash size, 900 bytes and the total RW size. So this is the flash size, 1032. So if we compare the numbers, so those numbers here are for specific cases that are listed in this configuration right there. So yours can be a little bit different, slightly different. But overall, let's see what's the trend. So when using the hard drivers and when using the low-layered drivers, what we see is that using the low-layered drivers, we devise the ROM size by 3. And also for the data, so the data, you have to take the number that you took before minus the heap and the size of the stack which is 1024. We see a ROM size of 2. In conclusion, we see that the LL offers a small footprint and a high performance compared to the LL which offers a high-level but has a higher footprint and is less performance.