Getting Started with Makefile: From Rules to Automated Builds

Getting Started with Makefile: From Rules to Automated Builds

By mastering the variables, rules, implicit rules, and automatic variables of Makefile, you can transform scattered compilation commands into a stable, efficient, and reusable build pipeline. Make Build Process 1. Basic Syntax of Makefile (Minimal Working Example) A simple Makefile: CC = gcc CFLAGS = -O2 -Wall SRC = main.c util.c OBJ = $(SRC:.c=.o) all: … Read more

Modular Programming Concepts in Embedded C

Modular Programming Concepts in Embedded C

Modular Programming Concepts Modular programming is a programming method that breaks down a program into independent, reusable modules. Each module implements a specific function, and modules interact through clearly defined interfaces. This concept helps improve the maintainability, readability, and scalability of the code. Preprocessing, Compilation, Assembly, Linking Preprocessing: Processes preprocessor directives in the source code, … Read more

CMake Learning Notes

CMake Learning Notes

CMake Learning Notes Chapter 1 Understanding CMake 1.1 CMake Introduction The make tool completes and automatically maintains the compilation work through a file called Makefile . The Makefile describes the compilation and linking rules of the entire project. Most IDEs have this tool, such as: Visual C++’s nmake, GNU make under Linux, QT’s qmake, etc. … Read more

Using CMake as a Build Tool for Large Projects

Using CMake as a Build Tool for Large Projects

Clickthe blue text Follow us This article mainly describes the basic usage of CMake. In previous documents, I covered two build tools, Makefile and Autotools. Related articles are as follows: “What is Makefile on Linux?” “What knowledge should you know before working with Makefile?” “Practical examples of Makefile” “Compiling with Autotools and Yocto” Previously, I … Read more

stm32-for-vscode: Compile, Debug, and Flash Firmware Directly in VSCode

stm32-for-vscode: Compile, Debug, and Flash Firmware Directly in VSCode

For those writing STM32 code, you must have used STM32CubeMX + CubeIDE, right? However, the IDE can sometimes be sluggish and the configuration can be quite frustrating. Today, I want to recommend a powerful tool: stm32-for-vscode, which allows you to compile, debug, and flash firmware directly in VSCode. It is lightweight and efficient, making it … Read more

FreeRTOS Makefile Explanation

FreeRTOS Makefile Explanation

Explanation of the Makefile content for the FreeRTOS demo project on Ubuntu: 1. Tool Definition Section PREFIX = arm-none-eabi- CC = $(PREFIX)gcc CXX = $(PREFIX)g++ AS = $(PREFIX)gcc -x assembler-with-cpp LD = $(PREFIX)g++ OBJCOPY = $(PREFIX)objcopy OBJDUMP = $(PREFIX)objdump SIZE = $(PREFIX)size GDB = $(PREFIX)gdb Defines the prefix for the cross-compilation toolchain and various tools … Read more

Essential Kernel Course for BSP Engineers: 2.5. Inter-Module Dependency Issues and the Principle of EXPORT_SYMBOL

Essential Kernel Course for BSP Engineers: 2.5. Inter-Module Dependency Issues and the Principle of EXPORT_SYMBOL

Adhering to high-quality original content, rejecting content piling, if you like it, click the star above to receive updates promptly, thank you for your attention! We previously learned how to compile and run kernel modules, but in reality, many driver modules are quite complex. Most driver modules consist of multiple files, and there are dependencies … Read more

Makefile: Why Modifying Only the .h Header File Doesn’t Work During Compilation?

Makefile: Why Modifying Only the .h Header File Doesn't Work During Compilation?

Have you ever encountered a situation like this: A .c file includes another .h header file, using a Makefile to build (compile) the application. The first time you compile and execute, everything works fine! However, if you modify the .h header file and try to compile again, issues arise: The expected execution flow is: make … Read more

Essential Tools for Embedded Development: A Step-by-Step Guide to Mastering Makefile

Essential Tools for Embedded Development: A Step-by-Step Guide to Mastering Makefile

Hello everyone, welcome to <span>LiXin Embedded</span>. In the development era, tasks like code compilation, linking, and cleaning can be quite tedious. Makefile acts like a project manager, helping you automate these cumbersome tasks. Many people may find Makefile a bit mysterious when they first encounter it, but it is not complicated. Today, we will take … Read more

Makefile Basics + Practical Application: A One-Stop Guide to Automated Builds

Makefile Basics + Practical Application: A One-Stop Guide to Automated Builds

In a makefile, we can generate specified target files from our source code based on a series of rules defined in the makefile. This helps us automate various operations such as compiling and packaging programs. 1 Basic Principles of Makefile: Any version of the shell will include the make command. When we execute the make … Read more