Five Important Considerations for Microcontroller Embedded Programming

Five Important Considerations for Microcontroller Embedded Programming

In the process of microcontroller programming, if a designer can master multiple programming languages simultaneously, then that designer is undoubtedly a very talented individual. However, mastering assembly, C, and C++ at the same time is quite challenging, and many beginners struggle significantly while learning even one of these languages. This article specifically compiles insights from … Read more

Using TCMSRAM Memory in GD32 Microcontroller

Using TCMSRAM Memory in GD32 Microcontroller

1. Introduction to GD32 Microcontroller Taking GD32F450ZKT6 as an example The GD32F450ZKT6 on-chip RAM is divided into two parts: 192K + 64K = 256K 2. Introduction to memheap Management Algorithm <span>The memheap management algorithm</span> is suitable for systems with multiple addressablenon-contiguous memory heaps. Using memheap memory management simplifies the usage when multiple memory heaps exist … Read more

C Language Issues in Embedded Development

C Language Issues in Embedded Development

Declare a constant using the preprocessor directive #define to indicate how many seconds are in a year (ignoring leap years): #define SECONDS_PER_YEAR (60 * 60 * 24 * 365)UL Write a standard macro MIN that takes two parameters and returns the smaller one: #define MIN(A,B) ((A) <= (B) ? (A):(B)) What is the purpose of … Read more

In-Depth Analysis of VxWorks Memory Management

In-Depth Analysis of VxWorks Memory Management

Efficient memory management is the cornerstone of Real-Time Operating Systems (RTOS). In the embedded field, applications often have extremely high requirements for performance, reliability, and determinism. VxWorks, as the world’s leading commercial RTOS, has played a significant role in critical areas such as aerospace, automotive electronics, industrial automation, and medical devices since its inception. Compared … Read more

Understanding the Destruction Order of Static Objects in C++

Understanding the Destruction Order of Static Objects in C++

In the vast world of C++ programming, the static keyword acts as a low-key yet crucial behind-the-scenes hero, widely used in variables, functions, and class members, playing an indispensable role. From modifying local variables to retain their state, to limiting the scope of functions, and to achieving shared class members, the presence of static is … Read more

C++ Monthly Highlights – Issue 11

C++ Monthly Highlights - Issue 11

This month’s C++ topic overview! (2025-08) 1. Structured Binding Variables Do Not Trigger NRVO #include <iostream>#include <tuple>#include <utility> struct T { T() = default; T(const T&) { std::cout << "Copy constructor called\n"; } T(T&&) noexcept { std::cout << "Move constructor called\n"; }}; std::pair<int, T> foo() { return {std::piecewise_construct, std::forward_as_tuple(42), std::forward_as_tuple()};} T func() { auto [x, … Read more

Comprehensive Guide to C++ Memory Management: From Alignment to Leak Prevention

Comprehensive Guide to C++ Memory Management: From Alignment to Leak Prevention

1.1. Memory Alignment: Hidden Costs of Structures Principle Revealed The compiler inserts padding bytes between structure members to improve access efficiency. For example: cpp struct Data { char c; // 1 byte int i; // 4 bytes → Actual usage4 bytes (including3 bytes padding) }; Actual layout:[c][pad][pad][pad][i], total size8 bytes. Optimization Techniques · Use#pragma pack(1) … Read more

C++ Interview Weekly (7): Implementation Principles of unique_ptr and shared_ptr

C++ Interview Weekly (7): Implementation Principles of unique_ptr and shared_ptr

In C++, manual resource management (<span>new/delete</span>) is prone to errors, leading to: •Memory leaks•Double free•Exception safety issues To address these problems, C++11 introduced smart pointers: •<span>std::unique_ptr</span>: Exclusive ownership•<span>std::shared_ptr</span>: Shared ownership, managed through reference counting We will analyze from three dimensions: principles, performance, and application scenarios. 1. Technical Background and Design Intent 1unique_ptr• Goal: Exclusive resource … Read more

Discussing C Programming – Caution with Pointer Function Returns

Discussing C Programming - Caution with Pointer Function Returns

In C language, the return value of pointer functions must be handled with caution. Here are the key considerations: ‌1. Valid Return Types‌ Pointer functions should return a pointer that matches the declared type (such as <span>int*</span>, <span>char*</span>, etc.), and the memory pointed to must be valid: int* func_returning_int_ptr() { /* … */ } char* … Read more

Tencent Engineer Submits Patch to Linux Kernel Introducing Swap Table Architecture

Tencent Engineer Submits Patch to Linux Kernel Introducing Swap Table Architecture

Source: Reprinted with permission from OSC Open Source Community (ID: oschina2013) Recently, Tencent engineer Kairui Song submitted a new patch to the Linux kernel mailing list, proposing the introduction of a new architecture called Swap Table, which integrates swap cache, swap mapping, and swap allocator into a new backend infrastructure. According to reports, the latest … Read more