Embedded device rapid upgrading method based on firmware partition

By employing a firmware partitioning and multi-core processing approach, the efficiency and reliability issues in large-capacity firmware upgrades are resolved, enabling efficient and reliable firmware updates suitable for industrial environments with multiple flash chips and limited bandwidth.

CN121300830APending Publication Date: 2026-01-09CSIC WUHAN LINCOM ELECTRONICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511488752.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-17
Publication Date
2026-01-09

AI Technical Summary

Technical Problem

Existing technologies suffer from problems such as lengthy upgrade times, high network transmission risks, numerous flash write cycles, device malfunctions, and efficiency bottlenecks during large-capacity firmware upgrades, especially in industrial environments with multiple flash chips and limited bandwidth.

Method used

By using a firmware partitioning approach, firmware data is divided into multiple partitions. Utilizing the multi-core processor architecture of embedded devices, data reception, comparison, and Flash operation tasks are decomposed into parallel execution threads. Only the different partitions are erased and burned. Combining partition-level comparison and multi-core parallel processing, efficient upgrades are achieved.

Benefits of technology

It significantly shortens firmware update time, improves upgrade efficiency, reduces flash write cycles, extends device lifespan, and enhances system reliability and maintenance efficiency, making it particularly suitable for scenarios with minor firmware differences.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121300830A_ABST
    Figure CN121300830A_ABST
Patent Text Reader

Abstract

The invention discloses a method for quickly upgrading embedded equipment based on firmware partition. The method comprises the following steps: after the embedded equipment is powered on, reading firmware data in Flash and partitioning the firmware data; the PC reads the firmware file to be upgraded and divides and packs the firmware file; the PC sends the partitioned data packet to the embedded device; the embedded device compares the received partition data with the original corresponding partition data in the Flash in real time while receiving the data packet; a multi-core architecture of embedded equipment is utilized to distribute tasks to different cores for parallel execution, and after processing of all partitions is completed, a PC machine is notified that updating is completed through a UDP (User Datagram Protocol). According to the method, the firmware updating efficiency of the embedded equipment is greatly improved, the firmware updating time is shortened by utilizing the partition erasing characteristic of Flash and the multi-core parallel processing capacity of the embedded equipment, and good feedback is obtained in actual engineering application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for rapid upgrade of embedded devices, specifically a method for rapid upgrade of embedded devices based on firmware partitioning, belonging to the field of embedded device technology. Background Technology

[0002] With the development of national industrial technology, embedded devices are becoming increasingly widespread in various fields, and different types of embedded devices are playing an increasingly important role. For example, in the field of data interfaces, embedded devices can adapt to various interface requirements, such as network, serial port, CAN, SRIO, HDMI, etc. In the field of data processing, with the development of deep learning and parallel computing technologies, embedded devices can also perform complex data calculations. Embedded devices can be customized according to different application requirements, and different firmware can achieve different functions. Therefore, the need for remote updates has emerged in the basic functions of embedded devices. When updating the firmware of embedded devices remotely via the network, only the feasibility of the function is often considered, while the firmware update efficiency is ignored. If an embedded device contains only one Flash and the firmware is small, the update efficiency can be ignored. However, if there are multiple Flashes and the firmware is large, a lot of time needs to be spent to complete the firmware update. In addition, in some reliability testing fields, the firmware update function needs to be repeatedly tested, which also requires a lot of time to complete the test. With the popularization of the Internet of Things and smart terminal devices, the application scope of embedded systems is expanding day by day, and firmware upgrades have become the core means of device function updates, performance optimization, and security maintenance.

[0003] Traditional firmware upgrade methods typically employ a strategy of transmitting the entire firmware package and performing a full reprogramming process. This involves transmitting the complete firmware package to the embedded device via a network or external storage device, followed by a full erase and reprogramming of the Flash memory. While this approach is acceptable when the firmware size is small or the network environment is stable, its drawbacks become apparent when the firmware size is large (e.g., involving multiple Flash chips or reaching several megabytes) or when the device is in a bandwidth-constrained industrial environment. These drawbacks include lengthy upgrade times, high network transmission risks (such as power outages or interference potentially causing upgrade failure), significant waste of Flash erase / write cycles leading to reduced memory lifespan, and device malfunctions during the complete erase / write process, resulting in service interruptions. Furthermore, the efficiency bottleneck of traditional methods is particularly pronounced in scenarios requiring frequent reliability testing or batch upgrades.

