A multi-APP implementation method, medium and terminal based on the electric power Hongmeng operating system

By designing location-independent APP compilation, XIPFS file system management and dynamic loading functions on the PHM version of the Power Hongmeng operating system, combined with SVC exception mechanism and MPU isolation, the problem of multi-APP cannot be achieved in the existing technology, and the system stability and APP reliability are improved.

CN119065821BActive Publication Date: 2025-03-25WASION GROUP HLDG
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411579087.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-03-25
Estimated Expiration
2044-11-07

AI Technical Summary

Technical Problem

The existing PHM version of the Power Hongmeng operating system cannot achieve multi-APP, resulting in unstable system operation, which may lead to the collapse of the entire system, limiting its development and application of equipment on the power side.

Method used

The APP code is compiled based on location-independent methods, and the APP is managed through the on-chip file system XIPFS. The dynamic loading function and the XIPFS file system are designed, the APP installation and startup are optimized, and the kernel state and the user state are separated and the address space isolation between the APP are achieved through the SVC exception mechanism and MPU isolation.

Benefits of technology

Multi-APPization has been realized, which improves the stability of system operation, reduces the proportion of flash and ram resources occupied by multi-APPization, ensures that APP exceptions will not cause abnormalities in other APPs and operating system kernels, and can re-pull the abnormal APP, improving the reliability of APP operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065821B_ABST
    Figure CN119065821B_ABST
Patent Text Reader

Abstract

The present invention is applicable to the field of data transmission technology, and relates to a multi-APP implementation method, medium and terminal based on the electric power Hongmeng operating system, including: APP compilation: compile and link the APP code in a position-independent manner, so that it can be started and run at any position, and define the startup information in the header; APP installation: install the APP into the internal Flash, and manage the APP through the on-chip execution file system XIPFS; APP startup: search for APP from the XIPFS file system, parse the APP header, and create the main thread of the APP, apply for and create user-state heap resources from the kernel ram; APP abnormal keep alive: separate the user state and kernel state, create a kernel thread, and detect the running state of the APP, and pull up the kernel thread when the APP is abnormal. The present invention has a simple process and convenient operation, can realize multi-APP, and greatly improves the stability of system operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data transmission, and in particular, relates to a multi-APP implementation method, medium and terminal based on the electric power Hongmeng operating system. Background Art

[0002] The power Hongmeng operating system is divided into five versions for different application scenarios, namely PHM, PHS, PHR, PEE, and PES. The PHM version is mainly used on power terminal devices. The main characteristics of power terminal devices are high stability requirements and limited storage resources. With the introduction of power Hongmeng, the business functions it carries also show a trend of changeability and edge computing, which requires the PHM version to support multiple business APPs and APP upgrade functions. The current PHM version of the power Hongmeng operating system is the kernel of the liteos-m series, which is a lightweight RTOS (real-time operating system). It does not support multiple business APPs. If the APP operation process is abnormal, it may also cause the entire system to crash, which greatly limits the development and application of the PHM version in power terminal devices. The patent application with publication number CN117215671A provides a method, device and medium for dynamic loading of MCU application programs. The method includes: building a dynamic loading feature of the App program and generating an App binary file; dynamically loading the App binary file through the kernel host program and executing the App program; the App program calls the kernel host service function to complete the dynamic loading of the App program. This patent application is also unable to achieve multi-APP and has the same drawbacks as the prior art.

[0003] Therefore, how to provide a method that can realize multi-APP to improve the stability of system operation is an urgent problem to be solved by personnel in this technical field. Summary of the invention

[0004] In view of the shortcomings of the prior art, the purpose of the present invention is to provide a multi-APP implementation method based on the electric power Hongmeng operating system, so as to solve the problem in the prior art that the electric power Hongmeng operating system cannot realize multi-APP, resulting in unstable system operation; in addition, the present invention also provides a multi-APP implementation medium and terminal based on the electric power Hongmeng operating system.

