Data processing method and device
By obtaining and modifying hardware configuration files and operating system migration files, merging and compiling the program into the memory of the microcontroller unit, the problem of low porting efficiency of IoT terminal operating systems is solved, and automated porting is realized, reducing development complexity and workload.
Patent Information
- Application Number
- CN202110442533.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-23
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2041-04-23
AI Technical Summary
In the prior art, the porting of operating systems to IoT terminals is relatively inefficient, and developers need to have a high professional level and a large amount of software development workload.
By obtaining hardware configuration files and operating system port files, modifying and processing the logic layer source code in the hardware configuration source file based on the logic layer source code in the operating system source file, combining the operating system project files and hardware project files, generating compiled files, and firing them into the memory of the microcontroller unit.
The automatic porting of the operating system to the Internet of Things terminal without having a high professional level at the operating system technology level is achieved, reducing the complexity and workload of transplantation and improving efficiency.
Smart Images

Figure CN113157259B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method and device. Background Art
[0002] At present, when porting the operating system to the IoT terminal, it is necessary to consider the differences in chip architecture, manufacturer, model and other factors of the IoT terminal; in addition, it is also necessary to consider the differences in initialization logic and interrupt logic of the IoT terminal. Related technologies In order to realize the porting of the operating system to the IoT terminal, developers are required to have a high level of professionalism in the technical level of the operating system. Even if the developers have a high level of professionalism, they are still required to carry out a large amount of software development, which is a large workload. As a result, the efficiency of porting the operating system to the IoT terminal is low. Therefore, the operating system porting method in the related technology has the problem of not being able to quickly port the operating system to the IoT terminal. Summary of the invention
[0003] The embodiments of the present application provide a data processing method and device, which can solve the problem that the operating system transplantation method in the related art cannot realize the rapid transplantation of the operating system to the Internet of Things terminal.
[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0005] According to one aspect of an embodiment of the present application, a data processing method is provided, comprising: obtaining a hardware configuration file generated for hardware configuration of a microcontroller unit, and obtaining an operating system porting file corresponding to an operating system to be ported, the hardware configuration file comprising a hardware configuration source file and a hardware engineering file corresponding to the hardware configuration source file, the operating system porting file comprising an operating system source file and an operating system engineering file corresponding to the operating system source file; modifying the logic layer source code in the hardware configuration source file based on the logic layer source code in the operating system source file to generate a modified source file; merging the operating system engineering file and the hardware engineering file to generate a merged engineering file; compiling the modified source file based on the merged engineering file to generate a compiled file; burning a program based on the compiled file, and importing the burned program into the memory of the microcontroller unit.
[0006] According to one aspect of an embodiment of the present application, a data processing device is provided, comprising: an acquisition unit, used to acquire a hardware configuration file generated for hardware configuration of a microcontroller unit, and to acquire an operating system porting file corresponding to an operating system to be ported, wherein the hardware configuration file includes a hardware configuration source file and a hardware engineering file corresponding to the hardware configuration source file, and the operating system porting file includes an operating system source file and an operating system engineering file corresponding to the operating system source file; a modification unit, used to modify the logic layer source code in the hardware configuration source file based on the logic layer source code in the operating system source file to generate a modified source file; a merging unit, used to merge the operating system engineering file and the hardware engineering file to generate a merged engineering file; a compiling unit, used to compile the modified source file based on the merged engineering file to generate a compiled file; and a burning unit, used to burn a program based on the compiled file, and import the burned program into the memory of the microcontroller unit.
[0007] In some embodiments of the present application, based on the aforementioned scheme, the operating system source files include a first category of source files and a second category of source files, the first category of source files are source files containing logic layer source code that does not perform modification processing in the operating system source files, and the second category of source files are source files containing logic layer source code that performs modification processing in the operating system source files, and the operating system engineering files include first category engineering files corresponding to the first category of source files and second category engineering files corresponding to the second category of source files, and the acquisition unit is configured to: acquire the first category of source files and the first category of engineering files, and copy the first category of source files and the first category of engineering files to a predetermined first directory; acquire the second category of source files and the second category of engineering files, and copy the second category of source files, the second category of engineering files, the hardware configuration source files, and the hardware engineering files to a predetermined second directory, and the first directory and the second directory are different directories under the operating system transplantation directory.
[0008] In some embodiments of the present application, based on the aforementioned scheme, the hardware configuration file also includes model information of the micro control unit, and the acquisition unit is configured to: based on the model information of the micro control unit, obtain a second type of source file and a second type of engineering file that have a corresponding relationship with the model information from a preset file library.
[0009] In some embodiments of the present application, based on the aforementioned scheme, the modification unit is configured to: modify the source code for implementing the interrupt function in the hardware configuration source file based on the source code for implementing the interrupt function in the operating system source file, and modify the source code for implementing the hardware initialization function in the hardware configuration source file based on the source code for implementing the operating system initialization function in the operating system source file.
[0010] In some embodiments of the present application, based on the aforementioned scheme, the modification unit is configured to: determine the source code for implementing the suspendable exception interrupt function and the source code for implementing the system clock interrupt function in the hardware configuration source file; determine the source code for implementing the multi-task interrupt function and the source code for implementing the system clock interrupt function in the operating system source file; replace the source code for implementing the suspendable exception interrupt function in the hardware configuration source file based on the source code for implementing the multi-task interrupt function in the operating system source file, and replace the source code for implementing the system clock interrupt function in the hardware configuration source file based on the source code for implementing the system clock interrupt function in the operating system source file.
[0011] In some embodiments of the present application, based on the aforementioned scheme, the modification unit is configured to: in the operating system source file, determine the header file reference source code for implementing data calls in the operating system, the interface function source code when the operating system calls the application program interface of the microcontroller unit, and the entry function source code for implementing the operating system initialization function; in the hardware configuration source file, determine the source code for implementing the hardware initialization function; based on the header file reference source code, the interface function source code and the entry function source code, modify the source code for implementing the hardware initialization function in the hardware configuration source file.
[0012] In some embodiments of the present application, based on the aforementioned scheme, the source code for implementing the hardware initialization function in the hardware configuration source file includes an interface function source code for implementing the call of the microcontroller unit and an entry function source code for implementing the hardware initialization function, and the modification unit is configured to: insert the header file reference source code into the source code for implementing the hardware initialization function in the hardware configuration source file; based on the interface function source code, encapsulate the interface function source code for implementing the call of the microcontroller unit in the hardware configuration source file to generate an encapsulated interface function source code; based on the entry function source code, encapsulate the entry function source code for implementing the hardware initialization function in the hardware configuration source file to generate an encapsulated entry function source code.
[0013] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the data processing method described in the above embodiment is implemented.
[0014] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method as described in the above embodiments.
[0015] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the data processing method provided in the above various optional embodiments.
[0016] In the technical solutions provided in some embodiments of the present application, the modified source files are compiled based on the merged project files to generate compiled files, so that when the operating system is ported, there is no need for developers to have a high level of professionalism in the technical level of the operating system, and there is no need for developers to perform a large amount of software development to automatically port the operating system to the Internet of Things terminal, thereby reducing the complexity of operating system porting and improving the efficiency of operating system porting.
[0017] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0019] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.
[0020] Figure 2 A flow chart of a data processing method according to an embodiment of the present application is shown.
[0021] Figure 3A specific flow chart of step S210 of the data processing method according to an embodiment of the present application is shown.
[0022] Figure 4 A specific flow chart is shown for modifying source code implementing a hardware initialization function in a hardware configuration source file based on source code implementing an operating system initialization function in an operating system source file according to an embodiment of the present application.
[0023] Figure 5 A specific flow chart is shown for modifying source code implementing a hardware initialization function in a hardware configuration source file based on source code implementing an operating system initialization function in an operating system source file according to an embodiment of the present application.
[0024] Figure 6 A specific flow chart of step S530 according to an embodiment of the present application is shown.
[0025] Figure 7 A block diagram of a data processing device according to an embodiment of the present application is shown.
[0026] Figure 8 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0027] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0028] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0029] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0030] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0031] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.
[0032] like Figure 1 As shown, the system architecture may include an operating system transplantation platform 101, a network 102, an integrated development environment (IDE) platform 103, and a terminal device 104 that needs to transplant the operating system. The network 102 is used to provide a medium for a communication link between the operating system transplantation platform 101, the IDE platform 103, and the terminal device 104. The network 102 may include various connection types, such as a wired communication link, a wireless communication link, and the like. The operating system transplantation platform 101 serves as a platform for developers to transplant the operating system, the terminal device 104 refers to a terminal device including a microcontroller unit, such as an Internet of Things terminal device or a smart home device, and the IDE platform 103 serves as an integrated development environment for software development of the microcontroller unit. It can be understood that the operating system transplantation platform 101 may be a server cluster composed of multiple servers, etc. Optionally, the operating system transplantation platform 101 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud databases, cloud storage, and operating system transplantation services.
[0033] It should be understood that Figure 1 The number of operating system transplantation platforms 101, networks 102, IDE platforms 103 and terminal devices 104 is only illustrative. According to implementation requirements, there can be any number of operating system transplantation platforms 101, networks 102, IDE platforms 103 and terminal devices 104, which are not limited here.
[0034] When porting the operating system to the terminal device 104, due to the differences in chip architecture, manufacturer, model, etc. of the microcontroller unit in the terminal device 104, as well as the differences in initialization logic and interrupt logic of the Internet of Things terminal, developers need to have a high level of expertise in the technical level of the operating system when porting the operating system to the terminal device 104. In addition, in order to address the above differences, developers need to carry out a lot of software development, which is a large workload, resulting in low efficiency in porting the operating system to the Internet of Things terminal.
[0035] Based on this, the operating system transplantation platform 101 in this embodiment obtains a hardware configuration file generated for the hardware configuration of the microcontroller unit, and obtains an operating system transplantation file corresponding to the operating system to be transplanted, the hardware configuration file includes a hardware configuration source file and a hardware engineering file corresponding to the hardware configuration source file, and the operating system transplantation file includes an operating system source file and an operating system engineering file corresponding to the operating system source file; and based on the logic layer source code in the operating system source file, the logic layer source code in the hardware configuration source file is modified to generate a modified source file; and the operating system engineering file and the hardware engineering file are merged to generate a merged engineering file; based on the merged engineering file, the modified source file is compiled to generate a compiled file; finally, the program is burned based on the compiled file, and the burned program is imported into the memory of the microcontroller unit. The logic layer source code in the hardware configuration source file is modified based on the logic layer source code in the operating system source file to generate a modified source file; and the operating system engineering file and the hardware engineering file are merged to generate a merged engineering file; the modified source file is compiled based on the merged engineering file to generate a compiled file, so that when the operating system is transplanted, it is not necessary for the developers to have a high level of professionalism in the technical level of the operating system, and the developers do not need to carry out a large amount of software development to automatically transplant the operating system to the Internet of Things terminal, thereby reducing the complexity of mobile transplantation and improving the efficiency of operating system transplantation.
[0036] The method provided in the embodiment of the present application may also involve a blockchain, that is, the data involved in the method provided in the embodiment of the present application may be stored based on a blockchain, for example, the source file data may be stored in a blockchain. Blockchain is a new application model of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods, each of which contains information about a batch of network transactions, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain may include a blockchain underlying platform, a platform product service layer, and an application service layer.
[0037] It should be noted that the data processing method provided in the embodiment of the present application is generally executed by the operating system transplantation platform 101 , and accordingly, the data processing device is generally arranged in the operating system transplantation platform 101 .
[0038] The implementation details of the technical solution of the embodiment of the present application are elaborated in detail below.
[0039] Figure 2A flowchart of a data processing method according to an embodiment of the present application is shown. The data processing method can be executed by an operating system transplantation platform. The operating system transplantation platform can be Figure 1 The operating system transplantation platform 101 shown in FIG. Figure 2 As shown, the data processing method at least includes steps S210 to S250, which are described in detail as follows:
[0040] In step S210, a hardware configuration file generated for hardware configuration of the microcontroller unit is obtained, and an operating system transplantation file corresponding to the operating system to be transplanted is obtained. The hardware configuration file includes a hardware configuration source file and a hardware engineering file corresponding to the hardware configuration source file. The operating system transplantation file includes an operating system source file and an operating system engineering file corresponding to the operating system source file.
[0041] In one embodiment, the hardware configuration file refers to a file generated by performing hardware configuration on a microcontroller unit in a terminal device, and the operating system transplantation file includes a hardware configuration source file and a hardware engineering file corresponding to the hardware configuration source file.
[0042] The hardware configuration source file refers to a source file containing the source code of the logic layer of the microcontroller unit in implementing the relevant hardware functions, specifically, including the source file of the source code for implementing the hardware initialization function and the source file of the source code for implementing the interrupt function. It can be understood that the hardware configuration source file can also include a user configuration file that records the hardware configuration information in the microcontroller unit, such as the internal clock frequency of the microcontroller unit, ROM size, ROM offset address, RAM memory size and RAM offset address and other hardware configuration information.
[0043] The hardware engineering file is an engineering file that instructs how to compile the hardware configuration source file. Based on the hardware engineering file, the source code in the hardware engineering file can be compiled to generate a binary file for program burning.
[0044] In one embodiment, the hardware configuration file may be specifically generated by a developer using a hardware configuration tool provided by a microcontroller unit manufacturer to perform hardware configuration according to the microcontroller unit to which the operating system is to be transplanted as required.
[0045] In one embodiment, the operating system transplantation file refers to a file information containing all logic layer source codes and related engineering files corresponding to the operating system. The operating system transplantation file includes the operating system source file and the operating system engineering file corresponding to the operating system source file.
[0046] The operating system source file is a source file containing all logic layer source codes corresponding to the operating system, and specifically, may include a source file of source code for implementing an interrupt function and a source file of source code for implementing an operating system initialization function.
[0047] The operating system project file is a project file that instructs how to compile the operating system source file. Based on the operating system project file, the source code in the operating system source file can be compiled to generate a binary file for program burning.
[0048] refer to Figure 3 , Figure 3 A specific flow chart of step S210 of the data processing method according to an embodiment of the present application is shown. Step S210 may specifically include steps S310 to S320, which are described in detail as follows.
[0049] In step S310, a first type of source file and a first type of project file are obtained, and the first type of source file and the first type of project file are copied to a predetermined first directory.
[0050] In step S320, the second type of source files and the second type of project files are obtained, and the second type of source files, the second type of project files, the hardware configuration source files and the hardware project files are copied to a predetermined second directory, where the first directory and the second directory are different directories under the operating system transplantation directory.
[0051] In one embodiment, the operating system source file may be a source file that is pre-compiled and stored in the operating system transplantation platform. The operating system source file includes a first type of source file and a second type of source file. The first type of source file refers to a source file containing a logic layer source code that does not perform a modification process in the operating system source file, and the second type of source file refers to a source file containing a logic layer source code that performs a modification process in the operating system source file. The operating system engineering file includes a first type of engineering file corresponding to the first type of source file and a second type of engineering file corresponding to the second type of source file. The first type of engineering file is an engineering file that indicates how to compile the first type of source file, and the second type of engineering file is an engineering file that indicates how to compile the second type of source file.
[0052] In one embodiment, in order to facilitate system transplantation, a first directory and a second directory may be created in advance, and the first type of source files and the first type of engineering files may be copied to the first directory, and the second type of source files, the second type of engineering files, the hardware configuration source files and the hardware engineering files may be copied to the second directory. By placing the logic layer source code for executing the modification process and the logic layer source code for not executing the modification process into different source files, and placing the second type of source files containing the logic layer source code for executing the modification process into the same directory as the hardware configuration source files and the hardware engineering files, it is beneficial to improve the efficiency of modifying the logic layer source code in the hardware configuration source file based on the logic layer source code in the operating system source file.
[0053] In one embodiment, due to differences in chip architecture, manufacturer, model, etc. of the microcontroller units on the terminal devices, when the operating system is ported to the microcontroller unit, the logic layer source code in the operating system needs to be modified.
[0054] In order to improve the efficiency of system transplantation, corresponding source files can be developed according to the differences in system transplantation for different models of microcontrollers, that is, corresponding second source files and second-type engineering files can be developed for different models of microcontrollers, and the developed second source files and second-type engineering files can be stored in the file library.
[0055] Specifically, when generating a file library containing second source files and second-category engineering files, the model information of the microcontroller unit can be used as index information, and it can be associated with the corresponding second source files and second-category engineering files, thereby facilitating the acquisition of second-category source files and second-category engineering files that have a corresponding relationship with the model information based on the model information of the microcontroller unit.
[0056] In step S220, the logic layer source code in the hardware configuration source file is modified based on the logic layer source code in the operating system source file to generate a modified source file.
[0057] In one embodiment, since the hardware configuration source file only includes the source code file for realizing the hardware initialization function, the terminal device can only realize the hardware initialization function. After the operating system is transplanted to the microprocessor unit of the terminal device, the terminal device needs to realize both the hardware initialization function and the operating system initialization function in the initialization logic, so it is necessary to modify the logic layer source code in the hardware configuration source file based on the logic layer source code in the operating system source file.
[0058] In addition, since the source code for implementing the interrupt function contained in the hardware configuration source file is only applicable to the case where there is no operating system, when the microprocessor unit supports the operating system, the logic layer source code in the hardware configuration source file needs to be modified based on the logic layer source code in the operating system source file.
[0059] In one embodiment, step S220 of modifying the logic layer source code in the hardware configuration source file based on the logic layer source code in the operating system source file includes: modifying the source code that implements the interrupt function in the hardware configuration source file based on the source code that implements the interrupt function in the operating system source file, and modifying the source code that implements the hardware initialization function in the hardware configuration source file based on the source code that implements the operating system initialization function in the operating system source file.
[0060] In this embodiment, when the logic layer source code in the hardware configuration source file is modified based on the logic layer source code in the operating system source file, the source code for implementing the interrupt function in the hardware configuration source file can be modified by the source code for implementing the interrupt function in the operating system source file, thereby enabling the terminal device to adapt to the situation of having an operating system.
[0061] The source code implementing the operating system initialization function in the operating system source file is modified and processed to implement the source code implementing the hardware initialization function in the hardware configuration source file, so that the terminal device can implement the hardware initialization function and the operating system initialization function at the same time.
[0062] refer to Figure 4 , Figure 4 A specific flow chart is shown for modifying the source code implementing the hardware initialization function in the hardware configuration source file based on the source code implementing the operating system initialization function in the operating system source file according to an embodiment of the present application, which may specifically include steps S410 to S430, as described in detail as follows.
[0063] In step S410, source code for implementing a suspendable exception interrupt function and source code for implementing a system clock interrupt function are determined in the hardware configuration source file.
[0064] In one embodiment, in order to modify the source code that implements the hardware initialization function in the hardware configuration source file based on the source code that implements the operating system initialization function in the operating system source file, in the hardware configuration source file, it is necessary to separately determine the source code that implements the suspendable exception interrupt function and the source code that implements the system clock interrupt function.
[0065] Specifically, it is possible to find a source file containing source code for implementing a suspendable exception interrupt function and a source file containing source code for implementing a system clock interrupt function from the hardware configuration source file according to the file name of the source file, and further obtain the source code for implementing the suspendable exception interrupt function and the source code for implementing the system clock interrupt function from the multiple corresponding source files found.
[0066] In step S420, source code for implementing the multi-task interrupt function and source code for implementing the system clock interrupt function are determined in the operating system source file.
[0067] In one embodiment, in order to modify the source code that implements the hardware initialization function in the hardware configuration source file based on the source code that implements the operating system initialization function in the operating system source file, in the operating system source file, it is necessary to separately determine the source code that implements the multi-tasking interrupt function and the source code that implements the system clock interrupt function.
[0068] Specifically, it is possible to find a source file containing source code for implementing a multi-tasking interrupt function and a source file containing source code for implementing a system clock interrupt function from the operating system source file according to the file name of the source file, and further obtain the source code for implementing the multi-tasking interrupt function and the source code for implementing the system clock interrupt function from the found source file.
[0069] In step S430, the source code for implementing the suspendable exception interrupt function in the hardware configuration source file is replaced based on the source code for implementing the multi-tasking interrupt function in the operating system source file, and the source code for implementing the system clock interrupt function in the hardware configuration source file is replaced based on the source code for implementing the system clock interrupt function in the operating system source file.
[0070] In one embodiment, after determining the above-mentioned source code, the source code in the operating system source file for implementing the multi-tasking interrupt function is replaced by the source code in the hardware configuration source file for implementing the suspendable exception interrupt function, and the source code in the operating system source file for implementing the system clock interrupt function is replaced by the source code in the hardware configuration source file for implementing the system clock interrupt function, so that the terminal device can realize the multi-tasking function, and then the interrupt function of the terminal device is applicable to the case where there is an operating system.
[0071] exist Figure 4 In the technical solution of the illustrated embodiment, by automatically modifying the source code for implementing the interrupt function in the hardware configuration source file with the source code for implementing the interrupt function in the operating system source file, it is possible to make the interrupt function of the terminal device adapt to the situation of having an operating system without the involvement of developers, which can effectively reduce the workload of developers and improve the efficiency of operating system transplantation for terminal devices.
[0072] refer to Figure 5 , Figure 5 A specific flow chart is shown for modifying the source code implementing the hardware initialization function in the hardware configuration source file based on the source code implementing the operating system initialization function in the operating system source file according to an embodiment of the present application, which may specifically include steps S510 to S530, as described in detail as follows.
[0073] In step S510, in the operating system source file, the header file reference source code for implementing data calls in the operating system, the interface function source code for implementing the operating system calling the application program interface of the micro control unit, and the entry function source code for implementing the operating system initialization function are determined.
[0074] In one embodiment, in order to modify the source code that implements the hardware initialization function in the hardware configuration source file based on the source code that implements the operating system initialization function in the operating system source file, in the operating system source file, it is necessary to separately determine the header file reference source code that implements data calls in the operating system, the interface function source code when the operating system calls the application program interface of the microcontroller unit, and the entry function source code that implements the operating system initialization function.
[0075] Specifically, it is possible to find a source file containing header file reference source code, a source file containing interface function source code, and a source file containing entry function source code from the operating system source files according to the file name of the source file, and further obtain the header file reference source code, interface function source code, and entry function source code from the multiple corresponding source files found.
[0076] In step S520, source code for implementing a hardware initialization function is determined in the hardware configuration source file.
[0077] In one embodiment, in order to modify the source code implementing the hardware initialization function in the hardware configuration source file based on the source code implementing the operating system initialization function in the operating system source file, the source code implementing the hardware initialization function needs to be determined separately in the hardware configuration source file.
[0078] Specifically, the source file of the source code for implementing the hardware initialization function may be found from the operating system source file according to the file name of the source file, and the source code for implementing the hardware initialization function may be further obtained from the found multiple corresponding source files.
[0079] In step S530, based on the header file reference source code, the interface function source code and the entry function source code, the source code for implementing the hardware initialization function in the hardware configuration source file is modified.
[0080] In one embodiment, after the source code is determined, modification processing can be performed. Specifically, new source code is inserted into the source code that implements the hardware initialization function in the hardware configuration file, replacing the existing source code in the hardware configuration file.
[0081] refer to Figure 6 , Figure 6 A specific flow chart of step S530 according to an embodiment of the present application is shown, which may specifically include steps S610 to S630, which are described in detail as follows.
[0082] In step S610, a header file reference source code is inserted into the source code for implementing the hardware initialization function in the hardware configuration source file.
[0083] In one embodiment, by inserting a header file reference source code into a source code used to implement a hardware initialization function in a hardware configuration source file, a function of making a data call in an operating system through an application program interface is implemented.
[0084] In step S620, based on the interface function source code, the interface function source code for implementing the call to the micro control unit in the hardware configuration source file is packaged to generate a packaged interface function source code.
[0085] In one embodiment, the entry function source code in the hardware configuration source file for implementing the hardware initialization function is encapsulated based on the entry function source code to generate an encapsulated interface function source code, so that the terminal device can call various hardware interfaces on the terminal device according to the new interface function, such as the various interfaces on the microprocessor unit and the interfaces on the various peripheral hardware devices controlled by the microprocessor unit.
[0086] In step S630, based on the entry function source code, the entry function source code implementing the hardware initialization function in the hardware configuration source file is encapsulated to generate encapsulated entry function source code.
[0087] In one embodiment, the entry function source code in the hardware configuration source file for implementing the hardware initialization function is encapsulated based on the entry function source code to generate encapsulated entry function source code, so that the terminal device can simultaneously perform hardware initialization and operating system initialization.
[0088] exist Figure 5 and Figure 6In the technical solution of the illustrated embodiment, the source code used to implement the hardware initialization function in the hardware configuration source file is modified by referencing the source code, the interface function source code, and the entry function source code, thereby achieving the goal of enabling the terminal device to simultaneously perform hardware initialization and operating system initialization without the involvement of developers, which can effectively reduce the workload of developers and improve the efficiency of operating system transplantation for terminal devices.
[0089] Please continue to refer to Figure 2 In step S230, the operating system engineering file and the hardware engineering file are merged to generate a merged engineering file.
[0090] In one embodiment, after modifying the logic layer source code in the hardware configuration source file based on the logic layer source code in the operating system source file and generating the modified source file, the operating system project file and the hardware project file can be combined to generate a merged project file.
[0091] In step S240, the modified source file is compiled based on the merged project file to generate a compiled file.
[0092] In one embodiment, after obtaining the merged project file, the modified source file is compiled based on how to compile the source code indicated by the merged project file to generate a compiled file. It can be understood that the generated compiled file is a binary file that can be burned.
[0093] In step S250, a program is burned based on the compiled file, and the burned program is imported into the memory of the micro control unit.
[0094] In one embodiment of the present application, a program is burned based on a compiled binary file, and the burned program is imported into the memory of the microcontroller unit, thereby implementing the transplantation of the operating system into the microprocessor unit of the terminal device.
[0095] From the above, it can be seen that the modified source files are compiled based on the merged project files to generate compiled files, so that when the operating system is transplanted, there is no need for developers to have a high level of professionalism in the technical level of the operating system, and there is no need for developers to do a lot of software development to automatically transplant the operating system to the Internet of Things terminal, which reduces the complexity of operating system transplantation and improves the efficiency of operating system transplantation.
[0096] The following describes an embodiment of the device of the present application, which can be used to execute the data processing method in the above embodiment of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the data processing method in the above embodiment of the present application.
[0097] Figure 7 A block diagram of a data processing device according to an embodiment of the present application is shown.
[0098] Reference Figure 7 As shown, a data processing device 700 according to an embodiment of the present application includes: an acquisition unit 710, a modification unit 720, a merging unit 730, a compiling unit 740 and a burning unit 750. The acquisition unit 710 is used to acquire a hardware configuration file generated for hardware configuration of a microcontroller unit, and to acquire an operating system transplantation file corresponding to an operating system to be transplanted, wherein the hardware configuration file includes a hardware configuration source file and a hardware engineering file corresponding to the hardware configuration source file, and the operating system transplantation file includes an operating system source file and an operating system engineering file corresponding to the operating system source file; the modification unit 720 is used to modify the logic layer source code in the hardware configuration source file based on the logic layer source code in the operating system source file to generate a modified source file; the merging unit 730 is used to merge the operating system engineering file and the hardware engineering file to generate a merged engineering file; the compiling unit 740 is used to compile the modified source file based on the merged engineering file to generate a compiled file; the burning unit 750 is used to burn a program based on the compiled file, and import the burned program into the memory of the microcontroller unit.
[0099] In some embodiments of the present application, based on the aforementioned scheme, the operating system source file includes a first category of source files and a second category of source files, the first category of source files are source files containing logic layer source code that does not perform modification processing in the operating system source file, and the second category of source files are source files containing logic layer source code that performs modification processing in the operating system source file, and the operating system engineering files include first category engineering files corresponding to the first category of source files and second category engineering files corresponding to the second category of source files, and the acquisition unit 710 is configured to: acquire the first category of source files and the first category of engineering files, and copy the first category of source files and the first category of engineering files to a predetermined first directory; acquire the second category of source files and the second category of engineering files, and copy the second category of source files, the second category of engineering files, the hardware configuration source files, and the hardware engineering files to a predetermined second directory, and the first directory and the second directory are different directories under the operating system transplantation directory.
[0100] In some embodiments of the present application, based on the aforementioned scheme, the hardware configuration file also includes model information of the micro control unit, and the acquisition unit 710 is configured to: based on the model information of the micro control unit, obtain a second type of source file and a second type of engineering file corresponding to the model information from a preset file library.
[0101] In some embodiments of the present application, based on the aforementioned scheme, the modification unit 720 is configured to: modify the source code for implementing the interrupt function in the hardware configuration source file based on the source code for implementing the interrupt function in the operating system source file, and modify the source code for implementing the hardware initialization function in the hardware configuration source file based on the source code for implementing the operating system initialization function in the operating system source file.
[0102] In some embodiments of the present application, based on the aforementioned scheme, the modification unit 720 is configured to: determine the source code for implementing the suspendable exception interrupt function and the source code for implementing the system clock interrupt function in the hardware configuration source file; determine the source code for implementing the multi-task interrupt function and the source code for implementing the system clock interrupt function in the operating system source file; replace the source code for implementing the suspendable exception interrupt function in the hardware configuration source file based on the source code for implementing the multi-task interrupt function in the operating system source file, and replace the source code for implementing the system clock interrupt function in the hardware configuration source file based on the source code for implementing the system clock interrupt function in the operating system source file.
[0103] In some embodiments of the present application, based on the aforementioned scheme, the modification unit 720 is configured to: in the operating system source file, determine the header file reference source code for implementing data calls in the operating system, the interface function source code when the operating system calls the application program interface of the microcontroller unit, and the entry function source code for implementing the operating system initialization function; in the hardware configuration source file, determine the source code for implementing the hardware initialization function; based on the header file reference source code, the interface function source code and the entry function source code, modify the source code for implementing the hardware initialization function in the hardware configuration source file.
[0104] In some embodiments of the present application, based on the aforementioned scheme, the source code for implementing the hardware initialization function in the hardware configuration source file includes an interface function source code for implementing the call of the microcontroller unit and an entry function source code for implementing the hardware initialization function, and the modification unit is configured to: insert the header file reference source code into the source code for implementing the hardware initialization function in the hardware configuration source file; based on the interface function source code, encapsulate the interface function source code for implementing the call of the microcontroller unit in the hardware configuration source file to generate an encapsulated interface function source code; based on the entry function source code, encapsulate the entry function source code for implementing the hardware initialization function in the hardware configuration source file to generate an encapsulated entry function source code.
[0105] Figure 8 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.
[0106] It should be noted that Figure 8 The computer system 800 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0107] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 802 or the program loaded from the storage part 808 to the random access memory (RAM) 803, such as executing the method described in the above embodiment. In the RAM 803, various programs and data required for system operation are also stored. The CPU 801, ROM 802 and RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0108] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed so that a computer program read therefrom is installed into the storage section 808 as needed.
[0109] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 809, and / or installed from a removable medium 811. When the computer program is executed by a central processing unit (CPU) 801, various functions defined in the system of the present application are executed.
[0110] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0111] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0112] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0113] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.
[0114] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0115] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0116] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.
[0117] It should be understood that the present application is not limited to the precise 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 application is limited only by the appended claims.
Claims
1. A data processing method, characterized in that: include: Obtain a hardware configuration file generated for hardware configuration of a microcontroller unit, and obtain an operating system transplantation file corresponding to the operating system to be transplanted, wherein the hardware configuration file includes a hardware configuration source file and a hardware engineering file corresponding to the hardware configuration source file, the operating system transplantation file includes an operating system source file and an operating system engineering file corresponding to the operating system source file, the operating system source file includes a first type of source file and a second type of source file, the first type of source file is a source file containing a logic layer source code that does not perform a modification process in the operating system source file, the second type of source file is a source file containing a logic layer source code that performs a modification process in the operating system source file, and the operating system engineering file includes a first type of engineering file corresponding to the first type of source file and a second type of engineering file corresponding to the second type of source file; Modifying the logic layer source code in the hardware configuration source file based on the logic layer source code in the operating system source file to generate a modified source file; Merging the operating system engineering file and the hardware engineering file to generate a merged engineering file; Compile the modified source file based on the merged project file to generate a compiled file; Burning a program based on the compiled file, and importing the burned program into the memory of the micro control unit; The step of obtaining the operating system transplantation file corresponding to the operating system to be transplanted includes: Obtaining the first-category source files and the first-category project files, and copying the first-category source files and the first-category project files to a predetermined first directory; Obtain the second type of source files and the second type of project files, and copy the second type of source files, the second type of project files, the hardware configuration source files and the hardware project files to a predetermined second directory, wherein the first directory and the second directory are different directories under the operating system transplantation directory.
2. The data processing method according to claim 1, characterized in that: The hardware configuration file also includes the model information of the micro control unit, and the obtaining of the second type of source files and the second type of engineering files includes: Based on the model information of the micro control unit, a second type of source file and a second type of engineering file corresponding to the model information are acquired from a preset file library.
3. The data processing method according to claim 1, characterized in that: The modifying the logic layer source code in the hardware configuration source file based on the logic layer source code in the operating system source file includes: Based on the source code that implements the interrupt function in the operating system source file, the source code that implements the interrupt function in the hardware configuration source file is modified, and based on the source code that implements the operating system initialization function in the operating system source file, the source code that implements the hardware initialization function in the hardware configuration source file is modified.
4. The data processing method according to claim 3, characterized in that: The modifying process of the source code implementing the interrupt function in the hardware configuration source file based on the source code implementing the interrupt function in the operating system source file comprises: In the hardware configuration source file, source code for implementing a suspendable exception interrupt function and source code for implementing a system clock interrupt function are determined; In the operating system source file, source code for implementing a multitasking interrupt function and source code for implementing a system clock interrupt function are determined; Based on the source code that implements the multi-task interrupt function in the operating system source file, the source code that implements the suspendable exception interrupt function in the hardware configuration source file is replaced; and based on the source code that implements the system clock interrupt function in the operating system source file, the source code that implements the system clock interrupt function in the hardware configuration source file is replaced.
5. The data processing method according to claim 3, characterized in that: Based on the source code in the operating system source file that implements the operating system initialization function, modifying the source code in the hardware configuration source file that implements the hardware initialization function includes: In the operating system source file, determine the header file reference source code for implementing data calls in the operating system, the interface function source code for implementing the operating system calling the application program interface of the microcontroller unit, and the entry function source code for implementing the operating system initialization function; In the hardware configuration source file, determine the source code that implements the hardware initialization function; Based on the header file reference source code, the interface function source code and the entry function source code, the source code for implementing the hardware initialization function in the hardware configuration source file is modified.
6. The data processing method according to claim 5, characterized in that: The source code for implementing the hardware initialization function in the hardware configuration source file includes an interface function source code for implementing the calling of the microcontroller unit and an entry function source code for implementing the hardware initialization function. The source code for implementing the hardware initialization function in the hardware configuration source file is modified based on the header file reference source code, the interface function source code and the entry function source code, including: Insert the header file reference source code into the source code for implementing the hardware initialization function in the hardware configuration source file; Based on the interface function source code, encapsulating the interface function source code for implementing the calling of the micro control unit in the hardware configuration source file to generate encapsulated interface function source code; Based on the entry function source code, the entry function source code that implements the hardware initialization function in the hardware configuration source file is encapsulated to generate encapsulated entry function source code.
7. A data processing device, characterized in that: include: an acquisition unit, configured to acquire a hardware configuration file generated for hardware configuration of a microcontroller unit, and to acquire an operating system porting file corresponding to an operating system to be ported, wherein the hardware configuration file includes a hardware configuration source file and a hardware engineering file corresponding to the hardware configuration source file, the operating system porting file includes an operating system source file and an operating system engineering file corresponding to the operating system source file, the operating system source file includes a first type of source file and a second type of source file, the first type of source file is a source file containing a logic layer source code that does not perform a modification process in the operating system source file, the second type of source file is a source file containing a logic layer source code that performs a modification process in the operating system source file, and the operating system engineering file includes a first type of engineering file corresponding to the first type of source file and a second type of engineering file corresponding to the second type of source file; A modification unit, configured to modify the logic layer source code in the hardware configuration source file based on the logic layer source code in the operating system source file to generate a modified source file; A merging unit, used to merge the operating system engineering file and the hardware engineering file to generate a merged engineering file; A compiling unit, used for compiling the modified source file based on the merged project file to generate a compiled file; A burning unit, used for burning a program based on the compiled file, and importing the burned program into the memory of the micro control unit; The step of obtaining the operating system transplantation file corresponding to the operating system to be transplanted includes: Obtaining the first-category source files and the first-category project files, and copying the first-category source files and the first-category project files to a predetermined first directory; Obtain the second type of source files and the second type of project files, and copy the second type of source files, the second type of project files, the hardware configuration source files and the hardware project files to a predetermined second directory, wherein the first directory and the second directory are different directories under the operating system transplantation directory.
8. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the data processing method as described in any one of claims 1 to 6.
9. A computer-readable medium, characterized in that A computer program is stored thereon, and when the computer program is executed by a processor, the data processing method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the data processing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for rapidly transplanting embedded operation system
CN102207887A