[0004] To address these challenges, the industry has gradually explored various optimization solutions. For example, differential upgrade (DeltaUpdate) technology is used to reduce data transmission by only transmitting the differences between the old and new firmware versions (patches). For instance, CN116360809A discloses a method, system, and medium for remote firmware upgrade of embedded smart terminals, focusing on improving efficiency through version matching and differential processing. However, this method still relies on the preprocessing stage of generating and applying differential packets, and when firmware partitions change dynamically, differential packets may fail due to address offsets, increasing processing complexity. Another common approach is to introduce a dual-partition (A / B partition) design to improve reliability. For example, CN101477471B discloses an online firmware upgrade method for embedded systems, dividing non-volatile memory into a protection partition (containing the bootloader and simplified operating system) and an application partition. Partition switching and backup mechanisms prevent device "bricking" due to upgrade failures. While this solution improves security, it does not solve the efficiency problem during the upgrade process, and the dual partitions occupy additional storage space, increasing hardware costs.

[0005] Secondly, existing technologies also attempt to combine partition management and parallel processing in upgrade solutions. For example, some methods utilize the multi-core processing capabilities of embedded devices to decompose the upgrade task into sub-tasks such as receiving, verification, and writing, which are executed in parallel; or they use multi-threading to package and send data on the PC. However, these methods mostly remain at the task-level parallelism level and do not deeply explore the potential of partition-level data comparison, and they lack adaptation to the physical characteristics of Flash (such as erasure operations being performed on a sector-by-sector basis). In addition, when multiple Flash chips need to be upgraded simultaneously, traditional methods usually use serial processing, which cannot fully utilize hardware parallelism. Summary of the Invention

[0006] The purpose of this invention is to provide a method for rapid firmware update of embedded devices based on firmware partitioning in order to solve at least one of the above-mentioned technical problems, thereby shortening firmware update time and improving firmware update efficiency of embedded devices.

[0007] This invention achieves the above objective through the following technical solution: a rapid upgrade method for embedded devices based on firmware partitioning, the rapid upgrade method for embedded devices comprising the following steps: S1. After the embedded device is powered on, it reads the firmware data stored in the Flash memory and divides the firmware data into multiple partitions according to the predefined Flash sector structure. S2, the PC reads the firmware file to be upgraded and divides and packages the firmware according to the same partitioning strategy; S3: The PC sends the partitioned data packets to the embedded device via the network; S4. While receiving data packets, the embedded device compares the received partition data with the corresponding partition data in Flash in real time. If the data of a certain partition has not changed, the erase and write operations of that partition are skipped; if the data is found to be inconsistent, the partition is erased and rewritten. S5 utilizes the multi-core architecture of embedded devices to distribute data reception, data comparison, and Flash operation tasks to different cores for parallel execution.

[0008] As a further aspect of the present invention: In S1, the partition size of the Flash sector structure is configured according to the Flash chip model, the partition size is set to 128K bytes, and the last partition is based on the actual data length.

[0009] As a further aspect of the present invention: In S3, the embedded device is equipped with a multi-core processor and runs an embedded operating system; the embedded operating system creates and schedules multiple concurrently executed threads; the firmware upgrade process is decomposed into data reception, data comparison and Flash operation subtasks; each subtask is assigned to an independent thread and scheduled by the operating system to run simultaneously on different processor cores.

[0010] As a further aspect of the present invention: the thread includes a receiving thread, a comparison thread, and erase and write operations; the receiving thread is responsible for receiving firmware data packets from different Flash or different port numbers; the comparison thread compares the received partition data with the corresponding partition data pre-read from the Flash byte by byte; the erase and write operations perform erase and write operations on the Flash partition that needs to be updated; the receiving thread, the comparison thread, and the erase and write operations communicate and coordinate with each other through a semaphore synchronization mechanism.

