CN114265608A - Method and device for upgrading TF card firmware, computer equipment and storage medium - Google Patents

Method and device for upgrading TF card firmware, computer equipment and storage medium Download PDF

Info

Publication number
CN114265608A
CN114265608A CN202111613782.2A CN202111613782A CN114265608A CN 114265608 A CN114265608 A CN 114265608A CN 202111613782 A CN202111613782 A CN 202111613782A CN 114265608 A CN114265608 A CN 114265608A
Authority
CN
China
Prior art keywords
firmware
card
upgrading
norflash
host
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
CN202111613782.2A
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.)
Suzhou Yilian Information System Co Ltd
Original Assignee
Suzhou Yilian Information System 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 Suzhou Yilian Information System Co Ltd filed Critical Suzhou Yilian Information System Co Ltd
Priority to CN202111613782.2A priority Critical patent/CN114265608A/en
Publication of CN114265608A publication Critical patent/CN114265608A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention relates to a method and a device for upgrading a TF card firmware, computer equipment and a storage medium, wherein the method comprises the following steps: acquiring a command sequence issued by a host; judging whether the command sequence is the same as a preset value or not; if so, switching the read-write function of the TF card to NandFlash to the read-write function of NorFlash; and acquiring a new firmware issued by the host, and writing the new firmware into NorFlash to complete firmware upgrade. The invention upgrades the card by replacing the special protocol command defined by the original TF manufacturer with the common read-write command sequence of the TF card, thereby avoiding the strict time sequence requirement of the host on the protocol command of the TF manufacturer, expanding the compatibility of the upgrading function of the TF card, enabling the TF card to be compatible with more host equipment and improving the universality.

Description

