Search

CN-122018937-A - Method for loading U3V camera firmware

CN122018937ACN 122018937 ACN122018937 ACN 122018937ACN-122018937-A

Abstract

The invention relates to the technical field of electric digital data processing and discloses a method for loading U3V camera firmware, which comprises the steps of presetting a basic firmware image containing an invalid serial number and a locking enabling bit in a nonvolatile memory, enabling the image to only establish physical connection when equipment is electrified, responding to an upper computer request, loading a write number proxy firmware into the nonvolatile memory and operating the write number proxy firmware to enable the equipment to enumerate as configuration interface equipment, receiving serial number data through the write number proxy firmware, executing direct addressing operation on the nonvolatile memory, writing the serial number and overwriting the enabling bit to be in an effective state, and enumerating the reset equipment as U3V function equipment based on the modified basic firmware image.

Inventors

  • LI MINGMING

Assignees

  • 瑞视科智能技术(上海)有限公司

Dates

Publication Date
20260512
Application Date
20260122

Claims (10)

  1. 1. A method of loading U3V camera firmware for a digital data processing terminal comprising a universal serial bus controller, a non-volatile memory and a volatile memory, the method comprising the steps of: Presetting a basic firmware image in a nonvolatile memory, wherein the basic firmware image comprises a serial number occupation field pointing to an invalid value and a guide enabling verification field in a locking state, and is configured to establish physical layer connection but not enumerate as U3V functional equipment when the system is powered on; Responding to a configuration request signal sent by an upper computer, loading a number writing agent firmware into a volatile memory through a universal serial bus controller, and temporarily enumerating a digital data processing terminal into configuration interface equipment by the system running the loaded number writing agent firmware; The number writing agent firmware receives unique serial number data and an activation instruction issued by the upper computer; the write number agent firmware performs direct addressing operation on the nonvolatile memory, writes the unique serial number data into the physical address of the serial number occupying field, and overwrites the boot enabling verification field as a valid state value; In response to the system reset signal, the universal serial bus controller loads a base firmware image containing unique serial number data according to a boot enable check field which is overwritten as a valid state value in the nonvolatile memory, and enumerates the system as a U3V functional device with a unique identity.
  2. 2. The method for loading U3V camera firmware according to claim 1, wherein the step of presetting the basic firmware image comprises compiling an original code to generate a binary object file, locating a memory mapping address field for storing a serial number in the binary object file, performing full-bit filling coverage on the memory mapping address field by using preset mask data to form an invalid value, locating a flag bit address for controlling skip of a boot flow in the binary object file, modifying data of the flag bit address to a blocking state for blocking the boot flow, and using the modified binary object file as the basic firmware image to write the modified binary object file into a nonvolatile memory in batch through a universal programming interface.
  3. 3. The method of loading U3V camera firmware of claim 1 wherein the write agent firmware is a lightweight boot program independent of the underlying firmware image, the write agent firmware includes only control endpoint logic of the USB communication protocol stack and underlying read-write driver logic for the non-volatile memory, the write agent firmware does not include image sensor driver logic and the U3V streaming protocol stack, and the step of enumerating the system as a configuration interface device based on the write agent firmware includes the USB controller reporting the device descriptor to the host computer using a specific vendor identifier and a product identifier defined in the write agent firmware, and establishing a control transfer channel for configuration data only.
  4. 4. The method for loading U3V camera firmware according to claim 1, wherein after the step of receiving the unique serial number data and the activation instruction issued by the host computer, the method further comprises the step of integrity verifying the unique serial number data, the integrity verifying step comprises the steps that the write agent firmware calculates a verification characteristic value of the received unique serial number data according to a preset verification algorithm, compares the verification characteristic value with a reference verification value issued by the host computer, and triggers erasing operation for the nonvolatile memory when the verification characteristic value is consistent with the reference verification value.
  5. 5. The method of loading U3V camera firmware according to claim 4, wherein in the integrity verification step, the write agent calculates the verification feature value according to the following formula : , wherein, Representing the first of the unique serial number data The number of bytes, Representing the total byte length of the unique serial number data, Representing a preset modulus reference value, the write agent firmware will calculate the obtained And carrying out equality judgment with the reference check value to determine the validity of the data transmission process.
  6. 6. The method of claim 1, wherein the step of overwriting the boot enable verification field with a valid state value is configured to perform an atomic operation after the unique serial number data is successfully written into the nonvolatile memory, wherein the write agent firmware locks a state register of the nonvolatile memory after the unique serial number data is confirmed to be successfully written, and sends a programming instruction to a sector where the boot enable verification field is located, and the boot program jumps to the valid state value of the main function entry after the lock state is turned over, and wherein if the unique serial number data is not written, the write agent firmware maintains the boot enable verification field as the lock state, and the system is returned to the restricted boot state defined by the base firmware image after the next power-on reset.
  7. 7. The method for loading U3V camera firmware according to claim 1, wherein the digital data processing terminal further comprises an encryption authentication module, the method further comprises the steps that during the operation of the number writing agent firmware, the upper computer issues an identity verification command, a key slot number and a password, the number writing agent firmware accesses the encryption authentication module of the digital data processing terminal through an internal bus, the key slot number and the password sent by the upper computer are input, the ciphertext output by the encryption authentication module is read after the encryption part finishes calculation, the encryption is uploaded to the upper computer through a universal serial bus controller, the upper computer calculates and outputs the ciphertext according to a secret key stored by the upper computer and a current password, if the secret key and the received ciphertext are consistent, the number writing agent firmware host is considered as a legal product, otherwise, the secret key is preset in the encryption authentication module and the password is changed, and the illegal camera cannot invade the number writing system is ensured.
  8. 8. The method for loading U3V camera firmware according to claim 1, wherein the triggering mode of the system reset signal comprises the steps that after the write number agent firmware completes the overwriting operation of the boot enable verification field, a reset instruction is actively written into a reset register of the universal serial bus controller to trigger soft reset, or after a write success confirmation message fed back by the write number agent firmware is received, an upper computer sends a power-off restarting instruction to a digital data processing terminal to trigger hard reset.
  9. 9. The method for loading U3V camera firmware according to claim 1, wherein the method is applied to a massively parallel production environment, an upper computer is simultaneously connected with a plurality of digital data processing terminals, the upper computer performs the step of loading the write number agent firmware in parallel for each connected digital data processing terminal, and the upper computer distributes unique serial number data which do not conflict with each other for each digital data processing terminal according to port physical topological addresses when each digital data processing terminal enumerates to be configured as interface equipment, and sends the unique serial number data and an activation instruction.
  10. 10. The method of claim 1, wherein the base firmware image includes direct memory access control logic for processing image data, wherein after the system enumerates as a U3V function device having a unique identity, the method further comprises the step of enabling the direct memory access control logic by the universal serial bus controller according to the valid status value to establish a data transmission link from the image sensor interface to the universal serial bus interface, and wherein the universal serial bus controller reads the unique serial number data in the nonvolatile memory and populates the unique serial number data in the device information field of the U3V boot protocol packet in response to an enumeration request of the host.