[0011] As a further aspect of the present invention: the receiving thread, the comparison thread, and the erase and write operations are respectively bound to different processor cores for operation through processor affinity settings; the thread responsible for receiving network packets is bound to the core with high interrupt handling efficiency, and the thread responsible for flash erasing and writing is bound to another core.

[0012] As a further aspect of the present invention: In S3, the PC assigns different network port numbers to the firmware data in different Flash memory locations; and the firmware data in the Flash memory is sent through the corresponding assigned UDP port, and the embedded device creates multiple corresponding Sockets to listen to the corresponding ports respectively.

[0013] As a further aspect of the present invention: In S3, after successfully receiving and verifying the data of a partition, the embedded device sends a status confirmation command containing the partition number to the PC via the network; the PC maintains the sending status table accordingly.

[0014] As a further aspect of the present invention: if the PC does not receive a confirmation of successful reception from the embedded device within a preset timeout period after sending a certain partition data, it determines that the partition data packet is lost or the transmission has failed; the PC then retrieves the partition data packet from the sending queue and retransmits it.

[0015] As a further aspect of the present invention: In S3, the PC reads multiple firmware files simultaneously and partitions and packages them, and the PC sends them in parallel through multiple network ports.

[0016] As a further aspect of the present invention: the method performs erase and write operations only on the Flash partitions whose content has changed through partition-level comparison; when the difference between the old and new firmware is small, only a few partitions need to be updated.

[0017] The beneficial effects of this invention are: 1) This invention uses a network as the transmission medium and partitions the Flash memory of the embedded device according to the Flash sector structure. It determines whether the current partition needs to be updated by comparing the partition data. If it needs to be updated, the data comparison and data update are processed in parallel. If it does not need to be updated, the partition is skipped directly. Multiple Flash memorys can be updated at the same time. When the firmware data to be updated is not much different from the firmware data stored in the Flash memory, this invention greatly improves the firmware update efficiency of embedded devices compared with other embedded device upgrade methods. By utilizing the partitioning and erasing characteristics of Flash memory and the multi-core parallel processing capability of embedded devices, the firmware update time is shortened. It has received good feedback in actual engineering applications. 2) This invention significantly improves the firmware upgrade efficiency of embedded devices through a firmware partitioning-based design and a multi-core parallel processing mechanism. By comparing partition-level data, erasure and writing operations are performed only on the Flash partitions that have changed, avoiding repeated processing of unchanged partitions and greatly reducing upgrade time. By utilizing the parallel capabilities of multi-core processors, data reception, data comparison, and Flash operation tasks are distributed to different cores for synchronous execution, realizing error handling between tasks and further compressing the upgrade cycle. It supports simultaneous upgrades of multiple Flash drives, and improves the overall upgrade throughput of the system through multi-port concurrent transmission and multi-threaded collaboration. This method is particularly suitable for scenarios with small firmware differences, which can greatly reduce the number of erase / write operations and network transmission burden, extend Flash life, and improve system reliability and maintenance efficiency. Attached Figure Description

[0018] Figure 1 This is a schematic diagram of the system framework of the present invention; Figure 2 This is a schematic diagram of the parallel execution process of the present invention; Figure 3 This is a schematic diagram of the PC program flow of the present invention; Figure 4 This is a schematic diagram of the embedded device program flow of the present invention. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] Example 1, as Figure 1 As shown, this embodiment provides a method for rapid upgrade of embedded devices based on firmware partitioning. This method includes the following steps: First: After the embedded device is powered on, it reads the firmware data stored in the Flash memory and divides the firmware data into multiple partitions according to the predefined Flash sector structure.

[0021] The partition size of the Flash sector structure is configured according to the Flash chip model, with the partition size set to 128K bytes. The last partition is based on the actual data length. Embedded devices and PCs agree on this partition size value in advance to ensure the consistency of data partitioning and reassembly.

[0022] Second: The PC reads the firmware file to be upgraded and divides and packages the firmware file according to the same partitioning strategy.