[0005] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0006] The present invention provides a multi-APP implementation method based on the power Hongmeng operating system, comprising the following steps:

[0007] S10, APP compilation: compile and link the APP code in a position-independent manner so that it can be started and run at any location, and define the startup information in the header;

[0008] S20, APP installation: The APP is installed into the internal Flash and managed through the on-chip execution file system XIPFS;

[0009] The step S20 includes the first writing of the APP into the on-chip execution file system XIPFS, APP update and APP deletion; wherein the specific steps of the first writing of the APP into the on-chip execution file system XIPFS are as follows:

[0010] S211, first erase the unwritten data on the internal FLASH with a block size of 4KB;

[0011] S212. When an APP is written into XIPFS, the APP size is rounded up with the erase block size to obtain the domain space size zone_size, and the entire domain space is managed by the domain management block, which occupies a part of the domain space;

[0012] S213. Apply for an APP management block in the domain space, marked as write, write the actual data of the APP into the APP management block, and fill in the APP length information in the APP management block;

[0013] S214, when a new APP needs to be written, if the remaining space in the domain meets the needs of the APP, repeat step S213; if the remaining space in the domain does not meet the needs of the APP, repeat steps S212 to S213;

[0014] S30, APP startup: Search for APP from the XIPFS file system, parse the APP header, create the main thread of the APP, apply for and create user-mode heap resources from the kernel RAM;

[0015] Furthermore, the specific steps of step S30 are as follows:

[0016] S301, find APP from the XIPFS file system;

[0017] S302, obtain the APP header information through compilation, and calculate the RAM required size ram_size of the APP;

[0018] S303, create the main thread of the APP, and apply for a heap space ram_zone of ram_size size from the operating system kernel as a data segment copy and a stack application for the internal thread, define the entry function of the main thread as a dynamic loading function, copy the data segment content from the flash to ram_zone, clear the bss segment, and relocate the reference to the absolute address;

[0019] S304, in the main thread function, apply for a memory space from ram_zone as the heap memory management of the user state, and use TLSF as the memory management algorithm;

[0020] S305, overload the definitions of malloc and free functions to enable them to obtain resources from the user state heap memory, thereby isolating the heap memory space between APPs and between APPs and the kernel;

[0021] S40, APP abnormality keep alive: separate the user state and kernel state, create a kernel thread, and detect the running status of the APP. When the APP is abnormal, pull up the kernel thread.

[0022] Furthermore, in step S10, the APP format includes an APP header and an APP payload, the APP header includes magic, name, data_size, heap_size, stack_size, stack_size_main and pri_main, and the APP payload is the actual content of the APP.

[0023] Furthermore, the magic is a magic number used to quickly determine whether the image file is an APP; the name is the name of the APP; the data_size is the size of the APP data segment; the heap_size is the size of the heap space reserved for the APP; the stack_size is the size of the stack space reserved for the APP; the stack_size_main is the size used by the main thread of the APP, and its space is allocated from the stack_size; the pri_main is the thread priority corresponding to the main thread of the APP; the sum of the data_size, heap_size and stack_size is the RAM size used by the APP; the actual content of the APP is the APP code actually running.

[0024] Further, the specific steps for APP update are as follows:

[0025] S221, the on-chip execution file system XIPFS has installed APP;

[0026] S222. When the APP is repeatedly installed, if the APP has been installed, the APP management is set to delete, and a new domain is applied to complete the installation of the APP;

[0027] S223. When the APP is installed again, if the APP has been installed, the APP management is set to delete. If there is still a domain for deleting the APP and the size meets the requirement, the entire domain is directly formatted to complete the installation of the APP, that is, no new domain is applied for.

[0028] Furthermore, the specific steps for deleting the APP are as follows:

[0029] S231, the on-chip execution file system XIPFS has installed APP;

[0030] S232. Only change the flag of the corresponding APP to delete, without deleting the actual data.

