CN116820495A - Firmware burning method, device and equipment - Google Patents

Firmware burning method, device and equipment Download PDF

Info

Publication number
CN116820495A
CN116820495A CN202310754720.6A CN202310754720A CN116820495A CN 116820495 A CN116820495 A CN 116820495A CN 202310754720 A CN202310754720 A CN 202310754720A CN 116820495 A CN116820495 A CN 116820495A
Authority
CN
China
Prior art keywords
register
firmware
burned
bus
equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310754720.6A
Other languages
Chinese (zh)
Inventor
党成斌
陈志列
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Qianhai Yanxiang Asia Pacific Electronic Equipment Technology Co ltd
Original Assignee
Shenzhen Qianhai Yanxiang Asia Pacific Electronic Equipment Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Qianhai Yanxiang Asia Pacific Electronic Equipment Technology Co ltd filed Critical Shenzhen Qianhai Yanxiang Asia Pacific Electronic Equipment Technology Co ltd
Priority to CN202310754720.6A priority Critical patent/CN116820495A/en
Publication of CN116820495A publication Critical patent/CN116820495A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The embodiment of the application relates to the technical field of chip firmware burning, and discloses a firmware burning method, device and equipment, wherein the method comprises the following steps: acquiring physical address information of equipment corresponding to a first bus; calling the storage space of the device in the kernel layer according to the physical address information; acquiring register information of the equipment in the storage space, and initializing a register of the equipment according to the register information; transmitting slave device address information to the register, and initializing the slave device; and sending operation instruction information and a firmware program to be burned to the register, so that the register writes the firmware program to be burned into the slave device corresponding to the slave device address information according to the operation instruction information. By the mode, firmware burning efficiency is improved.

Description

