Start control method and apparatus for embedded system, and storage medium and electronic device

By running different operating systems of the embedded system on the processor core, the first operating system with fast response speed controls the target device first, and then takes over control after the second operating system starts up. This solves the high cost problem caused by the additional chip in the operating system startup control method, and realizes the scalability of device control and the improvement of resource utilization.

WO2024221469A1PCT designated stage expired Publication Date: 2024-10-31INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Application Number
PCT/CN2023/091877
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-04-28
Publication Date
2024-10-31

AI Technical Summary

Technical Problem

In existing technologies, operating system boot control methods require additional chips, resulting in high device costs and a lack of scalability.

Method used

By running different operating systems of the embedded system on different processor cores, the first operating system with fast response speed controls the target device first, and then takes over control after the second operating system starts up, avoiding the use of additional chips and implementing device control in software.

Benefits of technology

It reduces equipment costs, improves the scalability and resource utilization of equipment control, and ensures the controllability of the equipment during the operating system startup process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023091877_31102024_PF_FP_ABST
    Figure CN2023091877_31102024_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present invention are a start control method and apparatus for an embedded system, and a storage medium and an electronic device. The method comprises: by means of a first operating system run on a first processor core of a processor, controlling a hardware controller of a target device via a first bus, so as to control a running state of the target device, wherein an embedded system comprises the first operating system; booting a second operating system to start on a second processor core of the processor, wherein the embedded system further comprises the second operating system, the response speed of the first operating system is higher than that of the second operating system, the first operating system communicates with the second operating system by means of a second bus, and the bandwidth of the second bus is greater than that of the first bus; and after the second operating system is started, by means of the second operating system, taking over the hardware controller via the first bus, so as to take over the control right of the target device.
Need to check novelty before this filing date? Find Prior Art

Description

Embedded system startup control method and device, storage medium and electronic device Technical Field

[0001] The present invention relates to the field of computers, and in particular to a startup control method and device for an embedded system, a storage medium, and an electronic device. Background Art

[0002] Devices such as servers, personal computers, and industrial computers can be equipped with specific devices to perform operations related to their operation, such as fans for cooling. In related technologies, these specific devices typically begin operating after the system is powered on. However, after powering on, the operating system running on the processor takes some time to properly take over and control the operating status of the specific device. During the operating system startup process, the specific device is uncontrollable.

[0003] To control the operating status of specific devices during the operating system startup process, an additional chip is typically used. However, the aforementioned operating system startup control method requires an additional chip, which increases device costs. Therefore, the operating system startup control method in the related art suffers from the problem of high device costs due to the need for an additional chip.

[0004] Summary of the Invention

[0005] The embodiments of the present invention provide a startup control method and device for an embedded system, a storage medium, and an electronic device, so as to at least solve the technical problem in the related art that the startup control method of an operating system requires the addition of an additional chip, resulting in high equipment costs.

[0006] According to one aspect of an embodiment of the present invention, a startup control method for an embedded system is provided, comprising: controlling a hardware controller of a target device via a first bus by a first operating system running on a first processor core of a processor to control the operating state of the target device, wherein the embedded system includes the first operating system; booting a second operating system on a second processor core of the processor, wherein the embedded system also includes the second operating system, the response speed of the first operating system is higher than that of the second operating system, the first operating system and the second operating system communicate via a second bus, and the bandwidth of the second bus is higher than that of the first bus; after the second operating system is started, taking over the hardware controller via the first bus by the second operating system to take over control of the target device.

[0007] According to another aspect of an embodiment of the present invention, a startup control device for an embedded system is also provided, comprising: a first control unit, configured to control a hardware controller of a target device via a first bus through a first operating system running on a first processor core of a processor, so as to control the operating state of the target device, wherein the embedded system includes the first operating system; a startup unit, configured to guide the startup of a second operating system on a second processor core of the processor, wherein the embedded system also includes the second operating system, the response speed of the first operating system is higher than that of the second operating system, the first operating system and the second operating system communicate via a second bus, and the bandwidth of the second bus is higher than that of the first bus; a first execution unit, configured to take over the hardware controller via the first bus through the second operating system after the second operating system is started, so as to take over control of the target device.

[0008] In an exemplary embodiment, the first control unit includes: a first execution module, used to execute a first control task of the first operating system on the first processor core, wherein the first control task is used to control the hardware controller; a reading module, used to read sensor data of a designated sensor corresponding to the target device through the first processor core; and a first sending module, used to send a device control instruction to the hardware controller via the first bus according to the sensor data of the designated sensor through the first control task, so that the hardware controller controls the operating state of the target device according to the device control instruction.

[0009] In an exemplary embodiment, the first sending module includes: a first determination submodule, used to determine the target parameter value of the device operating parameter of the target device according to the sensor data of the designated sensor through the first control task, wherein the device operating parameter is a parameter for controlling the operating state of the target device; and a sending submodule, used to send the device control instruction carrying the target parameter value to the hardware controller via the first bus through the first control task.

[0010] In an exemplary embodiment, the first determining submodule includes: a determining subunit configured to determine, when the target device is a fan, a target parameter value of a fan operating parameter of the fan according to sensor data of the designated sensor through the first control task.

[0011] In an exemplary embodiment, the determination subunit includes: a determination subunit, which is used to determine the target speed value of the fan's speed based on the sensor data of the temperature sensor through the first control task when the target device is a fan and the designated sensor is a temperature sensor, wherein the speed of the fan is positively correlated with the temperature detected by the temperature sensor.

[0012] In an exemplary embodiment, the first execution unit includes: a second sending module for sending a first inter-core interrupt to the first operating system via the second bus through the second operating system, wherein the first inter-core interrupt is used to request that the second operating system take over the hardware controller; a control module for controlling the hardware controller via the first bus through the second control task of the second operating system upon receiving a second inter-core interrupt returned by the first operating system in response to the first inter-core interrupt, indicating that the second operating system agrees to take over the hardware controller. The second control task is used to control the hardware controller.

[0013] In an exemplary embodiment, the device also includes: a second control unit for controlling a third control task of the first operating system to sleep in response to the acquired first inter-core interrupt after the first inter-core interrupt is sent to the first operating system via the second bus through the second operating system, wherein the third control task is used to control the hardware controller; and a first sending unit for sending the second inter-core interrupt to the second operating system via the second bus through the first operating system when the third control task has been dormant.

[0014] In an exemplary embodiment, the device further includes: a second execution unit, configured to push the system running data of the first operating system into a stack when the third control task has gone to sleep, wherein the second inter-core interrupt is further configured to instruct the second operating system to take over the first processor core.

[0015] In an exemplary embodiment, the device further includes: a wake-up unit for waking up the first processor core through the processor after the chip where the processor is located is powered on, before the first operating system running on the first processor core of the processor controls the hardware controller of the target device via the first bus; and a running unit for running a boot loader of the first operating system through the first processor core to guide the first operating system to start on the first processor core.

[0016] In an exemplary embodiment, the startup unit includes: a second execution module, used to execute the secondary program loader through the first processor core so that the secondary program loader wakes up the second processor core; and a running module, used to run the universal boot loader of the second operating system through the second processor core so as to guide the second operating system to start on the first processor core.

[0017] In an exemplary embodiment, the apparatus further includes: a third execution unit, configured to, after the second operating system takes over the hardware controller via the first bus, wake up the first operating system via the second bus when the second operating system is to be restarted, and have the first operating system take over the hardware controller via the first bus to take over control of the target device; and a third control unit, configured to control the second operating system to restart the system.

[0018] In an exemplary embodiment, the third execution unit includes: an initiating module, which is used to initiate a system wake-up interrupt to the first operating system via the second bus through the second operating system when the second operating system is to be restarted, wherein the system wake-up interrupt is used to wake up the first operating system.

[0019] In an exemplary embodiment, the device also includes: a first allocation unit, used to allocate a group of to-be-allocated businesses to the corresponding operating systems in the first operating system and the second operating system according to a dynamic resource allocation rule, wherein the dynamic resource allocation rule includes dynamic resource allocation according to at least one of the following: business response speed, business resource occupancy rate, business coupling degree, and business importance; a first determination unit, used to determine the resource allocation result corresponding to the group of to-be-allocated businesses, wherein the resource allocation result is used to indicate the processing resources in the processor's processing resources corresponding to each to-be-allocated business in the group of to-be-allocated businesses, and the processing resources of the processor include a processor core; a second allocation unit, used to allocate the processing resources of the processor to the first operating system and the second operating system according to the operating system corresponding to each to-be-allocated business and the resource allocation result.

[0020] In an exemplary embodiment, the first allocation unit includes at least one of the following: a first allocation module, used to allocate the to-be-allocated businesses whose business response speed requirements are greater than or equal to the set response speed threshold in the group of to-be-allocated businesses to the first operating system, and to allocate the to-be-allocated businesses whose business response speed requirements are less than the set response speed threshold in the group of to-be-allocated businesses to the second operating system; a second allocation module, used to allocate the to-be-allocated businesses whose business resource occupancy rate is less than the first occupancy rate threshold in the group of to-be-allocated businesses to the first operating system, and to allocate the to-be-allocated businesses whose business resource occupancy rate is greater than or equal to the first occupancy rate threshold in the group of to-be-allocated businesses to the second operating system; a third allocation module, used to allocate the to-be-allocated businesses containing sensitive information in the group of to-be-allocated businesses to the target operating system, wherein the target operating system is the operating system with a low frequency of interaction with the user object among the first operating system and the second operating system.

[0021] In an exemplary embodiment, the first allocation unit includes at least one of the following: a fourth allocation module, used to allocate the to-be-allocated businesses in the group of to-be-allocated businesses whose business coupling degree with the allocated businesses of the first operating system is greater than or equal to a first coupling degree threshold to the first operating system; and a fifth allocation module, used to allocate the to-be-allocated businesses in the group of to-be-allocated businesses whose business coupling degree with the allocated businesses of the second operating system is greater than or equal to a second coupling degree threshold to the second operating system.

[0022] In an exemplary embodiment, the first determination unit includes: a generation module for generating a resource mapping table of the group of to-be-allocated services and the processing resources of the processor based on the allocation results of the group of to-be-allocated services, combined with the resource utilization of the processing resources of the first operating system and the resource utilization of the processing resources of the second operating system.

[0023] In an exemplary embodiment, the second allocation unit includes: a sixth allocation module for allocating the unallocated processing resources to the operating system to which the to-be-allocated business corresponding to the unallocated processing resources is allocated, when it is determined according to the resource allocation result that there is a corresponding to-be-allocated business among the processing resources of the processor.

[0024] In an exemplary embodiment, the device further includes: a second sending unit, configured to send target data to a target virtual channel in the memory of the processor through the first operating system; a third sending unit, configured to send an interrupt notification message to the second operating system; and an acquisition unit, configured to respond to the interrupt notification message through the second operating system and acquire the target data from the target virtual channel in the memory.

[0025] In an exemplary embodiment, the memory includes a data storage area and a metadata storage area, the data storage area is divided into multiple storage units, each storage unit is used to store business data, and the metadata storage area is used to store the size and occupancy status of each storage unit in the data storage area.

[0026] In an exemplary embodiment, the second sending unit includes: a third execution module, used to read the records in the metadata storage area through the first operating system, and determine at least one storage unit in the data storage area that is in an idle state and has a total space greater than or equal to the length of the target data based on the read records to obtain the target virtual channel; a fourth execution module, used to set the state of at least one storage unit corresponding to the target virtual channel in the metadata storage area to an occupied state, and store the target data in the target virtual channel.

[0027] In an exemplary embodiment, the acquisition unit includes: a fifth execution module, used to read the records in the metadata storage area through the second operating system, and determine the target virtual channel based on the read records; a sixth execution module, used to obtain the target data from at least one storage unit corresponding to the target virtual channel, and set the state of the at least one storage unit to an idle state.

[0028] In an exemplary embodiment, the data storage area includes multiple memory channels, each memory channel is composed of one or more storage units, and the metadata storage area stores multiple records, each record is used to record metadata of a memory channel, and the metadata of each memory channel at least includes a channel ID of the memory channel, the size of the memory channel, and the occupied status of the memory channel; the third execution module includes: a first traversal submodule, which is used to traverse the records stored in the metadata storage area and determine whether there is a first target record indicating that the memory channel is in an idle state and the size of the memory channel is greater than or equal to the length of the target data; a second determination submodule, which is used to determine the memory channel indicated by the channel ID recorded in the first target record as the target virtual channel when the first target record exists.

[0029] In an exemplary embodiment, when a memory channel is occupied, the metadata of the memory channel also includes the ID of the source CPU core of the target data and the ID of the destination CPU core of the target data; the fifth execution module includes: a second traversal submodule, used to traverse the records stored in the metadata storage area to determine whether there is a second target record, wherein the second target record indicates that the memory channel is in an occupied state, and the ID of the destination CPU core is the ID of the CUP core of the second operating system, and the ID of the source CPU core is not the ID of the CUP core of the second operating system; a third determination submodule, used to determine the memory channel indicated by the channel ID recorded in the second target record as the target virtual channel when the second target record exists.

[0030] In an exemplary embodiment, the device also includes: a fourth execution unit, used to receive a memory request instruction from the first operating system and perform a locking operation on the memory of the processor, wherein the memory request instruction is used to apply for use of the memory of the processor; a fifth execution unit, used to read the occupied status of the memory when the memory is successfully locked, and determine whether there is an idle target memory space in the memory based on the occupied status of the memory, wherein the size of the target memory space is greater than or equal to the size of the memory requested by the memory request instruction; a feedback unit, used to feed back the address information of the target memory space to the first operating system when the target memory space exists in the memory, and update the occupied status of the memory.

[0031] In an exemplary embodiment, the memory includes a metadata storage area and a data storage area, the data storage area is used to store business data, the metadata storage area stores a status mapping table, the status mapping table is used to record the occupied status of the data storage area, and the fifth execution unit includes: a seventh execution module, which is used to read the records in the status mapping table from the metadata storage area, and determine whether the target memory space exists in the data storage area based on the records in the status mapping table.

[0032] In an exemplary embodiment, the device also includes: a judgment unit, used to determine whether the memory is currently in a locked state before performing a locking operation on the processor's memory, wherein the locked state indicates that the memory is in a state where it is requested for use; and a sixth execution unit, used to perform a locking operation on the memory when the memory is not currently in a locked state.

[0033] In an exemplary embodiment, the device also includes: a release unit, which is used to read the occupied status of the memory and determine whether there is free target memory space in the memory based on the occupied status of the memory, and release the lock on the memory if there is no free target memory space in the memory.

[0034] According to another aspect of an embodiment of the present invention, an embedded system is also provided, comprising: a chip and at least two operating systems, wherein the chip comprises a processor, a hardware controller, a first bus and a second bus, wherein the bandwidth of the second bus is higher than the bandwidth of the first bus, and the second bus is configured in a multi-master-multi-slave mode, and the first bus is configured in a one-master-multi-slave mode; the at least two operating systems run based on the processor, wherein the processing resources of the processor are dynamically allocated to the at least two operating systems, and the processing resources of the processor include processor cores; the at least two operating systems communicate through the second bus; the at least two operating systems control the hardware controller through the first bus; and the at least two operating systems are used to implement the steps in any of the above method embodiments.

[0035] According to another aspect of the embodiments of the present application, a chip is further provided, wherein the chip includes at least one of a programmable logic circuit and an executable instruction, and the chip runs in an electronic device to implement the steps of any of the above method embodiments.

[0036] According to another aspect of the embodiments of the present application, a BMC chip is further provided, which includes: a storage unit and a processing unit connected to the storage unit, the storage unit is used to store a program, and the processing unit is used to run the program to execute the steps in any of the above method embodiments.

[0037] According to another aspect of the embodiments of the present application, a mainboard is also provided, which includes: at least one processor; at least one memory for storing at least one program; when the at least one program is executed by the at least one processor, the at least one processor implements the steps of any one of the above method embodiments.

[0038] According to another aspect of the embodiments of the present application, a server is also provided, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the steps of any of the above method embodiments when executing the program stored in the memory.

[0039] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when run.

[0040] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0041] In an embodiment of the present invention, different operating systems of an embedded system are run on different processor cores of a processor. A first operating system running on a first processor core of the processor controls a hardware controller of a target device via a first bus to control the operating state of the target device. The embedded system includes the first operating system. A second operating system is started on a second processor core of the processor. The embedded system also includes the second operating system. The first operating system has a higher response speed than the second operating system. The first and second operating systems communicate via a second bus. The bandwidth of the second bus is higher than the bandwidth of the first bus. After the second operating system is started, the second operating system takes over the hardware controller via the first bus to take over control of the target device. Since at least two operating systems of the embedded system run on the processor and different operating systems have different response speeds, the first operating system with a faster response speed first controls the operating state of a specific device and takes over control of the specific device after the second operating system is started. No additional chips are required. Since device control is implemented by software, the system has strong scalability and can achieve the technical effect of improving core resource utilization. This solves the technical problem of high device cost caused by the need to add additional chips in the operating system startup control method in the related art. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0044] FIG1 is a schematic diagram of a hardware environment of a startup control method for an embedded system according to an embodiment of the present application;

[0045] FIG2 is a flow chart of an optional startup control method for an embedded system according to an embodiment of the present application;

[0046] FIG3 is a schematic diagram of an optional fan controller according to an embodiment of the present application;

[0047] FIG4 is a schematic diagram of an optional system power-on startup process according to an embodiment of the present application;

[0048] FIG5 is a schematic diagram of an optional inter-core interrupt according to an embodiment of the present application;

[0049] FIG6 is a flow chart of another optional startup control method for an embedded system according to an embodiment of the present application;

[0050] FIG7 is a schematic diagram of an optional startup control method of an embedded system according to an embodiment of the present application;

[0051] FIG8 is a schematic diagram of another optional startup control method for an embedded system according to an embodiment of the present application;

[0052] FIG9 is a schematic diagram of another optional startup control method of an embedded system according to an embodiment of the present application;

[0053] FIG10 is a schematic diagram of an optional embedded system according to an embodiment of the present application;

[0054] FIG11 is a schematic diagram of another optional embedded system according to an embodiment of the present application;

[0055] FIG12 is a structural block diagram of an optional startup control device for an embedded system according to an embodiment of the present application. DETAILED DESCRIPTION

[0056] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0057] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0058] The method embodiments provided in the embodiments of the present application can be executed in a server, a computer terminal, an equipment terminal or a similar computing device. Taking operation on a server as an example, FIG1 is a hardware environment diagram of a startup control method of an embedded system according to an embodiment of the present application. As shown in FIG1 , the server may include one or more (only one is shown in FIG1 ) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. In an exemplary embodiment, the above-mentioned server may also include a transmission device 106 and an input and output device 108 for communication functions. It will be understood by those skilled in the art that the structure shown in FIG1 is only for illustration and does not limit the structure of the above-mentioned server. For example, the server may also include more or fewer components than those shown in FIG1 , or have different configurations with equivalent functions or more functions than those shown in FIG1 .

[0059] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the startup control method of the embedded system in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to a server via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0060] The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned network may include a wireless network provided by the server's communications provider. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0061] In this embodiment, a startup control method for an embedded system is provided, which is applied to the above-mentioned server. FIG2 is a flow chart of an optional startup control method for an embedded system according to an embodiment of the present application. As shown in FIG2 , the flow chart includes the following steps:

[0062] Step S202: Controlling a hardware controller of a target device via a first bus by a first operating system running on a first processor core of a processor to control an operating state of the target device, wherein the embedded system includes the first operating system.

[0063] The startup control method of the embedded system in this embodiment can be applied to a scenario in which the operating state of a specific device is controlled by running an operating system on the processor core of the processor, which can correspond to the startup process of the embedded system. The above-mentioned embedded system can be an embedded heterogeneous multi-system. Heterogeneous multi-system refers to running multiple different operating systems (for example, a first operating system, a second operating system, etc.) in a multi-core processor of the embedded system, and these operating systems run simultaneously in the same embedded system. Different operating systems can run on different processor cores. The processor here can be a multi-core processor, for example, an 8-core processor, or a processor containing other numbers of processor cores. In this embodiment, the number of cores contained in the multi-core processor is not limited.

[0064] Devices such as servers, personal computers, and industrial computers can be equipped with specific devices to perform operations related to their operation. In related technologies, these specific devices typically begin operating after the system is powered on. However, after powering on, the operating system running on the processor takes some time to properly take over and control the operating status of the specific device. During the operating system startup process, the specific device is uncontrollable.