[0031] Furthermore, the specific steps of step S40 are as follows:

[0032] S401, initialization stage, implement APP access control to kernel resources through SVC exception mechanism;

[0033] S402, initialization stage, the code segment, data segment and stack space between APPs are isolated through MPU;

[0034] S403, initialization stage, creating a kernel thread, detecting the running status of the APP, and re-starting the kernel thread if the APP has not been running for a certain period of time;

[0035] S404, during the running phase, when the APP illegally accesses the address space of other APPs or the kernel address space during running, it will trigger its own hard fault. In the abnormal interruption, the APP system log is printed for problem location;

[0036] S405, during the running phase, the kernel thread detects that the APP stops running and restarts the kernel thread.

[0037] In a second aspect, the present invention further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program implements the above method when executed by a processor.

[0038] In a third aspect, the present invention further provides an electronic terminal, comprising: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal executes the method as described above.

[0039] Compared with the prior art, the multi-APP implementation method, medium and terminal based on the power Hongmeng operating system provided by the present invention have at least the following beneficial effects:

[0040] The current PHM version of the Hongmeng operating system for electric power is the kernel of the liteos-m series, which is a lightweight RTOS (real-time operating system). It does not support multi-APP for business. If the APP operation process is abnormal, it may also cause the entire system to crash, which greatly limits the development and application of the PHM version in power terminal equipment. The process of the present invention is simple and easy to operate. It first proposed the function of multi-APP for business on the PHM version of the Hongmeng operating system for electric power, providing a technical basis for the in-depth application of Hongmeng for electric power; it designed the XIPFS file system and dynamic loading function, optimized the installation and startup of APP, and greatly reduced the proportion of flash and RAM resources occupied by multi-APP; it realized the separation of kernel state and user state, user state heap memory management and MPU switching protection when switching between multiple APPs through the SVC exception mechanism, which improved the reliability of APP operation, and its own abnormality would not cause abnormalities in other APPs and the operating system kernel, and the APP could be pulled up again after the abnormality. The present invention conducts a comprehensive design of multi-APP from four aspects: APP compilation, APP installation, APP startup loading, and APP exception preservation, covering the entire life cycle of APP, and improves the utilization rate of FLASH resources through the XIPFS file system, and improves the reliability of APP operation through APP exception preservation. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the scheme of the present invention, a brief introduction is given below to the figures required for use in the description of the embodiments. Obviously, the figures described below are some embodiments of the present invention. For ordinary technicians in this field, other figures can be obtained based on these figures without paying any creative work.

[0042] Figure 1 A flowchart of a multi-APP implementation method based on the power Hongmeng operating system provided in an embodiment of the present invention;

[0043] Figure 2 A schematic diagram of isolation between APPs and between APPs and the kernel in a multi-APP implementation method based on the power Hongmeng operating system provided in an embodiment of the present invention;

[0044] Figure 3 A schematic diagram of user mode and kernel mode isolation implemented by an SVC exception mechanism in a multi-APP implementation method based on the power Hongmeng operating system provided in an embodiment of the present invention;

[0045] Figure 4 A schematic diagram of isolating code segments, data segments and stack spaces between APPs through MPU in a multi-APP implementation method based on the Hongmeng operating system provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0046] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. The preferred embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.

[0047] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0048] The present invention provides a multi-APP implementation method based on the electric power Hongmeng operating system, which is applied to the development and application of the PHM version of the electric power Hongmeng operating system in electric power terminal devices. The multi-APP implementation method based on the electric power Hongmeng operating system includes the following steps:

[0049] S10, APP compilation: compile and link the APP code in a position-independent manner so that it can be started and run at any location, and define the startup information in the header;

[0050] S20, APP installation: The APP is installed into the internal Flash and managed through the on-chip execution file system XIPFS;

