Using method of single-chip microcomputer algorithm module based on middleware
By introducing middleware into the microcontroller as the interface between App and algorithm modules, flexible updates and security authentication of algorithm modules are realized, solving the problems of low upgrade efficiency and poor flexibility in the existing technology, and improving user selectivity and simplicity of the upgrade process.
Patent Information
- Application Number
- CN202410089939.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-23
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, the update efficiency of microcontroller algorithm modules is low and the flexibility is poor. Users cannot freely choose algorithm applications, and the intervention of equipment manufacturers leads to interference in promotion and distribution charges.
Middleware is used as the interface between the App and the algorithm module, and common function calls and security authentication are encapsulated to realize free replacement and upgrade of the algorithm module, and secure authentication and location fixation are carried out through the middleware, supporting flexible updates of the algorithm module.
It improves the upgrade efficiency and flexibility of the microcontroller algorithm module, and users can freely choose algorithm applications, reducing the interference of equipment manufacturers' intervention and simplifying the upgrade process.
Smart Images

Figure CN120406970A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of embedded systems, and in particular to a method for using a single-chip microcomputer algorithm module based on middleware. Background Art
[0002] Currently, with the development of the Internet of Things (IoT) where everything is interconnected, many embedded devices have gained intelligence, and there may be many algorithm modules running in the devices. Due to the performance limitations of the single-chip microcomputer itself, when updating algorithm modules, all the code needs to be recompiled and linked again, resulting in a large upgrade package and low upgrade efficiency. Moreover, when a new algorithm application appears, the above steps need to be repeated, and the flexibility is very poor.
[0003] Users cannot freely choose a certain algorithm application because the manufacturer needs to completely recompile a certain algorithm. At the same time, due to the intervention of the device manufacturer, it will also cause certain interference to the promotion of algorithm modules by algorithm module manufacturers and the charging for the distribution of algorithm modules. Summary of the Invention
[0004] The present invention aims at the deficiencies and defects existing in the prior art and provides a method for using a single-chip microcomputer algorithm module based on middleware.
[0005] The object of the present invention can be achieved by the following technical solutions:
[0006] A method for using a single-chip microcomputer algorithm module based on middleware, the system architecture involved in this method includes an embedded device terminal, an App, middleware, algorithm modules, and security authentication, where:
[0007] The embedded device terminal mainly includes an MCU (Microcontroller Unit) and FLASH, which are used to store the App, middleware, and algorithm modules, and are platforms for running these modules and storing upgrade files;
[0008] The App refers to the main application of the device, which is used for controlling resources on the device, sending, receiving, and processing messages, and implementing the main logic. The App can interact with the algorithm module through the middleware.
[0009] The middleware refers to an interface layer arranged between the App and the algorithm module. This interface layer encapsulates common function calls and security authentication, and builds a bridge for the App to access the algorithm module.
[0010] The algorithm module refers to some modules that can enrich the functions of the device and can be freely replaced and upgraded. The algorithm module can exchange data with the App through the middleware. By calculating the data obtained from the App module, the desired result can be calculated.
[0011] When compiling and linking for the first time, it is necessary to allocate the addresses of the App, middleware, and third-party algorithm libraries in the link script in advance, and allocate enough space while considering future functions as much as possible. For the middleware, we need to have fixed function names and fix them in a fixed position through the compilation attributes of the compiler. When the system just starts running, the middleware needs to call the registration function of the algorithm library to obtain the key function list of the algorithm library. In this way, when the App accesses the middleware, it can access the key functions in the algorithm library just like accessing its own functions.
[0012] When the algorithm module needs to be upgraded, since the position of the algorithm module has been allocated in advance during the design of the algorithm module, after passing the security authentication when upgrading the algorithm module that needs to be upgraded, it is only necessary to upgrade the algorithm module to the fixed area. If the security authentication is not passed, the upgrade of the algorithm module is prohibited. Brief Description of the Drawings
[0013] Figure 1 It is a schematic diagram of the logical space allocation of the single-chip microcomputer algorithm module based on the middleware of the present invention.
[0014] Figure 2 It is a schematic diagram of the usage method for upgrading the single-chip microcomputer algorithm module based on the middleware of the present invention. Detailed Embodiments
[0015] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not limit the present invention.
[0016] The following further describes the present invention with reference to the accompanying drawings. The following content is only used to more clearly illustrate the technical solutions of the present invention and cannot be used to limit the protection scope of the present invention.
[0017] Figure 1 It shows the entire system architecture involved in the present invention. In the storage area of the entire single-chip microcomputer FLASH, the entire area is divided into three parts: the App main program area, the middleware area, and the algorithm module area.
[0018] The App main program area is used for storing the implementation of the main functions of the device, including logical processing functions such as peripheral control, storage operations, message sending and receiving, etc. The middleware area serves as a bridge for communication between the App main program area and the algorithm module area. The App main program can access the data of the algorithm module through the middleware, call the functions implemented in the algorithm module through the middleware interface, and plays a major role in security authentication. The algorithm module area contains the main implementation of the algorithm. If the customer needs to update the algorithm service, they can only update the algorithm module without updating the App main program and the middleware.
[0019] Figure 2 It shows the interaction process during the upgrade of the single-chip microcomputer algorithm module based on the middleware. Under normal circumstances, during the system operation, the App main program conducts information interaction and command transmission with the algorithm module through the middleware. The algorithm module also conducts information interaction and data communication with the App main program through the middleware, performs algorithm operations, obtains the operation results, and allows the App main program to store the results by calling the interface of the middleware.
[0020] During the upgrade of the algorithm module, first, it is necessary to notify the App main program that the algorithm module needs to be upgraded next. The App main program will then pause the call of the intermediate library and the algorithm module to prevent data chaos during the upgrade. The App main program needs to conduct identity security authentication on the algorithm module through the intermediate library. Only the algorithm module with successful identity verification can be upgraded to the device. For the upgraded algorithm module, program integrity confirmation is required. On the premise that all security processes are passed, the middleware will notify the App that the algorithm module has been updated and can call the new algorithm. If the identity authentication fails or the integrity verification fails, then the middleware will also exit this upgrade and continue to notify the App main program to run the previous algorithm module.
[0021] The above embodiments are descriptions of the specific implementation manners of the present invention, rather than limitations on the present invention. Those skilled in the relevant technical fields can also make various transformations and changes to obtain corresponding equivalent technical solutions without departing from the spirit and scope of the present invention. Therefore, all equivalent technical solutions should be included in the patent protection scope of the present invention.
Claims
1. A method for using a single-chip microcomputer algorithm module based on middleware, characterized in that, The system architecture involved in this method includes an embedded device terminal, an App, middleware, an algorithm module, and security authentication, where: The embedded device terminal mainly includes an MCU (Microcontroller Unit) and FLASH, which are used to store the App, middleware, and algorithm module, and are the platforms for running them and the platform for storing upgrade files; The App refers to the main application of the device, which is used for controlling resources on the device, sending, receiving, and processing messages, and implementing the main logic. The App can interact with the algorithm module through the middleware. The middleware refers to an interface layer arranged between the App and the algorithm module. The middleware function interface is fixed. This layer of interface encapsulates common function calls and security authentication, building a bridge for the App to access the algorithm module. The algorithm module refers to some modules that can enrich the functions of the device and can be freely replaced and upgraded. The algorithm module can exchange data with the App through the middleware. By calculating the data obtained from the App module, the desired results can be calculated.
2. The method for using a single-chip microcomputer algorithm module based on middleware according to claim 1, characterized in that, In the embedded device terminal, the storage planning of the single-chip microcomputer is divided into three parts: the App, the intermediate library, and the algorithm module. And it is required to isolate the address spaces of these three parts in the link script. The App needs to call the algorithm through the interface provided by the middleware. The algorithm module also needs to store the operation results through the interface provided by the middleware.
3. The method for using a single-chip microcomputer algorithm module based on middleware according to claim 1, wherein The App is the embodiment of the main functions of the embedded device and has the function of calling the algorithm module through the middleware.
4. The method for using a single-chip microcomputer algorithm module based on middleware according to claim 1, characterized in that, The middleware is the interface between the App and the algorithm module. The middleware abstracts the interfaces of the App and the algorithm module and unifies the function call interfaces. In this way, when the algorithm module is upgraded, the App does not need to be upgraded and can directly call the algorithm module.
5. The method for using a single-chip microcomputer algorithm module based on middleware according to claim 1, characterized in that, The algorithm module is independent of the App application and the middleware. The algorithm module needs to have a fixed registration interface for the middleware to use, and users can independently upgrade the algorithm module according to actual needs.