[0065] For example, the fan starts working after the system is powered on. Since the operating system running on the CPU (Central Processing Unit, which is the calculation and control core of the computer system and the final execution unit for information processing and program running) takes some time to take over the fan normally and set the fan speed, the fan cannot be controlled during the operating system startup process.

[0066] In related technologies, in order to control the operating status of specific devices during the operating system startup process, additional chips are usually used to control the operating status of specific devices during the operating system startup process. The additional chips can be CPLD (Complex Programmable Logic Device), EC (Embedded Controller) chips, custom chips, etc. The main reason for using additional chips is that CPLD, EC chips, and custom chips can start up in a very short time (for example, within 1 second) after powering on, and have high real-time performance. However, these three methods often require additional chips or complex programmable logic devices, which increases costs. Moreover, due to the custom hardware, they lack good scalability.

[0067] For example, in order to control the fan during the startup of the operating system, the server adopts the control method of BMC (Baseboard Management Controller, baseboard management controller, the management control chip in the server platform) combined with CPLD, the personal computer adopts the control method of EC chip (EC chip has the function of adjusting the fan speed according to temperature), and the industrial computer adopts the control method of customized chip. During the startup process of the server, personal computer, and industrial computer operating system, CPLD, EC chip, and customized chip will intervene to control the fan speed. After the operating system is fully started, the control of the fan will be handed over to the application in the operating system.

[0068] In order to at least partially solve the above technical problems, a multi-core multi-system (for example, a multi-core dual system) startup control method can be adopted to run different operating systems of the embedded system on different processor cores of the processor. Different operating systems have different response speeds. If the second operating system is not started, restarted, or otherwise unable to control the operating status of a specific device, the operating status of the specific device can be controlled by the first operating system with a higher response speed than the second operating system. This can reduce the situation where the operating status of the specific device is uncontrollable. At the same time, since no additional cost is required, it also has good scalability.

[0069] An embedded system can be run on a processor, and the processor can be a multi-core processor (for example, an octa-core processor), which can include multiple processor cores. The embedded system can include a first operating system and a second operating system. The first operating system can run on a first processor core of the processor, and the second operating system can run on a second processor core of the processor. The first processor core can be at least one processor core of the processor, and the second processor core can be all or part of the processor cores of the multiple processor cores of the processor except the first processor core. In addition to the processor cores, the processor resources for running each operating system can also include other types of resources, such as controller logic units. In addition, the processor cores occupied by different operating systems can be dynamically adjusted.

[0070] The processor can be a processor on a chip. The chip can include the above-mentioned processor, a hardware controller, a first bus and a second bus, wherein the hardware controller can be used to control external devices connected to the corresponding external interface; the first bus can be configured as a one-master-multiple-slave mode, which can be a bus used by the processor to control the hardware controller, for example, an APB (Advanced Peripheral Bus) bus; the second bus can be configured as a multi-master-multi-slave mode, which can be a bus used for communication between multiple cores of the processor 302, for example, an AHB (Advanced High Performance Bus) bus, and the bandwidth of the second bus is higher than the bandwidth of the first bus.

[0071] Here, the second bus is configured in multi-master multi-slave mode, which means that the second bus can be used for data communication between multiple master devices (Master) and multiple slave devices (Slave). That is, the second bus can be connected to multiple master devices and multiple slave devices, and the second bus can be used for data communication between master devices and between master devices and slave devices. All data transmission on the second bus is initiated by the master device, and the slave devices are responsible for responding. The first bus is configured in single-master multi-slave mode, which means that the first bus can be used for data communication between one master device and multiple slave devices. That is, the first bus can be connected to one master device and multiple slave devices, and the master device and slave devices can use the first bus for data communication. Data requests can only be sent from the master device to the slave device. After receiving the request, the slave device returns the corresponding response data to the master device. This process can achieve one-to-many access.

[0072] It should be noted that by using a multi-master and multi-slave mode bus for data communication between operating systems, it is convenient for each operating system to actively initiate data requests based on demand, and the hardware controller mainly controls the corresponding hardware based on the control of the operating system. Therefore, a master-multiple slave mode bus is used for communication between the operating system and the hardware controller, and data requests are all sent by the operating system to the hardware controller, which can improve the efficiency of the hardware controller's control.

[0073] The aforementioned AHB bus has been defined in AMBA (Advanced Microcontroller Bus Architecture) 2. The AHB bus is mainly used as a system high-speed bus and is suitable for high-performance, low-power system design. It can be used to connect high-performance modules and serve as the on-chip system bus of SoC (System on Chip). High-performance modules can be CPUs, DMAs (Direct Memory Access), and DSPs (Digital Signal Processing). In the AMBA protocol, AHB is primarily designed for system-level, high-bandwidth, and high-performance interconnection. It features: single clock edge operation; non-tri-state implementation; support for burst transmission; support for segmented transmission; support for multi-master and multi-slave interconnection modes; configurable 32-bit to 128-bit bus widths; and support for byte, nibble, and word transmissions. The AHB system consists of three parts: the master module (i.e., the master device), the slave module (i.e., the slave device), and the infrastructure. All transmissions on the AHB bus are initiated by the master module and responded to by the slave modules. The infrastructure includes the arbiter, master-to-slave multiplexer, slave-to-master multiplexer, decoder, dummy slave module, and dummy master module.

[0074] APB is mainly used for connecting low-bandwidth peripherals, such as UART (Universal Asynchronous Receiver / Transmitter) and 1284. Unlike AHB, its bus architecture does not support multiple master modules. The only master module in APB is the APB bridge. Its features include:

[0075] ①Can work at high frequency;

[0076] ②Simple protocol: no complex timing;

[0077] ③Synchronous bus: All transactions (read and write operations) on the bus depend on the rising edge of the clock;

[0078] ④One master and multiple slaves: Generally, APB is connected to the AHB bus system, and the transactions are converted between the AHB bus systems through the AHB APB Bridge. At this time, the Bridge is the master of APB, and other peripheral devices are slaves;

[0079] ⑤Simple interface: Compared with AXI (Advanced eXtensible Interface) and AHB, the interface is relatively simple;

[0080] ⑥Low power consumption;

[0081] ⑦ A variety of peripheral devices can be connected, for example, peripheral devices that can be controlled by the aforementioned hardware controller.

[0082] On the APB bus, data requests can only be sent from the master to the slave. After receiving the request, the slave returns the corresponding response data to the master. This process enables one-to-many access without involving the arbitration and decoder parsing operations of the AHB bus. The AHB bus has high bandwidth and is used to interconnect high-performance modules (CPU, DMA, etc.) in the system. The APB bus has lower bandwidth and is used to connect peripheral devices (UART, I2C, etc.) in the system. The AHB bus logic circuit and bus protocol are complex, while the APB bus interface circuit and bus protocol are relatively simple.

[0083] Here, the chip may be a BMC chip. The BMC chip may be a SOC chip based on an ARM (Advanced RISC Machine) multi-core architecture, integrating a variety of peripheral hardware IPs (Intelligent Peripheral). The BMC chip is placed on a motherboard (server motherboard).

[0084] Optionally, based on the constraint on response time, the first operating system can be an operating system with clear and fixed time constraints. All processing processes (task scheduling) need to be completed within the fixed time constraints, otherwise the system will fail. It can be called a real-time operating system (RTOS). The second operating system does not have this feature. The second operating system generally adopts a fair task scheduling algorithm. When the number of threads / processes increases, the CPU time needs to be shared. Task debugging is uncertain. It can be called a non-real-time operating system. For example, the Linux (full name GNU / Linux) system and the Windows system. The Linux system is a freely distributable Unix-like operating system. It is a multi-user, multi-tasking operating system based on POSIX (Portable Operating System Interface) that supports multi-threading and multi-CPU. The Windows system is an operating system developed based on a graphical user interface and is mainly used in computers, smartphones and other devices.

[0085] For example, taking an ARM architecture processor chip as an example, the processor chip can be an ARM processor, which includes a multi-core CPU. The RTOS system can run on the CPU0 core, and the Linux system can run on the CPU core (1, N) (N≥2, the total number of processor cores included in the processor is N+1) (Windows or other operating systems can also be run).

[0086] In this embodiment, when the second operating system is not started, restarted or otherwise unable to control the operating state of the target device, the hardware controller of the target device can be controlled by the first operating system via the first bus to control the operating state of the target device. The target device here can be a fan, or other device that needs to be running when the system is started. For the fan, its corresponding hardware controller is a fan controller, for example, a PWM (Pulse Width Modulation) controller or a FanTach (fan speed) controller. Here, the first operating system (for example, an RTOS system) is used to replace traditional CPLD, EC chips, and custom chips. On the one hand, hardware costs are saved, and on the other hand, since device control is implemented by software, scalability is high.

[0087] For example, dual systems, RTOS system and Linux system, are implemented based on the BMC dual-core, and fans are implemented based on the multi-core dual system. By utilizing the high real-time performance of the RTOS system, during the startup of the Linux system, the RTOS system can replace the CPLD, EC chip, or customized chip to control the fan, that is, take over the fan control and control the fan's operating status at a sufficiently fast speed.

[0088] Step S204 : booting a second operating system on the second processor core of the processor.

[0089] When the system is powered on or the second operating system is restarted, the second operating system can be booted on the second processor core of the processor so that the second operating system runs on the second processor core. Here, booting the second operating system on the second processor core means scheduling the second processor core to the second operating system. The system files or image files of the operating system can be stored in a memory on the chip where the processor is located or outside the chip, for example, in an external RAM (Random Access Memory).

[0090] Step S206: After the second operating system is started, the second operating system takes over the hardware controller via the first bus to take over the control of the target device.

[0091] After the second operating system is started, the first operating system can always control the running state of the target device. Taking into account that running multiple operating systems on a multi-core processor requires data interaction between multiple operating systems, and it is convenient for one operating system to perform overall control of the device, the second operating system can also take over the control of the target device. For example, the hardware controller can be taken over by the second operating system via the first bus. The way in which the second operating system takes over the control of the target device can be: after the second operating system is started, the second operating system sends a device takeover request to the first operating system, for example, sends an interrupt request via the second bus to request to take over the hardware controller of the target device. The first operating system can receive the device takeover request sent by the second operating system, transfer the control of the target device to the second operating system, and can also perform operations related to the handover of control of the target device, for example, stop running the business (process) used to control the running state of the target device.

[0092] For example, after the Linux system is fully booted, the RTOS system transfers control of the fan to the Linux system, which then controls the fan. This process can be performed after the system is powered on. That is, using a multi-core dual-system boot method, the RTOS system is booted first, facilitating earlier fan control. After the Linux system is fully booted, the RTOS system transfers control of the fan to the Linux system.

[0093] Here, it should be noted that, for servers, servers must at least have the characteristics of high scalability and high stability. Among them, since enterprise networks cannot remain unchanged for a long time, in today's network information age, if the server does not have a certain degree of scalability, it will affect the use of the server in the enterprise, and then affect the future development of the enterprise. Therefore, scalability has become the most basic feature required by the server. Only with high scalability can better utilization in the future be guaranteed. In addition to hardware scalability, scalability also includes software scalability. Since the functions of servers are still very complex compared to computers, not only hardware configuration, but also software configuration is very important. If you want to achieve more functions, it is impossible to imagine without comprehensive software support.

[0094] In addition, since the server needs to process a large amount of data to support the continuous operation of the business, the server also has a very important feature, such as high stability. If the server's data transmission cannot run stably, it will undoubtedly have a great impact on business development.

[0095] The solution of the present application takes advantage of the high scalability of the server and introduces a dual software system of the first operating system and the second operating system for generating hardware interface signals. At the same time, hardware devices such as GPLD and BMC chip can also be introduced to adjust the transmission voltage of the hardware interface signal and monitor the operating status of other devices inside the server. On this basis, the present application adopts a method in which the hardware interface signal corresponding to the request command is generated by the first operating system. First, the request command is obtained through the first operating system, and then the multiple logical bit information corresponding to the request command is determined. Finally, the hardware interface signal corresponding to the request command is generated according to the multiple logical bit information and the timer. It can be seen from the above that the present application generates the hardware interface signal corresponding to the request command through the first operating system, thereby achieving the technical effect of simulating the generation of hardware interface signals using software, thereby achieving the purpose of hardware logic design without the chip itself having the relevant hardware interface signals. It can not only reduce the design difficulty of the chip, but also reduce the design cost of the chip. The present application achieves the purpose of using a software system to generate hardware interface signals on the basis of not having to perform hardware logic design of the hardware interface signal on the chip, thereby reducing the design difficulty of the chip, and thus solving the technical problem in the related technology that the chip itself needs to have a hardware logic design of the controller, which leads to a high design cost of the chip.

[0096] In addition, the introduction of the first operating system and the second operating system dual software system can also ensure the stability of the server. Since the business response speed of the second operating system is slower than that of the first operating system, the first operating system with a faster business response speed is used to generate the hardware interface signal, which can ensure that the generation of the hardware interface signal will not be interrupted, thereby ensuring that the hardware interface signal can be output continuously and stably.

[0097] Through the above steps S202 to S206, the hardware controller of the target device is controlled via the first bus by the first operating system running on the first processor core of the processor to control the operating state of the target device, wherein the embedded system includes the first operating system; the second operating system is started on the second processor core of the processor, wherein the embedded system also includes the second operating system, the response speed of the first operating system is higher than that of the second operating system, the first operating system and the second operating system communicate via the second bus, and the bandwidth of the second bus is higher than that of the first bus; after the second operating system is started, the hardware controller is taken over by the second operating system via the first bus to take over the control of the target device, thereby solving the problem of high equipment cost caused by the need to add additional chips in the startup control method of the operating system in the related art, saving hardware costs and improving the scalability of equipment control.

[0098] In an exemplary embodiment, before controlling the hardware controller of the target device via the first bus by the first operating system running on the first processor core of the processor, the method further includes:

[0099] S11, after the chip where the processor is located is powered on, waking up the first processor core through the processor;

[0100] S12: Run a boot loader of the first operating system through the first processor core to guide the first operating system to start on the first processor core.

[0101] The entire system can be divided into two phases based on operating time: an initial startup phase and a real-time operation phase. The startup control method in this embodiment can be executed during either the initial startup phase or the real-time operation phase. The initial startup phase begins when the system is powered on, i.e., when the chip containing the processor is powered on. After the system is powered on, one core is awakened to execute the operating system boot process, while the remaining cores are temporarily dormant. The awakened core can be the first processor core.

[0102] Optionally, after power-on, the system will first execute a preset core scheduling strategy (boot strategy), that is, a processor core of the processor executes the core scheduling strategy. The core scheduling strategy can be stored in the RAM or Norflash (non-volatile flash memory) on the SOC chip. The scheduling strategy can be flexibly configured according to different design requirements. Its main functions include: specifying the initial processing resources (processor cores) required to run different operating systems, and determining the boot process of heterogeneous operating systems. Chip power-on can refer to power-on at the SOC chip level.

[0103] Optionally, the chip can be a BMC (Baseboard Management Controller, a management control chip in a server platform) chip, which refers to a SOC chip based on an ARM multi-core architecture that integrates a variety of peripheral hardware IPs (Intelligent Peripheral). The BMC chip is placed on the motherboard (server motherboard), and chip power-on refers to power-on at the SOC chip level.

[0104] After the first processor core wakes up, the first operating system can be booted and run on the first processor core through the boot loader: Yes, the first operating system can be booted and started on the first processor core by the first processor core through the boot loader. The boot loader (BootLoader) program can be located on a computer or other computer application. It refers to a program used to load the operating system, for example, an inherent program in the BootRom. The inherent program refers to the code that boots the operating system and belongs to the BootLoader program. The BootRom is a small mask ROM (Read-Only Memory) or write-protected flash memory embedded in the processor chip on the CPU chip.

[0105] Through this embodiment, in the initial startup phase, the boot loader is used to guide the operating system to start on the processor core corresponding to the operating system, which can improve the success rate of the operating system startup and prepare for the real-time operation phase.

[0106] In an exemplary embodiment, controlling a hardware controller of a target device via a first bus by a first operating system running on a first processor core of a processor includes:

[0107] S21, executing a first control task of a first operating system on a first processor core, wherein the first control task is used to control a hardware controller;

[0108] S22, reading sensor data of a designated sensor corresponding to the target device through the first processor core;

[0109] S23: Sending a device control instruction to the hardware controller via the first bus according to the sensor data of the designated sensor through the first control task, so that the hardware controller controls the operating state of the target device according to the device control instruction.

[0110] In this embodiment, the operating system controls the hardware controller of the target device by a control task (service) on the processor core running the operating system. The control task herein may refer to a corresponding control task. For the hardware controller of the target device, a first control task (first control process) of the first operating system may be executed on the first processor core, and the hardware controller may be controlled by the first control task.

[0111] The control of the hardware controller can be based on the sensor data of the sensor. For different target devices, the parameters that affect their operation may be different, and correspondingly, the sensor data that needs to be obtained may also be different. For the target device, it can be a device that runs after the chip is powered on, and the sensor corresponding to it is the designated sensor. There can be many types of designated sensors, which may include but are not limited to at least one of the following: temperature sensor, humidity sensor, noise sensor, etc. Since the first control task runs on the first processor core, the sensor data of the designated sensor can be read by the first processor core. The sensor data of the designated sensor can be stored in the storage space within the designated sensor, and can be transmitted from the designated sensor to the designated storage space. In this embodiment, there is no limitation on the reading location of the sensor data of the designated sensor.

[0112] The sensor data read from the designated sensor may be sensor data within a time period, all sensor data since the target device was started, or sensor data that meets other time constraints. After acquiring the sensor data from the designated sensor, the first control task may control the operating state of the target device based on the sensor data from the designated sensor. Controlling the operating state of the target device may be achieved by sending a device control instruction to a hardware controller of the target device via the first control task, so that the hardware controller controls the operating state of the target device in accordance with the device control instruction.

[0113] Optionally, the first control task can determine an expected operating state of the target device based on sensor data from a designated sensor; if the current operating state of the target device differs from the expected operating state, the device control instruction can be generated, which can control the operating state of the target device to be adjusted to the expected operating state. The device control instruction can be sent to a hardware controller of the target device via a first bus. The first bus is similar to that in the previous embodiment and is not further described here.

[0114] Through this embodiment, by reading the sensor data of the designated sensor and controlling the target device according to the sensor data, the operating state of the target device is controlled, thereby improving resource utilization.

[0115] In an exemplary embodiment, sending a device control instruction to a hardware controller via a first bus according to sensor data of a designated sensor by a first control task includes:

[0116] S31, determining a target parameter value of a device operating parameter of a target device according to sensor data of a designated sensor through a first control task, wherein the device operating parameter is a parameter for controlling an operating state of the target device;

[0117] S32: Sending the device control instruction carrying the target parameter value to the hardware controller via the first bus through the first control task.

[0118] In this embodiment, the first control task can determine the expected operating state of the target device based on sensor data from a designated sensor. The expected operating state can be represented by a parameter value of a device operating parameter. The device operating parameter can be a parameter that controls the operating state of the target device. The corresponding device operating parameter can be different for different types of devices. For example, for a fan, the corresponding device operating parameter can be the rotational speed, while for other types of devices, the device operating parameter can be other operating parameters. The expected operating state can correspond to a target parameter value of the device operating parameter of the target device.

[0119] After determining the target parameter value of the device operating parameter of the target device, the target parameter value can be carried in the above-mentioned device control instruction, that is, the device control instruction carrying the target parameter value is sent to the hardware controller through the first control task. The method of sending the device control instruction to the hardware controller can be similar to that in the aforementioned embodiment and will not be repeated here.

[0120] Through this embodiment, the parameter value of the device operating parameter of the target device is determined based on the sensor data, and the determined parameter value is carried in the device control instruction, which can improve the accuracy of device control.

[0121] In an exemplary embodiment, determining a target parameter value of a device operating parameter of a target device according to sensor data of a designated sensor by a first control task includes:

[0122] S41 : When the target device is a fan, determine a target parameter value of a fan operating parameter of the fan according to sensor data of a designated sensor through a first control task.

[0123] In this embodiment, the target device may be a fan, which may be used to dissipate heat from a server or other device, i.e., a cooling fan. In this case, the device operating parameter may be a fan operating parameter. The fan operating parameter may include one or more parameters, including but not limited to at least one of the following: rotation speed, rotation cycle, cycle switching time, and other operating parameters. This is not limited in this embodiment.