[0051] Step S20 includes writing the APP into the on-chip execution file system XIPFS for the first time, updating the APP, and deleting the APP. The specific steps of writing the APP into the on-chip execution file system XIPFS for the first time are as follows:

[0052] S211, first erase the unwritten data on the internal FLASH with a block size of 4KB;

[0053] S212. When an APP is written into XIPFS, the APP size is rounded up with the erase block size to obtain the domain space size zone_size, and the entire domain space is managed by the domain management block, which occupies a part of the domain space;

[0054] S213. Apply for an APP management block in the domain space, marked as write, write the actual data of the APP into the APP management block, and fill in the APP length information in the APP management block;

[0055] S214, when a new APP needs to be written, if the remaining space in the domain meets the needs of the APP, repeat step S213; if the remaining space in the domain does not meet the needs of the APP, repeat steps S212 to S213;

[0056] S30, APP startup: Search for APP from the XIPFS file system, parse the APP header, create the main thread of the APP, apply for and create user-mode heap resources from the kernel RAM;

[0057] Furthermore, the specific steps of step S30 are as follows:

[0058] S301, find APP from the XIPFS file system;

[0059] S302, obtain the APP header information through compilation, and calculate the RAM required size ram_size of the APP;

[0060] S303, create the main thread of the APP, and apply for a heap space ram_zone of ram_size size from the operating system kernel as a data segment copy and a stack application for the internal thread, define the entry function of the main thread as a dynamic loading function, copy the data segment content from the flash to ram_zone, clear the bss segment, and relocate the reference to the absolute address;

[0061] S304, in the main thread function, apply for a memory space from ram_zone as the heap memory management of the user state, and use TLSF as the memory management algorithm;

[0062] S305, overload the definitions of malloc and free functions to enable them to obtain resources from the user state heap memory, thereby isolating the heap memory space between APPs and between APPs and the kernel;

[0063] S40, APP abnormality keep alive: separate the user state and kernel state, create a kernel thread, and detect the running status of the APP. When the APP is abnormal, pull up the kernel thread.

[0064] The present invention has a simple process and convenient operation, can realize multi-APP, and greatly improves the stability of system operation.

[0065] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings.

[0066] The present invention provides a multi-APP implementation method based on the power Hongmeng operating system, which is applied to the development and application of the power Hongmeng operating system PHM version in power terminal devices, combined with Figures 1 to 4 In this embodiment, the multi-APP implementation method based on the power Hongmeng operating system includes the following steps:

[0067] S10, APP compilation: compile and link the APP code in a position-independent manner so that it can be started and run at any location, and define key startup information in the header to provide necessary information for the startup of the APP;

[0068] Specifically, the APP format includes the APP header and the APP payload, and has the following format:

[0069] The APP header includes magic, name, data_size, heap_size, stack_size, stack_size_main and pri_main. The magic is a magic number used to quickly determine whether the image file is an APP; name is the name of the APP; data_size is the size of the APP data segment; heap_size is the size of the heap space reserved for the APP; stack_size is the size of the stack space reserved for the APP; stack_size_main is the size used by the main thread of the APP, and its space is allocated from stack_size; pri_main is the thread priority corresponding to the main thread of the APP; the sum of data_size, heap_size and stack_size is the RAM size required by the APP;

[0070] The APP payload is the actual content of the APP, and the actual content of the APP is the APP code that is actually run.

[0071] S20, APP installation: In order to save RAM space, APPs need to be installed in the internal Flash and managed through the on-chip execution file system XIPFS (eXecute In Place filesystem);

[0072] Specifically, in this embodiment, step S20 includes writing the APP into the on-chip execution file system XIPFS for the first time, updating the APP, and deleting the APP. The specific steps of writing the APP into the on-chip execution file system XIPFS for the first time are as follows:

[0073] S211, first erase the internal FLASH with a block size of 4KB, and no data is written on the chip;

[0074] S212. When an APP is written into XIPFS, the APP size is rounded up with the erase block size to obtain the domain space size zone_size, and the entire domain space is managed by the domain management block, which occupies a part of the domain space;

