GNSS receiver firmware upgrade method and apparatus
By parsing the type identification bytes of the GNSS receiver firmware file, the data type and parameter information are determined, enabling firmware upgrades for the GNSS receiver. This solves the problem of inconvenient expansion and management of existing upgrade methods, and improves the convenience and scalability of upgrades.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-26
- Publication Date
- 2026-04-07
AI Technical Summary
Existing GNSS receiver firmware upgrade methods use proprietary protocols, which are not easy to expand and manage, making upgrades difficult.
By acquiring the firmware file to be upgraded, using pre-configured firmware parsing rules to parse the type identification bytes, determining the data type and parameter information, and then determining the data type and length of the data structure based on the data type and parameter information, the firmware upgrade of the GNSS receiver is achieved.
The portability and scalability of firmware files have been improved, making the upgrade and management of GNSS devices more convenient.
Smart Images

Figure CN117971264B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of GNSS equipment technology, and specifically to a GNSS receiver firmware upgrade method and apparatus. Background Technology
[0002] A geodetic GNSS receiver is a surveying instrument that uses an MCU or embedded system to implement its complex functions. Due to changing requirements or the need to fix malfunctions, the MCU or embedded software must be upgradeable. Existing upgrade methods all use proprietary protocols, which are not conducive to upgrade expansion and management. Therefore, designing an upgrade scheme that is easy to expand and manage has become a pressing technical problem for those skilled in the art. Summary of the Invention
[0003] To address the aforementioned shortcomings, this invention discloses a GNSS receiver firmware upgrade method, which enables firmware file parsing of the GNSS receiver, facilitating GNSS upgrade management.
[0004] The first aspect of this invention discloses a GNSS receiver firmware upgrade method, comprising:
[0005] Obtain the firmware file to be upgraded, which includes type identification bytes and data storage bytes;
[0006] The type identification bytes in the firmware file to be upgraded are parsed according to the pre-configured firmware parsing rules to determine the data type information and parameter information in the type identification bytes;
[0007] The data type of the corresponding data in the corresponding data structure is determined based on the data type information.
[0008] Based on the data type and the parameter information, determine the length information of the corresponding data in the data structure or the numerical information used to represent the corresponding data in the data structure to obtain the corresponding data parsing results;
[0009] The firmware of the corresponding GNSS receiver is flashed based on the data parsing results to achieve firmware upgrade of the GNSS receiver.
[0010] As an optional implementation, in a first aspect of the present invention, the firmware file to be upgraded is a data packet list, the data packet list including an FMW5 string, a firmware attribute list, a firmware file list, and a verification key-value pair; wherein, the firmware attribute list includes an attribute name, an attribute flag, and a first attribute value; the firmware file list includes a file name, a file flag, and a second attribute value; and the verification key-value pair includes an MD5 string.
[0011] As an optional implementation, in the first aspect of the present invention, the firmware parsing rules include data conversion rules and data calculation rules. The step of parsing the type identification bytes in the firmware file to be upgraded according to the pre-configured firmware parsing rules to determine the data type information and parameter information in the type identification bytes includes:
[0012] The type identification byte stored in hexadecimal format is converted into a binary type identification byte according to the pre-configured data conversion rules;
[0013] The data of the high three bits in the binary type identification byte are calculated according to the pre-configured data calculation rules to obtain the corresponding first calculation result, and the data of the low five bits in the binary type identification byte are calculated according to the pre-configured data calculation rules to obtain the corresponding second calculation result.
[0014] Data matching is performed based on pre-configured data matching rules and the first calculation result to determine the corresponding data type information, and data matching is performed based on pre-configured data matching rules and the second calculation result to determine the corresponding parameter information.
[0015] As an optional implementation, in the first aspect of the present invention, the data type includes integer type, floating-point type, string type, data list type, and key-value pair type;
[0016] All multi-byte integers and floating-point numbers are configured to use either little-endian byte order or big-endian byte order.
[0017] As an optional implementation, in a first aspect of the present invention, determining the data type of the corresponding data in the corresponding data structure based on the data type information includes:
[0018] If the data type information is the first data information, then the corresponding data in the corresponding data structure is determined to be of integer type;
[0019] If the data type information is the second data information, then the corresponding data in the corresponding data structure is determined to be of floating-point type;
[0020] If the data type information is third-party data information, then the corresponding data in the corresponding data structure is determined to be of string type;
[0021] If the data type information is the fourth data information, then the corresponding data in the corresponding data structure is determined to be of byte group type;
[0022] If the data type information is the fifth data information, then the corresponding data in the corresponding data structure is determined to be a data list type;
[0023] If the data type information is the sixth data information, then the corresponding data in the corresponding data structure is determined to be a key-value pair type.
[0024] As an optional implementation, in the first aspect of the present invention, the step of determining the length information of the corresponding data in the data structure or the numerical information used to represent the corresponding data in the data structure according to the data type and the parameter information to obtain the corresponding data parsing result includes:
[0025] When the data type is an integer, obtain the first numerical value associated with the integer type;
[0026] If the first value is less than or equal to 27, then the first value is determined as the numerical information of the corresponding data in the data structure;
[0027] If the first value is 28, then the value stored in the byte after the type identification byte is obtained as the numerical information of the corresponding data in the data structure.
[0028] If the first value is 29, then the value stored in the last two bytes of the type identification byte is obtained as the numerical information of the corresponding data in the data structure.
[0029] If the first value is 30, then the value stored in the last four bytes of the type identification byte is obtained as the numerical information of the corresponding data in the data structure.
[0030] If the first value is 31, then the value stored in the last eight bytes after the type identification byte is obtained as the numerical information of the corresponding data in the data structure.
[0031] As an optional implementation, in the first aspect of the present invention, the step of determining the length information of the corresponding data in the data structure or the numerical information used to represent the corresponding data in the data structure according to the data type and the parameter information to obtain the corresponding data parsing result includes:
[0032] When the data type is a string, obtain the second numerical value associated with the string type;
[0033] If the second value is less than or equal to 28, then the second value is determined as the length information of the corresponding data in the data structure;
[0034] If the second value is 29, then the value stored in the byte after the type identification byte will be used as the length information of the corresponding data in the data structure.
[0035] If the second value is 30, then the value stored in the last two bytes of the type identification byte will be used as the length information of the corresponding data in the data structure.
[0036] If the second value is 31, then the value stored in the last four bytes of the type identification byte will be used as the length information of the corresponding data in the data structure.
[0037] A second aspect of this invention discloses a GNSS receiver firmware upgrade device, comprising:
[0038] Acquisition module: used to acquire the firmware file to be upgraded, which includes type identification bytes and data storage bytes;
[0039] Parsing module: used to parse the type identification byte in the firmware file to be upgraded according to the pre-configured firmware parsing rules to determine the data type information and parameter information in the type identification byte;
[0040] First determining module: used to determine the data type of the corresponding data structure based on the data type information;
[0041] The second determining module is used to determine the length information of the corresponding data in the data structure or the numerical information of the corresponding data in the data structure based on the data type and the parameter information to obtain the corresponding data parsing result;
[0042] Upgrade module: Used to flash the firmware of the corresponding GNSS receiver based on the data parsing results to upgrade the firmware of the GNSS receiver.
[0043] A third aspect of the present invention discloses an electronic device, comprising: a memory storing executable program code; a processor coupled to the memory; the processor calling the executable program code stored in the memory to execute the GNSS receiver firmware upgrade method disclosed in the first aspect of the present invention.
[0044] A fourth aspect of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program causes a computer to execute the GNSS receiver firmware upgrade method disclosed in the first aspect of the present invention.
[0045] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0046] The GNSS receiver firmware upgrade method in this embodiment of the invention parses the firmware file configured according to the set rules to obtain the corresponding upgrade firmware file, and performs the upgrade operation on the corresponding firmware according to the upgrade firmware file. The firmware configuration rules of this solution can improve the portability and scalability of the overall firmware file, making GNSS equipment easier to upgrade and manage. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0048] Figure 1 This is a flowchart illustrating the GNSS receiver firmware upgrade method disclosed in an embodiment of the present invention;
[0049] Figure 2 This is a schematic diagram of the type identification byte parsing process disclosed in an embodiment of the present invention;
[0050] Figure 3 This is a schematic diagram of the data type determination process disclosed in the embodiments of the present invention;
[0051] Figure 4 This is a schematic diagram of the integer type recognition process disclosed in an embodiment of the present invention;
[0052] Figure 5 This is a schematic diagram of a firmware file display disclosed in an embodiment of the present invention;
[0053] Figure 6 This is another firmware file display diagram disclosed in an embodiment of the present invention;
[0054] Figure 7 This is a schematic diagram of the structure of a GNSS receiver firmware upgrade device provided in an embodiment of the present invention;
[0055] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0056] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0057] It should be noted that the terms "first," "second," "third," "fourth," etc., in the specification and claims of this invention are used to distinguish different objects, not to describe a specific order. The terms "comprising" and "having," and any variations thereof, in the embodiments of this invention are intended to cover non-exclusive inclusion. Exemplarily, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.
[0058] A geodetic GNSS receiver is a surveying instrument that uses an MCU or embedded system to implement its complex functions. Due to changing requirements or the need to fix malfunctions, the MCU or embedded software must have upgrade capabilities. Existing upgrade methods all use proprietary protocols, which are not conducive to upgrade expansion and upgrade management. Based on this, this invention discloses a GNSS receiver firmware upgrade method, apparatus, electronic device, and storage medium. It parses a firmware file configured according to set rules to obtain a corresponding upgrade firmware file, and then performs an upgrade operation on the corresponding firmware based on the upgrade firmware file. The firmware configuration rules of this solution improve the overall portability and scalability of the firmware file, making GNSS equipment upgrade management easier.
[0059] Example 1
[0060] Please see Figure 1 , Figure 1 This is a flowchart illustrating the GNSS receiver firmware upgrade method disclosed in this embodiment of the invention. The execution entity of the method described in this embodiment is an execution entity composed of software and / or hardware. This execution entity can receive relevant information via wired and / or wireless means and can send certain instructions. It may also have certain processing and storage functions. This execution entity can control multiple devices, such as remote physical servers or cloud servers and related software, or local hosts or servers and related software that perform related operations on devices located in a certain location. In some scenarios, it can also control multiple storage devices, which may be placed in the same location as the device or in different locations. Figure 1 As shown, the GNSS receiver firmware upgrade method includes the following steps:
[0061] S101: Obtain the firmware file to be upgraded, which includes type identification bytes and data storage bytes;
[0062] This step primarily involves receiving the firmware file to be upgraded. These firmware files are encoded according to the firmware file encoding rules mentioned in this embodiment of the invention. In this embodiment, the firmware file is encoded according to the DataPack structure. This ensures that subsequent file recognition is performed using the same rules for parsing. Here, DataPack is a data structure that can store integers, floating-point numbers, strings, byte arrays, and combinations thereof as byte arrays. DataPack has six data types, including basic data types: integers, floating-point numbers, strings, and byte arrays, and composite data types: lists and key-value pairs.
[0063] S102: Parse the type identification byte in the firmware file to be upgraded according to the pre-configured firmware parsing rules to determine the data type information and parameter information in the type identification byte;
[0064] During implementation, since the firmware file to be upgraded contains a type identification byte, the corresponding data type and parameter information can be determined by identifying this byte. Generally, a byte has 8 bits; for example, 00100100 constitutes a complete byte. During implementation, it can be divided into segments according to requirements to form the corresponding information representation. Specifically, the high three bits (001) can be used as the data type information, and the low five bits (00100) can be used as the parameter information. These parameters are type-related; for example, if it's an integer type, the parameter is the specific numeric information; if it's a string type, the parameter is the length information.
[0065] More preferably, Figure 2 This is a schematic diagram of the type identification byte parsing process disclosed in an embodiment of the present invention, as shown below. Figure 2 As shown, the firmware parsing rules include data conversion rules and data calculation rules. The step of parsing the type identification bytes in the firmware file to be upgraded according to the pre-configured firmware parsing rules to determine the data type information and parameter information in the type identification bytes includes:
[0066] S1021: Convert the type identification byte stored in hexadecimal format into a binary type identification byte according to the pre-configured data conversion rules;
[0067] S1022: Calculate the data of the high three bits in the binary type identification byte according to the pre-configured data calculation rules to obtain the corresponding first calculation result, and calculate the data of the low five bits in the binary type identification byte according to the pre-configured data calculation rules to obtain the corresponding second calculation result;
[0068] S1023: Perform data matching according to the pre-configured data matching rules and the first calculation result to determine the corresponding data type information, and perform data matching according to the pre-configured data matching rules and the second calculation result to determine the corresponding parameter information.
[0069] By employing appropriate data conversion and calculation rules to perform byte conversion calculations for type identification, the corresponding type information and the parameter information associated with the type information can be determined. Then, based on the parsed type information and parameter information, the corresponding data type and parameters can be determined.
[0070] S103: Determine the data type of the corresponding data in the corresponding data structure based on the data type information;
[0071] More preferably, the data types include integer types, floating-point types, string types, data list types, and key-value pair types; all multi-byte integers and floating-point numbers are configured using either little-endian byte order or big-endian byte order. In this embodiment, little-endian byte order refers to the least significant byte being stored at the lowest memory address and the most significant byte at the highest memory address; big-endian byte order is characterized by placing the most significant byte at the lowest memory address and the least significant byte at the highest memory address. To ensure compatibility in this embodiment, a unified setting modification is required: if little-endian byte order is used, subsequent storage and parsing will also use little-endian byte order; if big-endian byte order is used, subsequent storage and parsing will also use big-endian byte order.
[0072] More preferably, Figure 3 This is a schematic diagram of the data type determination process disclosed in the embodiments of the present invention, such as... Figure 3 As shown, determining the data type of the corresponding data in the corresponding data structure based on the data type information includes:
[0073] S1031: If the data type information is the first data information, then determine that the corresponding data in the corresponding data structure is of integer type;
[0074] S1032: If the data type information is the second data information, then determine that the corresponding data in the corresponding data structure is of floating-point type;
[0075] S1033: If the data type information is third data information, then the corresponding data in the corresponding data structure is determined to be of string type;
[0076] S1034: If the data type information is the fourth data information, then determine that the corresponding data in the corresponding data structure is of byte group type;
[0077] S1035: If the data type information is the fifth data information, then determine that the corresponding data in the corresponding data structure is a data list type;
[0078] S1036: If the data type information is the sixth data information, then the corresponding data in the corresponding data structure is determined to be a key-value pair type.
[0079] In this embodiment of the invention, different type values are set for different data types: the structure for integer type has a type value of 0, the structure for floating-point type has a type value of 1, the structure for string type has a type value of 2, the structure for byte group type has a type value of 3, the structure for list type has a type value of 4, and the structure for key-value pair type has a type value of 5. Different numerical values are used to represent different data types. Here, the first to sixth data information correspond one-to-one with 0-5 respectively.
[0080] S104: Determine the length information of the corresponding data in the data structure or the numerical information used to represent the corresponding data in the data structure according to the data type and the parameter information to obtain the corresponding data parsing result;
[0081] In this embodiment of the invention, encoding and parsing follow the same rules. For example, for an integer type structure with a type value of 0, the data is encoded in the following way:
[0082] 1. If the corresponding integer value is less than or equal to 27, then directly use that value as the corresponding parameter information;
[0083] 2. If the value is in the range [28, 255], the parameter is 28, and an additional byte is added to store the value; generally, a byte consists of 8 bits, and the corresponding numerical result is calculated through this byte.
[0084] 3. If the value is in the range [256, 65535], the parameter is 29, with an additional 2 bytes to store the value.
[0085] 4. If the value is in the range of [-2147483648, -1] or [65536, 2147483647], the parameter is 30, with an additional 4 bytes to store the value.
[0086] 5. If the value is less than -2147483648 or greater than 2147483647, the parameter is 31, and 8 bytes are added to store the value. The purpose of the added bytes is to store the integer value. In this embodiment of the invention, because the lower five bits are used as parameter information, it can be determined through calculation that the number of bits of the parameter is 5, and the range that can be represented is [0, 31]. The reason for this design is to reduce the amount of data as much as possible. In the specific design, the cases of 1, 2, 4, and 8 extra bytes are reserved, so starting from 31, only [0, 27] are unused and can be directly stored. Final effect: Values less than or equal to 27 only require 1 byte, values less than 256 only require 2 bytes, values less than 65536 only require 3 bytes, and values less than 2147483648 only require 5 bytes. This saves a lot of resources compared to using 8 bytes in total; the above method can reduce the use of resources and also facilitate numerical expansion.
[0087] In addition to encoding methods for integer types, corresponding data encoding can also be performed for floating-point types; for the structure of floating-point types, its type value is 1; if you need to save a single-precision floating-point number, the parameter is 4, and 4 bytes are added to store the float value; if you need to save a double-precision floating-point number, the parameter is 8, and 8 bytes are added to store the double value.
[0088] The above are the rules used when encoding. Therefore, the following methods can be used for parsing, which require specific parsing rules for parsing and recognition. Figure 4 This is a schematic diagram of the integer type recognition process disclosed in an embodiment of the present invention, as shown below. Figure 4 As shown, the step of determining the length information of the corresponding data in the data structure or the numerical information used to represent the corresponding data in the data structure based on the data type and the parameter information to obtain the corresponding data parsing result includes:
[0089] S104a: When the data type is an integer type, obtain the first numerical value associated with the integer type;
[0090] S104b: If the first value is less than or equal to 27, then the first value is determined as the numerical information of the corresponding data in the data structure;
[0091] S104c: If the first value is 28, then obtain the value stored in the byte after the type identification byte as the value information of the corresponding data in the data structure.
[0092] S104d: If the first value is 29, then obtain the value stored in the last two bytes of the type identification byte as the numerical information of the corresponding data in the data structure.
[0093] S104e: If the first value is 30, then obtain the value stored in the last four bytes of the type identification byte as the numerical information of the corresponding data in the data structure.
[0094] S104f: If the first value is 31, then the value stored in the last eight bytes of the type identification byte is obtained as the numerical information of the corresponding data in the data structure.
[0095] The above method can be used to recognize the corresponding integer values.
[0096] In addition to processing data of the above-mentioned numeric types, encoding rules are also configured for other data types. For example, for the string type, the type value of the string type is 2. In the specific implementation, the string uses UTF-8 encoding. The following length refers to the encoding length.
[0097] When encoding strings, the length must be processed first.
[0098] 1. If the length is less than or equal to 28, the parameter is the length.
[0099] 2. If the length is in the range [29, 255], then the parameter is 29, with an additional 1 byte of length value.
[0100] 3. If the length is in the range [256, 65535], the parameter is 30, with an additional 2 bytes of length value.
[0101] 4. If the length is greater than 65535, the parameter is 31, appending a 4-byte length value. After processing the length, directly append the UTF-8 encoding. UTF-8 encoding is a variable-length character encoding for Unicode. It can be used to represent any character in the Unicode standard, and the first byte in its encoding is still compatible with ASCII, allowing software that originally processed ASCII characters to continue using it with little or no modification.
[0102] Similarly, in addition to string types, there are also structures with byte array types and list types. The byte array type has a type value of 3; its length is handled in the same way as the string type, and the byte array is appended directly at the end. The list type has a type value of 4; its length is handled in the same way as the string type, and the list items are appended sequentially at the end. The list items are any DataPack structure.
[0103] A key principle of the datapack design in this invention is to store data using as few bytes as possible. If the string length is short, the string length can be directly stored in the parameters; if the string is long, 1, 2, or 4 bytes are appended based on the length value to store that length.
[0104] The following uses a string type as an example for specific parsing instructions. The process of determining the length information of the corresponding data in the data structure or the numerical information used to represent the corresponding data in the data structure based on the data type and the parameter information to obtain the corresponding data parsing result includes:
[0105] When the data type is a string, obtain the second numerical value associated with the string type;
[0106] If the second value is less than or equal to 28, then the second value is determined as the length information of the corresponding data in the data structure;
[0107] If the second value is 29, then the value stored in the byte after the type identification byte will be used as the length information of the corresponding data in the data structure.
[0108] If the second value is 30, then the value stored in the last two bytes of the type identification byte will be used as the length information of the corresponding data in the data structure.
[0109] If the second value is 31, then the value stored in the last four bytes of the type identification byte will be used as the length information of the corresponding data in the data structure.
[0110] In addition to the integer, floating-point, string, byte array, and list types mentioned above, there is also a key-value pair type. The key-value pair type has a value of 5, and its length is the number of key-value pairs. The processing method is the same as for the string type. Finally, key-value pairs are appended in the order of key1, value1, key2, value2, key3, value3, etc. Both keys and values are DataPack structures. Keys can only be integers, strings, or byte arrays, while values can be of any type.
[0111] S105: Based on the data parsing results, flash the corresponding GNSS receiver firmware to upgrade the GNSS receiver firmware.
[0112] More preferably, the firmware file to be upgraded is a data packet list, which includes an FMW5 string, a firmware attribute list, a firmware file list, and a verification key-value pair; wherein, the firmware attribute list includes an attribute name, an attribute flag, and a first attribute value; the firmware file list includes a file name, a file flag, and a second attribute value; and the verification key-value pair includes an MD5 string.
[0113] In this embodiment of the invention, the firmware file is a DataPack list with a length of 4, each item of which is as follows: the string "FMW5", a firmware attribute list, a firmware file list, and a verification key-value pair.
[0114] Each item in the firmware attribute list is an attribute, a list of length 3: the first item is the attribute name (string); the second item is a flag (integer); and the third item is the attribute value (any type, defined according to the name). Each item in the firmware file list is a file, a file attribute list. The file attribute list structure is the same as the firmware attribute list. The checksum key-value pair is a key-value pair type, with only one item: the key is the string "md5", and the value is a byte array type, representing the MD5 checksum of all file contents preceding the value.
[0115] In this embodiment of the invention, a specific firmware file is used for corresponding analysis and explanation:
[0116] First look at the file header, such as... Figure 5 Read byte 0000, which is 84 (i.e. 0x84). Its high 3 bits are 4 and its low 5 bits are 4, indicating that this is a list of length 4. This is the first level. Next, read 4 items of the list.
[0117] The next byte is 44, with the high 3 bits being 2 and the low 5 bits being 4, indicating that it is a string of length 4. Read out the 4 bytes, 46 4D 57 35, convert them to UTF-8 encoding, which is "FMW5", and end the first item of the first level list;
[0118] The next byte is 84, indicating a list of length 4. This is the second level, and the next four items are from this list. Read another byte, 83, indicating a list of length 3. This is the third level. Read another byte, 49, indicating a string of length 9, which reads "time-pack". The next byte is 00, an integer with a value of 0. The next byte is 53, indicating a string of length 19, which reads "2023-12-12 19:27:43". After reading these three items, the third level of the list ends, and the file attribute "time-pack" has the value 2023-12-12 19:27:43, with the flag set to 0. The next byte is 83, a list of length 3. Repeat the above steps to read the four attributes of the file.
[0119] 1. The value of the time-pack property is the string "2023-12-12 19:27:43".
[0120] 2. The value of name is the string W86-MAIN.
[0121] 3. The value of version is the string W86-MAIN.1.39.2312.179.
[0122] 4. The values of pn-supported are a list:
[0123] [W86-PCBA.1.1, W86G-PCBA.1.1, W86G-PCBA.1.2, W86K-PCBA.1.1, W86M-PCBA.1.1].
[0124] 5. After reading the attributes of the four files, the second level of the list is complete.
[0125] The next byte, the third byte from the end of line 00A0, is 81. It is parsed as a list of length 1, which is the second level, indicating that the firmware has a file. The next byte, 87, is parsed as a list of length 7, which is the third level, indicating that this file has 7 attributes. The next byte, 83, is parsed as a list of length 3, which is the first file attribute. The parsing continues until all 7 attributes are parsed.
[0126] 1. The value of the path attribute is the string w86-main.bin
[0127] 2. The value of the type attribute is the string esp32-bin.
[0128] 3. The value of the codec property is the string LCGE.
[0129] 4. The value of the size attribute is an integer: 926688
[0130] 5. The value of the MD5 attribute is the byte array 60F6 E7 7F C4 8E 41 54 31 15CC F0 17 76AA B5
[0131] 6. The value of version is the string W86-MAIN.1.39.2312.179
[0132] 7. The value of content is a byte array of length 926688.
[0133] Then look at the end of the document, such as Figure 6 The selected portion is the end of the file's content attribute. The next byte is A1, indicating a key-value pair of size 1, with the key being the string "md5" and the value being the byte array D9 E9 84CA D540CD 4F B8 80FF F606F0 68EC.
[0134] In the embodiments of the present invention Figure 5 and Figure 6 Both are hexadecimal editor interfaces, similar to WinHEX, which is a general-purpose tool; the left side displays the hexadecimal representation of the data, and the right side displays the ASCII representation of the data.
[0135] In this embodiment of the invention, backward compatibility needs to follow some principles and constraints. For example, the attribute list currently has three items: name, flag, and attribute value. For compatibility purposes, the definitions of these three items cannot be reduced or modified, but the addition of four or five items is compatible. Old software will ignore the fourth and fifth items when encountering new firmware, and new software needs to set default values for the missing fourth and fifth items when encountering old firmware.
[0136] At a higher level, modifying the definition of an attribute is incompatible, but adding an attribute is compatible. Taking file attributes as an example: if you want to add an attribute that restricts the firmware to use only on certain models, changing the time-pack attribute to the list of applicable models is incompatible, but adding a model-supported attribute makes it compatible. The above methods can achieve better expansion needs and meet more general user needs.
[0137] Taking the example above, the corresponding data construction is achieved by using the DataPack structure: firmware can save multiple firmware attributes of arbitrary format, can save multiple files, and files can have multiple attributes of arbitrary format. That is, the number and definition of attributes can be expanded arbitrarily and backwards with compatibility, and the number of files can also be expanded arbitrarily.
[0138] In this embodiment of the invention, firmware attributes are used to store information such as file packaging time, firmware version, firmware name, and applicable scope; file attributes are used to store information such as file name, type, version, verification, and content. While maintaining such high scalability, it is also very convenient to implement on an MCU. The firmware file is defined based on DataPack, including a nested list structure and attribute definitions.
[0139] The GNSS receiver firmware upgrade method in this embodiment of the invention parses the firmware file configured according to the set rules to obtain the corresponding upgrade firmware file, and performs the upgrade operation on the corresponding firmware according to the upgrade firmware file. The firmware configuration rules of this solution can improve the portability and scalability of the overall firmware file, making GNSS equipment easier to upgrade and manage.
[0140] Example 2
[0141] Please see Figure 7 , Figure 7 This is a schematic diagram of the GNSS receiver firmware upgrade device disclosed in an embodiment of the present invention. Figure 7 As shown, the GNSS receiver firmware upgrade device may include:
[0142] Acquisition module 21: used to acquire the firmware file to be upgraded, the firmware file to be upgraded includes type identification bytes and data storage bytes;
[0143] Parsing module 22: used to parse the type identification byte in the firmware file to be upgraded according to the pre-configured firmware parsing rules to determine the data type information and parameter information in the type identification byte;
[0144] First determining module 23: used to determine the data type of the corresponding data structure based on the data type information;
[0145] The second determining module 24 is used to determine the length information of the corresponding data in the data structure or the numerical information of the corresponding data in the data structure according to the data type and the parameter information to obtain the corresponding data parsing result;
[0146] Upgrade module 25: Used to flash the firmware of the corresponding GNSS receiver according to the data parsing results to realize the firmware upgrade of the GNSS receiver.
[0147] The GNSS receiver firmware upgrade method in this embodiment of the invention parses the firmware file configured according to the set rules to obtain the corresponding upgrade firmware file, and performs the upgrade operation on the corresponding firmware according to the upgrade firmware file. The firmware configuration rules of this solution can improve the portability and scalability of the overall firmware file, and make it easier to upgrade and manage GNSS equipment.
[0148] Example 3
[0149] Please see Figure 8 , Figure 8 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. The electronic device can be a computer, a server, etc. Of course, in certain cases, it can also be a mobile phone, tablet computer, monitoring terminal, or other smart device, as well as an image acquisition device with processing capabilities. Figure 8 As shown, the electronic device may include:
[0150] Memory 510 storing executable program code;
[0151] Processor 520 coupled to memory 510;
[0152] The processor 520 calls the executable program code stored in the memory 510 to execute some or all of the steps in the GNSS receiver firmware upgrade method in Embodiment 1.
[0153] This invention discloses a computer-readable storage medium storing a computer program that causes a computer to perform some or all of the steps in the GNSS receiver firmware upgrade method of Embodiment 1.
[0154] This invention also discloses a computer program product, wherein when the computer program product is run on a computer, the computer performs some or all of the steps in the GNSS receiver firmware upgrade method in Embodiment 1.
[0155] This invention also discloses an application publishing platform, which is used to publish computer program products. When the computer program products are run on a computer, the computer performs some or all of the steps in the GNSS receiver firmware upgrade method in Embodiment 1.
[0156] In various embodiments of the present invention, it should be understood that the sequence number of each process does not necessarily imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0157] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they can be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0158] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0159] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several requests to cause a computer device (which can be a personal computer, server, or network device, specifically a processor in the computer device) to execute some or all of the steps of the methods described in the various embodiments of the present invention.
[0160] In the embodiments provided by this invention, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information.
[0161] Those skilled in the art will understand that some or all of the steps in the various methods of the embodiments described can be implemented by a program instructing related hardware. This program can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0162] The GNSS receiver firmware upgrade method, apparatus, electronic device, and storage medium disclosed in the embodiments of the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A GNSS receiver firmware upgrade method, characterized in that, include: Obtain the firmware file to be upgraded, which includes type identification bytes and data storage bytes; The firmware file to be upgraded is a data packet list, which includes an FMW5 string, a firmware attribute list, a firmware file list, and a verification key-value pair; wherein, the firmware attribute list includes an attribute name, an attribute flag, and a first attribute value; the firmware file list includes a file name, a file flag, and a second attribute value; and the verification key-value pair includes an MD5 string. The type identification bytes in the firmware file to be upgraded are parsed according to pre-configured firmware parsing rules to determine the data type information and parameter information in the type identification bytes. The firmware parsing rules include data conversion rules and data calculation rules. The step of parsing the type identification bytes in the firmware file to be upgraded according to pre-configured firmware parsing rules to determine the data type information and parameter information in the type identification bytes includes: The type identification byte stored in hexadecimal format is converted into a binary type identification byte according to the pre-configured data conversion rules; The data of the high three bits in the binary type identification byte are calculated according to the pre-configured data calculation rules to obtain the corresponding first calculation result, and the data of the low five bits in the binary type identification byte are calculated according to the pre-configured data calculation rules to obtain the corresponding second calculation result. Data matching is performed according to pre-configured data matching rules and the first calculation result to determine the corresponding data type information, and data matching is performed according to pre-configured data matching rules and the second calculation result to determine the corresponding parameter information; The data type of the corresponding data in the corresponding data structure is determined based on the data type information. Based on the data type and the parameter information, determine the length information of the corresponding data in the data structure or the numerical information used to represent the corresponding data in the data structure to obtain the corresponding data parsing results; The firmware of the corresponding GNSS receiver is flashed based on the data parsing results to achieve firmware upgrade of the GNSS receiver.
2. The GNSS receiver firmware upgrade method as described in claim 1, characterized in that, The data types include integer type, floating-point type, string type, data list type, and key-value pair type; All multi-byte integers and floating-point numbers are configured to use either little-endian byte order or big-endian byte order.
3. The GNSS receiver firmware upgrade method as described in claim 2, characterized in that, Determining the data type of the corresponding data in the corresponding data structure based on the data type information includes: If the data type information is the first data information, then the corresponding data in the corresponding data structure is determined to be of integer type; If the data type information is the second data information, then the corresponding data in the corresponding data structure is determined to be of floating-point type; If the data type information is third-party data information, then the corresponding data in the corresponding data structure is determined to be of string type; If the data type information is the fourth data information, then the corresponding data in the corresponding data structure is determined to be of byte group type; If the data type information is the fifth data information, then the corresponding data in the corresponding data structure is determined to be a data list type; If the data type information is the sixth data information, then the corresponding data in the corresponding data structure is determined to be a key-value pair type.
4. The GNSS receiver firmware upgrade method as described in claim 3, characterized in that, The step of determining the length information of the corresponding data in the data structure or the numerical information used to represent the corresponding data in the data structure based on the data type and the parameter information to obtain the corresponding data parsing result includes: When the data type is an integer, obtain the first numerical value associated with the integer type; If the first value is less than or equal to 27, then the first value is determined as the numerical information of the corresponding data in the data structure; If the first value is 28, then the value stored in the byte after the type identification byte is obtained as the numerical information of the corresponding data in the data structure. If the first value is 29, then the value stored in the last two bytes of the type identification byte is obtained as the numerical information of the corresponding data in the data structure. If the first value is 30, then the value stored in the last four bytes of the type identification byte is obtained as the numerical information of the corresponding data in the data structure. If the first value is 31, then the value stored in the last eight bytes after the type identification byte is obtained as the numerical information of the corresponding data in the data structure.
5. The GNSS receiver firmware upgrade method as described in claim 3, characterized in that, The step of determining the length information of the corresponding data in the data structure or the numerical information used to represent the corresponding data in the data structure based on the data type and the parameter information to obtain the corresponding data parsing result includes: When the data type is a string, obtain the second numerical value associated with the string type; If the second value is less than or equal to 28, then the second value is determined as the length information of the corresponding data in the data structure; If the second value is 29, then the value stored in the byte after the type identification byte will be used as the length information of the corresponding data in the data structure. If the second value is 30, then the value stored in the last two bytes of the type identification byte will be used as the length information of the corresponding data in the data structure. If the second value is 31, then the value stored in the last four bytes of the type identification byte will be used as the length information of the corresponding data in the data structure.
6. A GNSS receiver firmware upgrade device, characterized in that, include: Acquisition module: used to acquire the firmware file to be upgraded, which includes type identification bytes and data storage bytes; The firmware file to be upgraded is a data packet list, which includes an FMW5 string, a firmware attribute list, a firmware file list, and a verification key-value pair; wherein, the firmware attribute list includes an attribute name, an attribute flag, and a first attribute value; the firmware file list includes a file name, a file flag, and a second attribute value; and the verification key-value pair includes an MD5 string. The parsing module is used to parse the type identification bytes in the firmware file to be upgraded according to pre-configured firmware parsing rules to determine the data type information and parameter information in the type identification bytes. The firmware parsing rules include data conversion rules and data calculation rules. The step of parsing the type identification bytes in the firmware file to be upgraded according to the pre-configured firmware parsing rules to determine the data type information and parameter information in the type identification bytes includes: The type identification byte stored in hexadecimal format is converted into a binary type identification byte according to the pre-configured data conversion rules; The data of the high three bits in the binary type identification byte are calculated according to the pre-configured data calculation rules to obtain the corresponding first calculation result, and the data of the low five bits in the binary type identification byte are calculated according to the pre-configured data calculation rules to obtain the corresponding second calculation result. Data matching is performed according to pre-configured data matching rules and the first calculation result to determine the corresponding data type information, and data matching is performed according to pre-configured data matching rules and the second calculation result to determine the corresponding parameter information; First determining module: used to determine the data type of the corresponding data structure based on the data type information; The second determining module is used to determine the length information of the corresponding data in the data structure or the numerical information of the corresponding data in the data structure based on the data type and the parameter information to obtain the corresponding data parsing result; Upgrade module: Used to flash the firmware of the corresponding GNSS receiver based on the data parsing results to upgrade the firmware of the GNSS receiver.
7. An electronic device, characterized in that, include: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the GNSS receiver firmware upgrade method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program causes a computer to perform the GNSS receiver firmware upgrade method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Universal OTA firmware package construction method capable of automatically adapting
CN113391790A