 Welcome on this short video where we are going to see how to debug your M4 firmware with the S1032Q IDE. So there is two approaches possible that we are going to explain, and after we will make a demo with a GPIOxTi example on the Decay2 board. To debug your firmware, you have two possibilities, the engineering mode and the production mode. The engineering mode is used to develop your firmware when you don't need interactions with the A7 part. And also it can be used at the beginning to start your development. Then after, when you are ready, you can use the production mode as soon as you start to use the interaction with the A7 and the M4. The engineering boot mode is a special configuration. So the boot pins are set to, as you see, boot zero is set to zero. And in this case, the Linux is not started. The boot chain is not starting the Linux. And in this case, the Qube 8 IDE is going to use ST-Link to load the firmware into the RAM. And we connect under reset with the GDB. And you will be able to debug from the beginning your M4 firmware. In the production mode, it's different. Linux is started. And we are going to use the remote proc framework used by Linux. And this remote proc framework is going to load and boot the firmware. In this production mode, we have to be careful. There is a difference between the engineering mode. In this case, the Linux framework has started the M4 firmware. So when the GDB is connecting to the M4, the M4 is running. So the initialization phase of the M4 is already done. So if you want to debug the initialization phase of the M4 firmware, you need to put an endless loop that you release when you are in the debugging phase. There is also another important thing to underline. In the production mode, the security, the clock and the power are undone by the Linux. So the clock of the IPs that are used by the firmware are enabled by Linux. And the security settings also is done by Linux. Whereas in engineering mode, there is no security settings. And the clock and the power of the IPs that are used by the firmware has to be initialized by the firmware. So there is a little difference for that. The two modes are supported by QBID. And today we are going to see the engineering mode and there will be another video for the production mode. Okay, so let's make the demonstration. So we are using a DK2 ball, we are just using the USB cable and the boot pin 0 is set to 0 to be in the engineering mode. So I go to the QBID IDE. Here I am under the virtual machine. And I'm going to select the project coming from the Qube Firmware package. So on my machine, the firmware repository is on my home directory. And then you just select the directory. You get the example, GPIOs, ECI, new tech, QBID, we say OK. And finished. Here we have the project. So we have the main file which is there. We are going to check first when we make the debug, it's better to go in optimization 0. So this is the case, you see settings, set plus build settings, go into settings, and then after optimization 0. Okay, so you can compile it. It's a very short compilation time because it's a small firmware. Okay, in this firmware we have a very simple application. So we have an XTI external interrupt that is connected to a GPIO A, A14. And when we press on this button on the GPIO 14, it's connected to a push button. And when we press on it, it will raise an interrupt on the XTI. And so we are registering here the callback, the function that is called when the interrupt is raised, when we press the button. So we have the interrupt handler. And the XTI handler will call the callback that we have just registered here. And we are going to put the callback is just toggling the LED 7 on the PH7. So let's make the test. So we go back to the call. This is the source call. So you see here engineering boot mode. So in this case, we are using this function that is going to make the initialization of all the clubs because we are in engineering mode. The production mode, it is done by links. So I search for the callback. I put a break point here. Okay. Now let's make a build configuration. So you go to debug, build configuration. And here you have this. This is a build configuration. In here, the more important is to use the mode, engineering mode. You have the production mode and the engineering mode. So this is the load mode. So we are going to load the firmware, the Firmware, by the G-type or the S-value link. Here we have the debug configuration. And here, this is an OpenSD script that will connect to the S-type link, the debug cell. And then we will run the GDB using this connection. The GDB will connect to OpenSD server with this port. So that at the start, we will reset the M4 and we will hide the M4. And then after, we will raise the reset and we will stop at break point here. So we can do it here. So on the PC, you can see that there is no trace of the Linux console. So the Linux is not started. We have nothing. So here, start the debug. So we see the OpenSD script information that are here. And here we are on the main, ready to make step-by-step debugging. So we can make step-by-step. If I go to the callback, the right point is set. I just run the firmware. So it's just a white loop. And when we have an error, we will go inside the callback. So I run the software. I press on the user one button. And I get stuck. I get catch inside the callback. And if we want to see the GPIO PH7, which is actually the GPIO that is used to toggle the led, we see that each time I press on it, I see the GPIO 7 state. So it's 2-1. So I see the orange led. If I do it again, it toggles to 0 again. So we have here the little demo. So here we have all the IPs of the SDL32MP1. We have all the registers. And each time you have some description of the register below here. Here we have the call stack. So we can see that we run the main and run the third drive. And we are caught in the callback here that toggles the led. So this is the end of the demo. This is a short demo. Just a few recall of what we have set. So we went into the debugger. We set this. And we just ensure that the looping are correct. And here we have a little reference. So you can go in this wiki to have more information about debug mode or genuine mode. And here you have also more information on how to import a project inside QBDE. How to start an example or how to start an empty project. And here we have a workshop on the M4 that is very interesting. Where you will find a lot of information that we have seen here for the two modes. And after you have more insight about the M4 and the resource sharing between the M4 and the A7. So inside it is in the Google Drive. And it is inside the zip file. And this is the site set here. Thank you very much.