[0075] The specific data structure is as follows:

[0076] zone_manage

[0077] {

[0078] int magic_num; / / Indicates that this area is not free and is used by the domain space.

[0079] int zone_size; / / The flash size occupied by the domain space

[0080] }

[0081] S213. Apply for an APP management block in the domain space, marked as write, write the actual data of the APP into the APP management block, and fill in the APP length information in the APP management block;

[0082] The specific data structure is as follows:

[0083] app_manage

[0084] {

[0085] char app_name

[16] ; / / app name

[0086] int status; / / app status, which can be: write status, delete status

[0087] int app_size; / / app size

[0088] }

[0089] S214. When a new APP needs to be written, if the remaining space in the domain meets the needs of the APP, repeat step S213; if the remaining space in the domain does not meet the needs of the APP, repeat steps S212 to S213.

[0090] Furthermore, in this embodiment, the specific steps of APP update are as follows:

[0091] S221, the on-chip execution file system XIPFS has installed APP;

[0092] S222. When the APP is repeatedly installed, if the APP has been installed, the APP management is set to delete, and a new domain is applied to complete the installation of the APP;

[0093] S223. When the APP is installed again, if the APP has been installed, the APP management is set to delete. If there is still a domain for deleting the APP and the size meets the requirement, the entire domain is directly formatted to complete the installation of the APP, that is, no new domain is applied for.

[0094] Furthermore, in this embodiment, the specific steps of deleting the APP are as follows:

[0095] S231, the on-chip execution file system XIPFS has installed APP;

[0096] S232. Only change the flag of the corresponding APP to delete, without deleting the actual data.

[0097] S30, APP startup: Search for APP from the XIPFS file system, parse the APP header, create the main thread of the APP, apply for and create user-mode heap resources from the kernel RAM;

[0098] Specifically, the specific steps of step S30 are as follows:

[0099] S301, find APP from the XIPFS file system;

[0100] S302. Obtain the following information from the APP header during the compilation: name, data_size, heap_size, stack_size, stack_size_main, pri_main, and calculate the APP's RAM requirement size: ram_size = data_size + heap_size + stack_size.

[0101] S303, create the main thread of the APP, whose thread name is name, and apply for a heap space ram_zone of ram_size size from the operating system kernel as a data segment copy and an internal thread stack application, define the entry function of the main thread as a dynamic loading function, and implement the following main functions: assign the address of ram_zone to the r9 register (r9 register is the base address register for data segment relocation, conventional usage), copy the data segment content from the flash to ram_zone, clear the bss segment, and relocate the reference to the absolute address;

[0102] S304, in the main thread function, apply for a memory space from ram_zone as the heap memory management of the user state. In order to reduce the existence of memory fragmentation, TLSF can be used as a memory management algorithm, and TLSF is a dynamic memory allocation algorithm with predictable execution time and low fragmentation;

[0103] S305, then overload the definitions of malloc and free functions to make them obtain resources from the user state heap memory, thereby isolating the heap memory space between APPs and between APPs and the kernel.

[0104] S40, APP abnormality keep alive: separate the user state and kernel state, create a kernel thread, and detect the running status of the APP. When the APP is abnormal, pull up the kernel thread.

[0105] Specifically, the specific steps of step S40 are as follows:

[0106] S401, initialization stage, the access control of APP to kernel resources is implemented through the SVC exception mechanism, thereby realizing the separation of user state and kernel state;

[0107] S402, in the initialization stage, the code segments, data segments and stack spaces between APPs are isolated through the MPU to improve the reliability of APP operation;

[0108] In this embodiment, process management needs to implement multiple APPs on a chip based on the MPU platform, and the address space isolation between APPs is implemented through the MPU. The resources of the MPU are limited. On the cortex-m4 chip, the MPU can protect 8 address intervals. Therefore, for a process, the used addresses must be within a continuous range as much as possible, and the discontinuous data cannot exceed 8. The memory resources of the process are shown in Table 1:

