A method for optimizing the starting time of a real-time operating system based on DSP

By generating a global variable table and allocating independent memory space in the DSP compiler, and optimizing the global variable initialization process, the problem of prolonged startup time caused by multi-functionality and multi-tasking in embedded real-time signal processing systems is solved, thereby shortening the system startup time and improving real-time performance.

CN116107644BActive Publication Date: 2026-03-31CSIC WUHAN LINCOM ELECTRONICS
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-08
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Embedded real-time signal processing systems experience longer startup times due to multi-functional and multi-tasking requirements, especially because the assignment operation of globally uninitialized arrays during the operating system startup phase consumes a significant amount of time.

Method used

The DSP compiler generates global variable tables __TI_cinit_table and __TI_handler_table, allocates independent memory space to store global uninitialized variables, skips the assignment operations of these variables during the operating system startup phase, and uses the __TI_zero_init function to clear uninitialized variables, thus optimizing the global variable initialization process.

Benefits of technology

It shortens the startup time of embedded real-time signal processing systems, solves the problem of prolonged system startup time caused by multi-functional and multi-tasking requirements, and improves the real-time performance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116107644B_ABST
    Figure CN116107644B_ABST
Patent Text Reader

Abstract

The application discloses a real-time operating system starting time optimization method based on DSP, which comprises the following steps: dividing independent memory space, dividing an independent memory space in a compiling link script, and storing global uninitialized variables; specifying the position of the global uninitialized variables, storing the global uninitialized variables into the same data segment through pre-compilation; and optimizing the system starting flow, filtering out the global uninitialized variables defined in the application layer code in the system starting process, and skipping initialization. The application has the beneficial effects that the system starting flow is optimized, the global uninitialized data groups in the application layer code are filtered out, and the assignment operation on the data groups is skipped, so that the starting time is shortened, and the problem that the system starting time is prolonged due to the increasing application software caused by the demand for multi-function and multi-task of the embedded real-time signal processing system based on DSP is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for optimizing DSP startup time, specifically a method for optimizing the startup time of a real-time operating system based on DSP, belonging to the field of DSP startup time optimization technology. Background Technology

[0002] With the increasing demand for diversified modern real-time embedded applications, the multi-functionality, multi-tasking, and integrated nature of embedded products have become an inevitable trend in the future development of embedded systems.

[0003] For embedded real-time signal processing products, achieving multi-functionality and multi-tasking means implementing more complex software functions, larger software size, and dependence on real-time operating systems. This will inevitably affect the system startup time. However, for applications such as high-speed signal processing with extremely high real-time requirements, system startup time is a critical indicator that cannot be affected in the slightest.

[0004] There are two main factors that contribute to longer system startup times due to increased application software code:

[0005] First, the increase in code leads to a larger binary file generated by compilation, which increases the amount of data moved during the boot phase and affects startup time. However, in practice, the increase in binary file size due to code increase is on the order of kilobytes, and this order of magnitude has a negligible impact on the boot phase.

[0006] Secondly, a large number of uninitialized global arrays were added to the application code. These arrays are usually hundreds of MB in size. The operating system takes a lot of time to assign values ​​to these arrays during the startup phase (usually by clearing these arrays to zero). Summary of the Invention

[0007] The purpose of this invention is to provide a DSP-based real-time operating system startup time optimization method to solve at least one of the above-mentioned technical problems. This method can optimize the operating system startup process, filter out globally uninitialized data groups in the application layer code, and skip the assignment operations of these arrays, thereby shortening the startup time.

[0008] The present invention achieves the above objective through the following technical solution: a method for optimizing the startup time of a real-time operating system based on DSP, including a DSP compiler, wherein the DSP compiler automatically generates two global variable tables during the compilation process, namely __TI_cinit_table and __TI_handler_table;

[0009] Among them, __TI_cinit_table is used for the load address and run address of all data segments, while __TI_handler_table is used to store the address of the data parsing function;