[0124] Correspondingly, determining the target parameter value of the device operating parameter of the target device based on the sensor data of the designated sensor by the first control task may include determining the target parameter value of the fan operating parameter of the fan by the first control task based on the sensor data of the designated sensor. After obtaining the target parameter value, the first control task sends a device control instruction carrying the target parameter value to the hardware controller of the fan via the first bus, thereby controlling the operating state of the fan.

[0125] Through this embodiment, by controlling the operating status of the fan, the operating status of the fan can be quickly controlled in scenarios such as system power-on, system restart, or other scenarios, thereby improving the timeliness of fan control.

[0126] In an exemplary embodiment, when the target device is a fan, determining, by a first control task, a target parameter value of a fan operating parameter of the fan based on sensor data of a designated sensor includes:

[0127] S51, when the target device is a fan and the designated sensor is a temperature sensor, determining a target speed value of the fan according to sensor data of the temperature sensor through a first control task, wherein the fan speed is positively correlated with the temperature detected by the temperature sensor.

[0128] For scenarios where the target device is a fan, the designated sensor can be a temperature sensor. The number of temperature sensors can be one or more, and the location of the temperature sensors can be configured as needed, with different temperature sensors being placed in different locations. Optionally, the sensor data of the temperature sensor represents the temperature detected by the temperature sensor. In this regard, the first control task can determine a target speed value for the fan based on the sensor data of the temperature sensor. Here, the fan speed is positively correlated with the temperature detected by the temperature sensor.

[0129] If there are multiple temperature sensors, the highest temperature detected by the multiple temperature sensors can be determined based on the sensor data from each temperature sensor. The fan speed can then be determined based on the highest temperature detected by the multiple temperature sensors. This ensures safe device operation compared to determining the fan speed based on the average temperature detected by the multiple temperature sensors. For scenarios with multiple fans, the speed of each fan can also be determined based on the highest or average temperature detected by the temperature sensor that matches each fan.

[0130] For example, the first operating system (for example, RTOS system) can be used to replace the CPLD, EC chip, custom chip and other processing units to control the fan speed (BMC fan control can be performed in real time). When the system is just powered on, the first processor core (for example, CPU0, the first processor core can be awakened by hardware), the first processor core runs the boot loader (for example, the specified program in BootRom), loads the first operating system to start, and the first processor core will read various temperature-related sensor data to perform fan control (for example, fan speed control), completely simulating the above-mentioned processing unit to complete the fan regulation function. When performing fan speed control, the first operating system can calculate the PWM value according to the temperature sensor, and then adjust the fan speed. In the above manner, the fan speed can be controlled by the first operating system during the startup of the second operating system.

[0131] For example, the hardware of the fan controller is shown in Figure 3. The multi-core processor includes CPU0 to CPUN. The multi-core processor normally runs the system's business programs. Since the Linux system runs more system business programs, the number of CPU cores initially allocated is relatively large: the core initially allocated to the RTOS system is CPU0, and the cores initially allocated to the Linux system are CPU1 to CPUN. When the system is just powered on, CPU0 is awakened, CPU0 runs the specified program in the BootRom, and loads the RTOS system to start. CPU0 reads various temperature-related sensor data through the IIC (Inter-Integrated Circuit) and controls the speed of the brushed fan (or brushless fan) through the brush controller (or brushless controller). The relationship between the first bus, the second bus and the IIC can be: the first bus can be a bus subordinate to the second bus, the IIC can be a bus subordinate to the first bus, and a bus subordinate to a bus can refer to a bus connected to the bus.

[0132] According to this embodiment, the operating system running on the processor core is used instead of an additional processing unit to control the fan speed, which can reduce the system operation cost while ensuring the controllability of the fan.

[0133] In an exemplary embodiment, booting a second operating system on a second processor core of a processor includes:

[0134] S61, executing the secondary program loader by the first processor core, so that the secondary program loader wakes up the second processor core;

[0135] S62: Run the universal boot loader of the second operating system through the second processor core to guide the second operating system to start on the first processor core.

[0136] In this embodiment, when the operating system is started, the Second Program Loader (SPL) can be loaded into the internal memory, for example, the Static Random-Access Memory (SRAM) inside the SOC, and the SPL can be responsible for loading the Universal Boot Loader (U-Boot) into the Random-Access Memory (RAM). The Second Program Loader can boot the second operating system and can also boot the first operating system.

[0137] For the second operating system, the second program loader can be executed by the first processor core to wake up the second processor core through the second program loader; the second processor core can run the universal boot loader (universal boot loader) of the second operating system, thereby guiding the second operating system to start on the first processor core. Here, the boot program of the second operating system is loaded by the second program loader, and the boot program of the second operating system may include the universal boot loader.

[0138] It's important to note that the second-stage program loader is the code executed by the first stage of the universal boot loader. It is responsible for transferring the second-stage code of the universal boot loader to system RAM (also known as off-chip memory) for execution. The universal boot loader is open source software licensed under the GPL (General Public License) and can be considered a bare-metal synthesis example.

[0139] For example, after the system is powered on, the processor will first wake up the CPU0 core so that the RTOS system can run as quickly as possible; then use the program in BootRom to boot the RTOS system; during the startup of the RTOS system, it will continue to load U-Boot through SPL, and U-Boot will boot the second operating system on CPU1 until the Linux system starts normally.

[0140] It should be noted that Boot Rom is the internal ROM program of a chip (for example, a SoC chip) and is the boot code of uboot. Boot Rom reads the startup information of the hardware (for example, the DIP switch settings) and reads the uboot-spl code (i.e., SPL) from the specified startup medium (for example, SD, MMC, etc.). SPL is mainly responsible for initializing the external RAM and environment and loading the actual uboot image into the external RAM for execution. The external RAM can be DDR (Double Data Rate Synchronous Dynamic Random-Access Memory) or other RAM.

[0141] Through this embodiment, the second processor core is awakened by the secondary program loader, and then the second processor core runs the universal boot loader to boot the second operating system on the corresponding processor core, which can improve the convenience and success rate of operating system startup.

[0142] As an optional example, the following explains the startup process of a multi-core dual system by taking an RTOS system and a Linux system as examples.

[0143] In order to take over fan management as quickly as possible, the RTOS system can be started as soon as possible. After the Linux system is started, the Linux system takes over the control of the fans. As shown in Figure 4, the startup process of the multi-core dual system may include the following steps:

[0144] Step 1: Wake up CPU0 when the system is just powered on.

[0145] Step 2: CPU0 runs the specified program in BootRom and loads the RTOS system to start;

[0146] Step 3: During the RTOS system startup process, wake up CPU1 to boot u-boot and start the fan control program (FanCtrl_RTOS_APP) in the first operating system;

[0147] Step 4: CPU1 boots u-boot, which may include the SPL stage and the Uboot stage, and enters the SPL stage by calling SPL;

[0148] Step 5: In the SPL stage, SPL guides Uboot to start;

[0149] Step 6: In the Uboot stage, the Linux kernel (CPU1 to CPUN) is loaded, and the BMC service program and the fan control program (FanCtrl_Linux_APP) in the second operating system are started.

[0150] Through this optional example, during the dual-system startup and operation process, the fan is controlled by first starting the RTOS system, and after the Linux system is started, the second operating system takes over the control of the fan. This can ensure that the fan is quickly controlled when the system is powered on, thereby improving the efficiency of fan control.

[0151] In an exemplary embodiment, taking over the hardware controller via the first bus by the second operating system includes:

[0152] S71, sending a first inter-core interrupt to the first operating system via the second bus through the second operating system, wherein the first inter-core interrupt is used to request the second operating system to take over the hardware controller;

[0153] S72, upon receiving a second inter-core interrupt returned by the first operating system in response to the first inter-core interrupt, indicating consent for the second operating system to take over the hardware controller, the hardware controller is controlled via the first bus by the second control task of the second operating system, wherein the second control task is used to control the hardware controller.

[0154] In this embodiment, the control of the target device can be transferred between different operating systems through inter-core interrupts. For example, SGI (Software Generated Interrupt, which is an inter-core interrupt in the Linux system) can be used. One operating system can send an inter-core interrupt to another operating system through IPI (Inter-Processor Interrupt) to request to take over the hardware controller of the target device, thereby obtaining control of the target device. Here, here, unlike common peripheral interrupts, IPI is an interrupt triggered between multiple cores in the SOC. Some interrupt numbers are specially reserved in the core for IPI. For example, in the ARM64 architecture, the reserved interrupt numbers are 16 interrupt numbers 0-15.

[0155] When the second operating system needs to take over the hardware controller of the target device, it can send a first inter-core interrupt to the first operating system to request that the second operating system take over the hardware controller. The first inter-core interrupt can be sent via the second bus. After receiving the first inter-core interrupt, the first operating system can determine whether the second operating system is currently allowed to take over the hardware controller. If so, the first operating system can return a second inter-core interrupt to the second operating system, indicating that it agrees to allow the second operating system to take over the hardware controller.

[0156] After receiving the second inter-core interrupt, the second operating system may control the hardware controller through a second control task. The second control task is used to control the hardware controller, and the second control task may control the hardware controller via the first bus. The second control task may be created before sending the first inter-core interrupt or after receiving the second inter-core interrupt, which is not limited in this embodiment.

[0157] For example, after the Linux system is started, CPU1 starts to send IPI interrupts to CPU0 to request control of the fan.

[0158] According to this embodiment, the control right of the target device is transferred between different operating systems through inter-core interrupts, which can improve the reliability of device control.

[0159] In an exemplary embodiment, after the second operating system sends the first inter-core interrupt to the first operating system via the second bus, the method further includes:

[0160] S81, in response to the acquired first inter-core interrupt, controlling a third control task of the first operating system to hibernate, wherein the third control task is used to control the hardware controller;

[0161] S82: When the third control task has been dormant, send a second inter-core interrupt to the second operating system via the first operating system via the second bus.

[0162] In this embodiment, for the first operating system, the task that controls the hardware controller of the target device is the third control task, which can be the aforementioned first control task. The logic for controlling the hardware controller is similar to that in the aforementioned embodiment. After receiving the first inter-core interrupt, the first operating system can control the third control task to hibernate, thereby avoiding a situation where both operating systems have control tasks controlling the hardware controller, leading to device control confusion.

[0163] After the third control task has been dormant (ie, the third control task is in a dormant state), the first operating system may send the second inter-core interrupt to the second operating system. The second inter-core interrupt may be sent via the second bus.

[0164] For example, the RTOS system receives an IPI interrupt sent by CPU1, and then begins to hibernate related services on the RTOS system one after another. When the related services on the RTOS system are completely dormant, CPU0 sends an IPI interrupt to CPU1, notifying CPU1 that it can obtain control of the fan.

[0165] Through this embodiment, based on the received inter-core interrupt, the corresponding control task can be put into sleep mode, and after the corresponding control task is put into sleep mode, the device control right can be transferred through the inter-core interrupt, thereby improving the reliability of device control.

[0166] In an exemplary embodiment, the method further includes:

[0167] S91 , when the third control task has been dormant, push system running data of the first operating system into a stack, wherein the second inter-core interrupt is further used to instruct the second operating system to take over the first processor core.

[0168] In this embodiment, when the second operating system is unable to control the operating state of the target device, the first operating system can temporarily control the operating state of the target device. In this case, the tasks running in the first operating system are all tasks related to controlling the operating state of the target device, such as the third control task. If the second operating system is able to control the operating state of the target device, then if the third control task has gone dormant, it is possible that no service processes are running in the first operating system, and the first processor core is not being effectively utilized.

[0169] For example, during the startup of the Linux system, the fan control rights are in the RTOS system. After Linux starts normally, the fan control rights will be taken over from the RTOS system. At this time, no business processes are running on the RTOS system, and the CPU0 core resources are not effectively utilized.

[0170] In this embodiment, a resource recovery mechanism for the processor core (e.g., CPU0) of the first operating system can be employed. When the third control task is dormant, the first operating system's context can be saved, i.e., the first operating system's system running data can be pushed onto a stack. Simultaneously, a second inter-core interrupt can be used to instruct the second operating system to take over the first processor core.

[0171] For example, a resource recovery mechanism for the CPU0 core can be used. After the Linux system is fully booted (booted on CPU1…CPUN), the RTOS system transfers fan control to the Linux system for control, releasing the CPU0 core for scheduling by the Linux system: CPU0 puts the RTOS system to sleep, releases all current services, pushes running data into the stack, and adds itself to the queue of the Linux operating system, allowing the Linux system to schedule resources, thereby achieving the goal of improving CPU core resource utilization. For the Linux system, after the Linux system takes over fan control, it can put the RTOS system to sleep, releasing the CPU0 core, and recovering the CPU0 core so that the Linux system can schedule the CPU0 core normally, so that all CPU cores serve the Linux system, saving resources and improving CPU core resource utilization.

[0172] Through this embodiment, a processor core resource recovery mechanism is adopted. After the second operating system takes over the control of the target device, the data of the first operating system running on the processor core of the first operating system is pushed into the stack, and the processor core of the first operating system is released to the second operating system, which can improve the resource utilization of the processor core.

[0173] As an optional example, the following uses an RTOS system and a Linux system as examples to explain the process of exchanging fan control rights through inter-core interrupts.

[0174] As shown in Figure 5, after the Linux system triggers the interrupt requesting to take over fan control, the FanCtrl_RTOS_APP process completes the processing, and the RTOS system pushes the system operation data into the stack, and then returns to agree to take over the interrupt of fan control. The Linux system takes over the CPU0 core and assigns the FanCtrl_Linux_APP process to the CPU0 core or other CPU cores of the Linux system according to the scheduling balancing algorithm.

[0175] Through this optional example, fan control rights are exchanged through inter-core interrupts, which can improve the convenience of information exchange and the reliability of device control.

[0176] In an exemplary embodiment, after the second operating system takes over the hardware controller via the first bus, the method further includes:

[0177] S101, when the second operating system is to be restarted, waking up the first operating system via the second bus by the second operating system, and taking over the hardware controller via the first bus by the first operating system to take over control of the target device;

[0178] S102: Control the second operating system to reboot the system.

[0179] In this embodiment, when a system needs to be restarted due to reasons such as a system crash or receiving a reboot command, the second operating system can first wake up the first operating system, and the first operating system can take over the hardware controller to take over control of the target device. Waking up the first operating system can be performed via the second bus, and the first operating system can take over the hardware controller via the first bus.

[0180] Through this embodiment, when the second operating system is restarted, the reliability of device control can be improved by waking up the first operating system to take over the control right of the target device.

[0181] In an exemplary embodiment, when the second operating system is to be restarted, waking up the first operating system via the second bus by the second operating system includes:

[0182] S111 , when the second operating system is to be restarted, initiate a system wake-up interrupt to the first operating system via the second bus through the second operating system, wherein the system wake-up interrupt is used to wake up the first operating system.

[0183] In this embodiment, waking up the first operating system can be achieved through an inter-core interrupt. If the second operating system is to be restarted (for example, the system crashes, receives a reboot command), the second operating system can initiate a system wake-up interrupt to the first operating system to wake up the first operating system. The system wake-up interrupt can be an active wake-up interrupt. After the first operating system takes over the hardware controller, it can control the second operating system to restart the system. After the second operating system restarts, it can take over the hardware controller again. The process of taking over the hardware controller is similar to that in the previous embodiment and will not be repeated here.

[0184] For example, as shown in FIG6 , in the fan control workflow, when the Linux system restarts (crash, reboot command), an active wake-up interrupt is initiated. The fan control process after the Linux system restarts may include the following steps:

[0185] Step S602: The Linux system is restarted due to reasons such as system crash or receiving a reboot command.

[0186] Step S604: The Linux system triggers an active wake-up interrupt;

[0187] Step S606: Wake up the RTOS system, and the RTOS system takes over the fan control right.

[0188] Step S608: Execute the Linux system restart process.

[0189] According to this embodiment, the operating system is actively awakened through inter-core interrupts, which can improve the convenience and reliability of operating system awakening.

[0190] The startup control method of the embedded system in the embodiment of the present application is explained below with reference to an optional example. In this optional example, the first operating system is an RTOS system, the second operating system is a Linux system, and the target device is a fan.

[0191] This optional example provides a solution for real-time fan control of a multi-core dual-system. As shown in FIG7 , the process of the startup control method of the embedded system in this optional example may include the following steps:

[0192] Step 1: During the T0-T1 phase, the system starts to power on, CPU0 is awakened by the hardware, and begins to execute the RTOS system code. At the same time, CPU1 is awakened to allow CPU1 to participate in the u-boot startup process.

[0193] Step 2: Starting at time T1, the awakened CPU1 begins executing the u-boot code, initializing some hardware-related data and booting the Linux operating system. At the same time, the fan control-related tasks on the RTOS system on CPU0 continue to run until time T5.

[0194] Step 3: At time T2, the Linux operating system starts to boot;

[0195] Step 4: At T3, the Linux system is started and CPU1 starts sending IPI interrupts to CPU0 to request control of the fan and to instruct CPU0 to stop RTOS system-related services and then run Linux system-related service codes.

[0196] Step 5: Starting from time T4, the RTOS system receives the IPI interrupt sent by CPU1, and then starts to hibernate the related services on the RTOS system one after another. When the related services on the RTOS system are completely dormant, CPU0 sends an IPI interrupt to CPU1, notifying CPU1 that it can obtain control of the fan and that CPU0 can participate in the business operation on the Linux system side.

[0197] Among them, starting from time T5, CPU0 is recycled to the Linux system side, and the entire system will change to the multi-core single system operation mode, running all subsequent codes normally.

[0198] Through this optional example, a CPU core is reused to replace the hardware to control the fan, thereby improving the resource utilization of the CPU core. At the same time, no additional cost is required and it also has good scalability.

[0199] In an exemplary embodiment, operating services and processing resources may be allocated to each operating system in the following manner, but not limited to:

[0200] Allocating a group of to-be-allocated services to corresponding operating systems in the embedded system according to a dynamic resource allocation rule, wherein the dynamic resource allocation rule includes dynamically allocating resources based on at least one of the following: service response speed, service resource occupancy rate, service coupling degree, and service importance, and the embedded system includes a first operating system and a second operating system;

[0201] Determining a resource allocation result corresponding to the set of to-be-allocated services, wherein the resource allocation result is used to indicate a processing resource corresponding to each to-be-allocated service in the set of to-be-allocated services among processing resources of a processor, the processing resources of the processor including a processor core;

[0202] The processing resources of the processor are allocated to the first operating system and the second operating system according to the operating system corresponding to each to-be-allocated service and the resource allocation result.

[0203] During the operation of the processor, a set of services to be allocated can be obtained, that is, services to be allocated to the first operating system and the second operating system. Since different services to be allocated may differ in terms of response speed, service resource occupancy rate, service coupling with other services, service importance, etc., resource dynamic allocation rules can be pre-configured. The resource dynamic allocation rules may include rules for performing service allocation, allocating services to corresponding operating systems so that the processing resources of the corresponding operating systems can execute the services allocated to themselves. Optionally, the resource dynamic allocation rules may include dynamically allocating resources based on at least one of the following: service response speed, service resource occupancy rate, service coupling degree, service importance. Different allocation rules may have corresponding priorities. For example, the priorities are in the following order from high to low: service importance, service coupling degree, service response speed, service resource occupancy rate. According to the source dynamic allocation rules, a set of services to be allocated (or tasks to be allocated, different services to be allocated may correspond to different processes) can be allocated to the corresponding operating systems in the embedded system to obtain service allocation results.

[0204] Alternatively, based on the response time constraint, the first operating system can be an operating system with clear, fixed time constraints. All processing (task scheduling) must be completed within these fixed time constraints, otherwise the system will fail. This can be a real-time operating system, such as FreeRTOS, RTLinux, or other real-time operating systems in embedded systems. The second operating system does not have this feature. It generally uses a fair task scheduling algorithm. When the number of threads / processes increases, CPU time needs to be shared, and task debugging is uncertain. This can be called a non-real-time operating system, such as Contiki, HeliOS, Linux, or other non-real-time operating systems in embedded systems.

[0205] Correspondingly, the business assigned to the first operating system is usually a real-time business. A real-time business refers to a business that needs to be scheduled within a specified time. The business requires the processor to process it at a fast enough speed, and the processing results can control the production process or respond quickly to the processing system within the specified time. As a typical scenario, the control of a robot arm in industrial control is a real-time business. The system needs to take timely measures before detecting an erroneous operation of the robot arm, otherwise serious consequences may result. The business assigned to the second operating system is usually a non-real-time business. A non-real-time business refers to a business that is not sensitive to scheduling time and has a certain tolerance for scheduling delays, for example, reading sensor data from a temperature sensor in a server.