[0023] Third: The PC sends the partitioned data packets to the embedded device via the network.

[0024] Embedded devices are equipped with multi-core processors and run embedded operating systems; the embedded operating system creates and schedules multiple concurrently executing threads; the firmware upgrade process is decomposed into data reception, data comparison, and Flash operation subtasks; each subtask is assigned to an independent thread and scheduled by the operating system to run simultaneously on different processor cores.

[0025] The thread includes a receiving thread, a comparison thread, and erase and write operations. The receiving thread is responsible for receiving firmware data packets from different Flash or different port numbers. The comparison thread compares the received partition data with the corresponding partition data pre-read from the Flash byte by byte. The erase and write operations perform erase and write operations on the Flash partitions that need to be updated. The receiving thread, the comparison thread, and the erase and write operations communicate and coordinate with each other through a semaphore synchronization mechanism.

[0026] The receiving thread, comparison thread, and erase and write operations are bound to different processor cores through processor affinity settings; the thread responsible for receiving network packets is bound to the core with high interrupt handling efficiency, and the thread responsible for flash erasing and writing is bound to another core.

[0027] The PC assigns different network port numbers to different Flash firmware data; and the Flash firmware data is sent through the corresponding assigned UDP port. The embedded device creates multiple corresponding sockets to listen to these ports respectively.

[0028] After successfully receiving and verifying the data of a partition, the embedded device sends a status confirmation command containing the partition number to the PC via the network; the PC then maintains the transmission status table based on this command.

[0029] If the PC does not receive a confirmation of successful reception from the embedded device within a preset timeout period after sending data for a certain partition, it determines that the partition data packet is lost or the transmission failed; the PC then retrieves the partition data packet from the sending queue and retransmits it.

[0030] The PC reads multiple firmware files simultaneously and partitions and packages them, then sends them in parallel through multiple network ports.

[0031] Fourth: While receiving data packets, the embedded device compares the received partition data with the corresponding partition data in Flash in real time. If the data of a certain partition has not changed, the erase and write operations of that partition are skipped; if the data is found to be inconsistent, the partition is erased and rewritten. Fifth: Utilize the multi-core architecture of embedded devices to distribute data reception, data comparison, and Flash operation tasks to different cores for parallel execution.

[0032] In this embodiment, the PC uses Fudan Microelectronics' JFMQL100TAI as the main chip, and is equipped with a PHY chip, DDR, two Flash chips, and other peripherals to form an embedded device. The JFMQL100TAI includes a quad-core ARM processor, such as... Figure 1 As shown: The PC mainly completes firmware data reading, firmware data partitioning and packaging, and network transmission; the embedded device mainly completes Flash partitioning (including firmware partitioning), firmware data partition reading, network reception and partition data comparison multi-threaded parallel processing, and Flash partition erasure and burning parallel processing.

[0033] Further explanation is needed: Embedded devices can update multiple Flash firmwares simultaneously. This embodiment uses two Flash firmware updates, and this can be extended to multiple updates in the same way.

[0034] However, when facing multiple Flash firmware upgrades and large firmware sizes, or when conducting firmware upgrade reliability testing, different port numbers are added to the network communication protocol between the PC and the embedded device to distinguish different Flash firmwares in order to improve the firmware update efficiency of embedded devices. This facilitates the simultaneous transmission of multiple Flash firmware data. In addition, since there are various forms of erasing and writing Flash chips, including whole-chip erasure or sector erasure, the Flash chip can be partitioned using the sector size. The corresponding binary firmware is also partitioned, and the firmware update is narrowed down to the partition. Before the firmware update, the partition data is compared. If the comparison results are inconsistent, the partition is updated. If the comparison results are consistent, the partition is not updated, avoiding erasing and updating the entire Flash. At the same time, multi-core parallel processing technology is used to process firmware data network reception, firmware data partition comparison, partition erasure, and writing in parallel, which greatly improves the firmware update efficiency.

[0035] This method performs erase and write operations only on Flash partitions whose content has changed through partition-level comparison; when the differences between the old and new firmware are small, only a few partitions need to be updated.