[0010] The optimization method includes the following steps:

[0011] S1) In the compilation and linking script of the DSP compiler, an independent memory space is allocated, and a dedicated data segment for the application layer code is added to point to this space to store global uninitialized variables;

[0012] S2) Use the #pragma DATA_SECTION preprocessor directive in the application layer code to store all global uninitialized variables in a dedicated data segment;

[0013] S3) Modify the global variable initialization process during the operating system startup phase, filter out uninitialized global variables defined in the application layer code, and skip the assignment operations on these variables.

[0014] As a further aspect of the present invention: the specific process of allocating an independent memory space in S1) includes:

[0015] ① Add a memory definition to the MEMORY field of the compiler / linker script, specifying the starting address and size;

[0016] ② The specified starting address should not conflict with the memory already in use, and the memory size should meet the total size of the application layer's global uninitialized variables.

[0017] As a further aspect of the present invention: In S1), the compilation and linking script of the DSP compiler describes the division of the static memory of the entire system, including the definition of each data segment, such as commonly used data segments such as .text segment, .data segment, and .bss segment, as well as some data segments dedicated to the application layer, such as .l2sram, .msmc, and .ddr3. These data segments correspond to different memory ranges such as on-chip L2 SRAM, on-chip shared memory MSM, and off-chip extended memory DDR3.

[0018] As a further aspect of the present invention: in S3), the global variable initialization process specifically includes:

[0019] ① Obtain the load address and runtime address from __TI_cinit_table;

[0020] ② Obtain the parsing function from __TI_handler_table based on the load address;

[0021] ③ Call the corresponding parsing function to parse the global variable data from the load address to the runtime address.

[0022] As a further aspect of the present invention: the analytical functions include three types.

[0023] __TI_zero_init, __TI_decompress_rle24, and __TI_decompress_none represent: initialization to zero, RLE-encoded decompression, and unencoded decompression, respectively. The first type is used to clear uninitialized global variables, while the latter two types are used to assign values ​​to initialized global variables.

[0024] As a further aspect of the present invention: the specific process of filtering out uninitialized global variables defined in the application layer code in step S3) includes:

[0025] Determine whether the address of the global variable belongs to the independent memory space described in S1), and whether the data parsing function corresponding to the global variable is __TI_zero_init.

[0026] The beneficial effects of this invention are: This invention optimizes the operating system startup process, filters out globally uninitialized data groups in the application layer code, and skips the assignment operations of these arrays, thereby shortening the startup time and solving the problem that the startup time of DSP-based embedded real-time signal processing systems increases due to the increasing number of application software required for multiple functions and tasks. Attached Figure Description

[0027] Figure 1 This is a schematic diagram of the unoptimized process of the operating system of this invention;

[0028] Figure 2 This is a schematic diagram of the application layer code compilation process of the present invention;

[0029] Figure 3 This is a schematic diagram of the optimized operating system of the present invention. Detailed Implementation

[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0031] Example 1

[0032] A method for optimizing the startup time of a DSP-based real-time operating system includes a DSP compiler, which automatically generates two global variable tables during the compilation process, namely __TI_cinit_table and __TI_handler_table.

[0033] Among them, __TI_cinit_table is used for the load address and run address of all data segments, while __TI_handler_table is used to store the address of the data parsing function;

[0034] The optimization method includes the following steps:

[0035] First: Allocate an independent memory space in the DSP compiler's compilation and linking script, and add a dedicated data segment for the application layer code pointing to this space to store global uninitialized variables.

[0036] The specific process of allocating an independent memory space includes: 1) adding a memory definition to the MEMORY field of the compilation and linking script, and specifying the starting address and size; 2) the specified starting address should not conflict with the memory already in use, and the memory size should meet the total size of the application layer's global uninitialized variables.