Method and device for upgrading TF card firmware, computer equipment and storage medium
Technical Field
The invention relates to the technical field of TF card firmware upgrading, in particular to a method and a device for upgrading TF card firmware, computer equipment and a storage medium.
Background
In the existing method for upgrading the firmware of the TF card online, Host equipment needs to send a Vendor Command (a Vendor special protocol Command, such as CMD56) customized by a TF card Vendor in the upgrading process, and the Command needs the Host equipment to design a time sequence conforming to the Vendor special protocol Command and then send the time sequence to the TF card; after receiving the command, the TF card changes the read-write function of the original NandFlash operation into the read-write function of NorFlash, when the Host performs the read-write operation on the TF card, the NorFlash operation is performed, by utilizing the principle, the Host equipment writes the new firmware into the area of the old firmware in the NorFlash, the old firmware is directly covered, and when the TF card system is started again, the running new firmware is burnt. Therefore, according to the method, the Host equipment needs to design a time sequence for sending the command, and if the designed time sequence cannot accurately meet the requirement, the internal state of the TF card is abnormal after the Host is sent, so that the subsequent upgrading process is directly influenced, and the upgrading is failed.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a method, a device, computer equipment and a storage medium for upgrading a TF card firmware.
In order to solve the technical problems, the invention adopts the following technical scheme:
the method for upgrading the firmware of the TF card comprises the following steps:
acquiring a command sequence issued by a host;
judging whether the command sequence is the same as a preset value or not;
if so, switching the read-write function of the TF card to NandFlash to the read-write function of NorFlash;
and acquiring a new firmware issued by the host, and writing the new firmware into NorFlash to complete firmware upgrade.
The further technical scheme is as follows: before the step of obtaining the command sequence issued by the host, the method further includes: and initializing an SD interface for the TF card.
The further technical scheme is as follows: the command sequence is a combination of a plurality of read commands, and the preset value comprises the sequence of the plurality of read commands and parameters thereof.
The further technical scheme is as follows: and in the step of acquiring the new firmware issued by the host and writing the new firmware into the NorFlash to finish the firmware upgrading, the area where the new firmware is written into the NorFlash is the area where the old firmware in the NorFlash is located, and the new firmware covers the old firmware.
The device that TF card firmware upgraded includes: the device comprises an acquisition unit, a judgment unit, a switching unit and an acquisition writing unit;
the acquisition unit is used for acquiring a command sequence issued by a host;
the judging unit is used for judging whether the command sequence is the same as the preset value or not;
the switching unit is used for switching the read-write function of the TF card to NandFlash to the read-write function of NorFlash;
and the acquisition and writing unit is used for acquiring the new firmware issued by the host and writing the new firmware into NorFlash to finish firmware upgrading.
The further technical scheme is as follows: further comprising: and the initialization unit is used for initializing the SD interface of the TF card.
The further technical scheme is as follows: the command sequence is a combination of a plurality of read commands, and the preset value comprises the sequence of the plurality of read commands and parameters thereof.
The further technical scheme is as follows: in the acquisition writing unit, a region where the new firmware is written into the NorFlash is a region where the old firmware in the NorFlash is located, and the new firmware covers the old firmware.
A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to realize the method for upgrading the firmware of the TF card.
A storage medium storing a computer program comprising program instructions which, when executed by a processor, implement the method of firmware upgrade of a TF card as described above.
Compared with the prior art, the invention has the beneficial effects that: the general read-write command sequence of the TF card replaces the special protocol command defined by the original TF manufacturer to upgrade the card, so that the strict time sequence requirement of the host on the protocol command of the TF manufacturer is avoided, the compatibility of the TF card upgrading function is expanded, the TF card can be compatible with more host devices, and the universality is improved.
The invention is further described below with reference to the accompanying drawings and specific embodiments.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a schematic diagram of a TF card chip start-up process;
fig. 2 is a schematic flowchart of a method for upgrading a TF card firmware according to an embodiment of the present invention;
fig. 3 is an application scenario diagram of a method for upgrading a TF card firmware according to an embodiment of the present invention;
fig. 4 is a schematic block diagram of an apparatus for upgrading a TF card firmware according to an embodiment of the present invention;
FIG. 5 is a schematic block diagram of a computer device provided by an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
The English explanation that the invention needs to relate to is as follows:
host: a host;
vendor Command: vendor specific protocol commands;
NandFlash: a kind of memorizer;
NorFlash: a non-volatile flash memory;
bootrom: a chip power-on starting program;
bootloader: a boot program;
FW: firmware;
ROM: a read only memory.
As shown in fig. 1, the TF card chip start includes a bootrom phase, a Bootloader phase and an FW firmware running phase; in an initial state, a ROM of the chip stores bootrom codes, a NorFlash stores Bootloader and FW codes, after the chip is powered on and started, the bootrom in the ROM operates, and the Bootloader codes are loaded into an operating space; then, the Bootloader code runs, and the code of the FW is loaded to the running space again; and finally, running the FW code and finishing the starting of the chip. In the online upgrading method, a Host device needs to design a time sequence for sending a Vendor Command, and after the Command is correctly sent, new firmware can be written into a TF card by using a common CMD25 (multi-block write) Command; however, if the Host Command timing designed by the Host cannot meet the requirement, the state in the card is likely to be abnormal after the Host Command timing is sent to the TF card, so that subsequent common read-write commands are likely to have problems, and the online upgrading process is likely to fail.
Referring to the embodiments shown in fig. 2 to 5, wherein, referring to fig. 2 to 3, the invention discloses a method for upgrading a TF card firmware, comprising the following steps:
s1, acquiring a command sequence issued by the host;
in this embodiment, before the step S1, the method further includes: and initializing an SD interface of the TF card so as to receive a command sequence issued by a host.
S2, judging whether the command sequence is the same as the preset value; if not, returning to execute the step S1;
the command sequence is a combination of a plurality of read commands, and the preset value comprises the sequence of the plurality of read commands and parameters thereof.
In this embodiment, the number of the read commands is 5, and the sequence and the parameters thereof are CMD17+0xa0000001, CMD17+0xa0000003, CMD17+0xa0000005, CMD17+0xa0000007, and CMD17+0xa0000002, respectively; the TF card receives the 5 read commands in sequence, and only when the sequence of the 5 commands and the parameters thereof completely accord with the preset conditions, the TF card can switch the internal read-write function of the NandFlash into the read-write function of the NorFlash.
S3, if yes, switching the read-write function of the TF card to NandFlash to the read-write function of NorFlash;
and S4, acquiring the new firmware issued by the host, and writing the new firmware into NorFlash to complete firmware upgrade.
In step S4, the area where the new firmware is written into NorFlash is the area where the old firmware in NorFlash is located, and the new firmware overwrites the old firmware.
In this embodiment, after the host cuts the new firmware into 4KB and aligns, the host writes the new firmware into the TF card by using an Open-ended CMD25 write command, at this time, the inside of the TF card writes the received new firmware data onto NorFLash, where the written location is a parameter of CMD25 (knowing a distribution location of firmware FW in NorFLash in advance, the location of the data to be written in NorFLash can be specified by using the parameter), and after the old firmware is overwritten, when the TF card system runs, Bootloader loads the updated new firmware.
Among them, the specific application scenario shown in fig. 3: and during online upgrading, directly covering the area of the old firmware in the NorFlash with the new firmware, and thus after the TF card is electrified again and operated, the Bootloader loads the new firmware.
In the invention, the Host only needs to send a common read command sequence (specifically a CMD17+ parameter, wherein the command sequence and the command parameter are in accordance with expectations), the read-write function of the NandFlash of the TF card is switched to the read-write function of the NorFlash, and then a common CMD25 (a plurality of write) command can be used for writing the new firmware into the TF card to complete the upgrade.
The invention upgrades the card by replacing the special protocol command defined by the original TF manufacturer with the common read-write command sequence (supported by Host equipment) of the TF card, thereby avoiding the strict time sequence requirement of the Host on the protocol command of the TF manufacturer, expanding the compatibility of the upgrading function of the TF card, enabling the TF card to be compatible with more Host equipment and improving the universality.
Referring to fig. 4, the present invention also discloses a device for upgrading a TF card firmware, including: an acquisition unit 10, a judgment unit 20, a switching unit 30 and an acquisition writing unit 40;
the acquiring unit 10 is configured to acquire a command sequence issued by a host;
the judging unit 20 is configured to judge whether the command sequence is the same as a preset value;
the switching unit 30 is configured to switch a read-write function of the TF card to NandFlash to a read-write function of NorFlash;
the obtaining and writing unit 40 is configured to obtain a new firmware issued by the host, and write the new firmware into NorFlash to complete firmware upgrade.
Wherein, the device still includes: and the initialization unit is used for initializing the SD interface of the TF card.
The command sequence is a combination of a plurality of read commands, and the preset value comprises the sequence of the plurality of read commands and parameters thereof.
In the obtaining and writing unit 40, the area where the new firmware is written into the NorFlash is the area where the old firmware in the NorFlash is located, and the new firmware covers the old firmware.
It should be noted that, as can be clearly understood by those skilled in the art, the specific implementation process of the device for upgrading the TF card firmware and each unit may refer to the corresponding description in the foregoing method embodiment, and for convenience and conciseness of description, no further description is provided herein.
The above-mentioned device for upgrading the firmware of the TF card can be implemented in the form of a computer program, which can be run on a computer device as shown in fig. 5.
Referring to fig. 5, fig. 5 is a schematic block diagram of a computer device according to an embodiment of the present application; the computer device 500 may be a terminal or a server, where the terminal may be an electronic device with a communication function, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device. The server may be an independent server or a server cluster composed of a plurality of servers.
Referring to fig. 5, the computer device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer programs 5032 include program instructions that, when executed, cause the processor 502 to perform a method for firmware upgrade of a TF card.
The processor 502 is used to provide computing and control capabilities to support the operation of the overall computer device 500.
The internal memory 504 provides an environment for running the computer program 5032 in the non-volatile storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 can be enabled to execute a method for firmware upgrade of the TF card.
The network interface 505 is used for network communication with other devices. Those skilled in the art will appreciate that the configuration shown in fig. 5 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation of the computer device 500 to which the present application may be applied, and that a particular computer device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It should be understood that in the embodiment of the present Application, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be understood by those skilled in the art that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing associated hardware. The computer program includes program instructions, and the computer program may be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program comprises program instructions, which when executed by a processor, can implement the method for upgrading the firmware of the TF card.
The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, which can store various computer readable storage media.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be merged, divided and deleted according to actual needs. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a terminal, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention.
The above embodiments are preferred implementations of the present invention, and the present invention can be implemented in other ways without departing from the spirit of the present invention.