Description

Method for loading U3V camera firmware Technical Field The invention relates to a method for loading U3V camera firmware, and belongs to the technical field of electric digital data processing. Background In the current industrial machine vision system, a universal serial bus controller is adopted as a core data processing unit by U3V standard imaging equipment, firmware mirror images in a nonvolatile memory are run and relied on, the firmware mirror images comprise a communication protocol stack, an image acquisition logic executable instruction stream and a unique equipment identifier for distinguishing hardware entities, a serial number is statically embedded into a firmware source code in a code compiling stage in the existing data processing flow, and a binary mirror image file uniquely corresponding to hardware is generated. Aiming at optimization of camera operation efficiency, for example, china patent with publication number CN112099859A discloses an industrial camera firmware system based on gigabit network and an implementation method, by constructing a firmware architecture comprising a main loop, interrupt service and a driving module, the response speed of the camera to network events and image data in an operation state is improved, however, the task scheduling and the data flow optimization of an operation state task of a focusing device in the prior art are carried out, a core pain point is not touched by the firmware deployment in a production state, the data processing flow still uses a serial number and other identity data static embedded firmware source code traditional paradigm, a code compiling stage generates a binary image file uniquely corresponding to hardware, the mode meets the protocol device uniqueness requirement, but contradiction is caused in a digital production and device initialization data processing logic, an executable instruction stream is used as a universal data entity to be kept consistent in the same type device, a device identifier is used as a differential data entity to be mutually exclusive in a physical device layer, the prior art couples the two compiling stages, and leads to generation, storage and verification of an independent binary large object file aiming at each physical device, under an initialization configuration scene, the limitation exists in generating an independent firmware mode aiming at a single physical device, the data and version management conflict, a large quantity of identifiers are different in a mapping mode, when the serial number and the image is only needs to be written with a mapping address and a mapping logic, the mapping is required to be written with a mapping logic, and the original image is used for the mapping is based on a new data, the mapping is required to be completely different, and the logic has a high-quality logic is required to be completely and has a high-quality logic is required to be in a high-quality logic and is required to be in a mapping logic and has high performance and is required to be in a mapping logic and has high quality and has high stability and has high quality and high stability. The data stream misalignment results in an identification error that corrects the memory sector that needs to be erased and rewritten. Therefore, how to improve the firmware image data structure and the loading time sequence, and realize the logic decoupling and the step-by-step residence in the nonvolatile memory of the universal instruction codes and the independent device identifiers on the premise of not changing the hardware architecture, becomes the technical problem to be solved by the invention. Disclosure of Invention In order to solve the problems in the background technology, the technical scheme of the invention is as follows, a method for loading U3V camera firmware, which is applied to a digital data processing terminal comprising a universal serial bus controller, a nonvolatile memory and a volatile memory, comprises the following steps: Presetting a basic firmware image in a nonvolatile memory, wherein the basic firmware image comprises a serial number occupation field pointing to an invalid value and a guide enabling verification field in a locking state, and is configured to establish physical layer connection but not enumerate as U3V functional equipment when the system is powered on; responding to a configuration request signal sent by an upper computer, loading a number writing agent firmware into a volatile memory through a universal serial bus controller, and jumping a system instruction pointer to an address space of the volatile memory so as to enumerate the digital data processing terminal into configuration interface equipment based on the number writing agent firmware; The number writing agent firmware receives unique serial number data and an activation instruction issued by the upper computer; the write number agent firmware performs direct addressing operation on the nonvolatile memory,