[0037] The compilation and linking script of the DSP compiler describes the division of the static memory of the entire system, including the definition of various data segments, such as commonly used data segments such as .text segment, .data segment, and .bss segment, as well as some data segments dedicated to the application layer, such as .l2sram, .msmc, and .ddr3. These data segments correspond to different memory ranges such as on-chip L2 SRAM, on-chip shared memory MSM, and off-chip extended memory DDR3.

[0038] Second: Use the #pragma DATA_SECTION preprocessor directive in the application layer code to store all global uninitialized variables in a dedicated data segment.

[0039] Third: Modify the global variable initialization process during the operating system startup phase to filter out uninitialized global variables defined in the application layer code and skip the assignment operations on these variables.

[0040] The global variable initialization process specifically includes: 1) obtaining the load address and runtime address from __TI_cinit_table; 2) obtaining the parsing function from __TI_handler_table based on the load address; 3) calling the corresponding parsing function to parse the global variable data from the load address to the runtime address.

[0041] The parsing functions include three types: __TI_zero_init, __TI_decompress_rle24, and __TI_decompress_none, which mean: initialization and clearing, RLE encoding format decompression, and no encoding decompression, respectively. The first type is used to clear uninitialized global variables, and the latter two types are used to assign values ​​to initialized global variables.

[0042] The specific process of filtering out uninitialized global variables defined in the application layer code includes: determining whether the address of the global variable belongs to the independent memory space described in S1), and whether the data parsing function corresponding to the global variable is __TI_zero_init.

[0043] Example 2

[0044] like Figures 1 to 3 As shown, a method for optimizing the startup time of a DSP-based real-time operating system is presented. The startup of the embedded real-time operating system can be divided into three stages:

[0045] ① C runtime environment setup, global variable initialization, and kernel runtime environment configuration;

[0046] ② Recording the execution time of these three stages reveals that the global variable initialization stage takes the longest.

[0047] ③ Optimize the global variable initialization process to shorten system startup time.

[0048] The global variable initialization process is explained further below.

[0049] During the compilation process, the DSP compiler automatically generates two global variable tables: __TI_cinit_table and __TI_handler_table. __TI_cinit_table is used for the load and run addresses of all data segments, while __TI_handler_table is used to store the addresses of data parsing functions.

[0050] The data parsing functions fall into three categories: __TI_zero_init, __TI_decompress_rle24, and __TI_decompress_none, which respectively represent: initialization and zeroing, RLE-encoded decompression, and unencoded decompression. The first category is used to zero out uninitialized global variables, while the latter two are used to assign values ​​to initialized global variables.

[0051] like Figure 1As shown, during the operating system startup phase, global variables are initialized by parsing `__TI_cinit_table` and `__TI_handler_table`. According to this process, we could optimize system startup time by simply skipping the execution of the data parsing function `__TI_zero_init`. However, this approach has two problems: First, the operating system kernel also defines some uninitialized global variables, which are initialized to 0 by default. If the `__TI_zero_init` function is not executed, the initial values ​​of these variables will be random numbers, potentially causing the operating system to crash. Second, the DSP compiler has a special mechanism: if a data segment contains both initialized and uninitialized global variables, all variables in that data segment will be parsed using the `__TI_decompress_xxx` function, thus failing to achieve the desired optimization effect.

[0052] The solutions to the two problems mentioned above are explained below:

[0053] like Figure 2 As shown, the DSP system software development adopts a static library-based approach. The application layer code implements corresponding functions by calling API functions provided by the operating system's static libraries and signal processing function libraries. During compilation, the application layer code is first compiled into a .obj file, and then linked together with the static libraries and linker script files to generate the final executable file.