Claims (10)

  1. The method for upgrading the TF card firmware is characterized by comprising the following steps:
    acquiring a command sequence issued by a host;
    judging whether the command sequence is the same as a preset value or not;
    if so, switching the read-write function of the TF card to NandFlash to the read-write function of NorFlash;
    and acquiring a new firmware issued by the host, and writing the new firmware into NorFlash to complete firmware upgrade.
  2. 2. The method for upgrading the firmware of the TF card according to claim 1, wherein the step of obtaining the command sequence issued by the host further comprises: and initializing an SD interface for the TF card.
  3. 3. The method for upgrading firmware of the TF card of claim 1, wherein the command sequence is a combination of a plurality of read commands, and the predetermined value includes an order of the plurality of read commands and parameters thereof.
  4. 4. The method for upgrading the firmware of the TF card of claim 1, wherein the new firmware issued by the host is obtained and written into NorFlash, so that in the step of upgrading the firmware, the area where the new firmware is written into NorFlash is the area where the old firmware in NorFlash is located, and the new firmware overwrites the old firmware.
  5. The device of TF card firmware upgrading, its characterized in that includes: the device comprises an acquisition unit, a judgment unit, a switching unit and an acquisition writing unit;
    the acquisition unit is used for acquiring a command sequence issued by a host;
    the judging unit is used for judging whether the command sequence is the same as the preset value or not;
    the switching unit is used for switching the read-write function of the TF card to NandFlash to the read-write function of NorFlash;
    and the acquisition and writing unit is used for acquiring the new firmware issued by the host and writing the new firmware into NorFlash to finish firmware upgrading.
  6. 6. The apparatus for upgrading the TF card firmware of claim 5, further comprising: and the initialization unit is used for initializing the SD interface of the TF card.
  7. 7. The apparatus of claim 5, wherein the command sequence is a combination of a plurality of read commands, and the predetermined value includes an order of the plurality of read commands and parameters thereof.
  8. 8. The apparatus for upgrading firmware of a TF card according to claim 5, wherein the area where the new firmware is written into the NorFlash in the get write unit is an area where the old firmware in the NorFlash is located, and the old firmware is overwritten by the new firmware.
  9. 9. A computer device, characterized in that the computer device comprises a memory and a processor, the memory stores a computer program, and the processor executes the computer program to realize the method for upgrading the TF card firmware according to any one of claims 1 to 4.
  10. 10. A storage medium storing a computer program comprising program instructions which, when executed by a processor, implement the method of TF card firmware upgrade according to any of claims 1 to 4.
