[MUSIC] So in this lecture, we'll continue talking about the different steps that happen when you click Verify or click Update that are required to get the code onto the Arduino for execution. We'll talk about the rest of the steps, Cross-Compilation being one of them, linking, that type of thing, so we'll talk about those. So compile a link. So after you've combined the different source code files into one, and you transform them adding the main and including the libraries and all that type of thing. Then you compile it, actually you cross-compile the code. So, avr-gcc is the program that is actually invoked to perform cross-compilation. So compilation is taking the C or C++ source code and generating the machine code required to execute the actual program. Cuz the processor, remember, only understands machine code, it only understands its own machine language, it doesn't understand the high-level language that we are actually coding in. So it has to get transformed into that, that's what compilation is. Now, cross-compilation, which is what we're doing here, is when you compile code on one machine for another machine. So, typically, you're compiling it on a desktop machine, laptop machine, which maybe has an Intel x86 type processor on it, something like that. And so you're compiling it on an x86 processor but the code that you get does not execute on an x86 processor. It executes on the Arduino's processor, specifically the AVR processor AVR Atmega328 that's running on the typical Arduino Uno setting, right? So you're compiling it on an Intel processor but you're compiling it for your target, is actually an AVR processor, a different processor. So if you take that executable and try to run it on your Intel it will not work. So this is called cross-compilation, you compile on one machine, but the target is another machine. So, avr-gcc is the tool that is used to, behind the scenes, the tool that is used to actually do this cross compilation. Now when I say behind the scenes, I mean that you as a user, as a programmer, you don't have to see that tool. You just click Verify or you click Upload, and the Arduino IDE invokes this program for you. And just so you know, GCC is made by the GNU corporation, free software. And avr-gcc is the compiler version for AVR target processors. So the resulting code executes on the AVR processor, not on your standard Intel. So, once you do compilation, you get an object file, a .o file, it's compiled but it's not finished yet because it still needs to be linked. So linking means taking the object files and combining them. So including the object files for your libraries, right? So you have these libraries, these Arduino libraries that you're using, and they have their own .o files, and those have to be linked together. So when we say linked, generally that means, it implies several things, but mostly it means, inside your code, whenever you make a call to a library function from Arduino, you have to insert a branch or a jump statement that jumps you to their code, okay? And, so, they have to be, but the question is separately when you compile them originally, you don't know where to jump to. But once you combine these .o files into one then you know where each function is relative to the other functions, so you can put the jumps in. So this is a longer story which we will not go into, but that's the linking process, you take the data files and you join them together. So the object file is linked to the Arduino library functions, which we're definitely using. Now, once we get these .o files, actually once we link it, once we get actually finish the linking, you get what's called a .elf file. That's an executable file. And you can execute that code. But, the Arduino processor does not accept ELF files. So we have to take the ELF file and change its format to another format. So for that, the IDE uses a program called avr-objcopy. And that's invoked to change the format of the executable file to the one that the Arduino expects to see. So this is a formatting thing, and we're not gonna go into details of it, but the .hex file is generated from the .elf file that's created after linking. So it changes from one format to another, and the hex file can actually be executed by the Arduino's processor. Thank you. [MUSIC]