[0054] like Figure 3As shown, the linker script mainly describes the division of the entire system's static memory, including the definition of various data segments, such as commonly used data segments like .text, .data, and .bss, as well as some data segments specifically for the application layer, such as .l2sram, .msmc, and .ddr3. These data segments correspond to different memory ranges, such as on-chip L2 SRAM, on-chip shared memory MSM, and off-chip extended memory DDR3. In embedded software development, to improve system real-time performance and minimize dynamic memory usage, static global arrays are frequently used. Static global variables occupy operating system memory by default, but this storage space has limited capacity. Therefore, a dedicated data segment is added. The specific process is as follows: A memory definition is added to the MEMORY field of the compilation and linking script, specifying the starting address and size. The specified starting address should not conflict with already used memory, and the memory size should meet the total size of uninitialized global variables in the application layer. A dedicated data segment for the application layer code points to this space. Then, in the application layer code, these global static arrays are defined in the specified memory space using the compilation directive `#pragma DATA_SECTION(xxx, ".ddr3")`. This means that all or large uninitialized global variables in the application layer code are defined in the same data segment (in this case, the .ddr3 data segment). The global variable initialization process is modified: if the run address of a global variable belongs to the .ddr3 data segment and the data parsing function is `__TI_zero_init`, the parsing function is skipped. This avoids affecting other uninitialized global variables and achieves optimization.

[0055] Working principle: The optimization method used is to optimize the operating system startup process, filter out the globally uninitialized data groups in the application layer code, and skip the assignment operations of these arrays, thereby shortening the startup time.

[0056] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

[0057] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

Claims

1. A method for optimizing the startup time of a DSP-based real-time operating system, characterized in that: The DSP compiler automatically generates two global variable tables, __TI_cinit_table and __TI_handler_table, during the compiling process; The __TI_cinit_table is used for the load address and run address of all data segments, and the __TI_handler_table is used for storing the address of the data analysis function; The real-time operating system startup time optimization method comprises the following steps: S1) Dividing an independent memory space in the compiling link script of the DSP compiler, and adding a data segment dedicated to the application layer code to point to the space, for storing global uninitialized variables; S2) Using the #pragma DATA_SECTION pre-compiler instruction in the application layer code to store all global uninitialized variables in the dedicated data segment; S3) Modifying the global variable initialization process in the operating system startup stage, filtering out the global uninitialized variables defined in the application layer code, and skipping the assignment operation on these variables; The global variable initialization process in S3) comprises: S31) Obtaining the load address and run address from the __TI_cinit_table; S32) Obtaining the analysis function from the __TI_handler_table according to the load address; S33) Calling the corresponding analysis function to parse the global variable data from the load address to the run address; In S3), the filtering of the global uninitialized variables defined in the application layer code comprises: Judging whether the address of the global variable belongs to the independent memory space described in S1), and whether the data analysis function corresponding to the global variable is __TI_zero_init.

2. The real-time operating system boot time optimization method of claim 1, wherein: In S1), the specific process of dividing an independent memory space comprises: S11) Adding a memory definition in the MEMORY field of the compiling link script, and specifying the start address and size; S12) The specified start address should not conflict with the used memory, and the memory size should meet the total size of the global uninitialized variables of the application layer.

3. The real-time operating system boot time optimization method of claim 1, wherein: In S1), the compiling link script of the DSP compiler describes the division of the entire system static memory, including the definition of each data segment and the data segment dedicated to the application layer, and the data segment corresponds to different memory intervals on-chip L2 SRAM, on-chip shared memory MSM, and off-chip extended memory DDR3.

4. The real-time operating system boot time optimization method of claim 1, wherein, The analysis function includes three types: __TI_zero_init, zero initialization, used for implementing zero initialization of uninitialized global variables __TI_decompress_rle24, RLE encoding format decompression, used for implementing assignment of initialized global variables; And __TI_decompress_none, no encoding decompression, used for implementing assignment of initialized global variables.

Citation Information

Patent Citations

  • A method for detecting uninitialized variables and terminal equipment

    CN109902001A

  • A method for realizing residence of a real-time operating system under an embedded architecture

    CN112416443A