[0206] It should be noted that a real-time operating system is an operating system that can accept and process external events or data at a fast enough speed when they occur, and the processing results can control the production process or respond quickly to the processing system within the specified time, dispatch all available resources to complete real-time business, and control the coordinated operation of all real-time businesses. It has the characteristics of timely response and high reliability.

[0207] Optionally, allocating the set of pending services to the corresponding operating systems can be performed by a service management module. As shown in FIG8 , the service management module can be a software module running on the first operating system or the second operating system. For example, the service management module running on the second operating system can be implemented by software in a Linux system. The service management module can allocate the set of pending services to the corresponding operating systems in the embedded system according to dynamic resource allocation rules.

[0208] After each to-be-allocated service is assigned to a corresponding operating system, corresponding processing resources can be allocated to each to-be-allocated service based on the service allocation results, resulting in a resource allocation result corresponding to a group of to-be-allocated services. When allocating processing resources to the to-be-allocated services, services assigned to a first operating system can be allocated the processing resources of the first operating system, while services assigned to a second operating system can be allocated the processing resources of the second operating system. Furthermore, considering load balancing, if unallocated processing resources exist, some services can be allocated the unallocated processing resources.

[0209] The processing resources of the processor can be dynamically allocated in units of time slices. Taking into account the frequent switching of the operating systems to which the processing resources belong and the fact that the business processing time is not necessarily an integer multiple of the time slice, which leads to the extension of the response time of some businesses, the processing resources can be allocated to the first operating system and the second operating system in units of processor cores. That is, the processor cores of the processor are allocated to the corresponding operating systems in units of the entire processor core. The number of processor cores allocated to each operating system is an integer, and the processor cores allocated to different operating systems are different.

[0210] Optionally, determining the resource allocation result corresponding to a group of services to be allocated can be performed by a resource dynamic allocation module. As shown in Figure 8, the resource dynamic allocation module can be a software module running on the first operating system or the second operating system. Taking running on the second operating system as an example, the resource dynamic allocation module can be implemented by a software module in the second operating system, which can dynamically allocate processing resources for the service based on the output of the service management module. Here, the software module can be a program module with preset functions. For example, for the resource dynamic allocation module, it can be a program module with a resource dynamic allocation function. For the service management module, it can be a program module with a service management function. Each software module can be deployed and adjusted as a whole, and can be applied in different application projects.

[0211] Based on the operating system corresponding to each to-be-allocated service and the resource allocation result, the processing resources of the processor can be allocated to the first operating system and the second operating system. Optionally, the unallocated processing resources of the processor can be allocated to the corresponding operating system. The unallocated processing resources can be determined based on the correspondence between the unallocated processing resources and the to-be-allocated services, and the correspondence between the to-be-allocated services and the operating systems.

[0212] Optionally, as shown in FIG8 , allocating the processor's processing resources to the first operating system and the second operating system can be performed by a resource adaptive scheduling module (e.g., a core adaptive scheduling module). The resource adaptive scheduling module can be a software module running on the first operating system or the second operating system. Taking running on the second operating system as an example, the resource adaptive scheduling module can be implemented by software in a Linux system. It can perform the actual scheduling of the processor's processing resources (e.g., processor hard core resources) based on the output of the service management module and the output of the dynamic resource allocation module. For example, after resource scheduling by the core resource adaptive module, M cores out of (M+N) cores are scheduled to the real-time operating system, and N cores are scheduled to the non-real-time operating system.

[0213] For example, heterogeneous operating systems (heterogeneous operating systems) can be run on different cores of the same processor, enabling the entire processor system to process both real-time and non-real-time services in parallel. Furthermore, by adaptively adjusting the processor core resources (e.g., processor cores) occupied by different operating systems, processor resource utilization can be significantly improved. Here, heterogeneity refers to the different types of operating systems running on the same multi-core processor in an embedded system, and multi-system refers to the number of operating systems running on the same multi-core processor in an embedded system, and these operating systems run simultaneously in the time dimension.

[0214] Optionally, the above process further includes: generating a rule structure by reading a rule configuration file, wherein the rule structure is used to record the resource dynamic allocation rule.

[0215] Dynamic resource allocation rules can be configured based on a rule configuration file. By reading the rule configuration file, a rule structure for recording dynamic resource allocation rules can be generated. Here, the rule configuration file can be a load balancing policy file (payload_balance.config). The load balancing policy file can be used to configure the classification method of various running services (or processes), the evaluation principle of the real-time level, etc. The dynamic resource allocation rules can be configured with different parameters in the load balancing policy file. An example of a load balancing policy configuration file is as follows:

[0216] classificationkinds=2 / / A value of 1 means that processes are classified according to attributes such as important and non-important. Otherwise, processes are classified according to the preset classification method (such as real-time and non-real-time);

[0217] real-time grade evaluation = 2 / / A value of 1 indicates that the average CPU usage in the past statistical minutes is used as the process real-time grade evaluation principle; otherwise, the preset priority is used as the process real-time grade evaluation principle;

[0218] statistic minutes = 5 / / represents the statistical time (in minutes) for the average occupancy of each process. This value is valid when real-time grade evaluation is 1.

[0219] Optionally, the dynamic resource allocation rules can be stored in a load balancing policy module. Here, the load balancing policy module can be a software module running under the first operating system or the second operating system (for example, a software module running under the Linux system), which can provide policy guidance for the service management module, including classification methods for various services (or processes) running in the system, evaluation principles for real-time levels, etc. The service management module can divide and manage the services in the system according to the real-time level, and further guide the resource adaptive scheduling module to reallocate processor resources. Exemplarily, it can perform actual classification of services based on the output of the load balancing policy module and generate a list containing real-time services and non-real-time services.

[0220] It should be noted that the above classification methods and real-time performance evaluation principles are open-ended, allowing users to customize their own methods or principles. The rules underlying service management in the service management module can be dynamically configured, allowing for the addition of additional rules based on existing rules. The service management module can configure multiple rules with the same functionality without conflicts between them. Specifically, rule selection criteria, such as the time of configuration and priority, can be used to determine which rule is currently in use among rules with the same function, thus avoiding conflicts between rules. The load_balance.config configuration file describes one possible scenario. In the configuration file, the classification_kinds variable indicates the specific classification criteria (e.g., service importance or real-time performance) and the classification category (e.g., critical services vs. general services, real-time services vs. non-real-time services), while the real-time_grade_evaluation variable indicates the real-time performance evaluation criteria (e.g., average CPU usage over the past statistic_minutes or a preset service priority). The real-time performance grade type is user-defined and can be defined as high, normal, or low, or further subdivided.

[0221] The output of the load balancing strategy module is the configured classification method, real-time level evaluation principle, etc. When implemented in software, it can be a specific configuration file (such as the load_balance.config file) or a structure variable. These files or structure variables can eventually be accessed by the business management module to obtain the specific load balancing strategy.

[0222] Through this embodiment, by reading the rule configuration file, a rule structure is generated to record the resource dynamic allocation rule, which can improve the convenience of information configuration.

[0223] Optionally, the above process also includes: obtaining a rule update configuration file through the external interface of the second operating system, wherein the rule update configuration file is used to update the configured resource dynamic allocation rules; using the rule update configuration file to update the rule structure to update the resource dynamic allocation rules recorded in the rule structure.

[0224] The rule structure can be in a fixed format, meaning it cannot be modified while the embedded system is running, or it can be in a flexibly configurable format, meaning it can be modified via a configuration file in a specific format. In this embodiment, a rule update configuration file can be obtained, which is used to update the configured dynamic resource allocation rules. Using the rule update configuration file, the rule structure can be updated, thereby updating the dynamic resource allocation rules recorded in the rule structure.

[0225] When using a rule update configuration file to update a rule structure, you can directly generate a new rule structure based on the rule update configuration file and use the newly generated rule structure to replace the existing rule structure, or you can use the parameter values ​​of the rule parameters indicated by the rule update configuration file to update the parameter values ​​of the corresponding rule parameters in the rule structure.

[0226] Optionally, the configuration file in a specific format can be read through the external interface of the first operating system or the second operating system. Considering the volume of services to be processed, dynamic resource scheduling of the embedded system can be primarily handled by the second operating system. When obtaining the rule update configuration file, the rule update configuration file can be obtained through the external interface of the second operating system.

[0227] For example, the load balancing policy module may be in a fixed format or may be configured through an external interface of the Linux system. For example, a configuration file (load_balance.config) in a specific format as described above may be defined, and configuration changes may be made through file reading and writing.

[0228] It should be noted that the external interface refers to the multi-core processor's external interface and can be a network interface, an SPI (Serial Peripheral Interface) controller interface, a UART serial port, or any other means of accessing data from the outside world. The hardware used to read files and the specific file locations vary depending on the implementation. For example, a network interface can be used to load configuration files from the World Wide Web (WWW) interface; an SPI controller can be used to read configuration files from the board's SPI Flash; and a UART serial port can be used to retrieve configuration files from serial data transceiver software on another PC (Personal Computer).

[0229] Through this embodiment, by obtaining a rule update configuration file and using the obtained rule update configuration file to update the rule structure, the flexibility of resource dynamic allocation rule configuration can be improved.

[0230] Optionally, a group of to-be-allocated services can be allocated to corresponding operating systems in an embedded system according to dynamic resource allocation rules in the following manner, but is not limited to: a group of to-be-allocated services whose service response speed requirements are greater than or equal to a set response speed threshold are allocated to a first operating system, and a group of to-be-allocated services whose service response speed requirements are less than a set response speed threshold are allocated to a second operating system.

[0231] When allocating pending services, the services can be assigned to corresponding operating systems based on their response speed requirements. Service response speed can be used to assess the real-time performance of a service. The higher the service response speed requirement, the more sensitive it is to the operating system's scheduling time and response speed. Services with high response speed requirements require the operating system to process them quickly enough, and their processing results must be sufficient to control the production process or respond quickly to the processing system within the specified timeframe. Services with lower response speed requirements, on the other hand, have a certain tolerance for scheduling delays.

[0232] For the services to be allocated whose service response speed requirement is greater than or equal to the set response speed threshold, they are sensitive to the scheduling time and response speed of the operating system, and such services to be allocated can be allocated to the first operating system (for example, real-time services are allocated to the real-time operating system). For the services to be allocated whose service response speed requirement is less than the set response speed threshold, they are not sensitive to the response speed and scheduling time, and therefore, such services to be allocated can be allocated to the second operating system (for example, non-real-time services are allocated to the non-real-time operating system). Here, the service response speed requirement can be indicated by an indication parameter of the service response speed, and the set response speed threshold can be a millisecond-level response speed threshold or a second-level response speed threshold, for example, 100ms, 200ms, 1s, etc. There is no limitation on the set response speed threshold in this embodiment.

[0233] Optionally, when a group of to-be-allocated services are allocated to corresponding operating systems in an embedded system, a first service list corresponding to the first operating system and a second service list corresponding to the second operating system can be output. The first service list is used to record the services allocated to the first operating system, and the second service list is used to record the services allocated to the second operating system. That is, the service allocation result includes the first service list and the second service list. The output first service list and the second service list can be used to perform a dynamic scheduling process of the processor's processing resources.

[0234] For example, the real-time level of system services is classified to obtain a list of real-time services and non-real-time services. Assume that there are 20 services in total, of which real-time services are services 1 and 2, and non-real-time services are services 3 to 20.

[0235] Here, the business management module can classify the currently pending businesses. When the BMC system first runs, since all the businesses currently to be run are known to the system, the business management module classifies these businesses based on the output of the load balancing module. After classification, different businesses will be assigned to different operating systems (RTOS system and Linux system) for execution. During subsequent operations, if the number of business processes changes (for example, some processes hang or new processes are started), the business management module will continue to divide the businesses, dividing and managing existing businesses in real time according to the load balancing strategy. The business management module can be a resident process in the Linux system. It is always running and manages and divides the currently running processes.

[0236] Through this embodiment, by allocating the services to be allocated to the corresponding operating systems according to the service response speed requirements, the timeliness of the service response for the services that are sensitive to the scheduling time can be guaranteed.

[0237] Optionally, a group of to-be-allocated services can be allocated to corresponding operating systems in an embedded system according to dynamic resource allocation rules in the following manner, but is not limited to: allocating to-be-allocated services whose service resource occupancy rate in a group of to-be-allocated services is less than a first occupancy rate threshold to a first operating system, and allocating to-be-allocated services whose service resource occupancy rate in a group of to-be-allocated services is greater than or equal to the first occupancy rate threshold to a second operating system.

[0238] When allocating pending services, the pending services can be allocated to the corresponding operating system based on the service resource occupancy rate of the pending services. The service resource occupancy rate can be the average proportion of the service to the processing resources per unit time (for example, the CPU occupancy rate per minute). The level of the service resource occupancy rate affects the response speed of the service and the response speed of subsequent services. Therefore, the real-time level of the service can be evaluated based on the service resource occupancy rate. The higher the service resource occupancy rate, the greater the impact on the scheduling time and response speed of the operating system, and the lower the real-time level. For services with low service resource occupancy rates, the impact on the scheduling time and response speed of the operating system is not significant, and the real-time level is higher.

[0239] For services to be allocated whose service resource occupancy rate is less than the first occupancy rate threshold, their impact on the scheduling time and response speed of the operating system is not significant, and such services to be allocated can be allocated to the first operating system. For services to be allocated whose service resource occupancy rate is greater than or equal to the first occupancy rate threshold, their impact on the scheduling time and response speed of the operating system is greater, and therefore such services to be allocated can be allocated to the second operating system. Here, the first occupancy rate threshold can be configured as needed, and can be 10%, 15%, 20% or other thresholds. At the same time, the first occupancy rate threshold can be dynamically adjusted.

[0240] Through this embodiment, by allocating the services to be allocated to the corresponding operating systems according to the service resource occupancy rates, it is possible to ensure timeliness of response to services with low service resource occupancy rates.

[0241] Optionally, a group of services to be allocated may be allocated to corresponding operating systems in the embedded system according to a dynamic resource allocation rule in at least one of the following ways, but not limited to:

[0242] Allocating to-be-allocated services, among a group of to-be-allocated services, whose service coupling degree with services already allocated to the first operating system is greater than or equal to a first coupling degree threshold, to the first operating system;

[0243] To-be-allocated services whose service coupling degree with services already allocated to the second operating system is greater than or equal to a second coupling degree threshold in a group of to-be-allocated services are allocated to the second operating system.

[0244] When allocating pending services, the services can be assigned to corresponding operating systems based on their business coupling. Business coupling indicates the degree of correlation between the pending services and the already allocated services in each operating system. If a pending service has a high business coupling with an already allocated service in one operating system, it is not appropriate to allocate it to another operating system. Therefore, the pending services can be allocated to corresponding operating systems based on their business coupling with the already allocated services in each operating system.

[0245] Optionally, the business coupling degree can be evaluated by the association between the input and output of the business. The business coupling degree can be represented by different coupling degree levels. If there is no relationship between the input and output of the business, the coupling degree level is low (or other coupling degree levels indicating that there is no association between the businesses). If the execution of a business depends on the output of another application (the business cannot start without the output as input), the coupling degree level between the businesses is high. If the execution of a business uses the output of another application, but the output does not hinder the normal execution of the business (the output can be obtained when the business executes the corresponding operation, and the corresponding operation is not a core operation), the coupling degree level between the businesses is medium. In addition, the business coupling degree can also be represented by a numerical value. The business coupling degree can be evaluated by one or more coupling degree conditions (for example, the association relationship between input and output), and the numerical value corresponding to the satisfied coupling degree condition is determined as the numerical value of the business coupling degree.

[0246] If there is a business to be allocated in a group of businesses to be allocated whose business coupling degree with the allocated business of the first operating system is greater than or equal to the first coupling degree threshold, then such business to be allocated can be allocated to the first operating system. If there is a business to be allocated in a group of businesses to be allocated whose business coupling degree with the allocated business of the second operating system is greater than or equal to the first coupling degree threshold, then such business to be allocated can be allocated to the second operating system.

[0247] For example, in addition to generating a list of real-time services and a list of non-real-time services, the service management module is also responsible for service decoupling evaluation and management, that is, finding out from all real-time services which can be independently handed over to the real-time operating system for running, so that the hardware resource dynamic allocation module can reallocate processor resources. For services that cannot be independently handed over to the real-time operating system for running, if they have a high degree of service coupling with non-real-time services, they can be allocated to the non-real-time operating system.

[0248] Here, some services, while requiring real-time performance, frequently interact with other non-real-time services in the system (i.e., they are highly coupled). To improve overall data interaction efficiency, these services are assigned to the non-real-time operating system. However, some real-time services are relatively independent and can simply be assigned to the real-time operating system. This process is known as "decoupling." There are various criteria for determining service decoupling; they can be based on the closeness of the relationships between the aforementioned services or other user-related metrics.

[0249] The reallocation strategy is open. One possible strategy is: when the system runs for the first time, processor cores are allocated according to the ratio of the number of services allocated to the real-time operating system and the non-real-time operating system by the service management module. During subsequent operation, resource allocation is adjusted according to the core resource occupancy rate of each system in the dual system. From this perspective, the reallocation process and the core preemption and release process are mutually coordinated processes.

[0250] Through this embodiment, by allocating the services to be allocated to the corresponding operating systems according to the service coupling degrees, the accuracy of service processing for multiple services with high service coupling degrees can be guaranteed.

[0251] Optionally, a group of services to be allocated may be allocated to corresponding operating systems in the embedded system according to a dynamic resource allocation rule in the following manner, but is not limited to:

[0252] Allocating a group of to-be-allocated services containing sensitive information to a target operating system, wherein the target operating system is an operating system of the first operating system and the second operating system that interacts less frequently with a user object.

[0253] In this embodiment, for the to-be-assigned business containing sensitive data (for example, sensitive information such as passwords) (which may be an important sensitive business, such as a business that is not desired to be exposed to users), it can be assigned to the target operating system, and the to-be-assigned business containing sensitive information is isolated by the target operating system at a hard-core level of security protection. Here, the target operating system is the operating system with a low frequency of interaction with the user object between the first operating system and the second operating system, or the operating system with a fast response speed, for example, the first operating system.

[0254] For example, the business processing module is responsible for further isolating the system business at the hard-core level of security protection, that is, dividing important sensitive businesses (which do not want to be exposed to users) into real-time businesses, and ultimately achieving the unloading of these businesses from non-real-time operating systems to real-time operating systems, thereby achieving the effect of security protection. Here, the different businesses divided by the business processing module can be organized in the form of structures during software implementation. By designing the security space between heterogeneous operating systems, sensitive businesses are unloaded from non-real-time operating systems to real-time operating systems, achieving the purpose of hard-core level security protection. Here, sensitive businesses refer to: security-related businesses, such as user passwords, identity information, and other businesses involving user personal privacy.

[0255] Here, the hard-core level refers to the isolation of services at the processor core level. Specifically, sensitive services are assigned to the real-time operating system (RTOSs occupy different cores than non-RTOSs, so this is considered core-level isolation). Compared to non-RTOSs, RTOSs interact with users less frequently and to a lesser degree, making it difficult for users to "detect" sensitive data generated by services running on them. For upper-layer applications, services such as user identity authentication management and secure encryption are considered these critical sensitive services. These services are forcibly classified as real-time services through the service management module. Subsequent dynamic allocation of hardware resources allows these services to run on the RTOS, achieving a secure isolation effect.

[0256] Through this embodiment, by allocating the to-be-assigned business containing sensitive information to an operating system with a low frequency of user interaction, the system business can be isolated for hard-core security protection, thereby improving the security of business execution.

[0257] Optionally, the resource allocation result corresponding to a group of services to be allocated may be determined in the following manner, but is not limited to:

[0258] According to the allocation results of a group of services to be allocated and combined with the resource utilization of the processing resources of the first operating system and the resource utilization of the processing resources of the second operating system, a resource mapping table of a group of services to be allocated and the processing resources of the processor is generated.

