Flexible mirroring FLASH partition upgrading system and method for embedded system
By working collaboratively between the host computer and the slave computer, the image size and upgrade parameters are adaptively adjusted, which solves the problem of strong image rigidity in embedded systems, realizes flexible image file trimming and function area switching, and improves upgrade speed and hardware space utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-04
- Publication Date
- 2026-04-03
AI Technical Summary
The rigidity of images in existing embedded systems makes them difficult to modify and expand flexibly, resulting in limited flexibility and speed in system upgrades and low hardware space utilization.
The system employs a collaborative working mechanism between the host computer and the slave computer, interacting through a high-speed communication protocol to adaptively adjust the image size and upgrade parameters. It divides the FLASH storage space into multiple areas, enabling flexible image file trimming and data writing. Combined with the address jump mechanism in the bootloader area, it achieves flexible switching of functional areas.
It enables flexible modification of image size, improves upgrade speed and hardware space utilization, and enhances the scalability and flexibility of embedded functions.
Smart Images

Figure CN121785628A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automotive driving information instrument technology, and in particular to a flexible FLASH partition upgrade system and method for embedded systems. Background Technology
[0002] An embedded system with software upgrade capabilities is a hardware and software solution that supports the iteration and modification of embedded software. It often requires pre-downloading the firmware of the underlying bootloader, which typically includes address jumps, application function bootstrapping, and silent upgrade functionality. In existing embedded system architectures, the bootloader firmware is usually imported into the microcontroller's FLASH memory, with pre-defined upgrade information such as address, length access, and verification access.
[0003] Among the numerous current solutions and methods, upgrade scenarios require the creation of an image file to be upgraded and the establishment of an upgrade protocol. Furthermore, firmware creation is relatively fixed, with file sizes typically uniform and unadjustable. This often leads to data redundancy, and the image file and upgrade flashing address cannot be arbitrarily adjusted. Consequently, it affects the flexibility, speed, and significant expansion and contraction of embedded functionality within the entire upgrade system. Summary of the Invention
[0004] To address the aforementioned issues, this invention discloses a flexible FLASH partitioning upgrade system and method for embedded systems, overcoming the limitations of image rigidity, difficulty in modification, and difficulty in expansion in existing technologies. It provides a system that allows for flexible modification of embedded image size and adaptive upgrade parameters, while significantly improving the hardware space utilization of embedded FLASH.
[0005] The specific plan is as follows: A flexible icon loading and updating system for functional safety instruments includes a host computer and a slave computer. The host computer acts as an image adaptive creation tool, participating in the compilation of new function software and generating an integer image file, i.e., the new function image. The slave computer is based on an MCU microcontroller and uses built-in FLASH hardware memory as NVM non-volatile memory. The host computer and the slave computer interact through a high-speed communication protocol. When the system's new function software is updated, the host computer automatically calculates the key parameters of the image and pre-embeds them in the new function image. After receiving the upgrade request and image data, the slave computer erases the FLASH, programs the data, and adaptively writes the data to the specified address FLASH space.
[0006] Furthermore, the key parameters include the effective data length and the invalid empty data length, and a compact new function image is obtained by pruning the empty data; wherein, the compact new function image includes pre-embedded upgrade length data, function host data, and check code data.
[0007] Furthermore, when the slave device is running the old image, the host computer sends an upgrade request and transmits the image data; wherein, the host computer uses a batch, multi-frame data transmission method to send the new function image to the slave device.
[0008] Furthermore, the FLASH space of the lower-level machine is divided into multiple areas, namely, upgrade length data space, function area selection space, function A area, function B area, and bootloader area.
[0009] Furthermore, the upgrade length data space is located at a fixed FLASH address, used to store the upgrade length data received from the host computer, and to calculate the current programming length and progress in real time.
[0010] Furthermore, the function area selection space is used to store a function area flag, namely function area A or function area B. This flag is updated at the end of each upgrade. After the embedded system starts up or is upgraded, the bootloader area determines which function area to jump to by reading this flag.
[0011] Furthermore, Function Area A and Function Area B are two independent storage areas used to receive functional host data from the host computer and perform the erase-then-program behavior. During the upgrade process, the currently inactive area is erased and a new image is programmed. When the programming length equals the upgrade length data, it indicates that the host function upgrade is complete, and then the integrity and correctness of the image are verified. After the verification is passed, the lower-level machine changes the function area selection space to complete the change of the length data space for this round of upgrade. Then the system is reset and starts running from the bootloader area.
[0012] Furthermore, the bootloader area is located at the first address of FLASH and is the code area that runs first when the system starts up. After the system is reset, it reads the flag bit from the function area selection space, determines the address of the current function area, and performs an address jump to start the corresponding function image.
[0013] This invention can modify the image firmware size and pre-embed specific upgrade parameters according to the actual amount of main functional data. It achieves flexible and high-speed upgrades with high speed, high utilization, and easy functional expansion.
[0014] A flexible image-based FLASH partition upgrade method for embedded systems includes the following steps: Step 101: Update the embedded software functions, then automatically calculate the length of the effective functional area data, confirm the running address of the functional area, identify the actual effective length to flexibly trim the image package, and embed the result into the generated new functional image, waiting for the host computer to issue an upgrade command; Step 102: When the lower-level machine is running the old embedded software function, after receiving the upgrade command from the upper-level machine, it starts the upgrade process and waits for the upper-level machine to transmit the image packet in frames and multiple packets to the lower-level machine via the high-speed data bus. Step 103: The lower-level machine receives the packet data, verifies that the packet header information is correct, parses the valid data length and stores it in the NVM non-volatile memory. Based on the length data recorded in the previous NVM non-volatile memory, it compares the current new firmware packet length with the old firmware length to identify the current functional area, and simultaneously erases the data in another backup area. After erasing, it enters programming mode and transmits the upper-level machine image data packet to the backup area in a multi-frame manner, programs and flashes it, and verifies it. After all valid data has been downloaded, the running area software will update the valid data length in the data packet and the running area selection flag to the NVM non-volatile memory. After all data transmission is completed, it waits for the upper-level machine to send a restart command. Step 104: After rebooting, enter the bootloader area, retrieve the updated image valid data from NVM non-volatile memory, select the run area flag, then determine the starting address of the function area, and then determine the size of the run data based on the length of the valid data, reserving it as the basis for erasing the flash length during the next upgrade; Step 105: The bootloader area determines the bootloader jump address based on the running area set in the NVM non-volatile memory, thereby adjusting the software to run in the function area, exiting the bootloader, and ending the upgrade process.
[0015] The beneficial effects of this invention are that it can not only flexibly modify the embedded image size, adaptively adjust the amount of FLASH erase and write copy data, and adaptively identify the function area jump address, but also improve the upgrade speed and enhance the scalability of embedded function upgrades. Attached Figure Description
[0016] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a flowchart of the workflow of each unit in this invention. Detailed Implementation
[0017] The present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are for illustrative purposes only and are not intended to limit the scope of the present invention.
[0018] like Figure 1 As shown, this invention provides a FLASH partition upgrade method for flexible image mirroring of an embedded system, including the following steps: Step 101: Update the embedded software functions, then automatically calculate the length of the effective functional area data, confirm the running address of the functional area, identify the actual effective length to flexibly trim the image package, and embed the result into the generated new functional image, waiting for the host computer to issue an upgrade command; Step 102: When the lower-level machine is running the old embedded software function, after receiving the upgrade command from the upper-level machine, it starts the upgrade process and waits for the upper-level machine to transmit the image packet in frames and multiple packets to the lower-level machine via the high-speed data bus. Step 103: The lower-level machine receives the packet data, verifies that the packet header information is correct, parses the valid data length and stores it in the NVM non-volatile memory. Based on the length data recorded in the previous NVM non-volatile memory, it compares the current new firmware packet length with the old firmware length to identify the current functional area, and simultaneously erases the data in another backup area. After erasing, it enters programming mode and transmits the upper-level machine image data packet to the backup area in a multi-frame manner, programs and flashes it, and verifies it. After all valid data has been downloaded, the running area software will update the valid data length in the data packet and the running area selection flag to the NVM non-volatile memory. After all data transmission is completed, it waits for the upper-level machine to send a restart command. Step 104: After rebooting, enter the bootloader area, retrieve the updated image valid data from NVM non-volatile memory, select the run area flag, then determine the starting address of the function area, and then determine the size of the run data based on the length of the valid data, reserving it as the basis for erasing the flash length during the next upgrade; Step 105: The bootloader area determines the bootloader jump address based on the running area set in the NVM non-volatile memory, thereby adjusting the software to run in the function area, exiting the bootloader, and ending the upgrade process.
[0019] like Figure 2 As shown, this invention provides a flexible icon loading and updating system for functional safety instruments, including a host computer and a slave computer. The host computer acts as an image adaptive creation tool, participating in the compilation of new function software and generating an integer image file, i.e., the new function image. The slave computer is based on an MCU microcontroller and uses built-in FLASH hardware memory as NVM non-volatile memory. The host computer and the slave computer interact through a high-speed communication protocol. When the system's new function software is updated, the host computer automatically calculates the key parameters of the image and pre-embeds them in the new function image. After receiving the upgrade request and image data, the slave computer erases the FLASH, programs the data, and adaptively writes the data to the designated address FLASH space. The FLASH space of the slave computer is divided into multiple areas, namely, upgrade length data space, function area selection space, function A area, function B area, and bootloader area. The specific workflow of each unit is as follows: S0: Upgrade length data, wait for the upgrade image package notification to the lower-level machine to write it into NVM non-volatile memory; S1: Function area selection space, written to NVM non-volatile memory along with the upgrade image package and S0, to provide space selection for the next run area; S2: Functional B area, also known as the backup area, provides a space for the complete upgrade process of S1 area; S3: Function A area, runs the current software functions and realizes the complete upgrade process. The erasure, programming and verification of the image data package are completed in S2 area. S2 and S3 are backups of each other. S4: Bootloader area. After the erase, download and verification are completed in S2 area, the system starts to reset and then jumps to S4 area to parse S1 data to determine the jump space of the function area. S5: After the lower-level machine recognizes the upgrade command, it erases the valid data in the S2 area; S6: After the S5 data erasure is completed, the host computer sends multiple frames of image data packets to the S2 blank area via a high-speed data bus. S7: The updated effective data length is reflected in the modified image packet data. It is sent by the host computer, and the slave computer parses the S0 data and fills it into the NVM non-volatile memory when the function is running. S8: The updated function area selection. After the lower-level machine parses the S1 data, it writes it together with the S7 data into the NVM non-volatile memory. S9: After the valid image data packet is fully programmed into the S2 area, the functional area software verifies the validity of the data and completes the upgrade.
[0020] The technical means disclosed in this invention are not limited to those disclosed in the above embodiments, but also include technical solutions composed of any combination of the above technical features. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications are also considered within the scope of protection of this invention.
Claims
1. A flexible mirroring FLASH partition upgrade system for embedded systems, characterized in that, It includes a host computer and a slave computer; the host computer acts as an image adaptive creation tool, participates in the compilation of new function software, and generates an integer image file, i.e., the new function image; the slave computer is based on an MCU microcontroller and uses the built-in FLASH hardware memory as NVM non-volatile memory. The host computer and the slave computer interact through a high-speed communication protocol. When the system updates with new function software, the host computer automatically calculates the key parameters of the image and embeds them into the new function image. After receiving the upgrade request and image data, the slave computer erases the FLASH, programs the data, and adaptively writes the data to the specified address FLASH space.
2. The FLASH partition upgrade system for flexible mirroring of an embedded system according to claim 1, characterized in that, The key parameters include the length of valid data and the length of invalid null data. A compact new function image is obtained by pruning the null data. The compact new function image includes pre-embedded upgrade length data, function host data, and checksum data.
3. The FLASH partition upgrade system for flexible mirroring of an embedded system according to claim 1, characterized in that, When the slave device is running the old image, the host computer sends an upgrade request and transmits the image data; the host computer uses a batch, multi-frame data transmission method to send the new function image to the slave device.
4. The FLASH partition upgrade system for flexible mirroring of an embedded system according to claim 1, characterized in that, The lower-level machine's FLASH space is divided into multiple areas, namely, upgrade length data space, function area selection space, function A area, function B area, and bootloader area.
5. The FLASH partition upgrade system for flexible mirroring of an embedded system according to claim 4, characterized in that, The upgrade length data space is located at a fixed FLASH address and is used to store the upgrade length data received from the host computer and to calculate the current programming length and progress in real time.
6. The FLASH partition upgrade system for flexible mirroring of an embedded system according to claim 4, characterized in that, The function area selection space is used to store a function area flag, namely function area A or function area B. This flag is updated at the end of each upgrade. After the embedded system starts up or is upgraded, the bootloader area reads this flag to determine which function area to jump to.
7. The FLASH partition upgrade system for flexible mirroring of an embedded system according to claim 4, characterized in that, Functional Area A and Functional Area B are two independent storage areas used to receive functional host data from the host computer and to perform the process of erasing and then programming. During the upgrade process, currently inactive areas are erased and a new image is programmed; when the programmed length equals the upgrade length data, it indicates that the host function upgrade is complete, and then the integrity and correctness of the image are verified. After the verification is successful, the lower-level machine changes the function area selection space to complete the change of the length data space for this round of upgrade; then the system is reset and starts running from the bootloader area.
8. The FLASH partition upgrade system for flexible mirroring of an embedded system according to claim 4, characterized in that, The bootloader area is located at the first address of FLASH and is the code area that runs first when the system starts. After the system is reset, it reads the flag bit from the function area selection space, determines the address of the current function area, and performs an address jump to start the corresponding function image.
9. A method for flexible image FLASH partitioning upgrade of an embedded system, based on the system described in any one of claims 1-8, comprising the following steps: Step 101: Update the embedded software functions, then automatically calculate the length of the effective functional area data, confirm the running address of the functional area, identify the actual effective length to flexibly trim the image package, and embed the result into the generated new functional image, waiting for the host computer to issue an upgrade command; Step 102: When the lower-level machine is running the old embedded software functions, it starts the upgrade process after receiving the upgrade command from the upper-level machine. And wait for the host computer's high-speed data bus to transmit the image packet in frames to the lower computer; Step 103: The lower-level machine receives the packet data, verifies that the packet header information is correct, parses the valid data length and stores it in the NVM non-volatile memory. Based on the length data recorded in the previous NVM non-volatile memory, it compares the current new firmware packet length with the old firmware length to identify the current functional area, and simultaneously erases the data in another backup area. After erasing, it enters programming mode and transmits the upper-level machine image data packet to the backup area in a multi-frame manner, programs and flashes it, and verifies it. After all valid data has been downloaded, the running area software will update the valid data length in the data packet and the running area selection flag to the NVM non-volatile memory. After all data transmission is completed, it waits for the upper-level machine to send a restart command. Step 104: After rebooting, enter the bootloader area, retrieve the updated image valid data from NVM non-volatile memory, select the run area flag, then determine the starting address of the function area, and then determine the size of the run data based on the length of the valid data, reserving it as the basis for erasing the flash length during the next upgrade; Step 105: The bootloader area determines the bootloader jump address based on the running area set in the NVM non-volatile memory, thereby adjusting the software to run in the function area, exiting the bootloader, and ending the upgrade process.