[0109] Table 1

[0110]

[0111] S403, initialization stage, creating a kernel thread, detecting the running status of the APP, and restarting the thread if the APP has not been running for a certain period of time;

[0112] S404, during the running phase, when the APP illegally accesses the address space of other APPs or the kernel address space during running, it will trigger its own hardfault. During the abnormal interruption, the APP system log is printed for problem location;

[0113] S405, during the running phase, the kernel thread detects that the APP stops running and restarts the thread.

[0114] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, any one of the methods in the present embodiment is implemented.

[0115] An embodiment of the present invention further provides an electronic terminal, comprising: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal executes any one of the methods in this embodiment.

[0116] The computer-readable storage medium in this embodiment can be understood by ordinary technicians in this field: all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to the computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes.

[0117] The electronic terminal provided in this embodiment includes a processor, a memory, a transceiver and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication with each other. The memory is used to store computer programs, the communication interface is used to communicate, and the processor and the transceiver are used to run computer programs so that the electronic terminal executes each step of the above method.

[0118] The multi-APP implementation method, medium and terminal based on the power Hongmeng operating system described in the above embodiment, compared with the prior art, the current PHM version of the power Hongmeng operating system is the kernel of the liteos-m series, which belongs to a lightweight RTOS (real-time operating system), which does not support multi-APP business. If the APP operation process is abnormal, it may also cause the entire system to crash, which greatly limits the development and application of the PHM version in power terminal equipment. The process of the present invention is simple and easy to operate. It first proposes the function of multi-APP business on the PHM version of the power Hongmeng operating system, providing a technical basis for the deepening application of power Hongmeng; the XIPFS file system and dynamic loading function are designed to optimize the installation and startup of APP, greatly reducing the proportion of flash and RAM resources occupied by multi-APP; the separation of kernel state and user state, user state heap memory management and MPU switching protection when switching between multiple APPs are realized through the SVC exception mechanism, which improves the reliability of APP operation, and its own abnormality will not cause abnormalities in other APPs and the operating system kernel, and the APP can be pulled up again after the abnormality. The present invention conducts a comprehensive design of multi-APP from four aspects: APP compilation, APP installation, APP startup loading, and APP exception preservation, covering the entire life cycle of APP, and improves the utilization rate of FLASH resources through the XIPFS file system, and improves the reliability of APP operation through APP exception preservation.

[0119] Obviously, the embodiments described above are only preferred embodiments of the present invention, rather than all embodiments. The preferred embodiments of the present invention are shown in the accompanying drawings, but they do not limit the patent scope of the present invention. The present invention can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive. Although the present invention has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific embodiments, or to perform equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of the present invention, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present invention.

Claims