[0036] Example 2: This example provides a rapid upgrade method for embedded devices based on firmware partitioning, which can be used in practical operations. The rapid upgrade method for embedded devices includes the following steps: After the embedded device is powered on, it first reads the firmware data stored in the two Flash memory modules. Based on the Flash sector structure, it partitions the firmware data into m1 and m2 parts respectively. If the last part is less than 128K in length, the remaining length is used. Here, 128K is just one way of partitioning, and other values ​​can also be set.

[0037] The embedded device runs on an embedded operating system and leverages the processor's four cores to create six threads: Thread 1 and Thread 2 are bound to processor core 0 and block while waiting to receive two firmware updates; Thread 3 and Thread 4 are bound to processor core 1 and block while waiting to compare partition data of two firmware files; Thread 5 is bound to processor core 2 and block while waiting to erase and write the first Flash partition; Thread 6 is bound to processor core 3 and block while waiting to erase and write the second Flash partition.

[0038] The PC runs a test program, opens and reads the two firmware files to be updated, partitions them (partition 1 and partition 2) and stores them in local memory, and then creates three threads: thread 1 and thread 2 are used to send data from firmware 1 and firmware 2, and thread 3 is used to receive status commands returned by the embedded device.

[0039] The PC's test program's thread 1 or thread 2 sends data from partition 1 to the embedded device. After receiving the data from partition 1, the embedded device's thread 1 or thread 2 first notifies the PC that the current partition's data reception is complete. Then, it sends a sem signal to notify thread 3 or thread 4 to begin comparing the partition 1 data. If the compared data matches, the partition can be skipped without any erasure or writing operations. If the compared data does not match, a sem signal is sent to notify thread 5 or thread 6 to begin erasing and writing the Flash partition 1. Simultaneously, the embedded device is receiving data from partition 2 while comparing partition 1 data, processing partition data comparison and UDP data reception in parallel.

[0040] The embedded device starts by receiving data from partition 1 and processes it in a loop according to the above operation until the last partition. After all partitions have been processed, the PC is notified of the update completion via UDP.

[0041] When performing a Flash firmware upgrade, instead of erasing and rewriting the entire Flash, the Flash is partitioned according to its sector structure. The Flash firmware update is then reduced to a partition within the Flash. In this embodiment, the Flash partition size is set to 128K, dividing the Flash into 256 regions.

[0042] Before updating the Flash firmware, the firmware data is first read and stored in local DDR memory according to partitions. When updating the firmware, the partition data received via UDP is compared with the stored partition data. If the comparison results are the same, it means that the partition data has not changed and can be skipped directly. If the comparison results are different, it means that the partition data has changed, and partition erasure and flashing are performed immediately. When the firmware data to be updated is not significantly different from the firmware data stored in Flash, many partitions can be skipped from updating. Only the partitions with changed data need to be updated, which can greatly save firmware update time.

[0043] When an embedded device has multiple cores, the multi-threaded parallel mechanism of the embedded operating system can be used to process firmware data UDP reception, partition data comparison, Flash partition erasure and burning in parallel. There is no need to wait for all firmware data to be received before updating, which fully leverages the parallel processing advantages of the multi-core operating system and improves the efficiency of remote firmware updates.

[0044] When performing firmware upgrades and updates for embedded devices, this invention can perform multiple Flash firmware updates simultaneously, not just one Flash.

[0045] Example 3, as Figure 2 , Figure 3 and Figure 4As shown, this embodiment provides a method for rapid upgrade of embedded devices based on firmware partitioning. This method is based on a PC and an embedded device. For the PC, an application program is written using the VS2010 development environment, and the program flowchart is shown below. Figure 3 As shown, the two Flash firmware files that need to be updated for the embedded device have been copied to the PC's hard drive. First, open and read the two firmware files that need to be stored. In this embodiment, the two Flash models are EFM25QL256-E8 and JFM29GL256-E56, respectively. Refer to the Flash chip datasheet and partition the data according to the Flash sector structure. Each Flash partition can be set to 128KB, for a total of 256 partitions. The corresponding firmware data is also partitioned in 128KB lengths. If the last partition has less than 128KB remaining, the remaining length will be used for partitioning. The partition data is then stored in the PC's local memory. Three task threads are created: thread 1, thread 2, and thread 3. Thread 1 and thread 2 are used to send data from firmware 1 and firmware 2, while thread 3 is used to receive status commands from the embedded device indicating that the operation is complete. Thread 1 and thread 2 first initialize the network sending socket, and then send the partition data sequentially according to the partition number. Thread 3 blocks and waits to receive the partition number returned by the embedded device after receiving the partition data. If the returned partition number is complete, the transmission is complete. If the returned partition number is missing, the missing partition data is retransmitted to ensure that all partition data is sent completely without packet loss.

