Zephyr Kernel Data Structures – Singly Linked List

Zephyr Kernel Data Structures - Singly Linked List

Singly Linked List The Zephyr singly linked list is implemented in the following file: zephyr/include/zephyr/sys/slist.h. Zephyr stores singly linked list data in sys_slist_t (i.e., each list element stores a pointer to the next element, rather than the data of the previous element). /** @cond INTERNAL_HIDDEN */ struct _slist { sys_snode_t *head; sys_snode_t *tail; }; /** … Read more

Zephyr Kernel Data Structure – MPSC

Zephyr Kernel Data Structure - MPSC

Overview MPSC_PBUF (Multi Producer Single Consumer Packet Buffer) is a circular buffer where data in MPSC_PBUF is managed in packets, and the size of the packets is variable. Users read or store data from MPSC_PBUF in packet units. To reduce data copying in memory, data production is divided into two steps: allocating packet space and … Read more

Zephyr Kernel Data Structures – Red-Black Tree

Zephyr Kernel Data Structures - Red-Black Tree

Overview The search time complexity of a linked list is O(N). As the number of members managed by the linked list increases, the algorithmic cost of searching increases. To address this, Zephyr provides an implementation of a red-black tree, where the time complexity for search and delete operations is O(log2(N)) for a tree of size … Read more

Zephyr Kernel Data Structures – Ring Buffer

Zephyr Kernel Data Structures - Ring Buffer

Overview The ring buffer is one of the commonly used data structures in embedded software development, storing content in a first-in-first-out manner, and is used to implement asynchronous “stream” replication of data. Zephyr provides a struct ring_buf abstraction to manage such data structures. Various drivers in Zephyr (UART, Modem, I2S, etc.), as well as shell, … Read more

Embedded Weekly Report #275: Security-Critical C Code Rules

Embedded Weekly Report #275: Security-Critical C Code Rules

Note: 1. Thank you all for your attention, continuing to summarize last week’s wonderful content. 2. Last week, a video was shared: BSP Video Tutorial Episode 21: Easily Achieve Variable Length Serial Port DMA Send/Receive with One Click, Supporting Bare Metal and RTOS, Including Two Approaches: MDK and IAR, More Convenient Than CubeMX 0 Weekly … Read more

Modbus TCP Programming and Experimentation

Modbus TCP Programming and Experimentation

11.7 Modbus TCP Programming and Experimentation This course does not support sensors that use the Modbus TCP protocol, so we will write two programs: ① modbus_server_tcp.c: Simulate a Modbus TCP sensor ② modbus_client_tcp.c: Operate the sensor The program structure is shown in the figure below: No special connections are required on the hardware. The source … Read more

Understanding the Debugging Tool – GDB

Understanding the Debugging Tool - GDB

Advertising Time Click the card below and give us a follow before you go! 1. Introduction to GDB GDB (GNU Debugger) is a powerful open-source debugging tool that helps developers debug programs written in languages such as C/C++. Mastering the basic usage of GDB is very beneficial for both beginners and experienced programmers. This article … Read more

How Makefile Compiles Code Files

How Makefile Compiles Code Files

This article summarizes: This article mainly introduces the process of using Makefile to compile code into executable binary files for microcontrollers and discusses commonly used Makefile syntax. It narrates the transformation from a straightforward Makefile to a more universal Makefile. Introduction to Makefile The most common function of a Makefile is to inform the make … Read more