[0259] In this embodiment, the allocation results for a set of pending services are used to indicate the correspondence between the pending services and operating systems. A pending service assigned to an operating system is typically executed using the processing resources of that operating system. However, if the volume of services assigned to a particular operating system is excessive and there are currently unallocated processing resources, the unallocated processing resources may be allocated to the pending services assigned to that operating system. Therefore, based on the allocation results for a set of pending services, combined with the resource utilization of the processing resources of the first operating system and the resource utilization of the processing resources of the second operating system, a resource mapping table can be generated between a set of pending services and the processing resources of the processor, indicating the processing resources allocated to each pending service.

[0260] Here, each service to be assigned is mapped to only one processor core, while the same processor core can be mapped to multiple services. Different services can be mapped to the same processor core by occupying different time slices of the same processor core. At any given time, the same processor core is occupied by only one service, meaning it is used to execute only one service. Different services assigned to an operating system can determine the time slices they occupy on the same processor resource based on the allocation time, service response speed requirements, or other methods.

[0261] For example, the dynamic resource allocation module dynamically adjusts processor resources based on the output of the service management module, creating a resource mapping table between different services and actual hardware resources. This optimizes the deployment structure of different hardware resources under heterogeneous operating systems to improve overall system hardware resource utilization. This dynamic resource allocation process is managed and configured by software in the second operating system.

[0262] Taking an eight-core processor (core 1 to core 8) as an example, the processor cores scheduled to the first operating system include: core 1, and the processor cores scheduled to the second operating system include: core 2, core 3 and core 4. There are 6 services to be allocated, real-time services are services 1 and 2, and non-real-time services are services 3 to 6. Corresponding processor cores are allocated to the 6 services, core 1 is allocated to service 1, core 5 is allocated to service 2, core 2 is allocated to service 3, core 3 is allocated to service 4, core 4 is allocated to service 5, and core 6 is allocated to service 6.

[0263] Through this embodiment, based on the correspondence between services and operating systems, and in combination with the usage of processing resources of different operating systems, dynamic allocation of processing resources is performed, thereby ensuring the rationality of processing resource allocation.

[0264] Optionally, the processing resources of the processor can be allocated to the first operating system and the second operating system according to the operating system corresponding to each to-be-allocated business and the resource allocation result in the following manner, but not limited to: when it is determined according to the resource allocation result that there is a corresponding to-be-allocated business among the unallocated processing resources of the processor, the unallocated processing resources are allocated to the operating system to which the to-be-allocated business corresponding to the unallocated processing resources is allocated.

[0265] When allocating processing resources, if there is a corresponding to-be-allocated business for the unallocated processing resources in the processor's processing resources, that is, the unallocated processing resources are allocated to the to-be-allocated business, the unallocated processing resources can be allocated to the operating system to which the to-be-allocated business corresponding to the unallocated processing resources is allocated.

[0266] Optionally, the resource adaptive scheduling module can perform actual scheduling of the processor's processing resources based on the results of the dynamic allocation of hardware resources. The resource adaptive scheduling module schedules a portion of the processor cores, such as the M cores in core group 1, to execute services assigned to the first operating system, and schedules the remaining processor cores, such as the N cores in core group 2, to execute services assigned to the second operating system.

[0267] Taking the aforementioned eight-core processor as an example, based on the service allocation and resource allocation results, unassigned core 4 can be assigned to the first operating system, and unassigned cores 5 and 6 can be assigned to the Linux system. The entire scheduling process can be led by the second operating system.

[0268] Through this embodiment, unallocated processor resources are scheduled to the corresponding operating system based on the resource allocation result, which can improve the utilization rate of the processor resources.

[0269] In an exemplary embodiment, in an optional implementation, a method for inter-core communication is provided. The method includes the following steps:

[0270] Step 1: The first operating system sends target data (which may be service data) to a target virtual channel (which may be storage space) in the processor memory.

[0271] Optionally, the target data is data to be sent, the target virtual channel is a free storage space in the memory, and the first operating system sending the target data to the target virtual channel in the processor memory means that the CPU core of the first operating system writes the data to be sent into the target virtual channel.

[0272] Step 2: The first operating system sends an interrupt notification message (which may be the aforementioned inter-core interrupt request) to the second operating system. Optionally, the CPU core of the first operating system sends an interrupt notification message to the CPU core of the second operating system. The interrupt notification message may carry the address of the target virtual channel, which is used to notify the second operating system to obtain target data from the target virtual channel. The interrupt notification message may be triggered by software or hardware.

[0273] In step 3, the second operating system responds to the interrupt notification message and retrieves the target data from the target virtual channel in memory. Optionally, the CPU core of the second operating system responds to the interrupt notification message, parses the address of the target virtual channel from the interrupt notification message, locates the target virtual channel in memory based on the parsed address, and retrieves the target data from the target virtual channel, thereby enabling data exchange between the first operating system and the second operating system.

[0274] Through the above steps, when multiple operating systems running on the processor need to transmit data to each other, the first operating system sending the data sends the target data to the target virtual channel in the processor memory, and sends an interrupt notification message to the second operating system. The second operating system receiving the data responds to the interrupt notification message to obtain the target data from the target virtual channel, which solves the problem of waste of resources and strong dependence on the operating system in the inter-core communication process, and achieves the effect of reducing the waste of resources and dependence on the operating system in the inter-core communication process.

[0275] In an exemplary embodiment, the memory includes a data storage area and a metadata storage area. The data storage area is divided into multiple storage units, each storage unit is used to store business data, and the metadata storage area is used to store the size and occupancy status of each storage unit in the data storage area.

[0276] Optionally, the target virtual channel is composed of one or more storage units in the data storage area, and the metadata storage area can be divided into storage slices with the same number as the storage units. Each storage slice is used to record the size and occupied status of a storage unit. The size of the storage unit can be represented by the first address and the last address of the storage unit, or by the first address and the length of the storage unit. The occupied status includes the occupied state and the unoccupied state, and can be represented by the value of the idle flag.

[0277] In an exemplary embodiment, the first operating system sends target data to a target virtual channel in the processor memory, including: the first operating system reads records in the metadata storage area, determines at least one storage unit in the data storage area that is in an idle state and has a total space greater than or equal to the length of the target data based on the read records, and obtains the target virtual channel; sets the state of at least one storage unit corresponding to the target virtual channel in the metadata storage area to an occupied state, and stores the target data in the target virtual channel.

[0278] It should be noted that in order to ensure that the target data can be written continuously into the memory, the target virtual channel to be written needs to be idle and have storage space that is greater than or equal to the length of the target data. Since the memory is divided into a metadata storage area and a data storage area, the occupancy status of each storage unit recorded in the metadata storage area can be read to find the idle storage unit that can meet the data storage requirements.

[0279] For example, the size of each storage unit is equal. If the length of the target data is greater than the length of a storage space, the number of required storage units is determined based on the length of the target data, and multiple storage units that are idle, continuous, and meet the data storage requirements are found to form a target virtual channel.

[0280] For another example, each storage unit is of equal size, and the data storage area has pre-combined the storage units to obtain multiple virtual channels of different sizes. Each virtual channel is composed of one or more storage units. The occupancy status of each virtual channel recorded in the metadata storage area can be read to find the virtual channel that is in an idle state and has a length greater than the length of the target data, that is, the target virtual channel. It should be noted that when the system software needs to apply for shared memory space, it will determine whether the length of the data to be applied for is greater than the maximum length of the data stored in the virtual channel. If it is greater than the maximum length of the data stored in the virtual channel, the system software can send the data to be sent in multiple times to ensure that the length of the data sent each time is less than or equal to the maximum length of the data stored in the virtual channel, thereby ensuring smooth communication.

[0281] In an exemplary embodiment, the second operating system responds to the interrupt notification message and obtains target data from the target virtual channel in the memory, including: the second operating system reads a record in the metadata storage area, determines the target virtual channel based on the read record; obtains the target data from at least one storage unit corresponding to the target virtual channel, and sets the state of the at least one storage unit to an idle state.

[0282] That is, after extracting target data from the storage unit corresponding to the target virtual channel, the second operating system sets the state of the storage unit corresponding to the target virtual channel to an idle state in order not to affect the use of the target virtual channel by other systems or tasks.

[0283] In an exemplary embodiment, the first operating system sends target data to a target virtual channel in a processor memory, including: a driver layer of the first operating system receives the target data, determines a virtual channel in an idle state in the memory, and obtains the target virtual channel; sets the state of the target virtual channel to an occupied state, and stores the target data in the target virtual channel.

[0284] Optionally, both the real-time operating system and the non-real-time operating system have a driver layer. After the driver layer receives the target data to be sent, it calls the interface to search for the target virtual channel in the memory. To avoid other systems applying to use the target virtual channel during the data writing process, after finding the target virtual channel, the state of the target virtual channel is set to occupied, and then the target data is written to the target virtual channel.

[0285] In an exemplary embodiment, when the first operating system includes an application layer, the application layer is provided with a human-computer interaction interface. Before the driver layer of the first operating system determines a virtual channel in an idle state in the memory, the application layer of the first operating system can receive the data to be sent input by the user through the human-computer exchange interface, encapsulate the data to be sent in a preset format, obtain the target data, and call the data write function to pass the target data to the driver layer through the preset communication interface, wherein the preset communication interface is provided on the driver layer.

[0286] Optionally, the application layer fills the data to be sent according to the preset format to obtain the target data, and then generates a device file ipidev in the system's / dev path. When the application layer needs to read and write data from the driver layer, it can first use the system's own open function to open the device file / dev / ipidev, and then use the system's own write function to send the target data from the application layer to the driver layer. The driver layer then places the data in the target virtual channel in the shared memory, and then triggers an interrupt to notify the second operating system to fetch the data.

[0287] In an exemplary embodiment, the second operating system responds to the interrupt notification message and obtains target data from the target virtual channel in the memory, including: the second operating system triggers an interrupt processing function based on the interrupt notification message, determines the target virtual channel from the memory through the interrupt processing function, and obtains the target data from the target virtual channel.

[0288] In an exemplary embodiment, determining the target virtual channel from the memory through the interrupt processing function and obtaining target data from the target virtual channel includes: calling the target task through the interrupt processing function, and having the target task determine the target virtual channel from the memory and obtain target data from the target virtual channel.

[0289] Optionally, the interrupt processing function sends a task notification to wake up the target task responsible for data extraction. The target task first searches for the target virtual channel in the shared memory by calling the interface, and then reads the target data from the target virtual channel and performs data parsing.

[0290] In an exemplary embodiment, when the second operating system includes an application layer, a function identifier is stored in the memory, the function identifier indicates a target function, and a target virtual channel is determined from the memory through an interrupt processing function, and target data is obtained from the target virtual channel, including: determining the function identifier and the target virtual channel from the memory through the interrupt processing function, and sending the address information of the target virtual channel to a target application matched by the function identifier, wherein the target application is a target application in the application layer; the target application calls a data reading function to pass the address information to the driver layer through a preset communication interface, the driver layer obtains the target data from the target virtual channel, and passes the target data to the target application layer program, wherein the preset communication interface is set in the driver layer, and the target application processes the target data according to the processing function matched by the function identifier to execute the target function.

[0291] Optionally, after the second application system receives the interrupt notification message, the application layer calls the corresponding interrupt handling function to search the target virtual channel from the memory, obtains the address information of the target virtual channel, and then generates a device file ipidev in the system's / dev path. When the application layer needs to read and write data from the driver layer, it can first use the system's own open function to open the device file / dev / ipidev, and then use the system's own read function to read the target data in the target virtual channel. That is, the driver layer finds the corresponding target data in the shared memory according to the address information of the target virtual channel, and returns the target data and the length of the target data to the application layer. In an exemplary embodiment, the state of the target virtual channel is set to idle.

[0292] It should be noted that different applications in the application layer can use the target data to implement different functions. Function identifiers are stored in the memory to indicate the target functions implemented by the application through the target data. Optionally, the function identifier can be Net or Cmd. When the system is initialized, Net, Cmd and the application PID will be registered to the driver. The driver layer can find the PID of the application based on the received NetFn and Cmd, and send the data to the corresponding application based on the PID.

[0293] For example, if NetFn=1 and Cmd=1, the first and second operating systems send "hello word" messages to each other. At system startup, an array is initialized with three columns: NetFn in the first column, Cmd in the second column, and the corresponding processing functions for NetFn and Cmd in the third column, denoted as xxCmdHandler. For example, when the second operating system receives a message from the first operating system, it obtains NetFn and Cmd from the message, determines that NetFn=1 and Cmd=1, and executes the processing function HelloCmdHandler corresponding to "hello word" to complete the corresponding function.

[0294] In an exemplary embodiment, a data storage area includes multiple memory channels, each memory channel is composed of one or more storage units, a metadata storage area stores multiple records, each record is used to record metadata of a memory channel, and the metadata of each memory channel includes at least a channel ID of the memory channel, the size of the memory channel, and the occupied status of the memory channel. A first operating system reads the records in the metadata storage area, and determines at least one storage unit in the data storage area that is in an idle state and has a total space greater than or equal to the length of the target data based on the read records. Obtaining the target virtual channel includes: traversing the records stored in the metadata storage area, and determining whether there is a first target record indicating that the memory channel is in an idle state and the size of the memory channel is greater than or equal to the length of the target data; if the first target record exists, determining the memory channel indicated by the channel ID recorded in the first target record as the target virtual channel.

[0295] It should be noted that the data storage area can be divided into n virtual memory channels, and the size of each memory channel can be different. That is, the sizes of the n virtual channels are 20*m, 21*m, 22*m, 23*m...2n-1*m, where m is the size of a storage unit. The following structure is set as metadata to manage the memory channels:

[0296] typedef struct{

[0297] uint32_t Flag;

[0298] uint16_t ChannelId;

[0299] uint8_t SrcId;

[0300] uint8_t NetFn;

[0301] uint8_t Cmd;

[0302] uint32_t Len;

[0303] uint32_t ChannelSize;

[0304] uint8_t* pData;

[0305] uint8_t CheckSum;

[0306] }IpiHeader_T

[0307] Among them, uint32_t Flag represents the status of the memory channel. For example, 0xA5A5A5A5 indicates that this channel is not empty, otherwise it is empty; uint16_t ChannelId represents the channel ID; uint8_t SrcId represents the source CPU ID, which is the CPU that writes data to the memory channel; uint8_t NetFn and uint8_t Cmd are function parameters; uint32_t Len is the length of the data stored in the memory channel; uint32_t ChannelSize represents the size of the memory channel; uint8_t *pData is the starting address of the memory channel; uint8_t CheckSum is a checksum. When the first operating system needs to send data, it calculates a checksum value for the sent data using a checksum algorithm and sends the checksum value to the second operating system. When the second operating system receives the data and the checksum value, it calculates a checksum value based on the received data using the same checksum algorithm and compares the calculated checksum value with the received checksum value. If they are consistent, the received data is valid. If they are inconsistent, the received data is invalid. Each virtual memory channel corresponds to a structure record, which is stored at the beginning of the shared memory in ascending order of channel ID. These structure records are initialized after the system is powered on. The initialization Flag is 0, indicating that the channel is empty. The initialization ChannelId is 0, 1, 2...n-1 in sequence. The initialization ChannelSize is the size of the corresponding virtual memory channel, and the initialization pData points to the first address of the corresponding virtual memory channel.

[0308] In an exemplary embodiment, when determining the target virtual channel, the first operating system uses the interface GetEmptyChannel to search for a virtual channel that meets the following two conditions in all memory channels based on the size of the target data to be sent: the idle flag Flag in the channel structure IpiHeader is not equal to 0xA5A5A5A5 (that is, the channel is in an idle state), and the channel size ChannelSize in the channel structure IpiHeader is greater than or equal to the size of the target data (that is, the memory size can meet the storage requirements of the target data). After finding the target virtual channel that meets the above conditions, the state of the channel is set to non-empty, that is, the idle flag Flag in the channel structure IpiHeader is set to 0xA5A5A5A5, and then the target data is copied to the target virtual channel.

[0309] In an exemplary embodiment, when a memory channel is occupied, the metadata of the memory channel also includes the ID of the source CPU core of the target data and the ID of the destination CPU core of the target data. The second operating system reads the records in the metadata storage area, and determines the target virtual channel based on the read records, including: traversing the records stored in the metadata storage area, and judging whether there is a second target record, wherein the second target record indicates that the memory channel is in an occupied state, and the ID of the destination CPU core is the ID of the CUP core of the second operating system, and the ID of the source CPU core is not the ID of the CUP core of the second operating system; when the second target record exists, the memory channel indicated by the channel ID recorded in the second target record is determined as the target virtual channel.

[0310] That is, the target virtual channel is a virtual channel among all channels that meets the following three conditions: first, the idle flag Flag in the channel structure IpiHeader is equal to 0xA5A5A5A5 (that is, indicating that the channel is occupied); second, the TargetId in the channel structure is equal to the ID of the current CPU (that is, indicating that the destination CUP of the target data is the CPU of the second operating system); third, the TargetId in the channel structure is not equal to SrcId (that is, indicating that the target data is not sent by the CPU of the second operating system).

[0311] It should be noted that if a 1-bit idle flag is used, 0 indicates channel empty, and 1 indicates channel not empty, if the flag is originally 0 and then suddenly changes to 1, the system will believe the channel is not empty after reading the flag, resulting in communication anomalies. In this embodiment, the idle flag is set to a multi-bit special character, for example, 0xA5A5A5A5. Since the probability of multiple bits simultaneously changing to special characters is much lower than the probability of a single bit changing, this prevents storage medium bit changes from affecting the flag value, thereby improving communication security.

[0312] In an exemplary embodiment, a metadata storage area stores a state mapping table, wherein the state mapping table contains multiple records, each record being used to record the occupied status of a storage unit. A first operating system reads the records in the metadata storage area, and determines, based on the read records, at least one storage unit in the data storage area that is in an idle state and whose total space is greater than or equal to the length of the target data, to obtain a target virtual channel, comprising: determining a preset number of storage units to be occupied by the target data; scanning each record in sequence from an initial position in the state mapping table; when a preset number of consecutive target records are scanned, determining the consecutive storage units indicated by the preset number of target records, wherein the target records indicate that the storage unit is in an idle state; and determining the consecutive storage units as the target virtual channel.

[0313] It should be noted that in order to facilitate data storage and retrieval, since the operating system needs to occupy continuous storage units in the memory when transferring business data, it is necessary to first determine the number of storage units in the memory request instruction. Since the memory space of each storage unit is the same, the preset number of continuous storage units required can be calculated according to the required memory space size, which is recorded as numb.

[0314] Optionally, the first operating system traverses the records from the index position in the state mapping table, where the index position may be the starting position of the state mapping table. Starting from the starting position of the state mapping table, each record of the state mapping table is queried in turn to determine whether there are continuous records of free memory pages greater than or equal to numb. If there are records that meet the above conditions, the continuous storage unit in the processor is determined through the correspondence between the record and the memory page, and the continuous storage unit is determined as the target virtual channel to write data to the target virtual channel.

[0315] In an exemplary embodiment, the interrupt notification message includes the starting address and a preset number of continuous storage units, the second operating system reads the records in the metadata storage area, and determines the target virtual channel based on the read records, including: scanning each record in sequence from the initial position of the status mapping table; when the starting address of the continuous storage unit is scanned, the storage unit indicated by the scanned address and the preset number of continuous storage units minus one are determined as the target virtual channel.

[0316] Optionally, the continuous storage unit refers to a number of continuous storage units equal to numb, and each record in the status mapping table also records the first address of the corresponding storage unit. When the second operating system scans a record of the first address of a number of continuous storage units equal to numb in the mapping table, it indicates that the first address of the target virtual channel has been scanned. The storage unit indicated by the first address and the numb-1 continuous storage units after the storage unit constitute the target virtual channel. The second operating system obtains data from the target virtual channel to complete data interaction with the first operating system.

[0317] In an exemplary embodiment, the scanned continuous target records are recorded by a counter. In the process of scanning each record in sequence from the initial position of the state mapping table according to the number of storage units, when the target record is currently scanned, the control counter is increased by one, and when the non-target record is currently scanned, the control counter is cleared.

[0318] Optionally, the relationship between the value of the counter and the number of required storage units is used to determine whether there are a preset number of continuous target records, that is, whether there are a preset number of continuous storage units. Optionally, the count of the counter is recorded as cntr. If a scanned storage unit is empty, cntr is added by 1. If the scanned storage unit is not empty, the accumulated number of continuous and idle storage units cntr is cleared, and the search for continuous and idle storage units starts from the address after the storage unit; until cntr is equal to numb, it means that continuous and idle storage units that meet the memory requirements have been found; if after scanning the entire state mapping table, there is no cntr greater than or equal to numb, it indicates that this dynamic memory application has failed and the preset number of continuous storage units does not exist.