1. A multi-APP implementation method based on the power Hongmeng operating system, characterized in that: The following steps are involved: S10, APP compilation: compile and link the APP code in a position-independent manner so that it can be started and run at any location, and define the startup information in the header; S20, APP installation: The APP is installed into the internal Flash and managed through the on-chip execution file system XIPFS; The step S20 includes the first writing of the APP into the on-chip execution file system XIPFS, APP update and APP deletion; wherein the specific steps of the first writing of the APP into the on-chip execution file system XIPFS are as follows: S211, firstly, an internal FLASH with an erase block size of 4KB is erased without writing data; S212. When an APP is written into XIPFS, the APP size is rounded up with the erase block size to obtain the domain space size zone_size, and the entire domain space is managed by the domain management block, which occupies a part of the domain space; S213. Apply for an APP management block in the domain space, marked as write, write the actual data of the APP into the APP management block, and fill in the APP length information in the APP management block; S214, when a new APP needs to be written, if the remaining space in the domain meets the needs of the APP, repeat step S213; if the remaining space in the domain does not meet the needs of the APP, repeat steps S212 to S213; S30, APP startup: Search for APP from the XIPFS file system, parse the APP header, create the main thread of the APP, apply for and create user-mode heap resources from the kernel RAM; The specific steps of step S30 are as follows: S301, find APP from the XIPFS file system; S302, obtain the APP header information through compilation, and calculate the RAM required size ram_size of the APP; S303, create the main thread of the APP, and apply for a heap space ram_zone of ram_size size from the operating system kernel as a data segment copy and a stack application for the internal thread, define the entry function of the main thread as a dynamic loading function, copy the data segment content from the flash to ram_zone, clear the bss segment, and relocate the reference to the absolute address; S304, in the main thread function, apply for a memory space from ram_zone as the heap memory management of the user state, and use TLSF as the memory management algorithm; S305, overload the definitions of malloc and free functions to enable them to obtain resources from the user state heap memory, thereby isolating the heap memory space between APPs and between APPs and the kernel; S40, APP abnormality keep alive: separate the user state and kernel state, create a kernel thread, and detect the running state of the APP. When the APP is abnormal, pull up the kernel thread.

2. According to claim 1, a multi-APP implementation method based on the power Hongmeng operating system is characterized in that: In the step S10, the APP format includes an APP header and an APP payload, the APP header includes magic, name, data_size, heap_size, stack_size, stack_size_main and pri_main, and the APP payload is the actual content of the APP.

3. According to claim 2, a multi-APP implementation method based on the power Hongmeng operating system is characterized in that: The magic is a magic number used to quickly determine whether the image file is an APP; the name is the name of the APP; the data_size is the size of the APP data segment; the heap_size is the size of the heap space reserved for the APP; the stack_size is the size of the stack space reserved for the APP; the stack_size_main is the size used by the main thread of the APP, and its space is allocated from the stack_size; the pri_main is the thread priority corresponding to the main thread of the APP; the sum of the data_size, heap_size and stack_size is the RAM size used by the APP; the actual content of the APP is the APP code actually running.

4. According to a method for implementing multiple APPs based on the power Hongmeng operating system according to claim 1, it is characterized in that: The specific steps for APP update are as follows: S221, the on-chip execution file system XIPFS has installed APP; S222. When the APP is repeatedly installed, if the APP has been installed, the APP management is set to delete, and a new domain is applied to complete the installation of the APP; S223. When the APP is installed again, if the APP has been installed, the APP management is set to delete. If there is still a domain for deleting the APP and the size meets the requirement, the entire domain is directly formatted to complete the installation of the APP, that is, no new domain is applied for.

5. According to claim 4, a multi-APP implementation method based on the power Hongmeng operating system is characterized in that: The specific steps to delete the APP are as follows: S231, the on-chip execution file system XIPFS has installed APP; S232. Only change the flag of the corresponding APP to delete, without deleting the actual data.

6. According to a method for implementing multiple APPs based on the power Hongmeng operating system according to claim 1, it is characterized in that: The specific steps of step S40 are as follows: S401, initialization stage, implement APP access control to kernel resources through SVC exception mechanism; S402, initialization stage, the code segment, data segment and stack space between APPs are isolated through MPU; S403, initialization stage, creating a kernel thread, detecting the running status of the APP, and re-starting the kernel thread if the APP has not been running for a certain period of time; S404, during the running phase, when the APP illegally accesses the address space of other APPs or the kernel address space during running, it will trigger its own hard fault. In the abnormal interruption, the APP system log is printed for problem location; S405, during the running phase, the kernel thread detects that the APP stops running and restarts the kernel thread.

7. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

8. An electronic terminal, characterized in that: include: Processor and memory; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal executes the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Dynamic loading method and device based on MCU application program and medium thereof

    CN117215671A

  • Multi-process MPU protection method and device and electronic equipment

    CN113569231A

  • Multi-application development method and device based on RTOS operating system

    CN118585211A