2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
The i.MX8MM processor uses the advanced 14L PCFinFET process, providing faster speed and higher power efficiency; quad-core Cortex-A53, single-core Cortex-M4, up to five cores, main frequency up to 1.8GHz, 2G DDR4 memory, 8G EMMC storage. Gigabit industrial-grade Ethernet, MIPI-DSI, USB HOST, WIFI/BT, 4G module, CAN, RS485 and other interfaces are all available. H264, VP8 video hard encoding, H.264, H.265, VP8, VP9 video hard decoding, and provide related processes, support 8-way PDM interface, 5-way SAI interface, 2-way Speaker. The system supports Android 9.0 (supports root access) Linux 4.14.78+Qt 5.10.1, Yocto, Ubuntu 20, Debian 9 systems. Suitable for smart charging piles, Internet of Things, industrial control, medical, intelligent transportation, etc., can be used for any general industrial and Internet of Things applications,
【Official Account】Xunwei Electronics
【Fan Group】258811263 (join the group to get driver documentation + routines)
The corresponding video explanation link for this chapter (watch online):
Linux tools: make tools and makefile files → https://www.bilibili.com/video/BV1M7411m7wT?p=19
When we wrote the first program hello world on Linux, we used the gcc command directly. It is very simple to compile a program. Just enter gcc followed by the name of the program and the name of the specified program to compile the executable file hello. However, if we need to compile a project in the future, and there are many source files in the project, it will be very troublesome to use this command to compile all of them. Moreover, if we modify a source file, we have to execute the process again when we use the command to compile, which will be very time-consuming.
If you have studied MCU before, you can compare the separate compilation and full compilation in the MCU development software Keil. Separate compilation is very time-saving, and full compilation is very time-consuming. We use commands to compile, which is equivalent to full compilation in our MCU software. In order to solve the problem that compiling a project is very cumbersome, our predecessors invented the compilation auxiliary tool make tool for us. Its compilation idea is very simple. It will compare which file has changed before compiling. If the modification time of this file is later than the compiled file, then it will rebuild these files as required, instead of wasting time rebuilding other files. If a c file is written on the MCU using Keil, and other files in this project have not been changed, then we don’t need to click on all compilation, just compile the files we have modified. Make is the same, but it is smarter. It does not need to be judged manually, and it will automatically help us judge before compiling.
The make tool is a compilation auxiliary tool used to solve the very cumbersome problem of using commands to compile projects.
Call this command tool: We use IDE to program on Windows. We have a graphical interface and corresponding buttons, such as build or run to compile. In fact, the use of make, a compilation auxiliary tool, is also very simple. We directly enter the make command on the console, and it will automatically call the make tool.
The author directly entered make in this directory, and then an error was reported because I did not tell the make tool what rules it should follow to compile our program. As shown in the figure below.
Makefile is a file that describes the rules for compiling and linking the entire project. After we enter the make command in the terminal, we call the make tool, and make will look for the makefile file in the current directory according to the file name. The name of the Makefile must be makefile or Makefile, and both uppercase and lowercase m are acceptable.
The reason why the author just entered the command and got an error is because there is no makefile in the current directory. The author created a new Makefile and then entered the make command in the current directory. After entering the make command, it will call the make tool, and the make tool will find the makefile in the current directory. Here, an error is reported again, because the makefile created by the author is found but it is empty because it does not contain any rules. As shown in the figure below.
The author will first write a simple one for everyone to try. Open the makefile file. When typing, be sure to press Tab to indent the first line. Do not use spaces. Then we enter the content, save and exit, as shown in the figure below.
Then enter make, and the executable file hello is successfully generated in the current directory. Execute it and you can see the successful output. At this point, our compilation process has been completed. We have also successfully used the makefile file and the make tool to compile hello.c into the hello executable file. As shown in the figure below.
Now that we have figured out what the make tool is, how to call the make tool, and what makefile is, and figured out their relationship, it will be very easy for us to learn makefile syntax and write makefile on bare metal.