[0319] In an exemplary embodiment, before the first operating system reads records in the metadata storage area and determines, based on the read records, at least one storage unit in the data storage area that is in an idle state and has a total space greater than or equal to the length of the target data, and obtains the target virtual channel, the method further includes: the first operating system sends a memory request instruction and performs a locking operation on the processor's memory, wherein the memory request instruction is used to request the use of the processor's memory; and when the memory is successfully locked, reads the records in the status mapping table.

[0320] Optionally, the memory request instruction is an instruction issued by the operating system running on the processor to request the use of the processor's memory. It should be noted that in order to prevent application conflicts caused by multiple operating systems applying to use the processor's memory at the same time, when the operating system sends the memory request instruction, it first performs a locking operation on the processor's memory. Only when the locking is successful can the memory be applied for. The locking operation refers to an exclusive operation of memory application. After the current operating system successfully locks, if the lock is not released, other servers do not have the right to apply for the use of the processor's memory.

[0321] In an exemplary embodiment, performing a locking operation on the memory of a processor includes: determining whether the memory is currently in a locked state, wherein the locked state indicates that the memory is in a state where it is requested for use; if the memory is not currently in a locked state, performing a locking operation on the memory; if the memory is currently in a locked state, determining that locking the memory has failed, and applying to lock the memory of the processor again after a preset time, until the memory is successfully locked, or until the number of lock applications is greater than a preset number.

[0322] Before the processor runs, the metadata storage area and the data storage area in the processor need to be initialized. Optionally, the records stored in the state mapping table in the metadata storage area are initialized, and the memory management information is initialized.

[0323] Before applying for memory, configure the memory management information as follows:

[0324] typedef struct{

[0325] uint32_t MemReady;

[0326] uint32_t MemLock;

[0327] }MallocMemInfo_T;

[0328] Among them, the member variable MemLock of the structure MallocMemInfo_T indicates whether the shared memory has been initialized. The variable MemReady is 0xA5A5A5A5, indicating that the initialization operation is completed and the memory can be dynamically allocated and released normally. The member variable MemReady of the structure MallocMemInfo_T indicates whether it is locked.

[0329] Alternatively, if the variable MemLock is read as 0, it indicates that no system or task is currently requesting memory, meaning the memory is not currently locked. If the variable MemLock is read as 0xA5A5A5A5, it indicates that a system or task is currently requesting memory and needs to wait until the current request is completed before retrying. The current lock request has failed.

[0330] In an exemplary embodiment, if a lock fails during a memory lock operation, the memory lock is applied again after waiting for a preset time until the lock is successful. For example, the preset time may be 100 microseconds.

[0331] In one exemplary embodiment, if a lock request fails and the number of repeated requests exceeds a preset number, indicating that the memory in the processor is unallocatable during the current time period, the request is terminated. For example, the preset number of times may be three. If the number of lock requests exceeds three, a message indicating that the current memory is unavailable may be returned to the operating system that sent the request.

[0332] Optionally, after a target virtual channel exists in the memory space of the processor for use by the first operating system, the first operating system stores the target data to be transmitted in the corresponding target virtual channel. In an exemplary embodiment, the occupancy status of the processor's memory space is updated according to the data writing status of the first operating system, that is, the target continuous memory space is changed from an unoccupied state to an occupied state. At the same time, in order to allow other systems or tasks to apply for memory, the lock on the memory is released.

[0333] In an exemplary embodiment, the method further includes: releasing the lock on the memory when a preset number of consecutive target records are not scanned.

[0334] Optionally, after scanning the records in the status mapping table, no preset number of continuous storage units in the idle state are detected, indicating that there is not enough space memory pages in the processor's memory for the first operating system to use. This dynamic memory application fails and the memory lock is released.

[0335] In an exemplary embodiment, an interrupt notification message is sent to the second operating system via a software interrupt. Optionally, sending the interrupt notification message to the second operating system via a software interrupt includes: writing an interrupt number and an ID of a CPU core of the second operating system into a preset register of a processor, and generating the interrupt notification message based on the interrupt number and the ID of the CPU core of the second operating system.

[0336] Optionally, a soft interrupt is a software-generated interrupt. Software can send an interrupt to its own CPU core or to other CPU cores. The default register can be the GICD_SGIR register. Software can write the SGI (Software Generated Interrupts) interrupt number and the destination CPU ID to the GICD_SGIR register to generate a software interrupt. The SGI interrupt number is a soft interrupt number reserved for inter-core communication.

[0337] In a multi-core heterogeneous operating system, to maximize compatibility with current resource allocation methods, interrupts 8 to 15 (a total of 8 interrupts) are used to represent the inter-core interrupt vector table. When the first operating system is an RTOS operating system and the second operating system is a Linux operating system, a feasible allocation scheme for the vector table is shown in Table 1:

[0338] Table 1

[0339] Optionally, a hardware interrupt refers to an interrupt generated by a hardware device, which can be a private peripheral interrupt or a shared peripheral interrupt. It should be noted that a hard interrupt is an interrupt introduced by hardware outside the CPU and is random. A soft interrupt is an interrupt introduced by software running in the CPU executing an interrupt instruction and is pre-set. This embodiment does not limit the method of generating an interrupt notification message.

[0340] In an optional embodiment, a method for sharing memory is provided. The method comprises the following steps:

[0341] Step 1: Receive a memory application instruction and perform a locking operation on the processor's memory, wherein the memory application instruction is used to apply for use of the processor's memory.

[0342] Optionally, the memory request instruction is an instruction issued by the operating system running on the processor to request the use of the processor's memory, which may be sent by the first operating system. It should be noted that in order to prevent application conflicts caused by multiple operating systems applying to use the processor's memory at the same time, when the operating system sends the memory request instruction, it first performs a locking operation on the processor's memory. Only when the locking is successful can the memory be applied for. The locking operation refers to an exclusive operation of memory application. After the current operating system successfully locks, if the lock is not released, other servers do not have the right to apply for the use of the processor's memory.

[0343] In the shared memory method provided in an embodiment of the present application, before performing a locking operation on the memory of the processor, the method also includes: determining whether the memory is currently in a locked state, wherein the locked state indicates that the memory is in a state where it is requested for use; and if the memory is not currently in a locked state, performing a locking operation on the memory.

[0344] Optionally, since multiple systems or multiple tasks will cause application conflicts when applying for memory use at the same time, the processor's memory can only be locked by one system or task in the same time period. Therefore, the current operating system can only perform a locking operation on the memory when it detects that the current memory is not in a locked state.

[0345] Optionally, whether the memory is in a locked state is determined by determining whether the preset variable stored in the memory is a preset value. If the preset variable is not a preset parameter value, it indicates that the memory is not in a locked state and no other system or task is applying for memory space, and the locking is successful; otherwise, if the preset variable is a preset parameter, it indicates that the memory is in a locked state at the current moment, and there are other systems or tasks other than the operating system applying for memory space, and the locking fails.

[0346] In the shared memory method, after determining whether the memory is currently in a locked state, it also includes: if the memory is currently in a locked state, determining that locking the memory has failed; if locking the memory has failed, applying to lock the processor's memory again after a preset time period until the memory is successfully locked, or until the number of lock applications is greater than a preset number.

[0347] Optionally, if locking fails during the memory locking operation, the memory locking is applied for again after waiting for a preset time until the locking is successful. For example, the preset time may be 100 microseconds.

[0348] In one exemplary embodiment, if a lock request fails and the number of repeated requests exceeds a preset number, indicating that the memory in the processor is unallocatable during the current time period, the request is terminated. For example, the preset number of times may be three. If the number of lock requests exceeds three, a message indicating that the current memory is unavailable may be returned to the operating system that sent the request.

[0349] Step 2, when the memory is locked successfully, read the memory occupied status, and determine whether there is free target memory space in the memory according to the memory occupied status, wherein the size of the target memory space is greater than or equal to the size of the memory requested by the memory request instruction.

[0350] After successfully applying for a lock, the operating system applies for memory in the processor. Optionally, based on the memory request instruction issued by the operating system, the operating system scans information recording the memory usage status to determine whether the target memory space exists. In other words, it determines whether there is unoccupied, continuous memory space in the processor that can meet the memory usage requirement. Meeting the memory usage requirement means that the size of the memory space is greater than or equal to the memory size requested by the operating system. In one exemplary embodiment, the determination result is obtained by determining whether the size of the unoccupied, continuous memory space is greater than or equal to the memory size requested by the operating system.

[0351] It should be noted that discontinuous memory space can also be used when applying for memory. A pointer can be added after a non-minimum memory block to point to the next minimum memory block obtained by the application. At the same time, when reading and writing data, data can be read and written across data blocks based on the storage address and pointer. This embodiment does not limit the form of the target memory space.

[0352] In step 3, if the target memory space exists in the memory, the address information of the target memory space is fed back to the sender of the memory request instruction, the memory occupation status is updated, and the memory lock is released. Here, the sender refers to the operating system (e.g., the first operating system) that sends the memory request instruction. It should be noted that since the operating system sends and receives data through shared memory during inter-core communication and uses the address returned by the requested memory to access data during the data transmission and reception process, it is necessary to determine the address information of the requested memory space.

[0353] Optionally, after there is a target memory space available for the operating system in the processor's memory space (which may be indicated by the above judgment result), the address information of the target continuous space is sent to the operating system, and the operating system stores the data to be transferred in the corresponding memory space according to the address information.

[0354] In an exemplary embodiment, the occupancy status of the processor's memory space is updated according to the data writing status of the operating system, that is, the target memory space is changed from an unoccupied state to an occupied state, and the locking operation before the dynamic memory application is released so that other operating systems can apply to use the processor's memory space.

[0355] The above steps can solve the problems of low efficiency, poor flexibility and excessive dependence on the operating system of shared memory among multiple cores, thereby improving the flexibility and efficiency of shared memory and reducing dependence on the operating system.

[0356] In the shared memory method, the memory includes a metadata storage area and a data storage area, the data storage area is used to store business data, the metadata storage area stores a state mapping table, the state mapping table is used to record the occupied state of the data storage area, reading the occupied state of the memory and judging whether there is free target memory space in the memory according to the occupied state of the memory, including: reading the records in the state mapping table from the metadata storage area, and judging whether there is target memory space in the data storage area according to the records in the state mapping table.

[0357] The occupied state of the memory is queried by querying the records in the state mapping table. Optionally, the metadata storage area stored in the processor is obtained, and the state mapping table in the metadata storage area is identified. By traversing the records in the state mapping table, the occupied state of the data storage area is read to determine whether there is continuous, idle memory space in the data storage area that meets the memory usage requirements.

[0358] In the shared memory method provided in an embodiment of the present application, a data storage area is composed of multiple memory pages, a status mapping table contains multiple records, each record is used to record the occupied status of a memory page, the records in the status mapping table are read from the metadata storage area, and whether there is a target memory space in the data storage area is judged according to the records in the status mapping table, including: determining a preset number of memory pages requested by the memory request instruction; scanning each record in sequence from the initial position of the status mapping table; when a continuous preset number of target records are scanned, determining that there is a target memory space in the memory, wherein the target record indicates that the memory page is in an idle state.

[0359] It should be noted that the data storage area is divided into multiple allocation units according to the same memory size, and each allocation unit is recorded as a memory page. For example, the memory space of the data storage area is A bytes, and the divided allocation unit is B bytes. Then the data storage area contains a total of A / B memory pages. The records in the status mapping table are also memory page records. Each memory page record is used to record the occupied status of a memory page. The number of memory page records in the status mapping table is the same as the number of memory pages in the data storage area.

[0360] Figure 9 is a schematic diagram of the relationship between the status mapping table and memory pages in the shared memory method according to an embodiment of the present application. As shown in Figure 9, the data storage area is a dynamically allocated memory block area, and the metadata storage area includes a dynamically allocated memory mapping table area, wherein the mapping table area is divided into the same number of records according to the number of memory pages divided into the data storage area, and the records are recorded as memory page records, and all memory page records are combined into a status mapping table. There is a one-to-one correspondence between all memory page records in the status mapping table and all memory pages in the data storage area. Each memory page record represents the allocation status of the corresponding memory page, that is, whether the memory page is occupied.

[0361] Optionally, since the business data for collaboration with the operating system needs to occupy consecutive memory pages in the processor, it is necessary to first determine the preset number of memory pages in the memory request instruction. Since the memory space of each memory page is the same, the preset number of required consecutive memory pages can be calculated based on the required memory space size, which is recorded as numb.

[0362] In an exemplary embodiment, after obtaining the state mapping table in the metadata storage area of ​​the processor, the memory page records are traversed from the index position in the state mapping table. The index position can be the starting position of the state mapping table. Starting from the starting position of the state mapping table, each memory page record of the state mapping table is queried in turn to determine whether there are continuous memory page records with a number of free memory pages greater than or equal to numb. If there are memory page records that meet the above conditions, the correspondence between the memory page records and the memory pages is used to determine whether the target memory space exists in the processor.

[0363] In the shared memory method provided in an embodiment of the present application, after scanning each record in sequence from the initial position of the status mapping table, the method also includes: after scanning all records in the status mapping table and there are no consecutive preset number of target records, determining that there is no target memory space in the memory.

[0364] Optionally, starting from the starting position of the state mapping table, query the memory page records of the state mapping table to determine whether there is continuous space with a number of memory pages greater than or equal to numb. If no continuous, preset number of free memory pages are found after scanning the entire state mapping table, it indicates that the target memory space does not exist.

[0365] In the shared memory method provided in an embodiment of the present application, the number of scanned target records is recorded by a counter. In the process of scanning each record in sequence from the initial position of the state mapping table, when the target record is currently scanned, the control counter is added by one. When the non-target record is currently scanned, the control counter is cleared to zero, wherein the non-target record indicates that the memory page is in an occupied state.

[0366] Optionally, by utilizing the relationship between the value of the counter and the number of required memory pages, it is determined whether there are a continuous preset number of target records, that is, whether there is a target memory space. Optionally, the count of the counter is recorded as cntr. If a scanned memory page is empty, cntr is incremented by 1. If the scanned memory page is not empty, the accumulated number of continuous, idle memory pages cntr is cleared to zero, and the search for continuous empty memory pages continues from the address after the memory page; until cntr is equal to numb, it means that continuous, idle memory pages that meet the memory requirements have been found; if cntr is less than numb in the process of scanning the entire state mapping table, it indicates that this dynamic memory application has failed and the target memory space does not exist.

[0367] In the shared memory method provided in an embodiment of the present application, when the initial position is the last position in the state mapping table, the address information of the target memory space is fed back to the sending end of the memory application instruction, including: determining the last scanned target record among a continuous preset number of target records, and feeding back the first address of the memory page indicated by the last scanned target record to the sending end.

[0368] Optionally, when scanning the state mapping table, the scanning method can be selected to scan from the first position of the state mapping table or from the last position of the state mapping table. When the scanning method is to scan from the last position of the state mapping table, when the value cntr displayed by the counter is greater than or equal to the preset number numb, the first address of the memory page corresponding to the last memory page scanned is recorded, and the status of these memory pages is set to non-empty in the memory page record, and the first address is used as the first address of the entire continuous memory page of this memory application instruction.

[0369] In an exemplary embodiment, the address is fed back to the operating system that issues the memory request instruction, and the operating system performs a data write operation on the memory according to the address information.

[0370] In the shared memory method provided in an embodiment of the present application, the initial position is the first position in the state mapping table, and the address information of the target memory space is fed back to the sender of the memory request instruction, including: determining the first scanned target record among a continuous preset number of target records, and feeding back the first address of the memory page indicated by the first scanned target record to the sender.

[0371] Optionally, when the scanning method is to scan from the first position of the status mapping table, when the value cntr displayed by the counter is greater than or equal to the preset number numb, the address of the first memory page record scanned is used as the first address and sent to the operating system that issues the memory request instruction. The operating system writes data to the memory according to the address information.

[0372] In the shared memory method provided in the embodiment of the present application, in the process of sequentially scanning each record from the initial position of the state mapping table, the first target record in the scanned continuous target records is stored through a preset variable.

[0373] Optionally, the preset variable refers to a variable in the state mapping table used to store the address information of the initial position, and it is recorded as offset. Each time a free, continuous memory page is scanned, the value cntr displayed by the counter is increased by 1. When the value cntr displayed by the counter is greater than or equal to the preset number numb, the address information currently stored in offset is used as the address of the first target record.

[0374] In the shared memory method provided in an embodiment of the present application, after reading the occupied status of the memory and determining whether there is free target memory space in the memory based on the occupied status of the memory, the method also includes: releasing the lock on the memory if there is no free target memory space in the memory.

[0375] Optionally, after scanning the memory page records in the status mapping table, if it is detected that the memory does not contain a preset number of continuous and free memory pages, that is, does not contain the target memory space, it indicates that there is not enough space in the processor's memory for the operating system to use the memory page, the dynamic memory request fails, and the memory lock is released.

[0376] In the shared memory method provided in an embodiment of the present application, the memory includes a metadata storage area and a data storage area, the data storage area is used to store business data, and the metadata storage area stores memory management information. Determining whether the memory is currently in a locked state includes: reading the memory management information stored in the metadata storage area, and determining whether the memory management information contains preset information, wherein the preset information indicates that the memory is in a locked state; if the memory management information contains the preset information, determining that the memory is not currently in a locked state; if the memory management information does not contain the preset information, determining that the memory is currently in a locked state.

[0377] To determine whether the processor's memory is in a locked state, it is necessary to use the memory management information in the metadata storage area to make a judgment. Optionally, when the memory management information of the metadata storage area is obtained, it is used to determine whether the memory management information contains preset information, wherein the preset information is used to indicate whether the memory is in a locked state; if the memory management information does not contain the preset information, it indicates that the current memory is in an unlocked state, otherwise it is in a locked state.

[0378] In the shared memory method provided in an embodiment of the present application, memory management information includes first field information and second field information. The first field information is used to describe whether the memory is in a locked state, and the second field is used to describe whether the memory is initialized. Before receiving the memory application instruction, the method also includes: initializing the first field information and the second field information stored in the data storage area.

[0379] Before the embedded system runs, the metadata storage area and data storage area in the processor need to be initialized. Optionally, the memory page records stored in the state mapping table in the metadata storage area are initialized, and the memory management information is initialized.

[0380] Optionally, the memory management information consists of first field information and second field information, the first field information indicates whether it is locked, and the second field information is used to indicate whether initialization is completed.

[0381] In the shared memory method provided in the embodiment of the present application, updating the occupied state of the memory includes: changing the state of the memory page corresponding to the target memory space recorded in the state mapping table to the occupied state.

[0382] Optionally, when the operating system needs to occupy the target memory space, the memory page records in the state mapping table area of ​​the metadata storage area are updated by identifying the address information of multiple memory pages of the target memory space according to the correspondence between the memory pages and the memory page records, so that the memory page records are changed from an unoccupied state to an occupied state. Furthermore, the occupation state of the processor's memory space is updated based on the data written by the operating system, that is, the target memory space is changed from an unoccupied state to an occupied state, and the locking operation before the dynamic memory request is released.

[0383] Optionally, in response to the storage operation of the first operating system, the target data is stored in the target memory space, and the address information of the continuous memory space is sent to the second operating system; an acquisition instruction sent by the second operating system based on the address information is received, and the target data stored in the target memory space is sent to the second operating system.

[0384] Here, after successfully requesting memory, the first operating system stores the target data value to be transferred in the target memory space and sends the address information of the target memory space to the second operating system cooperating with the first operating system, instructing the second operating system to retrieve the data. Optionally, after receiving the address information of the target memory space, the second operating system issues a data retrieval instruction. The embedded system receives the instruction and sends the target data stored in the target memory space to the second operating system.

[0385] Through the above steps, a memory application instruction of the first operating system is received, and a locking operation is performed on the memory of the processor, wherein the memory application instruction is used to apply for the use of the processor's memory; when the memory is locked successfully, the occupied state of the memory is read, and it is determined whether there is free target memory space in the memory based on the occupied state of the memory, wherein the size of the target memory space is greater than or equal to the size of the memory applied for by the memory application instruction; when the target memory space exists in the memory, the address information of the target memory space is fed back to the sending end of the memory application instruction, the occupied state of the memory is updated, and the lock on the memory is released; in response to the storage operation of the first operating system, the target data is stored in the target memory space, and the address information of the continuous memory space is sent to the second operating system; an acquisition instruction sent by the second operating system based on the address information is received, and the target data stored in the target memory space is sent to the second operating system, thereby solving the problems of low utilization efficiency, poor flexibility and over-reliance on the operating system of shared memory among multiple cores, thereby improving the flexibility and utilization efficiency of shared memory and reducing the dependence on the operating system.