CN202111613782.2A 2021-12-27 2021-12-27 Method and device for upgrading TF card firmware, computer equipment and storage medium Pending CN114265608A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111613782.2A CN114265608A (en) 2021-12-27 2021-12-27 Method and device for upgrading TF card firmware, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111613782.2A CN114265608A (en) 2021-12-27 2021-12-27 Method and device for upgrading TF card firmware, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114265608A true CN114265608A (en) 2022-04-01

Family

ID=80830535

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111613782.2A Pending CN114265608A (en) 2021-12-27 2021-12-27 Method and device for upgrading TF card firmware, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114265608A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115167902A (en) * 2022-07-12 2022-10-11 广东全芯半导体有限公司 Intelligent upgrading method and device for TF (Transflash) card

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115167902A (en) * 2022-07-12 2022-10-11 广东全芯半导体有限公司 Intelligent upgrading method and device for TF (Transflash) card

Similar Documents

Publication Publication Date Title
CN100474247C (en) Method for updating firmware in computer server systems
US8423991B2 (en) Embedded network device and firmware upgrading method
US9298470B2 (en) Method and apparatus for selecting bios program for a processor
US20070192582A1 (en) Techniques for initializing a device on an expansion card
US9411605B2 (en) Device-less and system agnostic unified extensible firmware interface (UEFI) driver
CN109753299A (en) A kind of method for upgrading system, device and computer storage medium
US20200394144A1 (en) Information processing system, information processing device, bios updating method for information processing device, and bios updating program for information processing device
CN113821235A (en) Operating system data updating method, operating system data updating apparatus, storage medium, and program product
JP2020535504A (en) How to upgrade system version and equipment
CN105468390B (en) BOOT online upgrading device and method
CN114265608A (en) Method and device for upgrading TF card firmware, computer equipment and storage medium
CN115357262A (en) Method for upgrading driver firmware in batch
CN111026417A (en) Embedded equipment upgrading method and embedded equipment
JP2015060411A (en) Firmware update method of information processor
US11061689B2 (en) Synchronization method for performing bi-directional data synchronization for bios
CN106484442B (en) Server system and method for updating startup mapping file
US9495146B2 (en) Host and method of upgrading connection manager of dongles
JP4190789B2 (en) Method and system for automatically concealing PCI expansion card in computer system
CN102184115A (en) Method and device for updating system software
US10120677B2 (en) Method of rewriting printer firmware, and printer
CN106611124A (en) Computer device and boot method thereof
CN112527365A (en) Application program updating method, nonvolatile memory, storage medium and household appliance
CN114265609A (en) Method and device for accelerating updating of TF card firmware, computer equipment and storage medium
CN110647343A (en) OpenPower server and system deployment method thereof
CN115328522A (en) Method and related equipment for realizing immediate effect of SSD firmware upgrade

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