技术领域Technical Field
本发明涉及嵌入式工业设备技术领域,具体涉及一种不复位控制芯片的固件实时更新方法、系统及计算机可读存储介质。The present invention relates to the technical field of embedded industrial equipment, and in particular to a firmware real-time updating method and system for a non-resetting control chip, and a computer-readable storage medium.
背景技术Background technique
固件(Firmware)是写入EPROM(可擦写可编程只读存储器)、EEPROM(电可擦可编程只读存储器) 或FLASH芯片中的程序。固件是设备内部保存的设备“驱动程序”,担任着一个数码产品最基础、最底层的工作。通过固件,操作系统才能按照标准的设备驱动实现特定机器的运行动作,一般可由用户通过特定的刷新程序进行升级的程序。而在硬件设备中,固件就是硬件设备的灵魂,因为一些硬件设备除了固件以外没有其它软件组成,因此固件也就决定着硬件设备的功能及性能。Firmware is a program written into EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory) or FLASH chip. Firmware is the device "driver" stored inside the device, and it performs the most basic and lowest-level work of a digital product. Through firmware, the operating system can implement the operation of a specific machine according to the standard device driver, and it can generally be upgraded by the user through a specific refresh program. In hardware devices, firmware is the soul of the hardware device, because some hardware devices have no other software components except firmware, so firmware determines the function and performance of the hardware device.
许多应用都要求产品在发布后支持软件升级,软件升级会强制应用包含一个自举程序,以管理闪存内容和与外部主机设备共享信息的通信介质。受单片机的架构影响,闪存擦/写操作期间会停止执行指令,由于这些操作可能花费数毫秒,应用通常离线来执行固件更新,停机时间可能长达数秒,这对于某些终端应用而言可能成本过高。在非冗余情况下,执行软件更新会使控制芯片进行复位重启,从而造成设备工作状态的变化,即使在冗余环境下,有时也需要手动重新设计设备升级流程,这同样会产生额外成本。Many applications require that products support software upgrades after release, which forces the application to include a bootloader to manage the flash memory contents and the communication medium to share information with an external host device. Due to the architecture of the microcontroller, instruction execution stops during flash erase/write operations. Since these operations can take several milliseconds, applications are often offline to perform firmware updates, and downtime can be as long as several seconds, which may be too costly for some terminal applications. In non-redundant situations, performing software updates will cause the control chip to reset and restart, resulting in changes in the device's operating state. Even in a redundant environment, it is sometimes necessary to manually redesign the device upgrade process, which also incurs additional costs.
发明内容Summary of the invention
有鉴于此,有必要提供一种防止终端应用非冗余设备配置进行固件升级时设备暂停响应的不复位控制芯片的固件实时更新方法、系统及计算机可读存储介质。In view of this, it is necessary to provide a firmware real-time update method, system and computer-readable storage medium that prevents the device from pausing to respond when the terminal applies a non-redundant device configuration to perform a firmware upgrade without resetting the control chip.
一种不复位控制芯片的固件实时更新方法,该控制芯片具有双存储分区闪存,所述方法包括以下步骤:A method for real-time firmware update without resetting a control chip, the control chip having a dual storage partition flash memory, the method comprising the following steps:
步骤一,控制芯片的第一闪存分区Flash Bank 1内存储更新前的应用程序代码和分区交换代码,控制芯片的第二闪存分区Flash Bank 2内存储更新后的应用程序代码和分区交换代码;Step 1: the first flash memory partition Flash Bank 1 of the control chip stores the application code and the partition exchange code before the update, and the second flash memory partition Flash Bank 2 of the control chip stores the application code and the partition exchange code after the update;
步骤二,控制芯片上电,默认从第一闪存分区Flash Bank 1启动,执行控制芯片启动代码,将闪存分区内的读写段拷贝至静态随机存取存储分区,初始化外部设备,进入主循环程序;Step 2: The control chip is powered on and starts from the first flash partition Flash Bank 1 by default. The control chip startup code is executed to copy the read and write segments in the flash partition to the static random access storage partition, initialize external devices, and enter the main loop program.
步骤三,执行Bank交换指令;控制芯片执行第一闪存分区Flash Bank 1的第二只读闪存分区ROM2区的分区交换代码,并开启内存重映射控制功能;Step 3, execute the Bank exchange instruction; the control chip executes the partition exchange code of the second read-only flash partition ROM2 area of the first flash partition Flash Bank 1, and starts the memory remapping control function;
步骤四,中央处理器CPU状态维持不变,控制芯片从第二闪存分区Flash Bank 2获取并执行下一条指令,引导至第二闪存分区Flash Bank 2的第一只读闪存分区ROM1,执行更新后的应用程序代码。Step 4: the CPU state remains unchanged, the control chip obtains and executes the next instruction from the second flash partition Flash Bank 2, guides to the first read-only flash partition ROM1 of the second flash partition Flash Bank 2, and executes the updated application code.
优选地,所述控制芯片具有内存重映射的控制功能,其堆栈、寄存器和PC指针都保持不变。Preferably, the control chip has a memory remapping control function, and its stack, register and PC pointer remain unchanged.
优选地,所述控制芯片包括两个独立的闪存分区,两个独立的闪存分区分别为第一闪存分区Flash Bank 1和第二闪存分区Flash Bank 2,每个所述闪存分区分别包括一个第一只读闪存分区ROM1和一个第二只读闪存分区ROM2,两个所述第一只读闪存分区ROM1存储有内容可变更的应用程序代码;两个所述第二只读闪存分区ROM2存储有相同的分区交换代码。Preferably, the control chip includes two independent flash memory partitions, the two independent flash memory partitions are respectively a first flash memory partition Flash Bank 1 and a second flash memory partition Flash Bank 2, each of the flash memory partitions includes a first read-only flash memory partition ROM1 and a second read-only flash memory partition ROM2, the two first read-only flash memory partition ROM1 store application code with changeable content; the two second read-only flash memory partition ROM2 store the same partition exchange code.
优选地,所述控制芯片还包括一个静态随机存取存储分区,所述静态随机存取存储分区包括第一读写分区SRAM1和第二读写分区SRAM2,所述第一读写分区SRAM1存储有可重新初始化的数据段内容;所述第二读写分区SRAM2存储有不可重新初始化的数据段内容。Preferably, the control chip also includes a static random access storage partition, which includes a first read-write partition SRAM1 and a second read-write partition SRAM2, wherein the first read-write partition SRAM1 stores re-initializable data segment content; and the second read-write partition SRAM2 stores non-re-initializable data segment content.
优选地,步骤一中的控制芯片的第一闪存分区Flash Bank 1内存储更新前的应用程序代码和分区交换代码,控制芯片的第二闪存分区Flash Bank 2内存储更新后的应用程序代码和分区交换代码的步骤具体包括:Preferably, the step of storing the application code and the partition exchange code before the update in the first flash partition Flash Bank 1 of the control chip in step 1, and storing the updated application code and the partition exchange code in the second flash partition Flash Bank 2 of the control chip specifically includes:
步骤1.1,第一闪存分区Flash Bank 1的第一只读闪存分区ROM1内存储更新前的应用程序代码,第一闪存分区Flash Bank 1的第二只读闪存分区ROM2存储分区交换代码;Step 1.1, the first read-only flash partition ROM1 of the first flash partition Flash Bank 1 stores the application code before the update, and the second read-only flash partition ROM2 of the first flash partition Flash Bank 1 stores the partition exchange code;
步骤1.2,第二闪存分区Flash Bank 2的第一只读闪存分区ROM1内存储更新后的应用程序代码,第二闪存分区Flash Bank 2的第二只读闪存分区ROM2存储分区交换代码。Step 1.2: the first read-only flash partition ROM1 of the second flash partition Flash Bank 2 stores the updated application code, and the second read-only flash partition ROM2 of the second flash partition Flash Bank 2 stores the partition exchange code.
优选地,步骤二中的将闪存分区内的读写段拷贝至静态随机存取存储分区的步骤具体包括:Preferably, the step of copying the read-write segment in the flash memory partition to the static random access storage partition in step 2 specifically includes:
步骤2.1,将可重新初始化的数据段内容拷贝至第一读写分区SRAM1;Step 2.1, copy the content of the reinitializable data segment to the first read-write partition SRAM1;
步骤2.2,将不可重新初始化的数据段内容拷贝至第二读写分区SRAM2。Step 2.2, copy the content of the data segment that cannot be reinitialized to the second read-write partition SRAM2.
优选地,步骤三中的开启内存重映射控制功能的具体步骤包括:Preferably, the specific steps of enabling the memory remapping control function in step 3 include:
步骤3.1,第一闪存分区Flash Bank 1与第二闪存分区Flash Bank 2的地址空间发生交换。Step 3.1: The address spaces of the first flash memory partition Flash Bank 1 and the second flash memory partition Flash Bank 2 are exchanged.
优选地,步骤四中的控制芯片从第二闪存分区Flash Bank 2获取并执行下一条指令后还包括以下步骤:Preferably, after the control chip in step 4 obtains and executes the next instruction from the second flash memory partition Flash Bank 2, the following steps are also included:
步骤4.1,第二闪存分区Flash Bank 2的第一只读闪存分区ROM1将第一读写分区SRAM1重新初始化,第二读写分区SRAM2的内容保持不变。Step 4.1, the first read-only flash partition ROM1 of the second flash partition Flash Bank 2 reinitializes the first read-write partition SRAM1, and the content of the second read-write partition SRAM2 remains unchanged.
以及,一种不复位控制芯片的固件实时更新系统,用于实现如上所述的不复位控制芯片的固件实时更新方法,所述系统包括:And, a real-time firmware update system without resetting the control chip, used to implement the real-time firmware update method without resetting the control chip as described above, the system comprising:
闪存分区单元,包括第一闪存分区Flash Bank 1和第二闪存分区Flash Bank 2,用于存储更新前后的应用程序代码和分区交换代码;A flash partition unit, including a first flash partition Flash Bank 1 and a second flash partition Flash Bank 2, for storing application code and partition exchange code before and after updating;
静态随机存取存储分区单元,包括第一读写分区SRAM1和第二读写分区SRAM2,用于存储可重新初始化数据段和不可重新初始化数据段;A static random access memory partition unit, comprising a first read-write partition SRAM1 and a second read-write partition SRAM2, for storing a re-initializable data segment and a non-re-initializable data segment;
命令执行单元,包括控制芯片,用于执行所述闪存分区单元内的应用程序代码。The command execution unit includes a control chip and is used to execute the application code in the flash memory partition unit.
以及,一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行实现如上所述的不复位控制芯片的固件实时更新方法。And, a computer-readable storage medium stores a computer program thereon, wherein the program is executed by a processor to implement the firmware real-time update method without resetting the control chip as described above.
上述不复位控制芯片的固件实时更新方法、系统及计算机可读存储介质中,设备的控制芯片使用带有双闪存分区的单片机,并具有内存重映射的控制功能,使控制芯片在执行旧固件应用程序功能的同时,对闪存分区进行新固件的编程,并通过内存重映射功能无缝交换执行新固件,完成不复位控制芯片的固件实时更新。从终端用户的角度考虑,本发明使得产品升级时不影响用户的正常使用,提供了终端使用的稳定性,安全性和易用性。从产品的使用寿命角度考虑,闪存上两个版本区域是交替使用的,升级成功后下一次启动从另一个区域运行,相比于在同一个区域进行版本更新和运行的产品,闪存分区交替使用延长了使用寿命,提高了产品的稳定性。本发明的方法简单,易于实现,成本低廉,便于推广。In the above-mentioned method, system and computer-readable storage medium for real-time firmware update without resetting the control chip, the control chip of the device uses a single-chip microcomputer with dual flash memory partitions and has a memory remapping control function, so that the control chip can program the flash memory partition with new firmware while executing the old firmware application function, and seamlessly exchange and execute the new firmware through the memory remapping function to complete the real-time firmware update of the control chip without resetting. From the perspective of the end user, the present invention does not affect the normal use of the user when the product is upgraded, and provides stability, security and ease of use for the terminal. From the perspective of the service life of the product, the two version areas on the flash memory are used alternately. After the upgrade is successful, the next startup will run from another area. Compared with products that perform version updates and operations in the same area, the alternating use of flash memory partitions prolongs the service life and improves the stability of the product. The method of the present invention is simple, easy to implement, low-cost, and easy to promote.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是本发明实施例不复位控制芯片的固件实时更新方法的设备交换固件流程图。FIG. 1 is a flowchart of device firmware exchange according to a method for real-time firmware update without resetting a control chip according to an embodiment of the present invention.
图2是本发明实施例不复位控制芯片的固件实时更新方法的双闪存存储分区在不同模式下的地址映射示意图。FIG. 2 is a schematic diagram of address mapping of dual flash memory partitions in different modes in a method for real-time firmware update without resetting a control chip according to an embodiment of the present invention.
图3是本发明实施例不复位控制芯片的固件实时更新方法的双闪存存储分区下程序和变量的地址映射示意图。3 is a schematic diagram of address mapping of programs and variables under dual flash memory storage partitions in a method for real-time firmware update without resetting a control chip according to an embodiment of the present invention.
具体实施方式Detailed ways
本实施例以不复位控制芯片的固件实时更新方法、系统及计算机可读存储介质为例,以下将结合具体实施例和附图对本发明进行详细说明。This embodiment takes the firmware real-time update method, system and computer-readable storage medium without resetting the control chip as an example, and the present invention will be described in detail below in conjunction with specific embodiments and drawings.
请参阅图1、图2和图3,示出本发明实施例提供的一种不复位控制芯片的固件实时更新方法,在本实施例中,使用的控制芯片具有内存重映射的控制功能,其堆栈、寄存器和PC指针都保持不变。所述控制芯片的内存重映射操作不会影响CPU的当前状态。所述方法包括以下步骤:Please refer to Figures 1, 2 and 3, which illustrate a method for real-time firmware update without resetting the control chip provided by an embodiment of the present invention. In this embodiment, the control chip used has a memory remapping control function, and its stack, register and PC pointer remain unchanged. The memory remapping operation of the control chip will not affect the current state of the CPU. The method includes the following steps:
步骤S100,控制芯片的第一闪存分区Flash Bank 1内存储更新前的应用程序代码和分区交换代码,控制芯片的第二闪存分区Flash Bank 2内存储更新后的应用程序代码和分区交换代码。Step S100: the first flash partition Flash Bank 1 of the control chip stores the application code and the partition exchange code before the update, and the second flash partition Flash Bank 2 of the control chip stores the application code and the partition exchange code after the update.
步骤S110,第一闪存分区Flash Bank 1的第一只读闪存分区ROM1内存储更新前的应用程序代码,第一闪存分区Flash Bank 1的第二只读闪存分区ROM2存储分区交换代码。Step S110 , the first read-only flash partition ROM1 of the first flash partition Flash Bank 1 stores the application code before updating, and the second read-only flash partition ROM2 of the first flash partition Flash Bank 1 stores the partition exchange code.
步骤S120,第二闪存分区Flash Bank 2的第一只读闪存分区ROM1内存储更新后的应用程序代码,第二闪存分区Flash Bank 2的第二只读闪存分区ROM2存储分区交换代码。Step S120 , the first read-only flash partition ROM1 of the second flash partition Flash Bank 2 stores the updated application code, and the second read-only flash partition ROM2 of the second flash partition Flash Bank 2 stores the partition exchange code.
具体地,控制芯片在执行第一闪存分区Flash Bank 1的第一只读闪存分区ROM1中的更新前的应用程序代码的同时,能够对第二闪存分区Flash Bank 2的第一只读闪存分区ROM1中的更新后的应用程序代码进行编程。Specifically, the control chip can program the updated application code in the first read-only flash partition ROM1 of the second flash partition Flash Bank 2 while executing the application code before update in the first read-only flash partition ROM1 of the first flash partition Flash Bank 1 .
步骤S200,控制芯片上电,默认从第一闪存分区Flash Bank 1启动,执行控制芯片启动代码,将闪存分区内的读写段拷贝至静态随机存取存储分区,初始化外部设备,进入主循环程序。Step S200, the control chip is powered on, and by default it starts from the first flash partition Flash Bank 1, executes the control chip startup code, copies the read and write segments in the flash partition to the static random access storage partition, initializes external devices, and enters the main loop program.
步骤S210,将可重新初始化的数据段内容拷贝至第一读写分区SRAM1。Step S210, copying the content of the reinitializable data segment to the first read-write partition SRAM1.
步骤S220,将不可重新初始化的数据段内容拷贝至第二读写分区SRAM2。Step S220, copying the content of the data segment that cannot be reinitialized to the second read-write partition SRAM2.
步骤S300,执行Bank交换指令;控制芯片执行第一闪存分区Flash Bank 1的第二只读闪存分区ROM2区的分区交换代码,并开启内存重映射控制功能。Step S300, executing the Bank exchange instruction; the control chip executes the partition exchange code of the second read-only flash partition ROM2 area of the first flash partition Flash Bank 1, and starts the memory remapping control function.
步骤S310,第一闪存分区Flash Bank 1与第二闪存分区Flash Bank 2的地址空间发生交换。Step S310: the address spaces of the first flash memory partition Flash Bank 1 and the second flash memory partition Flash Bank 2 are exchanged.
具体地,如图2所示,在正常模式下,第一闪存分区Flash Bank 1的地址空间为0x0800 0000至0x0803 FFFF, 第二闪存分区Flash Bank 2的地址空间为0x0804 0000至0x0807 FFFF;当内存重映射功能使能时,两个独立的闪存分区地址空间发生交换,即第一闪存分区Flash Bank 1的地址空间为0x0804 0000至0x0807 FFFF,第二闪存分区FlashBank 2的地址空间为0x0800 0000至0x0803 FFFF。Specifically, as shown in Figure 2, in normal mode, the address space of the first flash memory partition Flash Bank 1 is 0x0800 0000 to 0x0803 FFFF, and the address space of the second flash memory partition Flash Bank 2 is 0x0804 0000 to 0x0807 FFFF; when the memory remapping function is enabled, the address spaces of the two independent flash memory partitions are swapped, that is, the address space of the first flash memory partition Flash Bank 1 is 0x0804 0000 to 0x0807 FFFF, and the address space of the second flash memory partition FlashBank 2 is 0x0800 0000 to 0x0803 FFFF.
步骤S400,中央处理器CPU状态维持不变,控制芯片从第二闪存分区Flash Bank 2获取并执行下一条指令,引导至第二闪存分区Flash Bank 2的第一只读闪存分区ROM1,执行更新后的应用程序代码。Step S400, the CPU state remains unchanged, the control chip obtains and executes the next instruction from the second flash partition Flash Bank 2, guides to the first read-only flash partition ROM1 of the second flash partition Flash Bank 2, and executes the updated application code.
步骤S410,第二闪存分区Flash Bank 2的第一只读闪存分区ROM1将第一读写分区SRAM1重新初始化,第二读写分区SRAM2的内容保持不变。Step S410: the first read-only flash partition ROM1 of the second flash partition Flash Bank 2 reinitializes the first read-write partition SRAM1, and the content of the second read-write partition SRAM2 remains unchanged.
具体地,第二读写分区SRAM2的内容保持不变,即,在执行Bank交换指令前后,第一闪存分区Flash Bank 1和第二闪存分区Flash Bank 2共用的第二读写分区SRAM2的内容没有改变,使设备的关键工作状态保持不变。Specifically, the content of the second read-write partition SRAM2 remains unchanged, that is, before and after the Bank exchange instruction is executed, the content of the second read-write partition SRAM2 shared by the first flash partition Flash Bank 1 and the second flash partition Flash Bank 2 does not change, so that the key working state of the device remains unchanged.
优选地,所述控制芯片包括两个独立的闪存分区,两个独立的闪存分区分别为第一闪存分区Flash Bank 1和第二闪存分区Flash Bank 2,每个所述闪存分区分别包括一个第一只读闪存分区ROM1和一个第二只读闪存分区ROM2,两个所述第一只读闪存分区ROM1存储有内容可变更的应用程序代码;两个所述第二只读闪存分区ROM2存储有相同的分区交换代码。Preferably, the control chip includes two independent flash memory partitions, the two independent flash memory partitions are respectively a first flash memory partition Flash Bank 1 and a second flash memory partition Flash Bank 2, each of the flash memory partitions includes a first read-only flash memory partition ROM1 and a second read-only flash memory partition ROM2, the two first read-only flash memory partition ROM1 store application code with changeable content; the two second read-only flash memory partition ROM2 store the same partition exchange code.
具体地,两个所述第二只读闪存分区ROM2内存储的内容一致;两个所述第一只读闪存分区ROM1内存储的内容允许存在不同,其中,第一闪存分区Flash Bank 1的第一只读闪存分区ROM1内存储有更新前的应用程序代码,第二闪存分区Flash Bank 2的第一只读闪存分区ROM1内存储有更新后的应用程序代码。Specifically, the contents stored in the two second read-only flash partitions ROM2 are consistent; the contents stored in the two first read-only flash partitions ROM1 are allowed to be different, wherein the first read-only flash partition ROM1 of the first flash partition Flash Bank 1 stores the application code before the update, and the first read-only flash partition ROM1 of the second flash partition Flash Bank 2 stores the application code after the update.
优选地,所述控制芯片还包括一个静态随机存取存储分区,所述静态随机存取存储分区包括第一读写分区SRAM1和第二读写分区SRAM2,所述第一读写分区SRAM1存储有可重新初始化的数据段内容;所述第二读写分区SRAM2存储有不可重新初始化的数据段内容。Preferably, the control chip also includes a static random access storage partition, which includes a first read-write partition SRAM1 and a second read-write partition SRAM2, wherein the first read-write partition SRAM1 stores re-initializable data segment content; and the second read-write partition SRAM2 stores non-re-initializable data segment content.
具体地,由图2可以看出,本发明方法首先需要将所使用的控制芯片具有双闪存存储分区,并具有内存重映射的控制功能。在正常模式下,第一闪存分区Flash Bank 1的地址空间为0x0800 0000至0x0803 FFFF, 第二闪存分区Flash Bank 2的地址空间为0x08040000至0x0807 FFFF。当使能内存重映射功能时,两个独立的闪存分区地址空间将发生交换,即第一闪存分区Flash Bank 1的地址空间为0x0804 0000至0x0807 FFFF,第二闪存分区Flash Bank 2的地址空间为0x0800 0000至0x0803 FFFF。由图3可以看出,本发明方法需要对固件程序有内容和地址空间分配的要求,在独立的闪存分区(Flash Bank)里,可分为内容可变的应用代码区(ROM1)和内容/地址固定的Bank交换代码(ROM2)。在共用的静态随机存取存储分区(SRAM)里,分为可重新初始化的数据段(SRAM1)和不可重新初始化的数据段(SRAM2)。Specifically, as can be seen from FIG. 2, the method of the present invention first requires that the control chip used has dual flash storage partitions and has a memory remapping control function. In normal mode, the address space of the first flash partition Flash Bank 1 is 0x0800 0000 to 0x0803 FFFF, and the address space of the second flash partition Flash Bank 2 is 0x08040000 to 0x0807 FFFF. When the memory remapping function is enabled, the two independent flash partition address spaces will be exchanged, that is, the address space of the first flash partition Flash Bank 1 is 0x0804 0000 to 0x0807 FFFF, and the address space of the second flash partition Flash Bank 2 is 0x0800 0000 to 0x0803 FFFF. As can be seen from FIG. 3, the method of the present invention requires the content and address space allocation requirements for the firmware program. In the independent flash partition (Flash Bank), it can be divided into a content-variable application code area (ROM1) and a content/address fixed Bank exchange code (ROM2). In the shared static random access memory partition (SRAM), it is divided into a reinitializable data segment (SRAM1) and a non-reinitializable data segment (SRAM2).
如图1所示,控制芯片上电默认从第一闪存分区Flash Bank 1启动,并依次执行启动代码和初始化代码后,进入主循环等待Bank交换指令,接收到Bank交换指令之后,程序会执行第一闪存分区Flash Bank 1的ROM2区固定代码,进行内存重映射操作。由于第二闪存分区Flash Bank 2的ROM2区固定代码的地址空间和第一闪存分区Flash Bank 1的ROM2区一致,CPU状态不变的情况下,程序会执行第二闪存分区Flash Bank 2的ROM1区应用程式,实现了不复位控制芯片的固件实时更新。As shown in Figure 1, the control chip starts from the first flash partition Flash Bank 1 by default when it is powered on, and after executing the startup code and initialization code in sequence, it enters the main loop to wait for the Bank exchange instruction. After receiving the Bank exchange instruction, the program will execute the fixed code in the ROM2 area of the first flash partition Flash Bank 1 to perform memory remapping operations. Since the address space of the fixed code in the ROM2 area of the second flash partition Flash Bank 2 is consistent with the ROM2 area of the first flash partition Flash Bank 1, the program will execute the application program in the ROM1 area of the second flash partition Flash Bank 2 without changing the CPU state, thus realizing real-time firmware update without resetting the control chip.
以及,一种不复位控制芯片的固件实时更新系统,用于实现如上所述的不复位控制芯片的固件实时更新方法,所述系统包括:And, a real-time firmware update system without resetting the control chip, used to implement the real-time firmware update method without resetting the control chip as described above, the system comprising:
闪存分区单元,包括第一闪存分区Flash Bank 1和第二闪存分区Flash Bank 2,用于存储更新前后的应用程序代码和分区交换代码;A flash partition unit, including a first flash partition Flash Bank 1 and a second flash partition Flash Bank 2, for storing application code and partition exchange code before and after updating;
静态随机存取存储分区单元,包括第一读写分区SRAM1和第二读写分区SRAM2,用于存储可重新初始化数据段和不可重新初始化数据段;A static random access memory partition unit, comprising a first read-write partition SRAM1 and a second read-write partition SRAM2, for storing a re-initializable data segment and a non-re-initializable data segment;
命令执行单元,包括控制芯片,用于执行所述闪存分区单元内的应用程序代码。The command execution unit includes a control chip and is used to execute the application code in the flash memory partition unit.
以及,一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行实现如上所述的不复位控制芯片的固件实时更新方法。And, a computer-readable storage medium stores a computer program, wherein the program is executed by a processor to implement the firmware real-time update method without resetting the control chip as described above.
上述不复位控制芯片的固件实时更新方法、系统及计算机可读存储介质中,设备的控制芯片使用带有双闪存分区的单片机,并具有内存重映射的控制功能,使控制芯片在执行旧固件应用程序功能的同时,对闪存分区进行新固件的编程,并通过内存重映射功能无缝交换执行新固件,完成不复位控制芯片的固件实时更新。从终端用户的角度考虑,本发明使得产品升级时不影响用户的正常使用,提供了终端使用的稳定性,安全性和易用性。从产品的使用寿命角度考虑,闪存上两个版本区域是交替使用的,升级成功后下一次启动从另一个区域运行,相比于在同一个区域进行版本更新和运行的产品,闪存分区交替使用延长了使用寿命,提高了产品的稳定性。本发明的方法简单,易于实现,成本低廉,便于推广。In the above-mentioned method, system and computer-readable storage medium for real-time firmware update without resetting the control chip, the control chip of the device uses a single-chip microcomputer with dual flash memory partitions and has a memory remapping control function, so that the control chip can program the flash memory partition with new firmware while executing the old firmware application function, and seamlessly exchange and execute the new firmware through the memory remapping function to complete the real-time firmware update of the control chip without resetting. From the perspective of the end user, the present invention does not affect the normal use of the user when the product is upgraded, and provides stability, security and ease of use for the terminal. From the perspective of the service life of the product, the two version areas on the flash memory are used alternately. After the upgrade is successful, the next startup will run from another area. Compared with products that perform version updates and operations in the same area, the alternating use of flash memory partitions prolongs the service life and improves the stability of the product. The method of the present invention is simple, easy to implement, low-cost, and easy to promote.
需要说明的是,以上所述仅为本发明的优选实施例,并不用于限制本发明,对于本领域技术人员而言,本发明可以有各种改动和变化。凡在本发明的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。It should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410061190.1ACN117573175B (en) | 2024-01-16 | 2024-01-16 | Firmware real-time updating method, system and storage medium for non-reset control chip |
| LU600039ALU600039B1 (en) | 2024-01-16 | 2024-12-31 | Firmware real-time update method, system without resetting control chip and storage medium |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410061190.1ACN117573175B (en) | 2024-01-16 | 2024-01-16 | Firmware real-time updating method, system and storage medium for non-reset control chip |
| Publication Number | Publication Date |
|---|---|
| CN117573175A CN117573175A (en) | 2024-02-20 |
| CN117573175Btrue CN117573175B (en) | 2024-06-21 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410061190.1AActiveCN117573175B (en) | 2024-01-16 | 2024-01-16 | Firmware real-time updating method, system and storage medium for non-reset control chip |
| Country | Link |
|---|---|
| CN (1) | CN117573175B (en) |
| LU (1) | LU600039B1 (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118963803A (en)* | 2024-08-07 | 2024-11-15 | 大秦数字能源技术股份有限公司 | Firmware program updating method, system, storage medium and microprocessor |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116501343A (en)* | 2023-03-28 | 2023-07-28 | 超聚变数字技术有限公司 | Program upgrading method, power supply and computing device |
| CN116501357A (en)* | 2023-06-28 | 2023-07-28 | 广东高斯宝电气技术有限公司 | Online upgrade method of singlechip |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5596738A (en)* | 1992-01-31 | 1997-01-21 | Teac Corporation | Peripheral device control system using changeable firmware in a single flash memory |
| CN102662711B (en)* | 2012-04-06 | 2017-03-29 | 中兴通讯股份有限公司 | A kind of chip fast initializing method and device |
| CN102855151B (en)* | 2012-08-21 | 2016-06-08 | 武汉电信器件有限公司 | The optical module firmware not interrupting business is in application upgrade method |
| US11768611B2 (en)* | 2020-04-02 | 2023-09-26 | Axiado Corporation | Secure boot of a processing chip |
| CN112346770A (en)* | 2020-11-10 | 2021-02-09 | 天津津航计算技术研究所 | Embedded program online updating method |
| CN114428633A (en)* | 2022-01-05 | 2022-05-03 | 支付宝(杭州)信息技术有限公司 | Firmware upgrading method, device and equipment |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116501343A (en)* | 2023-03-28 | 2023-07-28 | 超聚变数字技术有限公司 | Program upgrading method, power supply and computing device |
| CN116501357A (en)* | 2023-06-28 | 2023-07-28 | 广东高斯宝电气技术有限公司 | Online upgrade method of singlechip |
| Publication number | Publication date |
|---|---|
| LU600039B1 (en) | 2025-07-01 |
| CN117573175A (en) | 2024-02-20 |
| Publication | Publication Date | Title |
|---|---|---|
| JP3906825B2 (en) | Computer system, computer system activation method and program | |
| JP3593241B2 (en) | How to restart the computer | |
| CN100501678C (en) | Control storage access on multiboot systems | |
| TWI480803B (en) | Shared file system management between independent operating systems | |
| US20040230963A1 (en) | Method for updating firmware in an operating system agnostic manner | |
| US7188238B2 (en) | Methods and apparatus to update a basic input/output system (BIOS) | |
| CN101091163B (en) | Manageable extension method, device and system for system firmware | |
| JPH08255084A (en) | Upgrade method of eeprom | |
| KR20010006749A (en) | Storing system-level mass storage configuration data in non-volatile memory on each mass storage device to allow for reboot/power-on reconfiguration of all installed mass storage devices to the same configuration as last use | |
| JP4527348B2 (en) | Interface device, method of updating firmware in interface device, and program thereof | |
| JP2006040301A (en) | Method of organizing information stored in non-volatile re-programmable semiconductor memory | |
| JP2009140512A (en) | Updating of read-only software module | |
| LU600039B1 (en) | Firmware real-time update method, system without resetting control chip and storage medium | |
| JP2018060316A (en) | Information processor, information processing system, information processor control method and information processor control program | |
| CN114327250B (en) | Storage system and storage system control method | |
| JP2020030812A (en) | Retrieving updated firmware code | |
| JPWO2004081791A1 (en) | Virtual machine system and firmware update method in virtual machine system | |
| US7234039B1 (en) | Method, system, and apparatus for determining the physical memory address of an allocated and locked memory buffer | |
| JP4735765B2 (en) | Linux program startup system | |
| CN116400972A (en) | Starting method, device and medium of baseboard management controller | |
| JP3693240B2 (en) | Method and system for executing adapter configuration routines utilizing different operating modes | |
| US6314482B1 (en) | Method and system for indexing adapters within a data processing system | |
| JP7491765B2 (en) | Firmware update system and firmware update method | |
| JP2000187533A (en) | Hardware initialization system by firmware | |
| CN113448639B (en) | Access method, device, equipment and storage medium for user configuration variable area |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP03 | Change of name, title or address | ||
| CP03 | Change of name, title or address | Address after:No. 10, Xingda Road, Songshan Lake Park, Dongguan City, Guangdong Province, 523000 Patentee after:Guangdong Gaosibao Electric Co.,Ltd. Country or region after:China Address before:No. 10 Xingda Road, Songshan Lake Park, Dongguan City, Guangdong Province Patentee before:Guangdong gausbao Electric Technology Co.,Ltd. Country or region before:China |