An RTOS task hook type adaptation method based on a compile-time static trampoline function table
CN122431993BActive Publication Date: 2026-08-28HUNAN BOJIANG INFORMATION TECHNOLOGY CO LTD
Patent Information
- Application Number
- CN202610917211.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-24
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2046-06-24
AI Technical Summary
Technical Problem
现有 RTOS 要么仅提供部分钩子类型,例如 RT-Thread 仅支持任务调度切换钩子,缺失任务创建和删除钩子;要么钩子功能定位于异常诊断而非完整的生命周期监控,例如 LiteOS-M 的异常钩子模块,未能够同时覆盖任务创建、删除、切换三类核心生命周期事件,无法满足应用层对任务全生命周期监控的需求
Benefits of technology
1.该基于编译期静态蹦床函数表的RTOS任务钩子类型适配方法,通过编译期预生成静态蹦床函数,所有代码在编译后固化到只读Flash区域,无需在运行时生成任何代码,从根本上解决了运行时代码生成与MCU硬件特性的矛盾,同时降低了系统复杂度和Flash占用量;且通过双向绑定表建立用户钩子函数与蹦床函数的一一映射关系,注销时仅需通过用户钩子函数指针即可反向定位到对应槽位,无需遍历整个钩子列表,时间复杂度为O(n),消除了传统动态链表方案的实时性损耗,同时避免了资源泄漏和钩子残留问题。
✦ Generated by Eureka AI based on patent content.
Smart Images

Figure CN122431993B_ABST
Abstract
The application discloses an RTOS task hook type adaptation method based on a compiling period static trampoline function table, and comprises the following steps: S1, a compiling period presetting stage; S2, a running period binding stage; S3, a running period calling stage; and S4, a running period canceling stage. According to the application, a static trampoline function is pre-generated in the compiling period, all codes are solidified to a read-only Flash area after being compiled, and any code does not need to be generated in the running time, so that the contradiction between the running time code generation and the MCU hardware characteristics is fundamentally solved, the system complexity and the Flash occupation are reduced, a one-to-one mapping relationship between a user hook function and the trampoline function is established through a bidirectional binding table, and when being canceled, the corresponding slot can be reversely positioned only through the user hook function pointer, the whole hook list does not need to be traversed, the time complexity is O (n), the real-time loss of a traditional dynamic link table scheme is eliminated, and the resource leakage and the hook residual problem are avoided.
Need to check novelty before this filing date? Find Prior Art
Citation Information
Patent Citations
Monomer firmware debugging method based on dynamic repair
CN119537187A
Automatic data calculation method and system based on configuration driving
CN121326441A