Firmware burning method, device and equipment
Technical Field
The embodiment of the application relates to the technical field of chip firmware burning, in particular to a firmware burning method, device and equipment.
Background
Currently, chips on various computer devices are burned by suppliers at the time of shipment to make the chips have an operation control function. However, in the actual use process, the same chip may be used for different purposes, and when the chip is used for different purposes, firmware with corresponding functions needs to be re-burned.
The inventor of the present application found that the conventional chip writing is generally performed by using a writing tool provided by a chip manufacturer, and the operation is very troublesome because of the special writing tool.
Disclosure of Invention
In view of the above problems, embodiments of the present application provide a firmware burning method, device and equipment, which are used for solving the above problems in the prior art.
According to an aspect of the embodiment of the present application, there is provided a firmware burning method applied to an application layer program, the method including:
acquiring physical address information of bus equipment corresponding to a first bus;
calling a storage space of the bus equipment in a kernel layer according to the physical address information;
acquiring register information of the bus equipment in the storage space, and initializing a register of the bus equipment according to the register information;
transmitting slave device address information to the register, and initializing the slave device;
and sending operation instruction information and a firmware program to be burned to the register, so that the register writes the firmware program to be burned into the slave device corresponding to the slave device address information according to the operation instruction information.
In some embodiments, initializing the register of the bus device according to the register information includes:
initializing a register of the bus device;
and if the initialization fails, returning a failure indication.
In some embodiments, initializing the slave device includes:
initializing the slave device;
and if the initialization fails, releasing the memory space of the bus equipment in the kernel layer.
In some embodiments, the sending the operation instruction information and the firmware program to be burned to the register includes:
acquiring a file lock corresponding to a firmware program to be burned;
setting address information of slave equipment and a writing instruction of the register;
and sending the firmware program to be burned, the address information of the slave equipment and the writing instruction to the register.
In some embodiments, the sending the firmware program to be burned, the slave address information, and the write instruction to the register includes:
setting a write instruction sending address of the register;
executing a firmware program writing step: judging the size of the firmware program to be burned, and if the size is larger than a preset threshold value, sending data with preset length to the register; if the firmware program is smaller than the preset threshold value, the rest firmware program is sent to the register;
Repeatedly executing the firmware program writing step until the firmware program to be burned is completely sent to the register;
and releasing the file lock corresponding to the firmware program to be burned.
In some embodiments, after initializing the slave device, the method includes:
reading the existing firmware program on the slave device;
and comparing the existing firmware program with the firmware program to be burned, and if the existing firmware program is consistent with the firmware program to be burned, releasing the storage space of the equipment in the kernel layer.
In some embodiments, before sending the operation instruction information and the firmware program to be burned to the register, the method further includes:
and carrying out integrity check on the firmware program to be burned.
On the other hand, the embodiment of the application also provides a firmware burning device, which comprises:
an address acquisition module: the method comprises the steps of obtaining physical address information of bus equipment corresponding to a first bus;
a storage space calling module: the memory space of the bus device in the kernel layer is called according to the physical address information;
register initialization module: the register information of the bus equipment in the storage space is obtained, and the register of the bus equipment is initialized according to the register information;
The slave device initialization module: the register is used for sending address information of the slave equipment to the register and initializing the slave equipment;
and a burning module: and the register is used for sending operation instruction information and the firmware program to be burned to the register so that the register writes the firmware program to be burned into the slave equipment corresponding to the slave equipment address information according to the operation instruction information.
On the other hand, the embodiment of the application also provides firmware burning equipment, which comprises: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus;
the memory is used for storing executable instructions, and the executable instructions enable the processor to execute the firmware burning method.
On the other hand, the embodiment of the application also provides a computer readable storage medium, wherein executable instructions are stored in the storage medium, and when the executable instructions run on the firmware burning device, the firmware burning device executes the operation of the firmware burning method described in any one of the above.
According to the embodiment of the application, professional burning equipment is directly omitted, the burning program is run in the system application layer, the bottom layer hardware storage space is directly operated by means of the/dev/mem equipment nodes in the kernel, the purpose of controlling the equipment to be burned is achieved, the BIOS is not required to provide description of I2C bus equipment and load a driving program through an ACPI table, and the function switch of related equipment is not required to be opened in the kernel, so that the memory space of the related bus equipment is directly accessed, the method can be applied to different system kernels, and the compatibility among different systems is improved.
The foregoing description is only an overview of the technical solutions of the embodiments of the present application, and may be implemented according to the content of the specification, so that the technical means of the embodiments of the present application can be more clearly understood, and the following specific embodiments of the present application are given for clarity and understanding.
Drawings
The drawings are only for purposes of illustrating embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 is a schematic diagram of a conventional firmware burning system;
fig. 2 shows an application scenario schematic diagram of a firmware burning method according to an embodiment of the present application;
fig. 3 shows a flowchart of a firmware burning method according to an embodiment of the present application;
fig. 4 shows a flowchart of a firmware burning initialization method according to an embodiment of the present application;
FIG. 5 is a flowchart of writing a firmware burning file according to another embodiment of the present application;
FIG. 6 is a flowchart of a firmware burning file reading process according to another embodiment of the present application;
fig. 7 is a schematic diagram of a firmware burning device according to an embodiment of the present application;
fig. 8 shows a schematic structural diagram of a firmware burning device according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein.
Currently, the initial program of chips on various electronic devices has been burned by suppliers at the time of shipment, especially some special chips on some reinforced notebook computers, such as: HDMI conversion chips and the like are often used for different purposes, and the corresponding functional firmware needs to be re-burned.
In firmware burning, a burning tool provided by a chip vendor may be used, as shown in fig. 1, where the vendor provided burner is often a USB device, and one end of the burner is connected to an operation terminal through a bus when the firmware is burned, for example: a Windows computer or a computer provided with other operating systems, and special burning software is arranged on the computer; the other end of the burner is connected to a chip to be burnt; the bus may be an I2C bus, or other operation buses, and then the programming software provided by the provider is opened on the operation terminal, and the programming of the firmware is performed by operating the programming software.
The inventor of the application discovers that the firmware burning mode has lower efficiency, particularly when the chip is installed and burned, the machine needs to be disassembled, the related chip is disassembled, the appearance of the machine is easily scratched, a large amount of time and labor are also generated when the chip is disassembled, and in addition, the burning process needs to be manually and frequently operated and is easy to make mistakes.
In order to solve the above technical problems, the present inventors have found that the I2C bus is a simple bidirectional two-wire synchronous serial bus, in the Linux system, the I2C bus device is a hardware resource, a plurality of slave devices can be mounted on one I2C bus, an address is sent first when an I2C command is sent, all the slave devices on the I2C bus receive the address, and when the slave devices receive the address belonging to themselves, the slave devices respond. In general, a plurality of I2C bus devices are provided on the SOC, a description of the I2C bus is provided in the BIOS, after the Linux system is started, hardware resources on the motherboard can be obtained according to an ACPI table transmitted to the system by the BIOS, and a suitable driver is loaded according to contents in the table. Therefore, when the Linux system is started, the driver of the I2C bus device is loaded by the kernel, at the moment, the I2C bus device can be seen by looking up/dev/catalogue under the system, if two I2C buses exist under the system, two I2C-0 and I2C-1 devices can be seen, linux provides a set of standard to operate/dev/these device nodes under the condition that the I2C-0 bus is connected with a chip to be burnt, the chip to be burnt is an HDMI conversion chip, and then signals can be sent to the HDMI conversion chip by operating the I2C-0 bus, so that the control operation of the HDMI conversion chip is realized.
However, in the above method, the correct description needs to be provided for the I2C bus resource in the BIOS, in addition, in the kernel switch, the function of i2c_dev is already turned on, otherwise, in/DEV/directory, devices such as I2C-0, I2C-1 will not be generated, which is troublesome, needs to change the system configuration, and has poor portability of software.
In order to solve the technical problems, the inventor provides a firmware burning method, a device and equipment, which are characterized in that a firmware burning program is arranged at an application layer of a system, a memory mapping technology is adopted to directly access a storage space of bottom hardware from a register corresponding to equipment on a user space operation SOC, the firmware burning program directly calls the storage space of the equipment corresponding to a bus adopted during firmware burning in a kernel layer, the user space of the application layer and the storage space of the kernel layer are mapped, the storage space of the bottom hardware is directly accessed, and the purpose of firmware burning of equipment to be burned is achieved by accessing the register related to the bus through the register related to the bus.
In this way, professional burning equipment is directly omitted, BIOS is not required to be modified, the burning program is run at the system application layer, registers related to bottom hardware are directly operated by virtue of the/dev/mem equipment nodes in the kernel, the purpose of controlling the equipment to be burned is achieved, BIOS modification is avoided, meanwhile, the work of a production end is reduced, firmware is not required to be burned in advance in a factory, and the device is very convenient and fast to upgrade in the whole machine environment.
Fig. 2 shows an application scenario of a firmware burning method according to an embodiment of the present application, in which an I2C bus and an HDMI conversion chip are taken as an example for illustration, it can be seen from fig. 2 that, on a motherboard, a CPU may be connected to the HDMI conversion chip through the I2C bus, and the CPU may implement burning of the HDMI conversion chip by running a firmware burning program of an application layer, and compared with fig. 1, an operation terminal and a dedicated burner are omitted, thereby greatly improving burning efficiency.
In order to more specifically describe the firmware burning method according to the embodiment of the present application, referring to fig. 3, the firmware burning method according to the embodiment of the present application is applied to an application layer program, and specifically includes:
step 110: acquiring physical address information of bus equipment corresponding to a first bus;
in existing systems, SOC systems typically integrate various control devices, such as: GPIO controller, I2C controller, SPI controller etc. each control device corresponds different physical addresses in Linux system, as shown in Table 1 below:
TABLE 1
In the embodiment of the application, the first bus is taken as an I2C bus for illustration, that is, in the SOC system, the device to be burned is connected to the I2C bus, and the access to the device to be burned can be realized by operating the I2C bus. Thus, the application layer program first obtains the physical address of the I2C bus device, and as can be seen from Table 1, the I2C0 address ranges from 0x000_28006000 to 0x000_28006FFF, and the I2C1 address ranges from 0x000_28007000 to 0x000_28007FFF.
Assuming that the device to be burned is connected to I2C0, the application layer program uses 0x000_28006000-0x000_28006fff as physical address information of the I2C bus device.
Step 120: calling a storage space of the bus equipment in a kernel layer according to the physical address information;
after the physical address signal corresponding to the I2C bus device is obtained, the storage space of the device node in dev/mem may be called by the relevant instruction. In a Linux system, a kernel mode physical memory can be directly accessed in a user mode through a mmap instruction.
The/dev/mem is a virtual character device of the linux system, and the/dev/mem device is a full image of all physical address spaces of the kernel, and the addresses include: physical memory (RAM) space, physical storage (ROM) space, CPU bus addresses, CPU register addresses, peripheral register addresses, GPIOs, timers, ADCs, etc. The/dev/mem device is typically used in conjunction with mmap to map the physical memory of the device to the user memory space of the application layer so that the user space can directly access the memory space of the kernel layer.
Step 130: acquiring register information of the bus equipment in the storage space, and initializing a register of the bus equipment according to the register information;
Each I2C bus device includes a plurality of register information, and when the I2C bus device is controlled, the I2C bus device needs to operate to each device to be burned through a plurality of registers of the I2C bus, as shown in table 2, which is a base address of each I2C register.
TABLE 2
Initializing a register of the bus equipment to acquire handle information corresponding to a node of the bus equipment so as to realize mapping from an application layer storage space to a kernel layer storage space through the handle information.
According to table 2, the addresses of the registers of the I2C bus devices are shown in table 1, and the physical address information of each I2C bus device is added with the offset value shown in table 2, so as to obtain the physical address of each register, for example: the address of the I2C control register ic_con is: the addresses of the I2C host address registers IC_TAR are from 0x000_28006000 to 0x000_28006003: from 0x000_28006004 to 0x000_28006007, and so on.
Step 140: transmitting slave device address information to the register, and initializing the slave device;
after the physical address of the register corresponding to the I2C bus is acquired, initializing the register corresponding to the used I2C bus device, wherein the initialization comprises the steps of setting the frequency of the I2C, enabling the I2C Master and the like. The purpose of the initialization is to subsequently operate the slave device connected to the I2C bus.
Each I2C bus can be provided with a plurality of slave devices, one slave address information is sent when an I2C command is sent, all the slave devices on the bus can receive the address, and when the slave devices on the I2C bus receive the address belonging to the slave devices, the slave devices respond, so that the slave addresses are used for distinguishing different devices on the bus, and the address is also called the slave address of the I2C device. Thus, when the host wants to access one of the devices, the address of the slave device must be sent first, so that the slave device will respond.
Therefore, before accessing the device to be burned, i.e. the slave device, the application layer program firstly sends the address information of the slave device corresponding to the slave device to the register of the I2C bus device, so that the I2C bus device controller controls the slave device according to the address information of the slave device, including initializing the slave device.
Step 150: sending operation instruction information and a firmware program to be burned to the register, so that the register writes the firmware program to be burned into a slave device corresponding to the slave device address information according to the operation instruction information;
after initialization is completed, the application layer program starts to operate the relevant registers of the I2C bus device, and the relevant firmware programs are written into the slave device by sending operation instruction information and the firmware programs to be burned to the registers and controlling the registers.
In the embodiment of the application, professional burning equipment is directly omitted, the burning program is run in the system application layer, the bottom layer hardware storage space is directly operated by means of the/dev/mem equipment node in the kernel, the purpose of controlling the equipment to be burned is achieved, the description of I2C bus equipment is not required to be provided for BIOS, the driver is not required to be loaded in advance through an ACPI table, the function switch of the I2C bus equipment is not required to be opened in the kernel, only the storage space of the relevant bus equipment is required to be directly accessed, the application program is not required to be modified when the equipment is applied to different system kernels, and the compatibility between different systems is improved.
Further, in order to ensure accuracy of firmware burning, in the embodiment of the present application, a register corresponding to an I2C bus device and a storage space corresponding to a slave device need to be initialized, and specifically, the initializing the register of the device according to register information further includes, as shown in fig. 4.
Step 210: acquiring physical address information of bus equipment;
in this embodiment, the physical address information of the I2C bus device is acquired, and the specific manner of acquiring, as described in step 110, is not repeated here. It should be noted that if the application layer program has acquired the physical address information of the bus device in step 110, the above address information may be reused in this step without re-acquisition.
Step 220: initializing a register of the bus device;
initializing the memory mapping of the dev/mem equipment node, and obtaining identifier information of the dev/mem equipment node so as to realize the mapping from the application layer storage space to the kernel layer storage space through the identifier information.
Step 230: judging a return value;
when the initialization is successful, the register returns a success indication, and the process goes to step 240; when the initialization fails, the register returns a failure indication, which goes to step 270.
Step 240: initializing slave equipment;
initializing slave devices, wherein the initialization includes, but is not limited to, setting frequency information of an I2C bus, enabling an I2C master, and the like, and also includes setting parameters and the like required by a device to be burned, and different slave device initialization modes are different and are not described herein.
Step 250: sending a Slave Addr;
after initializing the Slave device, the I2C bus device sends the Slave device address information Slave Addr to the Slave device, all the Slave devices on the bus receive the address, and when the Slave devices receive the address, the Slave devices respond to the address to return ACK, otherwise, the Slave devices return NACK. When an ACK is returned, indicating that the slave device has been initialized successfully, and going to step 270; when a NACK is returned, then the slave device initialization fails, via step 260.
Step 260: releasing the memory space of the bus device in the kernel layer;
and when the initialization fails, indicating that the operation on the storage space of the I2C equipment fails, and releasing the occupation of the storage space and not performing operation control on the storage space.
Step 270: and returning a result value.
And returning an operation result.
Through the embodiment, the I2C bus device and the related slave devices are initialized before the slave devices are operated, so that the accuracy of firmware burning can be ensured, and the efficiency of firmware burning is improved.
In order to better control the I2C bus device, the firmware is burned into the device to be burned, as shown in fig. 5, and the embodiment of the present application further provides a firmware burning file writing flow, including:
step 301: acquiring a file lock;
when the application layer program runs, firstly, the file lock is obtained, namely, the control authority of the program is obtained, on one hand, the file data can be accessed, on the other hand, the firmware burning operation can be ensured to be operated only once, and misoperation caused by multiple clicks of a user is prevented.
When the file lock is successfully acquired, the next operation is performed, and if the file lock cannot be acquired, the file lock returns to the starting state and the next operation is not performed.
Step 302: setting slave address information and a register writing instruction;
and sending slave device address information and a register writing instruction to the I2C register so that the I2C register can clearly determine the address of the device to be burned.
Step 303: checking a status register;
when slave address information or a register write instruction is sent to the register, the state of the state register needs to be checked, and the next write operation can be performed only when the state register shows that the write operation is successful.
When the status register status value is 1, indicating that the writing is successful, go to step 304;
when the status register status value is 0, indicating a write failure, the status of the status register continues to be checked.
Step 304: setting a value of a sending register, and setting an instruction register to enable a writing instruction;
after a response from the slave device is successfully obtained through the register of the I2C bus device, a write operation to the slave device is started.
The application layer program sets a value of a sending register, wherein the value of the sending register is a firmware program to be burned; at the same time, the set instruction register enables the write instruction.
Step 305: checking the register state;
further checking of the status register is required and will not be described in detail here.
Step 306: whether the data length is greater than a preset threshold;
because of the limited memory space of the transmit registers, the value written each time cannot exceed a preset threshold, typically 8bit data.
When the length of the firmware to be written is greater than the preset threshold, it indicates that the firmware to be written has not been sent, and step 307 is performed; when the length of the firmware to be written is not greater than the preset threshold, it is indicated as the last byte data, and step 309 is proceeded.
Step 307: setting a value of a transmission register; enabling a write command to send data;
resetting the value of the sending register according to the preset threshold length, and enabling the write command to send data.
Repeatedly executing the firmware program writing step until the firmware program to be burned is completely sent to the register;
step 308: checking a status register;
further checking of the status register is required and will not be described in detail here.
Step 309: setting a data register and sending the last data;
the last data is sent to the slave write.
Step 310: checking a status register;
further checking of the status register is required and will not be described in detail here.
Step 311: releasing the file lock;
When all the firmware is written to the slave's memory space, the file lock is released.
Step 312: returning a result value;
and returning a writing result.
In the embodiment, the firmware can be more accurately burnt into the slave device by setting the file lock and circularly writing the firmware program, so that the firmware burning efficiency is improved.
Further, in some embodiments, after initializing the slave device, the method further comprises: reading the existing firmware program on the slave device, comparing the existing firmware program with the firmware program to be burned, and if the existing firmware program is consistent with the firmware program to be burned, releasing the storage space of the device in the kernel layer.
Specifically, as shown in fig. 6, an embodiment of the present application provides a firmware burning file reading process, including:
step 401: acquiring a file lock;
when the application layer program runs, firstly, the file lock is obtained, namely, the control authority of the program is obtained, on one hand, the file data can be accessed, on the other hand, the firmware burning operation can be ensured to be operated only once, and misoperation caused by multiple clicks of a user is prevented.
When the file lock is successfully acquired, the next operation is performed, and if the file lock cannot be acquired, the file lock returns to the starting state and the next operation is not performed.
Step 402: setting address information of slave equipment and a writing instruction of the register;
and sending slave device address information and a register writing instruction to a register corresponding to the I2C bus device so that the I2C register can clearly determine the address of the device to be burned.
Step 403: checking a status register;
when slave address information or a register write instruction is sent to the register, the state of the state register needs to be checked, and the next write operation can be performed only when the state register shows that the write operation is successful.
When the status register status value is 1, indicating that the writing is successful, go to step 404;
when the status register status value is 0, indicating a write failure, the status of the status register continues to be checked.
Step 404: setting a value of a sending register, and setting an instruction register to enable a reading instruction;
after the response of the slave device is successfully obtained through the register of the I2C bus device, the application layer program sets the value of the transmission register so that the slave device is in a readable state, and then starts to perform a read operation on the slave device.
Step 405: checking a status register;
further checking of the status register is required and will not be described in detail here.
Step 406: setting a value of a transmission register to enable a read command to transmit data;
The application layer program sets the value of the send register to put the slave device in a readable state.
Step 407: checking a status register;
further checking of the status register is required and will not be described in detail here.
Step 408: judging whether the data length is larger than a preset threshold value or not;
because of the limited memory space of the data register, the length of the data read at a time cannot exceed a preset threshold, typically 8bit data.
When the length of the firmware data to be read is greater than the preset threshold value in the slave device, it is indicated that the firmware to be read is not read completely, and step 409 is shifted; when the length of the firmware data to be read is not greater than the preset threshold, the last byte data is indicated, and step 411 is performed.
Step 409: setting a data register, and reading data according to a preset threshold value;
and setting a data register of the I2C bus device into a reading state, and reading data from the slave device according to a preset threshold length.
Step 410: checking a status register;
further checking of the status register is required and will not be described in detail here.
Step 411: setting a data register and sending the last data;
when the firmware data in the slave device only leaves the last byte of data, then the data register of the I2C bus device retrieves the last byte of data from the slave device.
Step 412: checking a status register;
further checking of the status register is required and will not be described in detail here.
Step 413: releasing the file lock;
after all the firmware data is read from the memory space of the slave device, the application layer program can check the data already existing on the slave device, for example: in order to avoid that the same firmware is repeatedly written, the firmware data read from the slave device can be compared with the firmware data to be written, and if the comparison result is different, the writing operation is performed.
Furthermore, after the writing of the firmware data is completed, the written firmware data can be read again for comparison so as to ensure the consistency of the input data.
And after the data operation is completed, releasing the file lock.
Step 414: and returning a result value.
And returning a reading result.
Through the embodiment, on one hand, before the firmware is burnt, the data existing on the slave device is read for comparison, so that the problem of repeated burning is avoided, on the other hand, after the firmware is burnt, the data on the slave device is read for comparison, the accuracy of the burnt data can be ensured, and the efficiency of the firmware burning is improved.
In order to ensure the accuracy of the firmware program to be burned, in the embodiment of the application, before sending the operation instruction information and the firmware program to be burned to the register, the integrity check is performed on the firmware program to be burned first, so that the accuracy of the firmware to be burned is ensured.
Before the firmware is burned, the application layer program firstly checks the accuracy of the related parameters, then checks whether the firmware to be burned exists or not, and if the firmware to be burned passes the check, further reads the model of the chip to be burned to confirm the accuracy of the object to be burned, and formally starts the burning process after the integrity check is completed, so that the accuracy of the firmware to be burned is ensured.
It can be known from the above that, by the firmware burning method provided by the embodiment of the application, the professional burning device is directly omitted, by running the burning program at the system application layer, by means of the/dev/mem device node in the kernel, the bottom hardware storage space is directly operated, the purpose of controlling the device to be burned is achieved, the description of the I2C bus device is not required to be provided for BIOS, the driver is not required to be loaded in advance through the ACPI table, the function switch of the I2C bus device is not required to be opened in the kernel, only the storage space of the relevant bus device is required to be directly accessed, when the firmware is applied to different system kernels, the application program is not required to be modified, the compatibility between different systems is improved, when a plurality of chips to be burned are arranged on the main board, the application layer program is only required to be changed, the firmware upgrading of a plurality of chips can be realized by directly running the application layer program, and the operation is convenient.
Fig. 7 is a schematic structural diagram of a firmware burning device according to an embodiment of the present application. As shown in fig. 7, the apparatus 500 includes: an address acquisition module 501, a memory space calling module 502, a register initialization module 503, a slave device initialization module 504, and a burn-in module 505.
The address obtaining module 501 is configured to obtain physical address information of a bus device corresponding to the first bus;
the memory space calling module 502 is configured to call a memory space of the bus device in a kernel layer according to the physical address information;
the register initialization module 503 is configured to obtain register information of the bus device in the storage space, and initialize a register of the bus device according to the register information;
the slave device initializing module 504 is configured to send slave device address information to the register, and initialize the slave device;
the writing module 505 is configured to send operation instruction information and a firmware program to be written to the register, so that the register writes the firmware program to be written to a slave device corresponding to the slave device address information according to the operation instruction information.
In an alternative manner, the register initialization module 503 is further configured to initialize registers of the bus device; and if the initialization fails, releasing the memory space of the bus equipment in the kernel layer.
In an alternative manner, the slave device initialization module 504 is further configured to initialize the slave device; and if the initialization fails, releasing the memory space of the bus equipment in the kernel layer.
In an optional manner, the burning module 505 is further configured to obtain a file lock corresponding to a firmware program to be burned; setting address information of slave equipment and a writing instruction of the register; and sending the firmware program to be burned, the address information of the slave equipment and the writing instruction to the register.
In an alternative manner, the burning module 505 is further configured to set a write instruction sending address of the register; executing a firmware program writing step: judging the size of the firmware program to be burned, and if the size is larger than a preset threshold value, sending data with preset length to the register; if the firmware program is smaller than the preset threshold value, the rest firmware program is sent to the register; repeatedly executing the firmware program writing step until the firmware program to be burned is completely sent to the register; and releasing the file lock corresponding to the firmware program to be burned.
In an optional manner, the method further includes an accuracy verification module 506, which is configured to read a firmware program existing on the slave device; and comparing the existing firmware program with the firmware program to be burned, and if the existing firmware program is consistent with the firmware program to be burned, releasing the storage space of the equipment in the kernel layer.
In an optional manner, the method further includes an integrity checking module 507, which is configured to perform integrity checking on the firmware program to be burned.
The firmware burning device provided by the embodiment of the application directly omits professional burning equipment, runs the burning program at the system application layer, directly operates the bottom hardware storage space by means of the/dev/mem equipment node in the kernel, achieves the purpose of controlling the equipment to be burned, does not need BIOS to provide description of I2C bus equipment and load a driving program through an ACPI table, does not need to open a function switch of related equipment in the kernel, directly accesses the storage space of the related bus equipment, can be applied to different system kernels, and improves the compatibility among different systems. When a plurality of chips needing to be burned are arranged on the main board, firmware upgrading of the plurality of chips can be realized by directly running the application layer program only by changing configuration information of the application layer program, and the operation is convenient.
Fig. 8 is a schematic structural diagram of a firmware burning device according to an embodiment of the present application, and the specific embodiment of the present application does not limit the specific implementation of the firmware burning device.
As shown in fig. 8, the firmware burning apparatus may include: a processor 602, a communication interface (Communications Interface), a memory 606, and a communication bus 608.
Wherein: processor 602, communication interface 604, and memory 606 perform communication with each other via communication bus 608. Communication interface 604 is used to communicate with network elements of other devices, such as clients or other servers. The processor 602 is configured to execute the program 610, and may specifically perform the relevant steps in the embodiment of the firmware burning method.
In particular, program 610 may include program code comprising computer-executable instructions.
The processor 602 may be a central processing unit CPU or a specific integrated circuit ASIC (Application Specific Integrated Circuit) or one or more integrated circuits configured to implement embodiments of the present application. The one or more processors included in the firmware burning device may be the same type of processor, such as one or more CPUs; but may also be different types of processors such as one or more CPUs and one or more ASICs.
Memory 606 for storing program 610. The memory 606 may comprise high-speed RAM memory or may further comprise non-volatile memory (non-volatile memory), such as at least one disk memory.
Program 610 may be specifically invoked by processor 602 to cause the firmware burning device to:
acquiring physical address information of bus equipment corresponding to a first bus;
calling a storage space of the bus equipment in a kernel layer according to the physical address information;
acquiring register information of the bus equipment in the storage space, and initializing a register of the bus equipment according to the register information;
transmitting slave device address information to the register, and initializing the slave device;
and sending operation instruction information and a firmware program to be burned to the register, so that the register writes the firmware program to be burned into the slave device corresponding to the slave device address information according to the operation instruction information.
In some embodiments, initializing the register of the bus device according to the register information includes:
initializing a register of the bus device;
and if the initialization fails, returning a failure indication.
In some embodiments, initializing the slave device includes:
initializing the slave device;
and if the initialization fails, releasing the storage space of the equipment in the kernel layer.
In some embodiments, the sending the operation instruction information and the firmware program to be burned to the register includes:
acquiring a file lock corresponding to a firmware program to be burned;
setting address information of slave equipment and a writing instruction of the register;
and sending the firmware program to be burned, the address information of the slave equipment and the writing instruction to the register.
In some embodiments, the sending the firmware program to be burned, the slave address information, and the write instruction to the register includes:
setting a write instruction sending address of the register;
executing a firmware program writing step: judging the size of the firmware program to be burned, and if the size is larger than a preset threshold value, sending data with preset length to the register; if the firmware program is smaller than the preset threshold value, the rest firmware program is sent to the register;
repeatedly executing the firmware program writing step until the firmware program to be burned is completely sent to the register;
and releasing the file lock corresponding to the firmware program to be burned.
In some embodiments, after initializing the slave device, the method includes:
reading the existing firmware program on the slave device;
And comparing the existing firmware program with the firmware program to be burned, and if the existing firmware program is consistent with the firmware program to be burned, releasing the storage space of the equipment in the kernel layer.
In some embodiments, before sending the operation instruction information and the firmware program to be burned to the register, the method further includes:
and carrying out integrity check on the firmware program to be burned.
The firmware programming equipment provided by the embodiment of the application directly omits professional programming equipment, directly operates the bottom layer hardware storage space by running the programming program in the system application layer and by means of the/dev/mem equipment node in the kernel, achieves the purpose of controlling the equipment to be programmed, does not need BIOS to provide description of I2C bus equipment and load a driving program through an ACPI table, does not need to open a function switch of related equipment in the kernel, directly accesses the storage space of the related bus equipment, can be applied to different system kernels, and improves the compatibility among different systems. When a plurality of chips needing to be burned are arranged on the main board, firmware upgrading of the plurality of chips can be realized by directly running the application layer program only by changing configuration information of the application layer program, and the operation is convenient.
The embodiment of the application provides a computer readable storage medium, which stores executable instructions, wherein the executable instructions enable a firmware burning device to execute the firmware burning method in any method embodiment when the executable instructions run on the firmware burning device.
The embodiment of the application provides a computer program which can be called by a processor to enable firmware burning equipment to execute the firmware burning method in any method embodiment.
An embodiment of the present application provides a computer program product, where the computer program product includes a computer program stored on a computer readable storage medium, where the computer program includes program instructions, when the program instructions are executed on a computer, cause the computer to execute the firmware burning method in any of the above method embodiments.
The algorithms or displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a construction of such a system is apparent from the description above. In addition, embodiments of the present application are not directed to any particular programming language. It will be appreciated that the teachings of the present application described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present application.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the above description of exemplary embodiments of the application, various features of the embodiments of the application are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed application requires more features than are expressly recited in each claim.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component, and they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
It should be noted that the above-mentioned embodiments illustrate rather than limit the application, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The application may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names. The steps in the above embodiments should not be construed as limiting the order of execution unless specifically stated.