[0386] In an exemplary embodiment, when the first operating system uses physical addresses to perform data read and write operations and the second operating system uses virtual addresses to perform data read and write operations, the second operating system converts the address information of the target memory space into a virtual address, and uses the virtual address to access the memory to read the target data from the target memory space.

[0387] When using shared memory to send and receive data between cores, the address returned by dynamically requested memory is used. However, different systems may use different address systems. For example, a real-time operating system is the first operating system, and a non-real-time operating system is the second operating system. In a real-time operating system, physical addresses can be used directly to access shared memory, but in a non-real-time operating system, physical addresses cannot be used directly to access shared memory. Therefore, a mapped virtual address is required. After the second operating system receives the address information of the target memory space, it converts it using the address information offset, maps it to a virtual address, and performs operations based on the virtual address. Optionally, the shared memory virtual base address vBase in a non-real-time operating system (the real physical address of the shared memory is assumed to be 0x96000000); the shared memory physical base address pBase in a real-time operating system (i.e., 0x96000000).

[0388] The address returned by dynamically allocated memory in a non-RTOS is also the virtual address vData. In a non-RTOS, Offset = vData - vBase. When data is sent from a non-RTOS to an RTOS, the RTOS uses the address pData to access the dynamically allocated shared memory (pData = pBase + Offset). The address returned by dynamically allocated memory in an RTOS is the physical address pData. In an RTOS, Offset = pData - pBase. When data is sent from an RTOS to a non-RTOS, the non-RTOS uses the address vData to access the dynamically allocated shared memory (vData = vBase + Offset).

[0389] In an exemplary embodiment, the memory includes a metadata storage area and a data storage area, and the metadata storage area and the data storage area are similar to those in the aforementioned embodiment and are not described in detail here. Optionally, the metadata storage area stored in the processor is obtained, and the state mapping table in the metadata storage area is identified, and each memory page record is traversed from the index position in the state mapping table, and each memory page record in the state mapping table is queried in turn to determine whether there are continuous memory page records that record free memory pages greater than or equal to a preset number. In the case that there are memory page records that meet the above conditions, the corresponding relationship between the memory page record and the memory page is used to determine whether the target memory space exists in the processor. The corresponding relationship between the memory page record and the memory page is used to determine whether the target memory space exists in the processor.

[0390] In this embodiment, a method for sharing memory is also provided, which includes: before the operating system issues a memory request instruction, in order to prevent multiple operating systems from applying for the processor's memory space at the same time, a locking operation needs to be applied, and it is determined whether the locking is successful; if the judgment result indicates that the dynamic memory lock application is successful, the number of consecutive memory pages that need to be allocated is calculated according to the memory size in the issued memory request instruction, and recorded as nmemb; if the judgment result indicates that the lock application fails, the application is reissued after waiting for a period of time (which can be 100 microseconds) until the application is successful. If the number of lock application failures is greater than a preset number (the preset number can be three times), the memory application is exited.

[0391] In an exemplary embodiment, after the lock application is successful, the metadata storage area of ​​the processor is initialized, and the last position of the state mapping table is recorded as offset. The number of required continuous memory pages is calculated according to the size of the required memory space in the memory application instruction, and the number of memory pages is recorded as nmemb. A counter for recording the number of memory pages is set, which is recorded as cmemb. Then, the state mapping table of the metadata storage area in the processor is obtained, and the entire state mapping table is scanned starting from the offset position of the state mapping table. The continuous memory pages are found through the correspondence between the memory page records stored in the state mapping table and the memory pages in the data storage area. Empty memory page. If the current memory page being scanned is in an occupied state, offset = offset - cmemb, and then the data cmemb of the continuous empty memory pages accumulated in the counter is cleared, and the search for continuous empty memory pages is restarted from the new offset position; if the scanned memory page is empty, that is, in an idle state, the value cmemb of the counter is increased by 1, and offset = offset - 1, and the next memory page is continued to be judged until cmemb is equal to nmemb, that is, when the counter data is equal to the size of the required memory space, it means that a continuous memory page that meets the requirements has been scanned.

[0392] In an exemplary embodiment, the memory page that meets the requirements is marked as occupied in the corresponding status mapping table, the first address of the last memory page found is used as the first address of the entire continuous memory page dynamically applied for, the lock of the dynamically applied memory is released, and this dynamic memory application is successful.

[0393] If the offset value is less than 0 during the scanning of the entire state mapping table, it indicates that there is no memory page that meets the requirements for use by the operating system, and the lock for dynamic memory application is released, and this dynamic memory application fails.

[0394] In addition, after dynamically applying for space, if it is found that the space is insufficient, the size can be dynamically adjusted. The updated memory application instruction can be issued again, and the memory can be locked. If the locking is successful, if the memory space required by the updated memory application instruction is increased, it is determined whether the required memory space exists after the applied target continuous memory. If so, the application is successful. If the memory space required by the updated memory application instruction is reduced, part of the memory space is released.

[0395] This embodiment divides the storage area into multiple storage areas, uses index positions to dynamically apply for space according to the actual required size, releases it after use, and can dynamically adjust the size if it is found that the space is insufficient after dynamic application, thereby improving the flexibility and efficiency of shared memory.

[0396] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.

[0397] According to another aspect of an embodiment of the present application, an embedded system for implementing the startup control method of the embedded system is further provided. FIG10 is a schematic diagram of an optional embedded system according to an embodiment of the present application. The embedded system may include:

[0398] chip and at least two operating systems, wherein,

[0399] The chip includes a processor 1002, a hardware controller 1004, a first bus 1006 and a second bus 1008, wherein:

[0400] The bandwidth of the second bus 1008 is higher than that of the first bus 1006 , and the second bus 1008 is configured in a multi-master-multi-slave mode, while the first bus 1006 is configured in a one-master-multi-slave mode;

[0401] At least two operating systems are run on the processor 1002, wherein processing resources of the processor are dynamically allocated to the at least two operating systems, and the processing resources of the processor include a processor core;

[0402] At least two operating systems communicate via the first bus 1006;

[0403] At least two operating systems control the hardware controller via the second bus 1008 .

[0404] Among them, the above-mentioned chip can be the above-mentioned BMC chip; the above-mentioned processor can be the above-mentioned multi-core processor, and the above-mentioned hardware controller can be used to control external devices connected to the corresponding external interface; the above-mentioned first bus is configured as a one-master-multiple-slave mode, which can be a bus used by the processor to control the hardware controller, for example, APB, and the above-mentioned second bus is configured as a multi-master-multi-slave mode, which can be a bus used for communication between multiple processor cores of the processor, for example, AHB, and the bandwidth of the second bus is higher than the bandwidth of the first bus.

[0405] The embedded system may include at least two operating systems, which run based on a processor, and the processing resources of the processor are dynamically allocated to the at least two operating systems. The processing resources of the processor include a processor core. The at least two operating systems control the hardware controller through a first bus, and the at least two operating systems communicate through a second bus.

[0406] Optionally, at least two operating systems may be used to implement the startup control method for the embedded system. For example, a first operating system and a second operating system among the at least two operating systems may be used to implement the startup control method for the embedded system. Optionally, the hardware controller may include one or more controllers corresponding to chip peripherals, including but not limited to at least one of the following: I2C, USB (Universal Serial Bus), UART, ADC (Analog to Digital Converter), JTAG (Joint Test Action Group), RTC (Real-Time Clock), GPIO (General Purpose Input / Output), WDT (Watch Dog Timer), Virtual UART, Super I / O, SGPIO (Serial General Purpose Input / Output), PWM (Pulse Width Modulation), FanTach (fan speed control), Timer, PECI (Platform Environment Control Interface), Mailbox, and may also include other types of controllers. The external interface may include one or more, including but not limited to the external interface corresponding to any of the above controllers.

[0407] For example, an example of a BMC chip can be shown in Figure 11. The hardware of the BMC chip can include, but is not limited to, a SOC sub-module and a BMC out-of-band sub-module, wherein the SOC sub-module mainly includes an ARM core (ARM Core 1, ARM Core 2, ..., ARM Core X), which can also include, but is not limited to, a DDR (Double Data Rate) 4 controller (memory controller), a MAC (Media Access Control Address) controller (network controller), an SD (Secure Digital) Card / eMMC (Embedded Multi Media Card) controller (storage controller), a PCIe RC (Root Complex) controller, an SRAM (Static Random-Access Memory) and an SPI controller.

[0408] The cores and controllers are interconnected via a second bus, enabling interaction between them. ARM cores are also connected to the second bus (e.g., via an AXI bridge), enabling inter-core communication. Furthermore, the SOC submodules also implement interconnection between the second bus and the first bus (e.g., via an APB bridge), providing a physical path for the SOC submodules to access peripherals on the first bus.

[0409] The DDR4 controller can be connected to other components or devices through the DDR4PHY (Physical Layer) interface, the MAC controller is connected to other components or devices through the RGMII (Reduced Gigabit Media Independent Interface), the SD card / eMMC controller is connected to other components or devices through the SD interface, and the PCIe RC controller is connected to other components or devices through the PCIe PHY interface.

[0410] The BMC out-of-band submodule primarily includes controllers for chip peripherals such as PWM, GPIO, FanTech (fan speed control), and mailbox. These controllers enable out-of-band management functions such as PECI communication with the BMC (for example, using GPIO to simulate PECI) and fan control. As shown in Figure 11, the BMC out-of-band submodule can, but is not limited to, interact with the SOC submodule via the second bus.

[0411] The BMC chip interconnects the on-chip ARM cores, storage units, and controller hardware resources via the first and second buses. Dynamic, balanced scheduling of processor resources primarily involves the BMC chip's ARM core resource scheduling, and inter-core communication refers to communication between ARM cores. Taking the Linux system preempting the RTOS system core as an example, the Linux system first sends an inter-core interrupt (interrupt number 9) to core 1 via the on-chip second bus on one of cores 2 to N. If the RTOS system is idle at this time and preemption is allowed, core 1 responds to the inter-core interrupt (interrupt number 10) via the second bus and releases the peripheral controller resources currently mapped to core 1 (e.g., PWM / PECI). Upon receiving inter-core interrupt 10, the Linux system initiates a preemption process, adding core 1 to the Linux SMP scheduler and simultaneously obtaining control of the PWM / PECI peripherals, allowing it to be controlled via the first bus.

[0412] On the one hand, at least two operating systems include a first operating system and a second operating system, wherein the chip loads a communication value to a second bus, and the second bus sends a communication signal carrying the communication value to a communication register corresponding to the second operating system to realize communication between the first operating system and the second operating system, wherein the communication value is used to indicate the communication content between the first operating system and the second operating system.

[0413] On the other hand, the chip loads the control value to the first bus, and the first bus sends the control signal carrying the control value to the register corresponding to the hardware controller to realize the operating system's control over the hardware controller, wherein the control value is used to indicate the operating system's control content over the hardware controller.

[0414] The operating system controls the hardware controller by accessing (such as performing read and write operations) the registers of each hardware controller. The operating system accesses the registers of the hardware controller by, but is not limited to, reading or writing the register addresses of each hardware controller, and the addresses of these registers can be, but are not limited to, unique and determined when the chip is designed. For example, the operating system can implement a specific function (such as the communication function between the above-mentioned operating systems or the control function of the operating system on the hardware controller) by writing a specific value (i.e., the above-mentioned communication register or the register corresponding to the hardware controller) to a specific address (i.e., the above-mentioned communication register or the register corresponding to the hardware controller). In other words, different functions correspond to different control values, and the chip maintains the correspondence between the function of the hardware controller and the control value, for example: a control value of 00 means that the air conditioner accelerates by one gear, a control value of 01 means that the air conditioner decelerates by one gear, and so on.

[0415] Communication, control, and other interactions between operating systems and between operating systems and hardware controllers can be, but are not limited to, conducted via buses. The operating system's read and write operations on the registers of each hardware controller are ultimately converted into control signals for the hardware controller via the first bus (or second bus). This conversion and the control of the hardware controller by the first bus (or second bus) can be, but are not limited to, automatically implemented by the chip's internal hardware. This implementation complies with the bus specification. During operation, the first bus (or second bus) can transmit physical signals related to control and bus protocols, and can also transmit valid data to the hardware controllers via its physical data channels.

[0416] According to another aspect of the embodiments of the present application, a startup control device for an embedded system is provided for implementing the startup control method of the embedded system. FIG12 is a block diagram of an optional startup control device for an embedded system according to an embodiment of the present application. As shown in FIG12 , the device may include:

[0417] A first control unit 1202 is configured to control a hardware controller of a target device via a first bus through a first operating system running on a first processor core of a processor, so as to control an operating state of the target device, wherein the embedded system includes the first operating system;

[0418] a startup unit 1204, connected to the first control unit 1202, and configured to boot a second operating system on the second processor core of the processor, wherein the embedded system further includes the second operating system, the first operating system has a higher response speed than the second operating system, the first operating system and the second operating system communicate via a second bus, and the bandwidth of the second bus is higher than the bandwidth of the first bus;

[0419] The first execution unit 1206 is connected to the startup unit 1204 and is configured to, after the second operating system is started, take over the hardware controller via the first bus through the second operating system to take over the control right of the target device.

[0420] It should be noted that the first control unit 1202 in this embodiment can be used to execute the above step S202, the starting unit 1204 in this embodiment can be used to execute the above step S204, and the first execution unit 1206 in this embodiment can be used to execute the above step S206.

[0421] Through the above-mentioned module, the hardware controller of the target device is controlled via the first bus by the first operating system running on the first processor core of the processor to control the operating state of the target device, wherein the embedded system includes the first operating system; the second operating system is guided to start on the second processor core of the processor, wherein the embedded system also includes the second operating system, the response speed of the first operating system is higher than that of the second operating system, the first operating system and the second operating system communicate through the second bus, and the bandwidth of the second bus is higher than that of the first bus; after the second operating system is started, the hardware controller is taken over by the second operating system via the first bus to take over the control of the target device, thereby solving the problem of high equipment cost caused by the need to add additional chips in the startup control method of the operating system in the related art, saving hardware costs and improving the scalability of equipment control.

[0422] In an exemplary embodiment, the first control unit includes:

[0423] A first execution module, configured to execute a first control task of a first operating system on a first processor core, wherein the first control task is configured to control a hardware controller;

[0424] a reading module, configured to read sensor data of a designated sensor corresponding to a target device through the first processor core;

[0425] The first sending module is used to send a device control instruction to the hardware controller via the first bus according to the sensor data of the designated sensor through the first control task, so that the hardware controller controls the operating state of the target device according to the device control instruction.

[0426] In an exemplary embodiment, the first sending module includes:

[0427] a first determining submodule, configured to determine a target parameter value of a device operating parameter of a target device according to sensor data of a designated sensor through a first control task, wherein the device operating parameter is a parameter for controlling an operating state of the target device;

[0428] The sending submodule is configured to send the device control instruction carrying the target parameter value to the hardware controller via the first bus through the first control task.

[0429] In an exemplary embodiment, the first determining submodule includes:

[0430] The determination subunit is configured to determine, when the target device is a fan, a target parameter value of a fan operating parameter of the fan according to sensor data of a designated sensor through a first control task.

[0431] In an exemplary embodiment, the determining subunit includes:

[0432] Determine a sub-unit, which is used to determine the target speed value of the fan according to the sensor data of the temperature sensor through a first control task when the target device is a fan and the designated sensor is a temperature sensor, wherein the fan speed is positively correlated with the temperature detected by the temperature sensor.

[0433] In an exemplary embodiment, the first execution unit includes:

[0434] A second sending module is configured to send a first inter-core interrupt to the first operating system via the second bus through the second operating system, wherein the first inter-core interrupt is used to request the second operating system to take over the hardware controller;

[0435] A control module is configured to control the hardware controller via the first bus through a second control task of the second operating system upon receiving a second inter-core interrupt returned by the first operating system in response to the first inter-core interrupt, indicating consent for the second operating system to take over the hardware controller. The second control task is configured to control the hardware controller.

[0436] In an exemplary embodiment, the apparatus further comprises:

[0437] a second control unit, configured to, after the second operating system sends the first inter-core interrupt to the first operating system via the second bus, control a third control task of the first operating system to hibernate in response to the acquired first inter-core interrupt, wherein the third control task is used to control the hardware controller;

[0438] The first sending unit is configured to send a second inter-core interrupt to the second operating system via the first operating system via the second bus when the third control task has been dormant.

[0439] In an exemplary embodiment, the apparatus further comprises:

[0440] The second execution unit is configured to push system running data of the first operating system into a stack when the third control task has been dormant, wherein the second inter-core interrupt is further configured to instruct the second operating system to take over the first processor core.

[0441] In an exemplary embodiment, the apparatus further comprises:

[0442] a wake-up unit, configured to wake up the first processor core through the processor after the chip where the processor is located is powered on, before the first operating system running on the first processor core of the processor controls the hardware controller of the target device via the first bus;

[0443] The running unit is configured to run a boot loader of the first operating system through the first processor core to guide the first operating system to start on the first processor core.

[0444] In one exemplary embodiment, the startup unit includes:

[0445] a second execution module, configured to execute the secondary program loader through the first processor core, so as to wake up the second processor core through the secondary program loader;

[0446] The running module is used to run the universal boot loader of the second operating system through the second processor core to guide the second operating system to start on the first processor core.

[0447] In an exemplary embodiment, the apparatus further comprises:

[0448] a third execution unit, configured to, after the second operating system takes over the hardware controller via the first bus, wake up the first operating system via the second bus when the second operating system is to be restarted, and allow the first operating system to take over the hardware controller via the first bus to take over control of the target device;

[0449] The third control unit is used to control the second operating system to restart the system.

[0450] In an exemplary embodiment, the third execution unit includes:

[0451] The initiating module is used to initiate a system wake-up interrupt to the first operating system via the second bus when the second operating system is to be restarted, wherein the system wake-up interrupt is used to wake up the first operating system.

[0452] In an exemplary embodiment, the apparatus further comprises:

[0453] A first allocation unit is configured to allocate a group of to-be-allocated services to corresponding operating systems in the first operating system and the second operating system according to a dynamic resource allocation rule, wherein the dynamic resource allocation rule includes dynamically allocating resources based on at least one of the following: service response speed, service resource occupancy rate, service coupling degree, and service importance;

[0454] a first determining unit, configured to determine a resource allocation result corresponding to a group of services to be allocated, wherein the resource allocation result is used to indicate a processing resource corresponding to each of the services to be allocated in the group of services to be allocated, the processing resource of the processor including a processor core;

[0455] The second allocation unit is configured to allocate the processing resources of the processor to the first operating system and the second operating system according to the operating system corresponding to each service to be allocated and the resource allocation result.

[0456] In an exemplary embodiment, the first allocation unit includes at least one of the following:

[0457] a first allocation module, configured to allocate to the first operating system services among a group of to-be-allocated services whose service response speed requirements are greater than or equal to a set response speed threshold, and to allocate to the second operating system services among a group of to-be-allocated services whose service response speed requirements are less than the set response speed threshold;

[0458] a second allocation module, configured to allocate to the first operating system a group of to-be-allocated services whose service resource occupancy rates are less than a first occupancy rate threshold, and to allocate to the second operating system a group of to-be-allocated services whose service resource occupancy rates are greater than or equal to the first occupancy rate threshold;

[0459] The third allocation module is used to allocate the to-be-allocated services containing sensitive information in a group of to-be-allocated services to a target operating system, wherein the target operating system is the operating system with a low interaction frequency with the user object among the first operating system and the second operating system.

[0460] In an exemplary embodiment, the first allocation unit includes at least one of the following:

[0461] A fourth allocation module is configured to allocate services to be allocated, whose service coupling degree with services allocated to the first operating system is greater than or equal to a first coupling degree threshold, to the first operating system, from a group of services to be allocated;

[0462] The fifth allocation module is configured to allocate services to be allocated, which have a service coupling degree with services allocated to the second operating system greater than or equal to a second coupling degree threshold, to the second operating system.

[0463] In an exemplary embodiment, the first determining unit includes:

