# keil_pack_public_mode **Repository Path**: yangzaiwei/keil_pack_public_mode ## Basic Information - **Project Name**: keil_pack_public_mode - **Description**: C语言模组 - **Primary Language**: C - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2020-05-30 - **Last Updated**: 2025-07-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ZiBuYu.public_mode ZiBuYu.public_mode is an internal software package that provides a series of components and functionalities for embedded development. This package is released under the Apache License 2.0. ## Project Description This project contains multiple modules, covering functionalities such as RTT (Real-Time Transfer), CPU architecture support, dynamic table management, linked list operations, and ring buffer management. These modules can be used in embedded systems based on Cortex-M series processors to simplify debugging, communication, and resource management. ## Component List - **RTT (Real-Time Transfer)**: Provides an implementation of SEGGER RTT for real-time communication between the host and the target device. - **CPU Module**: Includes low-level CPU operations such as interrupt control, wait for interrupt, and bit reversal. - **Dynamic Table**: Supports dynamic registration and execution of function tables and timer tables. - **Linked List**: Provides basic operations for singly and doubly linked lists. - **Ring Buffer**: Implements management of ring buffers in both C and C++ versions. - **Container**: Provides object lookup functionality. - **Auto Initialization Module**: Supports automatic initialization and execution of components. - **Stack Trace**: Contains hardware exception handling and stack trace functionality. ## Usage Instructions ### Initialize RTT Before using RTT functionality, call `SEGGER_RTT_Init()` to initialize the RTT control block. ```c SEGGER_RTT_Init(); ``` ### Write to RTT Buffer Use `SEGGER_RTT_Write` or `SEGGER_RTT_WriteString` to write data to the RTT buffer. ```c SEGGER_RTT_Write(0, "Hello, World!", 13); SEGGER_RTT_WriteString(0, "Hello, World!"); ``` ### Read from RTT Buffer Use `SEGGER_RTT_Read` to read data from the RTT buffer. ```c char buffer[128]; unsigned bytesRead = SEGGER_RTT_Read(0, buffer, sizeof(buffer)); ``` ### Dynamic Function Table Registration Use `func_table_register` to register functions into the dynamic function table, and execute registered functions via `func_table_centralized_run` or `func_table_distributed_run`. ```c u8 func_table_register(struct func_dyna_table_def *obj, u8 (*ptr)(void)); void func_table_centralized_run(struct func_dyna_table_def *obj); ``` ### Linked List Operations Provides operations for inserting, removing, and traversing linked lists. ```c void list_insert_after(struct list_node *src, struct list_node *obj); void list_remove_node(struct list_node *obj); ``` ### Ring Buffer Supports data writing, reading, and status queries. ```c void ring_buffer_write_block(struct ring_buffer_def* buf, u8* dat, u16 num); void ring_buffer_read_block(struct ring_buffer_def* buf, u8* dat, u16 num); ``` ## License This project is licensed under the Apache License 2.0. For more details, see the [LICENSE](LICENSE) file. ## Contribution Guidelines To contribute code, please ensure compliance with the Apache License 2.0 and submit a Pull Request that adheres to the project's coding standards. ## Installation Instructions To integrate this package into your project, add the required source and header files using Keil MDK or another supported IDE. ### Configure RTT Configure the lock mechanism and interrupt priority settings in `SEGGER_RTT_Conf.h` according to your target platform. ```c #define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20) ``` ### Example Usage Refer to the `SEGGER_RTT_printf` function in `SEGGER_RTT_printf.c` to learn how to format output strings. ```c SEGGER_RTT_printf(0, "Value: %d\n", value); ``` ## Build and Package Use the `gen_pack.bat` script to generate the software package. ```bash gen_pack.bat ``` ## Sample Projects For specific usage examples, refer to the project configurations provided in `snippets.xml`. ## Supported Platforms This software package is primarily designed for ARM Cortex-M series processors and supports multiple compilers including ARMCC, GCC, and IAR. ## Contact For questions or support, please contact yangzaiwei@163.com. --- **Note:** This README.md file is automatically generated based on the project structure and source code, and is intended to provide developers with a quick start guide. For more detailed information, please refer to the project documentation and source code comments.