Claims (10)

1. A firmware burning method, which is applied to an application layer program, the method comprising:
acquiring physical address information of bus equipment corresponding to a first bus;
Calling a storage space of the bus equipment in a kernel layer according to the physical address information;
acquiring register information of the bus equipment in the storage space, and initializing a register of the bus equipment according to the register information;
the slave device address information is sent to the register, and the slave device corresponding to the slave device address information is initialized;
and sending operation instruction information and a firmware program to be burned to the register, so that the register writes the firmware program to be burned into the slave device corresponding to the slave device address information according to the operation instruction information.
2. The firmware burning method as claimed in claim 1, wherein initializing the register of the bus device according to the register information comprises:
initializing a register of the bus device;
and if the initialization fails, returning a failure indication.
3. The firmware burning method of claim 2, wherein initializing the slave device comprises:
initializing the slave device;
and if the initialization fails, releasing the memory space of the bus equipment in the kernel layer.
4. The firmware burning method as claimed in claim 1, wherein said sending operation instruction information and a firmware program to be burned to the register includes:
acquiring a file lock corresponding to a firmware program to be burned;
setting the address information of the slave device and a writing instruction of the register;
and sending the firmware program to be burned, the address information of the slave equipment and the writing instruction to the register.
5. The firmware burning method as claimed in claim 4, wherein said sending the firmware program to be burned, the slave address information, and the write instruction to the register includes:
setting a write instruction sending address of the register;
executing a firmware program writing step: judging the size of the firmware program to be burned, and if the size is larger than a preset threshold value, sending data with the preset threshold value length to the register; if the firmware program is smaller than the preset threshold value, the rest firmware program is sent to the register;
repeatedly executing the firmware program writing step until the firmware program to be burned is completely sent to the register;
and releasing the file lock corresponding to the firmware program to be burned.
6. The firmware burning method as claimed in claim 1, wherein after initializing the slave device, comprising:
reading the existing firmware program on the slave device;
and comparing the existing firmware program with the firmware program to be burned, and if the existing firmware program is consistent with the firmware program to be burned, releasing the memory space of the bus equipment in the kernel layer.
7. The firmware burning method as claimed in claim 1, wherein before the operation instruction information and the firmware program to be burned are sent to the register, further comprising:
and carrying out integrity check on the firmware program to be burned.
8. A firmware burning device, comprising:
an address acquisition module: the method comprises the steps of obtaining physical address information of bus equipment corresponding to a first bus;
a storage space calling module: the memory space of the bus device in the kernel layer is called according to the physical address information;
register initialization module: the register information of the bus equipment in the storage space is obtained, and the register of the bus equipment is initialized according to the register information;
the slave device initialization module: the register is used for sending address information of the slave equipment to the register and initializing the slave equipment;
And a burning module: and the register is used for sending operation instruction information and the firmware program to be burned to the register so that the register writes the firmware program to be burned into the slave equipment corresponding to the slave equipment address information according to the operation instruction information.
9. A firmware burning apparatus, comprising: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus;
the memory is configured to store executable instructions that cause the processor to perform the firmware burning method according to any of claims 1-7.
10. A computer readable storage medium, wherein executable instructions are stored in the storage medium, which when run on a firmware burning device, cause the firmware burning device to perform the operations of the firmware burning method according to any of claims 1-7.
CN202310754720.6A 2023-06-26 2023-06-26 Firmware burning method, device and equipment Pending CN116820495A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310754720.6A CN116820495A (en) 2023-06-26 2023-06-26 Firmware burning method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310754720.6A CN116820495A (en) 2023-06-26 2023-06-26 Firmware burning method, device and equipment

