Understanding HPM_SDK Development: Advantages and Differences

Understanding HPM_SDK Development: Advantages and Differences

1. Background Recently, during discussions with some developers or feedback in developer groups, it has been noted that the development approach for the HPM microcontroller is different from traditional microcontroller development methods. Some developers feel lost due to not being familiar with this approach, while others believe their apps heavily rely on hpm_sdk. Based on … Read more

A Beginner’s Guide to CMake: The Universal Build Tool

A Beginner's Guide to CMake: The Universal Build Tool

1. What is CMake? In short, CMake is a top-notch build configuration tool, renowned for its expertise in automatically generating Makefiles. When multiple developers collaborate on large projects, especially in complex environments that span various languages such as C/C++/Java or compilers, it acts like a conductor, orderly guiding the compilation process until it elegantly produces … Read more

Calling C Functions from C++ Code

Calling C Functions from C++ Code

1. Introduction Recently, I used C++ code to call functions from C code, and I would like to document the process. 2. Code 1. Include Header Files The content of the include/add.h header file is as follows: #ifndef __ADD_HPP__ #define __ADD_HPP__ #include <stdio.h> #include <stdlib.h> int function_add(int a, int b); #endif The content of the … Read more

Read the Code | Simplifying Library Imports with CMake Configuration Files

Read the Code | Simplifying Library Imports with CMake Configuration Files

Read the Code | Simplifying Library Imports with CMake Configuration Files 0. Introduction When writing CMake for our library, we ensure it compiles correctly. However, users of the library need to write some CMake code to find the included header files, shared/static libraries, and executables. This can be a cumbersome task for library users. As … Read more

CMake Black Technology: Unifying Windows/Linux/Mac Development Environments with a Single Script

CMake Black Technology: Unifying Windows/Linux/Mac Development Environments with a Single Script

In cross-platform development, developers are often hindered by build scripts: Linux uses <span>Makefile</span>, Windows requires Visual Studio solutions, and macOS needs to accommodate Xcode. If the project team includes both Windows developers and those accustomed to Linux, the environmental differences can be quite troublesome. The value of CMake lies in its ability to generate project … Read more

Compiling C++ Programs with CMake on Linux

Compiling C++ Programs with CMake on Linux

Compiling C++ Programs with CMake on Linux 1. Compiling a Single .cpp File with g++ Use g++/gcc to compile a .cpp file and generate an executable file named .out g++ main.cpp 1. Create the file main.cpp #include <iostream>using namespace std; int main(){ cout<<"hello world"<<endl; return 0;} 2. Compile the file to generate the executable file … Read more

Compiling OpenCV with MinGW-GCC and Developing in VSCode on Windows

Compiling OpenCV with MinGW-GCC and Developing in VSCode on Windows

0. Introduction OpenCV (Open Source Computer Vision Library: http://opencv.org) is an open-source library that contains hundreds of computer vision algorithms. It is essentially a C++ API, rather than the C-based OpenCV 1.x API (the C API has been deprecated since the release of OpenCV 2.4 and has not been tested with C compilers). Since OpenCV’s … Read more

CMake User Guide (Part 1): Common Techniques and Compilation Summary

CMake User Guide (Part 1): Common Techniques and Compilation Summary

In C/C++ projects, CMake has become the industry standard for build systems, and cross-compilation is a hurdle that every embedded developer will encounter. Simply put, it involves setting up a code compilation environment for Arm boards to run code on Arm devices. The commonly used compilation tools are Makefile and CMake, and this article records … Read more

C++ Project Build Part Eight: CMake Code Directory

C++ Project Build Part Eight: CMake Code Directory

Last time, in C++ Project Build Part Seven: Creating a Library with CMake, all the source code of the modules (libraries and executables) in the example demo7 was in one directory, which made the structure very unclear (if there are hundreds of source files, it would be a nightmare). Below, we will look at an … Read more

CMake User Guide (Part II): Operations and Basic Usage with Multiple Source Files

CMake User Guide (Part II): Operations and Basic Usage with Multiple Source Files

When managing multiple source files in C/C++ projects, CMake has become the industry standard for build systems. This article will analyze the core methods for handling multiple source file operations and common basic usages of CMake statements, documenting how to eliminate the tedious task of manually maintaining compilation lists. 1. Project Structure When there are … Read more