[0046] For embedded devices, such as Figure 2 As shown, leveraging the advantages of a quad-core processor, a parallel processing flow is designed to perform partition data reception, data comparison, partition erasure, and error writing. At time t0, only the data of the first partition is received, and data comparison and partition erasure are not yet started. At time tk, when the UDP receives the data of the Kth partition, the data of the ith partition is being compared, and the jth partition is being erased and written. If the firmware to be updated is only slightly different from the firmware data already stored in the Flash, the partition erasure and writing operations with consistent data can be omitted, greatly shortening the firmware update time.

[0047] After the embedded device is powered on, such as Figure 4As shown, the firmware data stored in the two Flash memory modules is first read. Based on the previously set 128K sector size, the read firmware data is partitioned. Assuming the first firmware data is divided into m1 partitions and the second firmware data into m2 partitions, if the length of either m1 or m2 partition is less than 128K bytes, the remaining length is used. Both m1 and m2 are less than the total partition size of 256. The partitioned firmware data is then stored in DDR memory. Six task threads are then created. Threads 1 and 2 are used to receive the firmware data from the two Flash memory modules and return a partition data reception completion command to the PC. Threads 1 and 2 are bound to processor core 0. Threads 3 and 4 are used for comparing the partition data of the two Flash memory modules and are bound to processor core 1. Threads 5 and 6 are used for erasing and writing data to the two Flash memory modules. Thread 5 is bound to processor core 2, and thread 6 is bound to processor core 3. Leveraging the advantages of multi-core processing, network reception, partition data comparison, Flash partition erasure, and programming are processed in parallel. When thread 1 or thread 2 finishes receiving data from the first partition, it notifies the PC that the data reception for that partition is complete. Simultaneously, it uses sem_post to notify thread 3 or thread 4 to perform data comparison for partition 1. Thus, while receiving data from the second partition, thread 3 or thread 4 is also performing data comparison. If the partition data received from the network matches the partition data stored in the Flash, the partition is skipped without any erasure or programming operations, saving the erasure and programming time for that partition. If the comparison results are inconsistent, the partition number is recorded, and sem_post is used to notify thread 5 or thread 6 to start the erasure and programming operations for that partition. This process is repeated cyclically. After all partitions are processed, the PC is notified via UDP that the update is complete.

[0048] When the firmware to be updated differs very little from the firmware stored in Flash, assuming that only 'a' partitions have data changes, then according to the processing method in this embodiment, only 'a' partitions need to be erased, which can save the erasure time of 256-a partitions, and also save the writing time of m1-a or m2-a, greatly improving the firmware update efficiency.

[0049] Working process: The PC reads the firmware file to be upgraded, partitions and packages the firmware according to the predefined Flash sector structure, and sends it to the embedded device via network packets. After the embedded device powers on, it pre-reads the existing firmware data in the Flash and partitions it into memory according to the same strategy. The device uses a multi-core processor to create multiple threads, which are responsible for receiving network data, comparing partition data, and performing Flash erase and write operations, respectively. After the receiving thread obtains complete partition data, it immediately triggers the comparison thread to perform real-time comparison. If the data matches, the partition is skipped; if they do not match, the erase and write operations are triggered to erase and write the partition. The entire process uses a semaphore mechanism to achieve synchronization between threads, ensuring that data reception, comparison, and writing proceed in parallel. The PC ensures the reliability of data transmission through status confirmation and retransmission mechanisms, ultimately achieving efficient and reliable firmware upgrades.