Publications (1)

Publication Number Publication Date
CN116820495A true CN116820495A (en) 2023-09-29

Family

ID=88128698

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310754720.6A Pending CN116820495A (en) 2023-06-26 2023-06-26 Firmware burning method, device and equipment

Country Status (1)

Country Link
CN (1) CN116820495A (en)

Similar Documents

Publication Publication Date Title
US5854905A (en) Extensible bios for boot support of devices on multiple hierarchical buses
US9940291B2 (en) Assigning processors to memory mapped configuration
US8874953B2 (en) System and method of cloud testing and remote monitoring for integrated circuit components in system validation
US6195749B1 (en) Computer system including a memory access controller for using non-system memory storage resources during system boot time
US7146512B2 (en) Method of activating management mode through a network for monitoring a hardware entity and transmitting the monitored information through the network
JP2015062131A (en) Method for booting host device from mmc/sd device, host device bootable from mmc/sd device and mmc/sd device for booting host device
CN109324991B (en) Hot plug device, method, medium and system of PCIE (peripheral component interface express) equipment
CN109426613B (en) Method for retrieving debugging data in UEFI and computer system thereof
CN109656630B (en) Configuration space access method, device, framework and storage medium
KR100764921B1 (en) Virtual rom for device enumeration
US20090193152A1 (en) External device with a driver auto-run installation and method thereof
US10572434B2 (en) Intelligent certificate discovery in physical and virtualized networks
CN107135462B (en) Bluetooth pairing method of UEFI firmware and computing system thereof
CN112306581B (en) Method and medium for managing Basic Input Output System (BIOS) configuration by baseboard management controller
JPH07271711A (en) Computer system
US20190068772A1 (en) Computer system and method thereof for bluetooth data sharing between uefi firmware and os
CN116627472A (en) Firmware program upgrading method and server of high-speed peripheral component equipment
US20040243385A1 (en) Emulation of hardware devices in a pre-boot environment
CN115664953B (en) Resource allocation method and related device of external equipment
CN111338699A (en) Computer mainboard initialization method and device, computer equipment and storage medium
CN110765060A (en) Method, device, equipment and medium for converting MDIO bus into parallel bus
CN116820495A (en) Firmware burning method, device and equipment
CN112667544A (en) Method, device, system and medium for controlling mainboard slot enabling
CN106445571B (en) Mainboard and starting method
CN114579198B (en) Memory chip starting method and device, computer equipment and storage medium

Legal Events

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