[0464] The generation module is used to generate a resource mapping table of a group of services to be allocated and the processing resources of the processor based on the allocation results of the group of services to be allocated, combined with the resource utilization of the processing resources of the first operating system and the resource utilization of the processing resources of the second operating system.

[0465] In an exemplary embodiment, the second dispensing unit includes:

[0466] The sixth allocation module is configured to allocate the unallocated processing resources to the operating system to which the to-be-allocated business corresponding to the unallocated processing resources is allocated when it is determined according to the resource allocation result that there is a corresponding to-be-allocated business among the unallocated processing resources of the processor.

[0467] In an exemplary embodiment, the apparatus further comprises:

[0468] a second sending unit, configured to send the target data to a target virtual channel in the memory of the processor through the first operating system;

[0469] A third sending unit, configured to send an interrupt notification message to the second operating system;

[0470] The acquiring unit is configured to respond to the interrupt notification message through the second operating system and acquire target data from the target virtual channel in the memory.

[0471] In an exemplary embodiment, the memory includes a data storage area and a metadata storage area. The data storage area is divided into multiple storage units, each storage unit is used to store business data, and the metadata storage area is used to store the size and occupancy status of each storage unit in the data storage area.

[0472] In an exemplary embodiment, the second sending unit includes:

[0473] a third execution module, configured to read records in the metadata storage area through the first operating system, determine, based on the read records, at least one storage unit in the data storage area that is in an idle state and has a total space greater than or equal to the length of the target data, and obtain a target virtual channel;

[0474] The fourth execution module is configured to set the state of at least one storage unit corresponding to the target virtual channel in the metadata storage area to an occupied state, and store the target data in the target virtual channel.

[0475] In an exemplary embodiment, the acquiring unit includes:

[0476] a fifth execution module, configured to read records in the metadata storage area through the second operating system, and determine a target virtual channel according to the read records;

[0477] The sixth execution module is configured to obtain target data from at least one storage unit corresponding to the target virtual channel, and set the state of the at least one storage unit to an idle state.

[0478] In an exemplary embodiment, the data storage area includes multiple memory channels, each memory channel is composed of one or more storage units, the metadata storage area stores multiple records, each record is used to record metadata of a memory channel, and the metadata of each memory channel includes at least a channel ID of the memory channel, a size of the memory channel, and an occupied status of the memory channel; the third execution module includes:

[0479] A first traversal submodule is configured to traverse the records stored in the metadata storage area to determine whether there is a first target record indicating that the memory channel is in an idle state and the size of the memory channel is greater than or equal to the length of the target data;

[0480] The second determining submodule is configured to determine, when the first target record exists, the memory channel indicated by the channel ID recorded in the first target record as the target virtual channel.

[0481] In an exemplary embodiment, when the memory channel is occupied, the metadata of the memory channel further includes the ID of the source CPU core of the target data and the ID of the destination CPU core of the target data; the fifth execution module includes:

[0482] a second traversal submodule, configured to traverse the records stored in the metadata storage area and determine whether a second target record exists, wherein the second target record indicates that the memory channel is in an occupied state, the ID of the destination CPU core is the ID of the CPU core of the second operating system, and the ID of the source CPU core is not the ID of the CPU core of the second operating system;

[0483] The third determining submodule is configured to determine, when the second target record exists, the memory channel indicated by the channel ID recorded in the second target record as the target virtual channel.

[0484] In an exemplary embodiment, the apparatus further comprises:

[0485] a fourth execution unit, configured to receive a memory request instruction from the first operating system and perform a locking operation on the memory of the processor, wherein the memory request instruction is used to request use of the memory of the processor;

[0486] a fifth execution unit, configured to, when the memory is locked successfully, read the memory occupation status and determine whether there is free target memory space in the memory according to the memory occupation status, wherein the size of the target memory space is greater than or equal to the size of the memory requested by the memory request instruction;

[0487] The feedback unit is configured to feed back address information of the target memory space to the first operating system when the target memory space exists in the memory, so as to update the occupied state of the memory.

[0488] In an exemplary embodiment, the memory includes a metadata storage area and a data storage area, the data storage area is used to store business data, the metadata storage area stores a state mapping table, and the state mapping table is used to record the occupied state of the data storage area. The fifth execution unit includes:

[0489] The seventh execution module is configured to read the records in the state mapping table from the metadata storage area, and determine whether the target memory space exists in the data storage area according to the records in the state mapping table.

[0490] In an exemplary embodiment, the apparatus further comprises:

[0491] a judgment unit, configured to judge whether the memory is currently in a locked state before performing a locking operation on the memory of the processor, wherein the locked state indicates that the memory is in a state where use is requested;

[0492] The sixth execution unit is configured to execute a locking operation on the memory when the memory is not currently in a locked state.

[0493] In an exemplary embodiment, the apparatus further comprises:

[0494] The release unit is used to read the occupied state of the memory and determine whether there is free target memory space in the memory according to the occupied state of the memory. If there is no free target memory space in the memory, release the lock on the memory.

[0495] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0496] An embodiment of the present application further provides a chip, wherein the chip includes at least one of a programmable logic circuit and an executable instruction, and the chip runs in an electronic device to implement the steps of any of the above method embodiments.

[0497] The embodiment of the present application further provides a BMC chip, wherein the BMC chip may include: a storage unit and a processing unit connected to the storage unit. The storage unit is used to store a program, and the processing unit is used to run the program to perform the steps in any of the above method embodiments.

[0498] An embodiment of the present application also provides a mainboard, wherein the mainboard includes: at least one processor; at least one memory for storing at least one program; when the at least one program is executed by the at least one processor, the at least one processor implements the steps of any one of the above method embodiments.

[0499] An embodiment of the present application also provides a server, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus, and the memory is used to store computer programs; the processor is used to implement the steps of any of the above method embodiments when executing the program stored in the memory to achieve the same technical effect.

[0500] The communication bus of the server can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. The communication interface is used for communication between the server and other devices.

[0501] The memory may include RAM or NVM (Non-Volatile Memory), such as at least one disk storage. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor. The aforementioned processor may be a general-purpose processor, including a CPU, a NP (Network Processor), etc.; it may also be a DSP (Digital Signal Processing), an ASIC, an FPGA, or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component.

[0502] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above method embodiments when run.

[0503] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, a ROM, a RAM, a mobile hard disk, a magnetic disk, or an optical disk.

[0504] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0505] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0506] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail here.

[0507] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices, they can be implemented using program code executable by the computing device, and thus, they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be performed in a different order than herein, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0508] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included within the scope of protection of the present application.

Claims

1. A startup control method for an embedded system, characterized in that: include: Controlling a hardware controller of a target device via a first bus through a first operating system running on a first processor core of a processor, so as to control an operating state of the target device, wherein the embedded system includes the first operating system; Booting a second operating system on a second processor core of the processor, wherein the embedded system further includes the second operating system, the response speed of the first operating system is higher than that of the second operating system, the first operating system and the second operating system communicate via a second bus, and the bandwidth of the second bus is higher than that of the first bus; After the second operating system is started, the second operating system takes over the hardware controller via the first bus to take over the control of the target device.

2. The method according to claim 1, characterized in that The controlling of the hardware controller of the target device via the first bus by the first operating system running on the first processor core of the processor includes: executing a first control task of the first operating system on the first processor core, wherein the first control task is used to control the hardware controller; reading, by the first processor core, sensor data of a designated sensor corresponding to the target device; The first control task sends a device control instruction to the hardware controller via the first bus according to the sensor data of the designated sensor, so that the hardware controller controls the operating state of the target device according to the device control instruction.

3. The method according to claim 2, characterized in that The sending of a device control instruction to the hardware controller via the first bus according to the sensor data of the designated sensor by the first control task includes: determining, through the first control task, a target parameter value of a device operating parameter of the target device according to the sensor data of the designated sensor, wherein the device operating parameter is a parameter for controlling an operating state of the target device; The device control instruction carrying the target parameter value is sent to the hardware controller via the first bus through the first control task.

4. The method according to claim 3, characterized in that The determining, through the first control task, a target parameter value of a device operating parameter of the target device according to the sensor data of the designated sensor includes: In a case where the target device is a fan, a target parameter value of a fan operating parameter of the fan is determined according to the sensor data of the designated sensor through the first control task.

5. The method according to claim 4, characterized in that In the case where the target device is a fan, determining a target parameter value of a fan operating parameter of the fan according to sensor data of the designated sensor through the first control task includes: When the target device is a fan and the designated sensor is a temperature sensor, the target speed value of the fan is determined according to the sensor data of the temperature sensor through the first control task, wherein the speed of the fan is positively correlated with the temperature detected by the temperature sensor.

6. The method according to claim 1, characterized in that The taking over the hardware controller via the first bus by the second operating system includes: Sending a first inter-core interrupt to the first operating system via the second bus by the second operating system, wherein the first inter-core interrupt is used to request the second operating system to take over the hardware controller; Upon receiving a second inter-core interrupt returned by the first operating system in response to the first inter-core interrupt, indicating agreement for the second operating system to take over the hardware controller, the hardware controller is controlled via the first bus by a second control task of the second operating system, wherein the second control task is used to control the hardware controller.

7. The method according to claim 6, characterized in that After sending the first inter-core interrupt to the first operating system via the second bus by the second operating system, the method further includes: In response to the acquired first inter-core interrupt, controlling a third control task of the first operating system to sleep, wherein the third control task is used to control the hardware controller; In a case where the third control task has been dormant, the second inter-core interrupt is sent to the second operating system through the first operating system via the second bus.

8. The method according to claim 7, characterized in that The method further comprises: In a case where the third control task has been dormant, system operation data of the first operating system is pushed into a stack, wherein the second inter-core interrupt is also used to instruct the second operating system to take over the first processor core.

9. The method according to claim 1, characterized in that: Before the first operating system running on the first processor core of the processor controls the hardware controller of the target device via the first bus, the method further includes: After the chip where the processor is located is powered on, waking up the first processor core by the processor; A boot loader of the first operating system is run through the first processor core to guide the first operating system to start on the first processor core.

10. The method according to claim 1, characterized in that The booting starts a second operating system on a second processor core of the processor, comprising: executing the second-level program loader through the first processor core, so that the second-level program loader wakes up the second processor core; The universal boot loader of the second operating system is run through the second processor core to guide the second operating system to start on the first processor core.

11. The method according to claim 1, characterized in that: After the second operating system takes over the hardware controller via the first bus, the method further includes: When the second operating system is to be restarted, the first operating system is awakened by the second operating system via the second bus, and the first operating system takes over the hardware controller via the first bus to take over the control of the target device; Control the second operating system to restart the system.

12. The method according to claim 11, characterized in that The step of waking up the first operating system by the second operating system via the second bus when the second operating system is to be restarted includes: When the second operating system is to be restarted, the second operating system initiates a system wake-up interrupt to the first operating system via the second bus, wherein the system wake-up interrupt is used to wake up the first operating system.

13. The method according to any one of claims 1 to 12, characterized in that The method further comprises: Allocating a group of services to be allocated to corresponding operating systems in the first operating system and the second operating system according to a dynamic resource allocation rule, wherein the dynamic resource allocation rule includes dynamically allocating resources according to at least one of the following: service response speed, service resource occupancy rate, service coupling degree, and service importance; Determine a resource allocation result corresponding to the set of services to be allocated, wherein the resource allocation result is used to indicate a processing resource corresponding to each service to be allocated in the set of services to be allocated among the processing resources of the processor, and the processing resources of the processor include a processor core; The processing resources of the processor are allocated to the first operating system and the second operating system according to the operating system corresponding to each to-be-allocated service and the resource allocation result.

14. The method according to claim 13, characterized in that The allocating a group of services to be allocated to the corresponding operating system in the embedded system according to the dynamic resource allocation rule comprises at least one of the following: Allocate the services to be allocated whose service response speed requirements are greater than or equal to the set response speed threshold in the group of services to be allocated to the first operating system, and allocate the services to be allocated whose service response speed requirements are less than the set response speed threshold in the group of services to be allocated to the second operating system; Allocate the services to be allocated whose service resource occupancy rate is less than a first occupancy rate threshold in the group of services to be allocated to the first operating system, and allocate the services to be allocated whose service resource occupancy rate is greater than or equal to the first occupancy rate threshold in the group of services to be allocated to the second operating system; Allocate the group of to-be-allocated services including sensitive information to a target operating system, wherein the target operating system The operating system is an operating system, of the first operating system and the second operating system, which has a low interaction frequency with the user object.

15. The method according to claim 13, characterized in that The allocating a group of services to be allocated to the corresponding operating system in the embedded system according to the dynamic resource allocation rule comprises at least one of the following: Allocating the services to be allocated, whose service coupling degree with the services allocated to the first operating system is greater than or equal to a first coupling degree threshold, to the first operating system in the group of services to be allocated; The services to be allocated, among the group of services to be allocated, whose service coupling degree with the services allocated to the second operating system is greater than or equal to a second coupling degree threshold, are allocated to the second operating system.

16. The method according to claim 13, characterized in that The determining of the resource allocation result corresponding to the group of services to be allocated includes: According to the allocation result of the group of services to be allocated, combined with the resource utilization of the processing resources of the first operating system and the resource utilization of the processing resources of the second operating system, a resource mapping table of the group of services to be allocated and the processing resources of the processor is generated.

17. The method according to claim 13, characterized in that The allocating the processing resources of the processor to the first operating system and the second operating system according to the operating system corresponding to each of the services to be allocated and the resource allocation result includes: When it is determined according to the resource allocation result that unallocated processing resources in the processing resources of the processor have corresponding to-be-allocated services, the unallocated processing resources are allocated to the operating system to which the to-be-allocated services corresponding to the unallocated processing resources are allocated.

18. The method according to any one of claims 1 to 12, characterized in that The method further comprises: sending target data to a target virtual channel in a memory of the processor through the first operating system; Sending an interrupt notification message to the second operating system; The second operating system responds to the interrupt notification message to obtain the target data from the target virtual channel in the memory.

19. The method according to claim 18, characterized in that The memory includes a data storage area and a metadata storage area. The data storage area is divided into a plurality of storage units, each storage unit is used to store business data, and the metadata storage area is used to store the size and occupation status of each storage unit in the data storage area.

20. The method according to claim 19, characterized in that The sending the target data to the target virtual channel in the memory of the processor through the first operating system includes: Reading the records in the metadata storage area through the first operating system, determining at least one storage unit in the data storage area that is in an idle state and has a total space greater than or equal to the length of the target data according to the read records, and obtaining the target virtual channel; The state of at least one storage unit corresponding to the target virtual channel in the metadata storage area is set to an occupied state, and the target data is stored in the target virtual channel.

21. The method according to claim 20, characterized in that The step of responding to the interrupt notification message through the second operating system to obtain the target data from the target virtual channel in the memory includes: Reading the records in the metadata storage area through the second operating system, and determining the target virtual channel according to the read records; The target data is acquired from at least one storage unit corresponding to the target virtual channel, and a state of the at least one storage unit is set to an idle state.

22. The method according to claim 21, characterized in that The data storage area includes a plurality of memory channels, each memory channel is composed of one or more storage units, the metadata storage area stores a plurality of records, each record is used to record metadata of a memory channel, and the metadata of each memory channel at least includes a channel ID of the memory channel, a size of the memory channel, and an occupied state of the memory channel; The step of reading the records in the metadata storage area through the first operating system, determining at least one storage unit in the data storage area that is in an idle state and has a total space greater than or equal to the length of the target data according to the read records, and obtaining the target virtual channel includes: Traversing the records stored in the metadata storage area, determining whether there is a first target record indicating that the memory channel is in an idle state and the size of the memory channel is greater than or equal to the length of the target data; In the case where the first target record exists, the memory channel indicated by the channel ID recorded in the first target record is determined as the Target virtual channel.

23. The method according to claim 22, characterized in that In the case where the memory channel is occupied, the metadata of the memory channel further includes the ID of the source CPU core of the target data and the ID of the destination CPU core of the target data; The step of reading the record in the metadata storage area through the second operating system and determining the target virtual channel according to the read record includes: Traversing the records stored in the metadata storage area, determining whether there is a second target record, wherein the second target record indicates that the memory channel is in an occupied state, and the ID of the destination CPU core is the ID of the CPU core of the second operating system, and the ID of the source CPU core is not the ID of the CPU core of the second operating system; In a case where the second target record exists, a memory channel indicated by a channel ID recorded in the second target record is determined as the target virtual channel.

24. The method according to any one of claims 1 to 12, characterized in that The method further comprises: receiving a memory application instruction of the first operating system, and performing a locking operation on the memory of the processor, wherein the memory application instruction is used to apply for use of the memory of the processor; In the case that the memory is locked successfully, reading the occupied state of the memory, and judging whether there is free target memory space in the memory according to the occupied state of the memory, wherein the size of the target memory space is greater than or equal to the size of the memory requested by the memory request instruction; In the case that the target memory space exists in the memory, the address information of the target memory space is fed back to the first operating system to update the occupied state of the memory.

25. The method according to claim 24, characterized in that The memory includes a metadata storage area and a data storage area, the data storage area is used to store business data, the metadata storage area stores a state mapping table, the state mapping table is used to record the occupied state of the data storage area, and the reading of the occupied state of the memory and judging whether there is free target memory space in the memory according to the occupied state of the memory include: The records in the state mapping table are read from the metadata storage area, and it is determined whether the target memory space exists in the data storage area according to the records in the state mapping table.

26. The method according to claim 24, characterized in that Before performing the locking operation on the memory of the processor, the method further includes: Determine whether the memory is currently in a locked state, wherein the locked state indicates that the memory is in a state where use is requested; When the memory is not currently in a locked state, a locking operation is performed on the memory.

27. The method according to claim 24, characterized in that After reading the occupied state of the memory and determining whether there is free target memory space in the memory according to the occupied state of the memory, the method further includes: When there is no free target memory space in the memory, the lock on the memory is released.

28. An embedded system, characterized in that: include: chip and at least two operating systems, wherein: The chip includes a processor, a hardware controller, a first bus and a second bus, wherein: The bandwidth of the second bus is higher than that of the first bus, and the second bus is configured as a multi-master and multi-slave mode, and the first bus is configured as a one-master and multi-slave mode; The at least two operating systems are run based on the processor, wherein processing resources of the processor are dynamically allocated to the at least two operating systems, and the processing resources of the processor include a processor core; The at least two operating systems communicate via the second bus; The at least two operating systems control the hardware controller via the first bus; The at least two operating systems are used to implement the steps of the method described in any one of claims 1 to 27.

29. A startup control device for an embedded system, characterized in that: include: The first control unit is configured to control the target device via the first bus through the first operating system running on the first processor core of the processor. The hardware controller controls to control the operation state of the target device, wherein the embedded system includes the first operating system; a startup unit, configured to boot a second operating system on a second processor core of the processor, wherein the embedded system further comprises the second operating system, the response speed of the first operating system is higher than that of the second operating system, the first operating system and the second operating system communicate via a second bus, and the bandwidth of the second bus is higher than that of the first bus; The first execution unit is used to take over the hardware controller through the first bus by the second operating system after the second operating system is started, so as to take over the control right of the target device.

30. A chip, characterized in that: The chip includes at least one of a programmable logic circuit and an executable instruction, and the chip runs in an electronic device to implement the method according to any one of claims 1 to 27.

31. A BMC chip, characterized in that: include: A storage unit and a processing unit connected to the storage unit, the storage unit is used to store a program, and the processing unit is used to run the program to execute the method according to any one of claims 1 to 27.

32. A motherboard, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 27.

33. A server, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method according to any one of claims 1 to 27 when executing a program stored in a memory.

34. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 26 when executed by a processor.

35. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 27 are implemented.

Citation Information

Patent Citations

  • Method and device for controlling multiple operating systems, electronic equipment and computer storage medium

    CN108932160A

  • Direction control application starting method and device, electronic equipment and storage medium

    CN112395018A

  • System starting method and device, electronic equipment and storage medium

    CN115357310A

  • Staged power on / off sequence at the I / O PHY level in an interchip interface

    US20180024963A1

Cited By

  • Control method and device for heat dissipation equipment on server and electronic equipment

    CN119292437A

  • Control method and device for heat dissipation equipment on server, and electronic equipment

    CN119292437B

  • Operation method and device of heat dissipation equipment on server and electronic equipment

    CN119292439A

  • System starting method and device, storage medium, electronic equipment and computer program product

    CN119536831A

  • Resource processing method and electronic equipment

    CN120892096A