 Let's now quickly start directly to the FileX implementation because I think it's really more and more easy to understand in a practical way than discussing over a slide. So again, I'm going to switch to my screen. So I'm going to share the other screen. In this lab, we will going to create a file system on a RAM. We're going to create in the RAM for two reasons, basically. The first reason is because the Nucleo is not having onboard any SD card holder or is not having any USB connector to attach directly a USB key, for example, but you would need in this case a kind of hardware in the middle. And the other reason is that I told you that when you work with a physical device, you need the low-level driver. The RAM disk in this case is the only case that you don't need a low-level driver more than the one that is already provided by the library itself. This is because if you think about it, what is a level driver for a RAM file? The low-level driver is simply a mem copy because you are going to copy to pass. So to copy your string from your local buffer to the RAM disk. So from RAM to RAM, so the low-level driver that is already provided is simply performing a mem copy. We will see later directly in the code what will happen. So let me switch to the QBD. Okay, create a new project. So start. This is again the usual flow. So new STM32 project. Okay, again, let's skip the MCUM view and directly let's go to the board selector. Select again the Nucleo. So H72, select, next. Project name, I don't know, RAM disk, for example, RAM underscore disk. Use default location. No need to change anything. Click finish. This is all peripheral. You can type yes here even if we are not going to use any peripheral, led, bottom, and so on. We only need the RAM and we will only use the RAM of this device on the STM32 H7 device. Okay, you can see again on the left on the project explorer that there is nothing but the core library, the core user file, and the driver. So this is still a bare metal project. Let's go again to Alt O or select component. Again, we need the file X, but after including the operating system. So first of all, let's add the operating system. So RTOS predicts core, so the minimal, and after that we can pass to the file X. So again, let's include the core again. The level X we can skip because the level X is for the management of the flash and directly go to file system interface and add the low level driver for the RAM interface. Let's click on OK. Again, another line appeared here on the categories. Select software pack, select the Azure RTOS, and you will see here that finally not only the RTOS that we enable, but also the file X, a label again, and the file system interface. So the low level driver for the RAM disk. Select all of them. So first tab about the operating system. Again we are going to use the static memory. And since we are going to use the static memory and since we need a cache buffer to work with the file system, we need also to increase the size of the memory pool. So let's give more than 1K, so let's give 3K for example. Memory pool for the file X, OK. The file system has been configured, don't need to change anything. Let's go now to the file X tab. Here the only thing that we need to change is the base address of the RAM disk. By default it's the access RAM 1. We need to change to the access RAM 2 because the location 1 is already used for other stuff, other things of the operating system. So let's move to access RAM 2 base, keeping the same default size 8K, OK. And that's it. We have in few click enabled, added and enabled the RTOS and the file system, the file X. Before generating the code, there is only one thing that is mandatory to be done when working with the operating system. We need to change the time base because the system tick is now being used by the operating system. We need to move the time base for the AL from SysTick to a low resolution timer let's say. So let's go to system core on the left. Click on Sys and move the time base source from SysTick to Timer 6 for example, OK. Now we are ready to generate the code. So save everything, upper path will appear, we want to generate the code, click on yes. It will take a while, again two libraries will be added. First of all, the operating system library again and the other one is about the file X. So if we explode the middleware, we will see not only the 3DX source but also the file X source but again never touch the file related to the middleware. So you can take a look but do not modify it. And the other folder added is the file X. Open file X, open up and you will see here the app underscore file X dot C file. Even in this case like this morning, we are now working no more with a Bermeter project but with an OS based project. This means that the main dot C file has no more sense to be modified so you can close it because the while one will be never reached because the execution will never exit the 3DX in it. So you can close the main dot C and you can open instead the app underscore file X dot C file. This is the file that we overwrite. So you can work at file system level outside the QB, deleting this file and adding the other one or directly change directly the content of this file. This is what I'm going to do. So select all delete and now I'm going to copy the content of this file directly control C, control B. If everything is correct, you should see 268 as number of lines inside this file. Save and compile. Control B, this will take a while because we are going to compile not only the OS but also the file X so this will take a while. You can see on the console how much file are going to be compiled. In the meantime, let's scroll across the file and see how it's composed. Let's start from the beginning. Okay, default sector size. We are going to use a RAM disk file 8K in size. So 8K with sector size of 512, it means in theory we have 16 sector but some sector at the beginning are reserved for the file system itself. Let's say sector number one. In sector number one, we will use in the following steps at the break point in the code. We are going to monitor sector by sector what is going to happen. Sector number one is where you can find the information related to the file system itself. Sector number three is the sector where you can find information about files and directories. And then finally starting sector number five, you will find let's say the payload of the file, so the content of the file. So only the odd sector 125 are going to be used for our purpose. We can ignore sector number, the even one, so sector number two and sector number four because they are reserved for file system stuff. So the default sector size here is 512 or in X is 0x200. And so later we are going to check the offset zero, the offset 400 and the offset 800. So we will see later. Other stuff, stack size, stack priority and thread priority, preemption priority, okay, you manage it. Media memory, for example. Media memory is a pointer to a buffer used for file system as a cache memory. Using a cache memory it means that you will not notice some change into the RAM disk content exactly when you are going to create a file, write to a file, etc. Because you have a cache memory in the middle, you will see later what will happen step by step. So you will notice also the behavior due to the buffer in the middle, to the cache in the middle. So file system media RAM disk, okay, file system file file x, thread x, thread file x thread. As I told you this morning for the file system, every component of the file system of the thread x and so on has an handler. So every operation on the thread on the file or the RAM disk has is handler is pointer. So you can work on it through this pointer. The thread entry is the content, the function that is going to be executed by our task is the thread entry task we already used for the led toggle. Now we are going to change the behavior from a simple led toggle to the management of the file system. So we are going to create a RAM disk, we are going to create a file, open, write, close and so on. That's gone. On the file x unit, there is the allocation of the thread stack to gain size and the creation of the thread itself using again the same parameter we discovered. After that you have the allocation of the cache. So the small buffer, 512, we discussed it before, you have a cache in the middle between what you want to do and the real workflow on the RAM disk, so write and so on. About the thread entry, I'll comment only the first line because the other one we will see step by step. So media format, the media format is the function used to create the RAM disk. You will see here the address of the RAM disk, you will see here the famous low level driver. The low level driver repeat is always needed for your device, whatever device are you going to include. If we go inside it, you will find what I told you before, I need to compile before, okay. I will come back later. Here you will find the low level driver meaning the mem copy because we are going to work with a RAM disk. So all the operations are from memory to memory in the end, from RAM to RAM. So the low level driver is a mem copy. Other stuff, you have here sides of the cache and a pointer to the cache itself. You have the name of the volume, you will see this name inside the sector number zero and you will see other other parameters that are already self-explaining. So number of fath, the rector entry and so on, sector side, this is important, this is a file under 12. Once compiled, yes, let's go in the bug again and flash the board and put a breakpoint here. The bug has stm32 application, keep it the default value so do not change anything, okay. Okay, board has been flashed. Before going in execution, let's add a breakpoint inside our task. So let's add a breakpoint to the effects media format, for example, file line 120. To add a breakpoint, simply double-click on it. Let's run. The breakpoint is disabled here. Why? Let me check. It's disabled. Ah, it's skip all the points, no, no, no, okay. There was a button that was pressed, not by me. Okay. Okay. Let's go back, reset the chip and redo the bug. Okay, now I see. To watch the content of the run disk, let's add a memory monitor. So the same operation done by Manuel this morning. So if you don't see the memory browser, go to window, show view, memory. Let's add as an address the base of the run file, so 0x2402000, okay. Let's add a nice rendering model. So click on new rendering and select traditional, double-click. Let's go step by step. You will see on the sector number one, so at the offset 0x0 format of the media. So you will see here the name run disk. You will see here the fast system itself, file x, et cetera. Now let's scroll the memory monitor and let's go to third sector. Set this at offset 0x400, so let's scroll down, okay. It's around this zone. Let's go on step by step. We are going to create a file and to open it. This is the file at offset 0x400, around. So sector number three, because the sector number two is reserved, same as sector number four. The file is fxtest.txt, and after that we are going to write something at address 0x800, exactly. This is the file x working on STM32. So you can see here that everything happened, so the first sector is for the file system, the third sector is for the file and the directory, and starting the fifth sector you will see the payload. We can continue step by step, but basically what is going to be done is simply reopen the file again, go to the beginning on the file, and read the content of the file. So we can check that the content of the file is exactly the same content included around disk and it's exactly the same buffer we used before for the right operation. So what we saw is how to add a FAT file system and how to include in a quick and easy way with a few clicks in the end, through the cube mix, the file x library. It's obviously, we have done this step through around disk because it's quicker and you don't need any spatial driver, but in the end you can repeat with all the media that you want, that you like, that you want to use. And also flash memories, and they are supported through not only the file x, but also thanks to the level x and the where leveling implemented in software by the library itself.