[0050] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

[0051] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

Claims

1. A method for rapid upgrade of embedded devices based on firmware partitioning, characterized in that, The method for rapid upgrade of embedded devices includes the following steps: S1. After the embedded device is powered on, it reads the firmware data stored in the Flash memory and divides the firmware data into multiple partitions according to the predefined Flash sector structure. S2, the PC reads the firmware file to be upgraded and divides and packages the firmware file according to the same partitioning strategy; S3: The PC sends the partitioned data packets to the embedded device via the network; S4. While receiving data packets, the embedded device compares the received partition data with the corresponding partition data in Flash in real time. If the data of a certain partition has not changed, the erase and write operations of that partition are skipped; if the data is found to be inconsistent, the partition is erased and rewritten. S5. Utilize the multi-core architecture of the embedded device to distribute data reception, data comparison, and Flash operation tasks to different cores for parallel execution. Process the above operations in a loop until the last partition is completed. After all partitions are processed, notify the PC via UDP to complete the update.

2. The method for rapid upgrade of embedded devices according to claim 1, characterized in that: In S1, the partition size of the Flash sector structure is configured according to the Flash chip model, with the partition size set to 128K bytes, and the last partition based on the actual data length.

3. The method for rapid upgrade of embedded devices according to claim 1, characterized in that: In S3, the embedded device is equipped with a multi-core processor and runs an embedded operating system; The embedded operating system creates and schedules multiple concurrently executing threads; it decomposes the firmware file upgrade process into subtasks of data reception, data comparison, and Flash operation. Each subtask is assigned to an independent thread and scheduled by the embedded operating system to run simultaneously on different processor cores.

4. The method for rapid upgrade of embedded devices according to claim 3, characterized in that: The thread includes a receiving thread, a comparison thread, and erase and write operations; the receiving thread is responsible for receiving firmware data packets from different Flash or different port numbers; The comparison thread compares the received partition data with the corresponding partition data pre-read from the Flash byte by byte; the erase and write operations perform erase and write operations on the Flash partitions that need to be updated; the receiving thread, the comparison thread, and the erase and write operations communicate and coordinate with each other through a semaphore synchronization mechanism.

5. The method for rapid upgrade of embedded devices according to claim 4, characterized in that: The receiving thread, comparison thread, and erase and write operations are bound to different processor cores through processor affinity settings; the thread responsible for receiving network packets is bound to a core with high interrupt handling efficiency, and the thread responsible for flash erasing and writing is bound to another core.

6. The method for rapid upgrade of embedded devices according to claim 1, characterized in that: In step S3, the PC assigns different network port numbers to the firmware data in different Flash memory locations; and the firmware data in the Flash memory is sent through the corresponding assigned UDP port, and the embedded device creates multiple corresponding Sockets to listen to the corresponding ports.

7. The method for rapid upgrade of embedded devices according to claim 1, characterized in that: In step S3, after successfully receiving and verifying the data of a partition, the embedded device sends a status confirmation command containing the partition number to the PC via the network; the PC maintains the sending status table accordingly.

8. The method for rapid upgrade of embedded devices according to claim 7, characterized in that: If the PC does not receive a successful reception confirmation from the embedded device within a preset timeout period after sending a certain partition data, it determines that the partition data packet is lost or the transmission failed; the PC then retrieves the partition data packet from the sending queue and retransmits it.

9. The method for rapid upgrade of embedded devices according to claim 1, characterized in that: In S3, the PC reads multiple firmware files simultaneously and partitions and packages them, and then sends them in parallel through multiple network ports.

10. The method for rapid upgrade of embedded devices according to claim 1, characterized in that: This method performs erase and write operations only on Flash partitions whose content has changed through partition-level comparison; when the difference between the old and new firmware is small, only a few partitions need to be updated.

Citation Information

Patent Citations

  • Embedded system firmware on-line upgrading method

    CN101477471B

  • Embedded intelligent terminal firmware remote upgrading method and system and medium

    CN116360809A