Essential Guide for CMake Beginners to Master Build Skills

Essential Guide for CMake Beginners to Master Build Skills

Linux | Red Hat Certified | IT Technology | Operations Engineer 👇1000 people technical communication QQ group, note 【Official Account】 for faster approval 1. CMake Installation 1. Download the CMake installation package from the official website, I downloaded v3.26 wget https://github.com/Kitware/CMake/releases/download/v3.26.0-rc4/cmake-3.26.0-rc4-linux-x86_64.sh 2. Locate the downloaded .sh file and execute the script using bash bash cmake-3.26.0-rc4-linux-x86_64.sh … Read more

Basic Framework of Linux Kernel Modules

The writing of Linux kernel modules intimidates many people, but it is actually not that difficult or complicated. Here’s a basic framework to help those with a little knowledge get started quickly. 1. Basic Framework (Before Kernel 2.3.13) #include<linux/kernel.h> #include<linux/module.h> int init_module(void){ pr_info("hello module.\n"); return 0; } void cleanup_module(void){ pr_info("hello end.\n"); } MODULE_LICENSE("GPL"); #include<linux/module.h> int … Read more

CMake Tutorial: Building and Managing Projects

CMake Tutorial: Building and Managing Projects

Click the above“Mechanical and Electronic Engineering Technology” to follow us CMake is a free, cross-platform build tool designed for building, testing, and packaging software. CMake is used to control the compilation process of software using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used with your chosen … Read more

Efficiently Manage Linux Projects with Makefile

Efficiently Manage Linux Projects with Makefile

Linux | Red Hat Certified | IT Technology | Operations Engineer 👇 Join the technical exchange QQ group of 1000 people, note “public account” for faster approval Basic Structure A simple Makefile usually includes the following parts: Variable Definitions: You can define compilers, compilation options, source files, etc. Rules: Specify how to build targets. The … Read more

Essential Makefile Guide: Step-by-Step Project Compilation!

Linux | Red Hat Certified | IT Technology | Operations Engineer 👇1000 people technical exchange QQ group, note 【public number】 for faster access 1. Basic Structure of Makefile The Makefile contains a series of “rules”, with the basic structure of each rule as follows: target…: prerequisites… <tab> command Target(target): usually the name of the file … Read more

Linux System Programming: Creating and Using Static Libraries

Click the above“Mechanical and Electronic Engineering Technology” to follow us In Linux system programming, a Static Library is a compiled code library that contains a collection of multiple compilation units (such as functions and data) that can be shared by multiple programs. Static libraries typically have the file extension .a. Creating a Static Library Compile … Read more

Linux System Programming: Creating and Using Dynamic Libraries

Click the above“Mechanical and Electronic Engineering Technology” to follow us In Linux system programming, a dynamic library (Dynamic Library) is also known as a shared library (Shared Library), which is a library that is loaded only when the program runs. Dynamic libraries can be shared by multiple programs, saving memory and disk space, and making … Read more

Understanding the Differences Between Clang and GCC

The main differences between Clang and GCC are as follows: Clang compiles faster than GCC, including time for preprocessing, syntax analysis, parsing, semantic analysis, and abstract syntax tree generation. Clang uses less memory than GCC. The intermediate products generated by Clang are smaller than those generated by GCC. Clang provides more user-friendly error messages than … Read more

Debugging Information with DEBUG Print in IAR

Debugging Information with DEBUG Print in IAR

#include “stdafx.h” #include<stdio.h> #include<stdlib.h> #include<string.h> // Whether to enable DEBUG mode //#define _DEBUG_ 0 // Not enabled #define _DEBUG_ 1 // Enabled #if _DEBUG_ #define PRINTF(…) printf(__VA_ARGS__) #else #define PRINTF(…) #endif int main() { int a, b, c; b = 1; c = 2; a = b + c; PRINTF(“a = %d\n”, a); getchar(); return … Read more

Avoiding Overflow Errors in Keil C51 Large Integer Constants

Avoiding Overflow Errors in Keil C51 Large Integer Constants

The default integer constant operations in the C51 compiler may lead to overflow errors. To avoid potential calculation errors, the data type of large integers should be specified. Keil C51 is a compiler compatible with ANSI C. The ANSI C standard specifies that the default data types for decimal integer constants are one of int, … Read more