Heteronuclear communication method and device based on shared memory, electronic equipment and vehicle
By using real-time channels and non-real-time channels in shared memory to process real-time and non-real-time data, the problem of insufficient real-time performance in traditional methods is solved, and the data interaction performance of high real-time systems is improved.
Patent Information
- Application Number
- CN202310524784.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-10
- Publication Date
- 2024-11-12
AI Technical Summary
In high real-time systems, traditional shared memory reading and writing methods cannot effectively distinguish between real-time data and non-real-time data, resulting in the real-time nature of real-time services being affected, and link delays will occur when multiple services read and write data at the same time. Influence response speed.
At least one real-time channel and one non-real-time channel are used to write and read real-time data and non-real-time data into shared memory respectively, so as to avoid queueing for real-time data during reading and writing, and process in parallel when multiple services are read and written simultaneously.
It improves the real-time response of real-time services, reduces the data link delay between microprocessors and microcontrollers in shared memory, and improves the real-time data interaction between different cores and data read and write efficiency.
Smart Images

Figure CN118939442A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a heterogeneous core communication method, device, electronic device and vehicle based on shared memory. Background Art
[0002] Shared memory is a communication method between multiple processes, usually used in multi-processor computer systems. It can be accessed by different processors to enable multiple processors to transfer information through shared memory. It can also be used to transfer information between heterogeneous cores. For example, heterogeneous SoCs (microprocessors and microcontrollers) use shared memory for communication. Among them, the communication process between microprocessors and microcontrollers involves reading and writing data to shared memory. Related technologies usually use a single channel to read and write data to shared memory. The microprocessor first writes the data to be processed generated by the task in batches in sequence through a single channel into the shared memory. The microcontroller further processes the data written by the microprocessor. The microprocessor reads the processed data in sequence through a single channel and responds to the service. However, in some high-real-time systems, such as car systems, the data generated by real-time services needs to be processed in real time, and the traditional way of reading and writing data to shared memory does not distinguish the timeliness of the data, that is, the data of real-time services and non-real-time services are read and written to shared memory in sequence, so the real-time data of real-time services will have a waiting problem during the reading and writing process, which affects the real-time performance; in addition, in high-real-time systems, there are usually multiple services that need to read and write data to shared memory at the same time. Large amounts of data read and written using a single channel will also cause link delays, further affecting the response speed requirements of real-time services. Therefore, the real-time performance of data interaction between different cores needs to be improved. Summary of the invention
[0003] The present disclosure proposes a heterogeneous core communication method, device and electronic device based on shared memory, aiming to solve one of the technical problems in the related art at least to a certain extent.
[0004] The first aspect of the present disclosure proposes a heterogeneous core communication method based on shared memory, including: obtaining first real-time data generated by a real-time service and first non-real-time data generated by a non-real-time service; writing the first real-time data into the shared memory through at least one real-time channel, and writing the first non-real-time data into the shared memory through at least one non-real-time channel; reading second real-time data from the shared memory through the real-time channel, and reading second non-real-time data from the shared memory through the non-real-time channel, wherein the second real-time data and the second non-real-time data are data after the microcontroller processes the first real-time data and the first non-real-time data.
[0005] The second aspect embodiment of the present disclosure proposes a heterogeneous core communication device based on shared memory, including: an acquisition module, used to acquire first real-time data generated by a real-time service and first non-real-time data generated by a non-real-time service; a writing module, used to write the first real-time data into the shared memory through at least one real-time channel, and write the first non-real-time data into the shared memory through at least one non-real-time channel; a reading module, used to read second real-time data from the shared memory through the real-time channel, and read second non-real-time data from the shared memory through the non-real-time channel, wherein the second real-time data and the second non-real-time data are data after the microcontroller processes the first real-time data and the first non-real-time data.
[0006] An embodiment of the third aspect of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the shared memory-based heterogeneous core communication method of the embodiment of the present disclosure.
[0007] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the shared memory-based heterogeneous core communication method disclosed in the embodiment of the present disclosure.
[0008] A fifth aspect of the present disclosure provides a vehicle, wherein the vehicle includes an electronic device according to the first aspect.
[0009] In this embodiment, the microprocessor obtains the first real-time data generated by the real-time service and the first non-real-time data generated by the non-real-time service, and writes the first real-time data to the shared memory through at least one real-time channel, and writes the first non-real-time data to the shared memory through at least one non-real-time channel, and reads the second real-time data from the shared memory through the real-time channel, and reads the second non-real-time data from the shared memory through the non-real-time channel, wherein the second real-time data and the second non-real-time data are the data processed by the microcontroller on the first real-time data and the first non-real-time data. Compared with the prior art of using a single channel to read and write data to the shared memory, this embodiment can connect the real-time service with the shared memory. The non-real-time services are distinguished, and real-time data is read and written to the shared memory using the real-time channel, and non-real-time data is read and written to the shared memory using the non-real-time channel. Therefore, the real-time data does not need to wait in line during the reading and writing process, thereby improving the real-time response of the real-time service; and, the present solution can use at least one real-time channel and non-real-time channel to read and write real-time data and non-real-time data to the shared memory in parallel. Therefore, when multiple real-time services and non-real-time services read and write data at the same time, the technical effect of improving the data reading and writing efficiency is achieved, thereby effectively reducing the data link delay between the microprocessor and the microcontroller in the shared memory process, thereby improving the real-time performance of the data interaction between the different cores.
[0010] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0012] Figure 1 It is a flowchart of a heterogeneous core communication method based on shared memory provided according to an embodiment of the present disclosure;
[0013] Figure 2 is a schematic diagram of a heterogeneous core communication system architecture based on shared memory provided according to an embodiment of the present disclosure;
[0014] Figure 3 is a flow chart of a heterogeneous core communication method based on shared memory provided according to another embodiment of the present disclosure;
[0015] Figure 4 It is a schematic diagram of a heartbeat mechanism for heterogeneous core communication based on shared memory provided according to an embodiment of the present disclosure;
[0016] Figure 5 is a schematic diagram of a heterogeneous core communication device based on shared memory provided according to another embodiment of the present disclosure;
[0017] Figure 6A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0018] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0019] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0020] It should be noted that the executor of the shared memory-based heterogeneous core communication method of this embodiment can be a shared memory-based heterogeneous core communication device, which can be implemented by software and / or hardware, and can be configured in an electronic device, which can include but is not limited to a terminal, a server, etc.
[0021] Figure 1 is a flow chart of a heterogeneous core communication method based on shared memory provided according to an embodiment of the present disclosure. The method can be applied to a microprocessor, such as Figure 1 As shown, the method includes:
[0022] S101: Acquire first real-time data generated by a real-time service and first non-real-time data generated by a non-real-time service.
[0023] In order to implement a heterogeneous core communication method based on shared memory, the present disclosure provides a heterogeneous core communication system based on shared memory. Figure 2 is a schematic diagram of a heterogeneous core communication system architecture based on shared memory provided according to an embodiment of the present disclosure, such as Figure 2 As shown, the heterogeneous core communication system can be applied to any possible scenario, for example, to a vehicle system. The system includes a microprocessor core (hereinafter referred to as "microprocessor") and a microcontroller core (hereinafter referred to as "microcontroller"), the microprocessor and the microcontroller communicate based on shared memory, and the heterogeneous core communication method based on shared memory in this embodiment can be executed by the microprocessor.
[0024] In the embodiment of the present disclosure, the microprocessor first obtains the first real-time data generated by the real-time service and the first non-real-time data generated by the non-real-time service.
[0025] In practical applications, the microprocessor provides any possible service to the user, and this embodiment can classify services according to the service's requirements for response time, where services that require real-time response are called real-time services, and services that do not require real-time response are called non-real-time services. It can be understood that the real-time service and the non-real-time service can be one service or multiple services respectively, and there is no limitation on this.
[0026] For example, Figure 2 As shown, the microprocessor is configured with a user space, and the services provided to the user by the user space include, for example, time service, power management service, log service, micro-control service, etc. It can be understood that different systems provide different services. For example, in the vehicle system, time services include services such as users setting the system time and timing of the vehicle system, and power management services include users turning on the power of any device in the car, log services are users processing log data generated by the vehicle system, and micro-control services are users controlling the vehicle, for example, turning on lights, turning on wipers, etc. In the disclosed embodiment, the above-mentioned time service, power management service, log service, and micro-control service can be divided into real-time service and non-real-time service according to the requirements for response timeliness. For example, if micro-control service and power management service need real-time response, then micro-control service and power management service are regarded as real-time services, while time service and log service do not need real-time response, then time service and log service are regarded as non-real-time services.
[0027] Among them, the user triggering service will generate corresponding data to be processed, and the data to be processed generated by triggering the real-time service in this embodiment can be called the first real-time data, and the data to be processed generated by triggering the non-real-time service is called the first non-real-time data. The specific content of the first real-time data and the first non-real-time data is not limited to this.
[0028] In the embodiment of the present disclosure, when a user triggers one or more real-time services and non-real-time services, the microprocessor first acquires first real-time data generated by the real-time service and first non-real-time data generated by the non-real-time service.
[0029] In practical applications, the heterogeneous core communication system based on shared memory can be implemented based on the Inter Platform Shared Memory (IPSM) technology, such as Figure 2 As shown, the microcontroller can provide an IPSM read-write interface for services, and the microcontroller obtains the first real-time data and the first non-real-time data through the interface.
[0030] S102: writing first real-time data into a shared memory through at least one real-time channel, and writing first non-real-time data into the shared memory through at least one non-real-time channel.
[0031] Among them, the channel can also be called a data transmission link, which is used by the microprocessor to read and write data to the shared memory, while the channel used to transmit real-time data can be called a real-time channel, and the channel used to transmit non-real-time data can be called a non-real-time channel.
[0032] In the embodiment of the present disclosure, at least one real-time channel (IPSM real-time channel) and at least one non-real-time channel (IPSM non-real-time channel) can be configured for the microprocessor. Figure 2 As shown, for example, this embodiment can configure 3 real-time channels (D0, D1, D2) and 4 non-real-time channels (D3, D4, D5, D6), wherein the number of real-time channels and non-real-time channels can be flexibly configured according to the actual application scenario, and there is no restriction on this. In some embodiments, each service (real-time service or non-real-time service) corresponds to a channel (real-time channel or non-real-time channel), or multiple services correspond to a real-time channel or a non-real-time channel.
[0033] After acquiring the first real-time data and the first non-real-time data, the microprocessor may further write the first real-time data into the shared memory through at least one real-time channel, and write the first non-real-time data into the shared memory through at least one non-real-time channel. More specifically, the first real-time data and the first non-real-time data are written into the memory space (i.e., the memory block cache) allocated to the microprocessor in the shared memory, wherein, Figure 2 As shown, the memory space allocated to the microprocessor may correspond to the real-time channel and the non-real-time channel, that is, it includes 3 real-time data memory spaces for storing real-time data and 4 non-real-time data memory spaces.
[0034] Some embodiments, such as Figure 2 As shown, in the operation of writing the first non-real-time data into the shared memory through at least one non-real-time channel, the first non-real-time data can be first stored in the cache configured by the non-real-time channel (i.e., the non-real-time channel cache), which can be called a sending cache, wherein a corresponding sending cache can be configured for each non-real-time channel; further, the first non-real-time data in the sending cache is written byte by byte into the data sending queue configured by the non-real-time channel, i.e., the IPSM sending queue; further, the first non-real-time data in the sending queue is written into the shared memory. Wherein, as Figure 2 As described, in the process of writing the first real-time data and the first non-real-time data into the shared memory, firstly, the first real-time data and the first non-real-time data are generated into a message (IPSM message), and then the main function is sent through IPSM to write into the shared memory.
[0035] Some other embodiments, such as Figure 2As shown, when generating an IPSM message, the first non-real-time data and the first real-time data in the IPSM sending queue (data sending queue) can be arbitrated to determine the sending priority, and the sending priority is used to indicate the sending order of the first real-time data and the first non-real-time data. Among them, the sending priorities of multiple first real-time data can be determined, or the sending priorities of multiple first non-real-time data can be determined, or the sending priorities of the first real-time data and the first non-real-time data can be determined, and there is no limitation to this; further, based on the sending priority, the first real-time data is sequentially written to the shared memory through at least one real-time channel, and the first non-real-time data is written to the shared memory through at least one non-real-time channel. Thus, this embodiment can meet the real-time requirements of real-time services.
[0036] S103: Read second real-time data from the shared memory through the real-time channel, and read second non-real-time data from the shared memory through the non-real-time channel.
[0037] Among them, the first real-time data processed by the microcontroller can be called the second real-time data. Similarly, the first non-real-time data processed by the microcontroller can be called the second non-real-time data. Among them, there is no restriction on the processing process of the microcontroller on the first real-time data and the first non-real-time data.
[0038] It is understandable that in the heterogeneous core communication process based on the shared memory technology, after the microprocessor writes the first real-time data and the first non-real-time data to be processed into the shared memory, the microcontroller can read the first real-time data and the first non-real-time data from the shared memory for processing, and write the processed data into the shared memory. Figure 2 As shown, this embodiment can allocate memory space for the microcontroller in the shared memory. The memory space of the microcontroller can be configured the same as the memory space of the microprocessor, that is, including 3 real-time data memory spaces and 4 non-real-time data memory spaces for storing real-time data. The microcontroller first obtains the first real-time data and the first non-real-time data from the shared memory (specifically, the memory space on the microprocessor side in the shared memory), further, processes the first real-time data and the first non-real-time data to generate the second real-time data and the second non-real-time data respectively, and further, writes the second real-time data and the second non-real-time data into the memory space allocated to the microcontroller in the shared memory.
[0039] In the embodiment of the present disclosure, the microprocessor can read the second real-time data from the shared memory through the real-time channel, and read the second non-real-time data from the shared memory through the non-real-time channel.
[0040] Specifically, Figure 2As shown, the microprocessor can execute the IPSM receiving main task, and read the second real-time data and the second non-real-time data by byte from the shared memory (specifically the memory space on the microcontroller side) through the real-time channel and the non-real-time channel respectively (i.e., IPSM data reception).
[0041] In some embodiments, before executing the IPSM receiving main task, the microprocessor may first determine whether the current real-time channel and non-real-time channel are not empty, that is, determine whether the channel is currently occupied; when it is determined that the real-time channel and the non-real-time channel are empty (not occupied), read the second real-time data through the real-time channel, and read the second non-real-time data through the non-real-time channel.
[0042] In some embodiments, when reading the second real-time data, the second real-time data is first read from the shared memory through the real-time channel; further, the second real-time data is cached, and the cache can be called a first receiving cache (i.e., a real-time channel cache). In this embodiment, for example, the first receiving cache can be configured for each real-time channel, in which case the second real-time data read from each real-time channel can be stored in the first receiving cache corresponding to the real-time channel.
[0043] In some other embodiments, when reading the second non-real-time data, the second non-real-time data is first read from the shared memory through the non-real-time channel, and the second non-real-time data is written into the data receiving queue configured by the non-real-time channel (i.e., the IPSM receiving queue); further, the second non-real-time data in the data receiving queue is stored in the second receiving cache configured by the non-real-time channel (i.e., the non-real-time channel cache). Moreover, this embodiment can, for example, configure the second receiving cache for each non-real-time channel respectively. Among them, when reading the second non-real-time data, this embodiment can first determine whether the second receiving cache is not empty, and when it is determined that the second receiving cache is empty, the second non-real-time data in the data receiving queue is stored in the second receiving cache. Thus, this embodiment can cache the second real-time data and the second non-real-time data to ensure that the shared memory will not be occupied for a long time, saving the storage space of the shared memory.
[0044] Furthermore, in response to acquiring the second real-time data and the second non-real-time data, this embodiment can respond to the real-time service and the non-real-time service respectively.
[0045] Specifically, Figure 2As shown, after the microprocessor caches the second real-time data into the first receiving cache and caches the second non-real-time data into the second receiving cache, it can read the data at each address in the first receiving cache and the second receiving cache, and feed back the read data to the microprocessor user space through the IPSM read-write interface, so that the microprocessor can respond to the real-time service and the non-real-time service respectively based on the second real-time data and the second non-real-time data, that is, respond to the service triggered by the user, for example, control the modification time, execute the operation of turning on the car lights, etc.
[0046] In this embodiment, the microprocessor obtains the first real-time data generated by the real-time service and the first non-real-time data generated by the non-real-time service, and writes the first real-time data to the shared memory through at least one real-time channel, and writes the first non-real-time data to the shared memory through at least one non-real-time channel, and reads the second real-time data from the shared memory through the real-time channel, and reads the second non-real-time data from the shared memory through the non-real-time channel, wherein the second real-time data and the second non-real-time data are the data processed by the microcontroller on the first real-time data and the first non-real-time data. Compared with the prior art of using a single channel to read and write data to the shared memory, this embodiment can connect the real-time service with the shared memory. The non-real-time services are distinguished, and real-time data is read and written to the shared memory using the real-time channel, and non-real-time data is read and written to the shared memory using the non-real-time channel. Therefore, the real-time data does not need to wait in line during the reading and writing process, thereby improving the real-time response of the real-time service; and, the present solution can use at least one real-time channel and non-real-time channel to read and write real-time data and non-real-time data to the shared memory in parallel. Therefore, when multiple real-time services and non-real-time services read and write data at the same time, the technical effect of improving the data reading and writing efficiency is achieved, thereby effectively reducing the data link delay between the microprocessor and the microcontroller in the shared memory process, thereby improving the real-time performance of the data interaction between the different cores.
[0047] Figure 3 is a flow chart of a heterogeneous core communication method based on shared memory provided according to another embodiment of the present disclosure, such as Figure 3 As shown, the method includes:
[0048] S301: In response to a successful handshake with a microcontroller and the presence of heartbeat information within a preset time, first real-time data generated by a real-time service and first non-real-time data generated by a non-real-time service are acquired.
[0049] In the disclosed embodiment, before performing heterogeneous core communication, it can also be determined whether the heterogeneous cores (microprocessor and microcontroller) can communicate normally.
[0050] Specifically, Figure 4 is a schematic diagram of a heterogeneous core communication heartbeat mechanism based on shared memory provided according to an embodiment of the present disclosure, such as Figure 4As shown, in this embodiment, under the shared memory mechanism, the microcontroller and the microprocessor will send handshake information after startup, for example, the microcontroller sends handshake information to the microprocessor, or the microprocessor sends handshake information to the microcontroller, or the microcontroller and the microprocessor send handshake information to each other. In this embodiment, for example, the microprocessor receives the handshake information, and receiving the handshake information can indicate that the microprocessor and the microcontroller have successfully shaken hands under the shared memory mechanism; further, the heartbeat monitoring function is started, for example, the microprocessor side starts the heartbeat monitoring function, wherein the heartbeat monitoring function can be, for example, a timer (Timer) of a preset time (T0). If the microcontroller sends a new heartbeat packet (i.e., heartbeat information) within the preset time T0, it indicates that normal communication with the microcontroller is possible. In this case, the heartbeat packet reception count is cleared and the timer is restarted for heartbeat monitoring; if there is no heartbeat packet within T0, it indicates that communication with the microcontroller is disconnected. In this case, other cores (microcontroller or microprocessor) are restarted, and handshake information from other cores is waited for.
[0051] In the embodiment of the present disclosure, when the microprocessor determines that the handshake with the microcontroller is successful and there is heartbeat information (i.e., a new heartbeat packet sent by the microcontroller) within the preset time T0, the microprocessor obtains the first real-time data generated by the real-time service and the first non-real-time data generated by the non-real-time service. Thus, the embodiment can ensure normal communication between heterogeneous cores through the heartbeat mechanism.
[0052] S302: Write first real-time data into a shared memory through at least one real-time channel, and write first non-real-time data into the shared memory through at least one non-real-time channel.
[0053] The specific description of S302 refers to the above embodiment and will not be repeated here.
[0054] S303: After the first real-time data and the first non-real-time data are written into the shared memory, a first interrupt instruction is sent to the microcontroller.
[0055] Specifically, Figure 2 As shown, after the microprocessor writes the first real-time data and the first non-real-time data into the shared memory, it can send an interrupt instruction (interrupt) to the microcontroller, and the interrupt instruction can be called a first interrupt instruction, which is used for the microcontroller to interrupt the currently running task to process the first real-time data and the first non-real-time data. In this case, the microcontroller can respond to the first interrupt instruction, stop the currently running task, and read the first real-time data and the first non-real-time data from the shared memory and process them.
[0056] S304: Receive a second interrupt instruction from the microcontroller.
[0057] In the disclosed embodiment, after writing the second real-time data and the second non-real-time data into the shared memory, the microcontroller may send an interrupt instruction to the microprocessor, the interrupt instruction may be referred to as a second interrupt instruction, and the second interrupt instruction is used to interrupt the task currently being run by the microprocessor. In this case, the microprocessor of the present embodiment may receive the second interrupt instruction.
[0058] S305: In response to the second interrupt instruction, read second real-time data from the shared memory through the real-time channel, and read second non-real-time data from the shared memory through the non-real-time channel.
[0059] Furthermore, the microprocessor may stop the currently running task in response to the second interrupt instruction, and read and process the second real-time data and the second non-real-time data from the shared memory.
[0060] Therefore, this implementation can enable the microcontroller to quickly process data through the first interrupt instruction, and enable the microprocessor to quickly read data through the second interrupt instruction, thereby further improving the real-time performance of data interaction between different cores.
[0061] In this embodiment, the microprocessor obtains the first real-time data generated by the real-time service and the first non-real-time data generated by the non-real-time service, and writes the first real-time data to the shared memory through at least one real-time channel, and writes the first non-real-time data to the shared memory through at least one non-real-time channel, and reads the second real-time data from the shared memory through the real-time channel, and reads the second non-real-time data from the shared memory through the non-real-time channel, wherein the second real-time data and the second non-real-time data are the data processed by the microcontroller on the first real-time data and the first non-real-time data. Compared with the prior art of using a single channel to read and write data to the shared memory, this embodiment can connect the real-time service with the shared memory. Non-real-time services can be distinguished, and real-time data can be read and written to shared memory using real-time channels, and non-real-time data can be read and written to shared memory using non-real-time channels. Therefore, real-time data does not need to wait in line during the reading and writing process, thereby improving the real-time response of real-time services; and, this solution can use at least one real-time channel and non-real-time channel to read and write real-time data and non-real-time data to shared memory in parallel, so when multiple real-time services and non-real-time services read and write data at the same time, the technical effect of improving data reading and writing efficiency is achieved, thereby effectively reducing the data link delay between the microprocessor and the microcontroller in the shared memory process, thereby improving the real-time data interaction between hetero-cores. In addition, this embodiment can ensure normal communication between hetero-cores through the heartbeat monitoring function. Moreover, this implementation can enable the microcontroller to quickly process data through the first interrupt instruction, and enable the microprocessor to quickly read data through the second interrupt instruction, thereby further improving the real-time data interaction between hetero-cores.
[0062] In practical applications, by opening up specific real-time channels and non-real-time channels on the shared memory between heterogeneous SoCs (microprocessors and microcontrollers), and adding real-time IPSM logic frameworks on the microcontroller and microprocessor sides, it has been verified that a heterogeneous SoC only takes 600us to complete an end-to-end task interaction between the microcontroller core and the microprocessor core.
[0063] In order to implement the above embodiments, the present disclosure also proposes a heterogeneous core communication device based on shared memory.
[0064] Figure 5 It is a schematic diagram of a heterogeneous core communication device based on shared memory provided according to another embodiment of the present disclosure.
[0065] like Figure 5 As shown, the heterogeneous core communication device 50 based on shared memory includes:
[0066] An acquisition module 501 is used to acquire first real-time data generated by a real-time service and first non-real-time data generated by a non-real-time service;
[0067] A writing module 502, configured to write first real-time data into a shared memory through at least one real-time channel, and write first non-real-time data into the shared memory through at least one non-real-time channel;
[0068] The reading module 503 is used to read the second real-time data from the shared memory through the real-time channel, and to read the second non-real-time data from the shared memory through the non-real-time channel, wherein the second real-time data and the second non-real-time data are data after the microcontroller processes the first real-time data and the first non-real-time data.
[0069] In some embodiments, a sending module is used to send a first interrupt instruction to a microcontroller after the first real-time data and the first non-real-time data are written into a shared memory, wherein the first interrupt instruction is used by the microcontroller to interrupt a currently running task to process the first real-time data and the first non-real-time data.
[0070] In some embodiments, the reading module 503 is specifically used to: receive a second interrupt instruction from a microcontroller, wherein the second interrupt instruction is used to interrupt a currently running task; and respond to the second interrupt instruction to interrupt the currently running task, and read second real-time data from the shared memory through a real-time channel, and read second non-real-time data from the shared memory through a non-real-time channel.
[0071] In some embodiments, the write module 502 is specifically used to: store the first non-real-time data to the first cache of the non-real-time channel configuration; write the first non-real-time data in the first cache to the data sending queue of the non-real-time channel configuration; and write the first non-real-time data in the sending queue to the shared memory.
[0072] In some embodiments, the write module 502 is specifically used to: arbitrate the first non-real-time data in the data sending queue and the first real-time data of the real-time channel to determine the sending priority; and based on the sending priority, write the first real-time data and the first non-real-time data into the shared memory in sequence.
[0073] In some embodiments, the reading module 503 is specifically used to: read the second real-time data from the shared memory through the real-time channel, and store the second real-time data in the first receiving buffer configured by the real-time channel.
[0074] In some embodiments, the reading module 503 is specifically used to: read the second non-real-time data from the shared memory through the non-real-time channel, and write the second non-real-time data into the data receiving queue configured by the non-real-time channel; and store the second non-real-time data in the data receiving queue into the second receiving cache configured by the non-real-time channel.
[0075] In some embodiments, the reading module 503 is specifically used to: determine whether the real-time channel and the non-real-time channel are not empty; and when the real-time channel and the non-real-time channel are empty, read the second real-time data through the real-time channel, and read the second non-real-time data through the non-real-time channel.
[0076] In some embodiments, the reading module 503 is specifically used to: determine whether the second receiving buffer is not empty; and if the second receiving buffer is empty, store the second non-real-time data in the data receiving queue into the second receiving buffer.
[0077] In some embodiments, the receiving module 503 is specifically used to: in response to a successful handshake with the microcontroller and the presence of heartbeat information within a preset time, obtain first real-time data generated by the real-time service and first non-real-time data generated by the non-real-time service.
[0078] In this embodiment, the microprocessor obtains the first real-time data generated by the real-time service and the first non-real-time data generated by the non-real-time service, and writes the first real-time data to the shared memory through at least one real-time channel, and writes the first non-real-time data to the shared memory through at least one non-real-time channel, and reads the second real-time data from the shared memory through the real-time channel, and reads the second non-real-time data from the shared memory through the non-real-time channel, wherein the second real-time data and the second non-real-time data are the data processed by the microcontroller on the first real-time data and the first non-real-time data. Compared with the prior art of using a single channel to read and write data to the shared memory, this embodiment can connect the real-time service with the shared memory. The non-real-time services are distinguished, and real-time data is read and written to the shared memory using the real-time channel, and non-real-time data is read and written to the shared memory using the non-real-time channel. Therefore, the real-time data does not need to wait in line during the reading and writing process, thereby improving the real-time response of the real-time service; and, the present solution can use at least one real-time channel and non-real-time channel to read and write real-time data and non-real-time data to the shared memory in parallel. Therefore, when multiple real-time services and non-real-time services read and write data at the same time, the technical effect of improving the data reading and writing efficiency is achieved, thereby effectively reducing the data link delay between the microprocessor and the microcontroller in the shared memory process, thereby improving the real-time performance of the data interaction between the different cores.
[0079] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0080] In order to implement the above embodiments, the present disclosure further proposes a computer program product. When an instruction processor in the computer program product is executed, the heterogeneous core communication method based on shared memory proposed in the above embodiments of the present disclosure is executed.
[0081] Figure 6 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. Figure 6 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0082] like Figure 6 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0083] The bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnection (PCI) bus.
[0084] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0085] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 Not shown, often called a "hard drive").
[0086] although Figure 6 Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a compact disc read only memory (CD-ROM), a digital versatile disc read only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the various embodiments of the present disclosure.
[0087] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described in the present disclosure.
[0088] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 12, and / or may communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0089] The processing unit 16 executes various functional applications by running programs stored in the system memory 28, such as implementing the heterogeneous core communication method based on shared memory mentioned in the above embodiment.
[0090] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0091] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
[0092] It should be noted that, in the description of the present disclosure, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present disclosure, unless otherwise specified, the meaning of "plurality" is two or more.
[0093] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present disclosure includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present disclosure belong.
[0094] It should be understood that the various parts of the present disclosure can be implemented in hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0095] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0096] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0097] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0098] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0099] Although the embodiments of the present disclosure have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present disclosure. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present disclosure.
Claims
1. A heterogeneous core communication method based on shared memory, It is characterized in that The method comprises: Acquire first real-time data generated by the real-time service and first non-real-time data generated by the non-real-time service; Writing the first real-time data into a shared memory through at least one real-time channel, and writing the first non-real-time data into the shared memory through at least one non-real-time channel; The second real-time data is read from the shared memory through the real-time channel, and the second non-real-time data is read from the shared memory through the non-real-time channel, wherein the second real-time data and the second non-real-time data are data after the microcontroller processes the first real-time data and the first non-real-time data.
2. The method according to claim 1, It is characterized in that After writing the first real-time data into the shared memory through at least one real-time channel and writing the first non-real-time data into the shared memory through at least one non-real-time channel, the method further includes: After the first real-time data and the first non-real-time data are written into the shared memory, a first interrupt instruction is sent to the microcontroller, wherein the first interrupt instruction is used by the microcontroller to interrupt the currently running task to process the first real-time data and the first non-real-time data.
3. The method according to claim 2, It is characterized in that The step of reading the second real-time data from the shared memory through the real-time channel, and reading the second non-real-time data from the shared memory through the non-real-time channel, comprises: receiving a second interrupt instruction from the microcontroller, wherein the second interrupt instruction is used to interrupt a currently running task; and Responding to the second interrupt instruction to interrupt the currently running task, second real-time data is read from the shared memory through the real-time channel, and second non-real-time data is read from the shared memory through the non-real-time channel.
4. The method according to claim 1, It is characterized in that Writing the first non-real-time data into the shared memory through at least one non-real-time channel comprises: Storing the first non-real-time data in a sending buffer configured by the non-real-time channel; Writing the first non-real-time data in the sending buffer into a data sending queue configured by the non-real-time channel; and The first non-real-time data in the data sending queue is written into the shared memory.
5. The method according to claim 4, It is characterized in that The step of writing the first real-time data into a shared memory through at least one real-time channel, and writing the first non-real-time data into the shared memory through at least one non-real-time channel, comprises: arbitrating the first non-real-time data in the data transmission queue and the first real-time data of the real-time channel to determine a transmission priority; and Based on the sending priority, the first real-time data and the first non-real-time data are sequentially written into the shared memory.
6. The method according to claim 1, It is characterized in that The reading of the second real-time data from the shared memory through the real-time channel comprises: The second real-time data is read from the shared memory through the real-time channel, and the second real-time data is stored in a first receiving buffer configured by the real-time channel.
7. The method according to claim 1, It is characterized in that The step of reading the second non-real-time data from the shared memory through the non-real-time channel comprises: Reading second non-real-time data from the shared memory through the non-real-time channel, and writing the second non-real-time data into a data receiving queue configured by the non-real-time channel; and The second non-real-time data in the data receiving queue is stored in a second receiving buffer configured for the non-real-time channel.
8. The method according to claim 7, It is characterized in that The storing the second non-real-time data in the data receiving queue to the second receiving buffer configured by the non-real-time channel includes: Determining whether the second receiving buffer is not empty; and When the second receiving buffer is empty, the second non-real-time data in the data receiving queue is stored in the second receiving buffer.
9. A heterogeneous core communication device based on shared memory, It is characterized in that include: An acquisition module, used for acquiring first real-time data generated by a real-time service and first non-real-time data generated by a non-real-time service; A writing module, used for writing the first real-time data into a shared memory through at least one real-time channel, and writing the first non-real-time data into the shared memory through at least one non-real-time channel; A reading module is used to read second real-time data from the shared memory through the real-time channel, and to read second non-real-time data from the shared memory through the non-real-time channel, wherein the second real-time data and the second non-real-time data are data after the microcontroller processes the first real-time data and the first non-real-time data.
10. An electronic device, include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.
12. A vehicle, It is characterized in that The vehicle includes the electronic device as claimed in claim 10.
