CN101609544A - A data loading and testing method and device for an image processor - Google Patents
A data loading and testing method and device for an image processor Download PDFInfo
- Publication number
- CN101609544A CN101609544A CNA2009100632621A CN200910063262A CN101609544A CN 101609544 A CN101609544 A CN 101609544A CN A2009100632621 A CNA2009100632621 A CN A2009100632621A CN 200910063262 A CN200910063262 A CN 200910063262A CN 101609544 A CN101609544 A CN 101609544A
- Authority
- CN
- China
- Prior art keywords
- loading
- flash
- dsp
- program
- data
- 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.)
- Granted
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
Description
技术领域 technical field
本发明属于数字图像处理应用领域,具体涉及对图像处理机进行数据加载的方法与装置。The invention belongs to the application field of digital image processing, and in particular relates to a method and a device for loading data into an image processing machine.
背景技术 Background technique
图像处理机是对输入图像进行一系列处理、分析、识别、跟踪等操作,从而得出有用信息的设备。数字信号处理器(Digital Signal Processing,DSP)是图像处理机系统运行的主要载体之一。DSP在运行时,其程序和数据一般存放在内部的DSP或外扩的静态存储器(Static Random Access Memory,SRAM)中,掉电后将全部丢失,因此,DSP的程序文件和部分数据文件需要固化到外部的非易失性存储器中,如闪存(FLASH)。An image processor is a device that performs a series of operations such as processing, analysis, identification, and tracking on an input image to obtain useful information. Digital Signal Processing (DSP) is one of the main carriers for the operation of the image processor system. When the DSP is running, its programs and data are generally stored in the internal DSP or the externally expanded static memory (Static Random Access Memory, SRAM), and will be lost after power failure. Therefore, the program files and some data files of the DSP need to be cured to an external non-volatile memory, such as flash memory (FLASH).
图像处理机针对不同对象类型需采用不同的图像处理算法、不同的工作参数以及针对特定对象的模板图像,其对象类型可能为运动中的汽车、轮船、飞机,也可能为静止的建筑物、交通枢纽、重要设施等。由于图像处理的多样性和复杂性,决定了图像处理机具有多程序模块的特点。能够正确无误的将上述数据加载到图像处理机中,是图像处理机加载与测试装置必须满足的条件,如果数据加载失败,如何保证加载与测试装置能够继续正常工作,是此类装置设计中的技术难点。The image processor needs to use different image processing algorithms, different working parameters and template images for specific objects for different object types. The object types may be moving cars, ships, airplanes, or stationary buildings, traffic Hubs, important facilities, etc. Due to the diversity and complexity of image processing, the image processing machine has the characteristics of multi-program modules. Being able to load the above data into the image processor correctly is a condition that the image processor loading and testing device must meet. If the data loading fails, how to ensure that the loading and testing device can continue to work normally is a key point in the design of this type of device. Technical Difficulties.
常用的DSP软件在线调试与加载的方法是利用DSP制作厂商提供的仿真器通过DSP上的JTAG(Joint Test Action Group)端口进行。该方法在调试阶段非常方便,但是在复杂的嵌入式系统中,图像处理机可能只是整个系统的一部分。完成系统对接后,图像处理机与整个系统配合工作,一旦出现问题,就需要将图像处理机与整个系统分离,露出JTAG端口后才能实现软件的调试与加载。且使用JTAG加载,不仅需要仿真器、开发平台等额外的工具,还需要专业人士操作,适用范围窄。The commonly used method of online debugging and loading of DSP software is to use the emulator provided by the DSP manufacturer through the JTAG (Joint Test Action Group) port on the DSP. This method is very convenient in the debugging stage, but in complex embedded systems, the image processor may only be a part of the whole system. After the system docking is completed, the image processor works with the entire system. Once a problem occurs, the image processor needs to be separated from the entire system to expose the JTAG port to realize software debugging and loading. And using JTAG loading not only requires additional tools such as emulators and development platforms, but also requires professionals to operate, and the scope of application is narrow.
在《世界电子元器件》2008年第8期,空空导弹研究院的李世杰等人的《基于计算机串口DSP程序加载的实现》一文中,提到一种基于计算机串口对DSP进行加载的方法,通过一个UART芯片进行电平转换后连接到DSP的多通道缓存串口(Multi-channel Buffered Serial Port,McBSP)来进行,但是通信协议简单,给出的实例中只涉及到DSP单个程序模块的情况,不能适用于复杂的图像处理机。且该加载方法的可靠性不高,如果加载错误,将导致加载与测试装置瘫痪。In the 8th issue of "World Electronic Components" in 2008, in the article "Realization of DSP Program Loading Based on Computer Serial Port" by Li Shijie and others of Air-to-Air Missile Research Institute, a method of loading DSP based on computer serial port is mentioned. A UART chip is connected to the DSP's multi-channel buffered serial port (McBSP) after performing level conversion, but the communication protocol is simple, and the given example only involves the case of a single DSP program module. Suitable for complex image processing machines. Moreover, the reliability of the loading method is not high, and if the loading is wrong, the loading and testing device will be paralyzed.
在《研究与开发》2007年第26卷第10期,南京航空航天大学的张兵等人的《DSP片外Flash在系统编程的设计与实现》一文中,也提到了一种采用计算机串口对DSP片外Flash进行加载的方法,构建了一个常驻Flash的更新固件程序,解决了加载错误导致加载与测试装置瘫痪的问题,但是该方法所给出的实例也只涉及DSP处理单个软件的情况,通信协议简单,不能适用于具有多程序模块的图像处理机,且没有考虑更有效的措施来保证数据传输的可靠性。In "Research and Development", Volume 26, No. 10, 2007, in the article "Design and Implementation of DSP Off-chip Flash in System Programming" by Zhang Bing and others from Nanjing University of Aeronautics and Astronautics, a computer serial port pairing method is also mentioned. The method of loading Flash outside the DSP chip builds a resident Flash update firmware program, which solves the problem of paralysis of loading and testing devices caused by loading errors, but the example given by this method only involves the situation of DSP processing a single software , the communication protocol is simple and cannot be applied to image processors with multi-program modules, and no more effective measures are considered to ensure the reliability of data transmission.
发明内容 Contents of the invention
本发明的目的在于提供一种图像处理机数据加载方法和装置,在图像处理机被封装后,能够对程序进行升级和维护,并可根据不同的目标类型启用不同的图像处理程序,操作方便,可靠性高。The purpose of the present invention is to provide a data loading method and device for an image processor. After the image processor is packaged, the program can be upgraded and maintained, and different image processing programs can be activated according to different target types. The operation is convenient. High reliability.
一种图像处理机数据加载与测试方法,加载程序存储于图像处理机的FLASH首地址处,包括FLASH加载子模块、软件切换子模块、通路检测子模块、第一测试子模块、第二测试子模块、……、第n测试子模块,加载与测试装置启动时图像处理机的DSP将加载程序调入内存;待加载数据存入FLASH的后续地址,包括图像处理程序、程序参数以及目标模板图像;图像处理程序包括切换软件子模块、通路检测子模块和图像处理子模块;A data loading and testing method for an image processor, the loading program is stored at the first address of the FLASH of the image processor, including a FLASH loading submodule, a software switching submodule, a path detection submodule, a first testing submodule, and a second testing submodule Module, ..., the nth test sub-module, when the loading and testing device starts, the DSP of the image processor transfers the loading program into the memory; the data to be loaded is stored in the follow-up address of the FLASH, including the image processing program, program parameters and target template image ; The image processing program includes a switching software submodule, a path detection submodule and an image processing submodule;
DSP的当前运行程序接收加载与测试装置发送的指令信息,判断自身是加载程序还是图像处理程序,若是加载程序,则按照方式A进行处理:若是图像处理程序,则按照方式B进行处理;The current running program of the DSP receives the instruction information sent by the loading and testing device, and judges whether it is a loading program or an image processing program. If it is a loading program, it will be processed according to mode A; if it is an image processing program, it will be processed according to mode B;
方式A:Method A:
A1)若指令信息为FLASH加载指令,则运行加载程序的FLASH加载子模块完成FLASH数据加载操作;A1) If the instruction information is a FLASH loading instruction, then run the FLASH loading submodule of the loading program to complete the FLASH data loading operation;
FLASH数据加载操作按照如下方法进行:The FLASH data loading operation is performed as follows:
(a11)FLASH加载子模块检测DSP连接的FLASH类型,向加载与测试装置返回包含有FLASH类型的接收就绪信息;(a11) The FLASH loading submodule detects the FLASH type connected to the DSP, and returns the receiving ready information containing the FLASH type to the loading and testing device;
(a12)加载与测试装置根据FLASH类型对待加载数据进行编码,将编码得到的数据包发送给FLASH加载子模块;(a12) The loading and testing device encodes the data to be loaded according to the FLASH type, and sends the encoded data packet to the FLASH loading submodule;
(a13)FLASH加载子模块接收数据包,对数据包解码并作正确性校验,将校验结果返回给加载与测试装置,如校验结果为正确,进入步骤(a4),否则,结束;(a13) The FLASH loading sub-module receives the data packet, decodes the data packet and performs a correctness check, and returns the check result to the loading and testing device. If the check result is correct, enter step (a4), otherwise, end;
(a14)FLASH加载子模块将解码得到的数据写入FLASH加载指令指定的FLASH扇区;(a14) The FLASH loading submodule writes the decoded data into the FLASH sector specified by the FLASH loading instruction;
(a15)FLASH加载子模块对写入FLASH的数据进行正确性校验,如果正确,则返回FLASH加载成功的状态信息,否则结束;(a15) The FLASH loading submodule checks the correctness of the data written into the FLASH, and if correct, returns the status information that the FLASH is loaded successfully, otherwise it ends;
A2)若指令信息为程序切换指令,则判断自身是否为目标程序,若是,则照常运行加载程序,向加载与测试装置返回目标程序正在运行的状态信息,否则DSP复位,运行加载程序的切换程序子模块将目标程序从FLASH中引导加载到DSP内存作为新的当前运行程序,并向加载与测试装置返回目标软件切换成功的状态信息;A2) If the instruction information is a program switching instruction, then judge whether it is the target program, if so, then run the loading program as usual, return the status information that the target program is running to the loading and testing device, otherwise DSP resets, and runs the switching program of the loading program The sub-module guides and loads the target program from the FLASH to the DSP memory as a new current running program, and returns the status information of the target software switching success to the loading and testing device;
A3)若指令信息为第i测试指令,i=1,2,……,n,则运行加载程序的第i个测试子模块完成相应测试,并向加载与测试装置返回表示测试结果的状态信息;A3) If the instruction information is the i-th test instruction, i=1, 2, ..., n, then run the i-th test submodule of the loader to complete the corresponding test, and return the status information representing the test result to the loading and testing device ;
A4)若指令信息为通路检测指令,则运行加载程序的通路检测子模块完成加载与测试装置与DSP间的通路检测,并向加载与测试装置返回表示检测结果的状态信息;A4) If the instruction information is a path detection instruction, then run the path detection submodule of the loading program to complete the path detection between the loading and testing device and the DSP, and return state information representing the detection result to the loading and testing device;
方式B:Method B:
B1)若指令信息为数据加载指令,则向加载与测试装置返回提示用户切换到加载程序的状态信息;B1) If the instruction information is a data loading instruction, then return to the loading and testing device the status information prompting the user to switch to the loading program;
B2)若指令信息为切换程序指令,则判断自身是否为目标程序,若是,则照常运行当前图像处理程序,向加载与测试装置返回目标程序正在运行的状态信息,否则DSP复位,运行前图像处理程序的切换程序子模块将目标程序从FLASH中引导加载到DSP内存作为新的当前运行程序,并向加载与测试装置返回目标软件切换成功的状态信息;B2) If the instruction information is a switch program instruction, then judge whether it is the target program, if so, then run the current image processing program as usual, and return the status information that the target program is running to the loading and testing device, otherwise the DSP resets, and the image processing before operation The switching program sub-module of the program guides and loads the target program from the FLASH to the DSP memory as a new current running program, and returns the status information that the switching of the target software is successful to the loading and testing device;
B3)若指令信息为第i测试指令,i=1,2,……,n,则向加载与测试装置返回提示切换到加载程序的状态信息;B3) If the instruction information is the i-th test instruction, i=1, 2, ..., n, then return to the loading and testing device the state information that prompts to switch to the loading program;
B4)若指令信息为通路检测指令,则运行当前图像处理程序的通路检测子模块完成加载与测试装置与DSP间的通路检测,并向加载与测试装置返回表示检测结果的状态信息。B4) If the instruction information is a path detection instruction, the path detection submodule running the current image processing program completes the path detection between the loading and testing device and the DSP, and returns status information indicating the detection result to the loading and testing device.
和以往传统背景技术相比,本发明的技术效果体现在:Compared with the traditional background technology in the past, the technical effect of the present invention is reflected in:
1.提高了加载可靠性。1. Improved loading reliability.
设计了一套常驻FLASH首地址处的加载程序,交付给用户后一般不用更改,有效的解决了数据加载失败导致加载与测试装置崩溃的问题。Design a set of loading programs that are resident at the first address of FLASH, and generally do not need to be changed after delivery to the user, which effectively solves the problem of data loading failures that cause the crash of the loading and testing device.
2.在图像处理机被封装后,方便对程序进行升级和维护2. After the image processor is packaged, it is convenient to upgrade and maintain the program
用户通过主控机控制图像处理机运行加载程序,以完成数据加载任务,从而方便地升级图像处理机的程序数据;另外,可以实际需要,扩展加载程序的测试子模块,例如监测图像处理机上重要器件器件的工作状态、查看并更改DSP中当前运行的程序类型、查看FLASH中已存储的数据内容等,实现对程序的有效维护。The user controls the image processor to run the loading program through the host computer to complete the data loading task, so as to conveniently upgrade the program data of the image processor; in addition, the test submodule of the loading program can be expanded according to actual needs, such as monitoring the important data on the image processor. The working status of the device, view and change the program type currently running in the DSP, view the data content stored in the FLASH, etc., to achieve effective maintenance of the program.
3.制订了一套通用的加载与测试装置与被加载图像处理机之间的通信协议。3. A common communication protocol between the loading and testing device and the image processor to be loaded is established.
该协议可扩展、易解释,不仅适用于基于计算机串口,还可以略加修改用于基于USB口或PCI口或网口的加载与测试装置,通用于具有FPGA+DSP+FLASH结构的图像处理机平台,具有通用、可扩展性强以及可靠性高等优点。The protocol is scalable and easy to explain. It is not only suitable for computer serial ports, but also can be slightly modified for loading and testing devices based on USB ports, PCI ports or network ports. It is generally applicable to image processors with FPGA+DSP+FLASH structure. The platform has the advantages of universality, strong scalability and high reliability.
4.改进了DSP多程序模块切换技术4. Improved DSP multi-program module switching technology
通过引入软件方式实现的引导选择开关,不需要修改处理机硬件,只需要用户输入待切换的目标程序信息,主控机控制DSP就可以实现多程序模块之间的任意切换。By introducing the boot selection switch implemented by software, it is not necessary to modify the hardware of the processor, only the user needs to input the information of the target program to be switched, and the main control computer can control the DSP to realize arbitrary switching between multi-program modules.
附图说明 Description of drawings
图1是本发明操作步骤图;Fig. 1 is a figure of operation steps of the present invention;
图2是指令包格式定义示意图;Fig. 2 is a schematic diagram of instruction packet format definition;
图3是文件包格式定义示意图;Fig. 3 is a schematic diagram of file package format definition;
图4是本发明加载与测试装置的整体结构图;Fig. 4 is the overall structural diagram of the loading and testing device of the present invention;
图5是本发明加载与测试装置和被加载图像处理机的层次结构图;Fig. 5 is a hierarchical structure diagram of the loading and testing device and the loaded image processor of the present invention;
图6是主控机端控制程序功能模块划分图;Fig. 6 is a division diagram of the functional modules of the control program at the main control terminal;
图7是串口数据格式图;Figure 7 is a serial port data format diagram;
图8是本发明加载与测试装置与被加载图像处理机的连接示意图;Fig. 8 is a schematic diagram of the connection between the loading and testing device of the present invention and the loaded image processor;
图9是主DSP和从DSP之间的McBSP口连接示意图;Fig. 9 is a schematic diagram of the McBSP port connection between the main DSP and the slave DSP;
图10是FLASH中数据存储示意图;Fig. 10 is a schematic diagram of data storage in FLASH;
图11是加载程序的子模块划分示意图;Fig. 11 is a schematic diagram of sub-module division of the loader;
图12是加载程序实施例的子模块划分示意图;Fig. 12 is a schematic diagram of sub-module division of the loader embodiment;
图13是运行于图像处理机主DSP中的加载程序模块流程图;Fig. 13 is a flow chart of the loading program module running in the main DSP of the image processing machine;
图14是运行于图像处理机主DSP中的图像处理程序模块流程图;Fig. 14 is the flow chart of the image processing program module running in the main DSP of the image processing machine;
图15是运行于图像处理机从DSP中的加载程序模块流程图;Fig. 15 is a flow chart of the loading program module running in the image processor from the DSP;
图16是运行于图像处理机从DSP中的图像处理程序模块流程图。Fig. 16 is a flow chart of the image processing program modules running in the image processor slave DSP.
具体实施方式 Detailed ways
下面结合附图及实施例作进一步详述。Further details will be given below in conjunction with the accompanying drawings and embodiments.
图1给出了本发明加载方法流程,具体为。Figure 1 shows the flow of the loading method of the present invention, specifically.
(1)将由DSP的开发平台编译生成的加载程序可执行文件转换成FLASH所支持的纯数据文件,例如将由CCS(Code Composer Studio)编译生成的.out文件,转换为16进制的.hex文件。加载程序包括FLASH加载子模块、切换程序子模块、通路检测子模块、器件测试子模块和FLASH数据查看子模块。(1) Convert the loader executable file compiled by the DSP development platform into a pure data file supported by FLASH, for example, convert the .out file compiled by CCS (Code Composer Studio) into a hexadecimal .hex file . The loading program includes a FLASH loading submodule, a switching program submodule, a path detection submodule, a device testing submodule and a FLASH data viewing submodule.
(2)采用DSP制作厂商提供的仿真器和调试接口,例如采用TI公司的USB仿真器和JTAG端口,将步骤(1)中生成的数据文件写到DSP片外FLASH的首地址处。(2) Adopt emulator and debugging interface provided by DSP manufacturer, for example, adopt USB emulator and JTAG port of TI company, write the data file generated in step (1) to the first address of DSP off-chip FLASH.
(3)启动加载与测试装置,包括连接加载与测试装置与被加载图像处理机,打开主控机,运行主控机控制程序模块,启动图像处理机。此时图像处理机中的各DSP所运行的程序均为步骤(2)中烧写到FLASH首地址处的加载程序。(3) Starting the loading and testing device, including connecting the loading and testing device with the image processor to be loaded, turning on the main control computer, running the control program module of the main control computer, and starting the image processor. At this moment, the programs run by each DSP in the image processor are the loading programs programmed into the first address of the FLASH in step (2).
(4)加载程序的FLASH加载子模块进行数据加载前,先测试从主控机→图像处理机DSP→主控机的数据通路是否正确,如果正确,则进入步骤(5),否则结束操作,检查故障原因。(4) Before the FLASH loading sub-module of the loading program carries out data loading, first test whether the data path from the main control computer → image processing machine DSP → main control computer is correct, if correct, then enter step (5), otherwise end the operation, Check the cause of the failure.
(5)FLASH加载子模块按照下述方式分别将各种数据写入指定FLASH的扇区位置:(5) The FLASH loading sub-module writes various data into the sector positions of the specified FLASH in the following ways:
(5.1)用户向FLASH加载子模块发送FLASH加载指令,FLASH加载指令包括的信息有:待加载数据大小、写入FLASH的扇区起始地址;(5.1) The user sends a FLASH loading command to the FLASH loading sub-module, and the information included in the FLASH loading command includes: the size of the data to be loaded, the starting address of the sector to be written into the FLASH;
(5.2)FLASH加载子模块接收到FLASH加载指令后,检测连接的FLASH类型,并做好接收待加载数据的准备;(5.2) After the FLASH loading sub-module receives the FLASH loading instruction, it detects the connected FLASH type and prepares to receive the data to be loaded;
(5.3)加载与测试装置接收到DSP准备就绪的消息后,对待加载数据进行编码,并将编码得到的数据包发送给加载程序;待加载数据存入FLASH的后续地址,包括图像处理程序、程序参数以及目标模板图像;图像处理程序包括切换程序子模块、通路检测子模块和图像处理子模块;(5.3) After the loading and testing device receives the message that the DSP is ready, the data to be loaded is encoded, and the encoded data packet is sent to the loading program; the data to be loaded is stored in the follow-up address of the FLASH, including the image processing program, program Parameters and target template images; the image processing program includes a switching program submodule, a path detection submodule and an image processing submodule;
(5.4)FLASH加载子模块接收待加载数据包,对数据包解码并作正确性校验,将校验结果返回给加载与测试装置,如校验结果为正确,进入步骤(5.5),否则,结束本次操作,检测故障原因,回到步骤(3);(5.4) The FLASH loading sub-module receives the data packet to be loaded, decodes the data packet and performs correctness verification, and returns the verification result to the loading and testing device. If the verification result is correct, enter step (5.5), otherwise, End this operation, detect the cause of the failure, and return to step (3);
(5.5)FLASH加载子模块将解码得到的有效待加载数据写入FLASH加载指令所指定的扇区位置;(5.5) The FLASH loading submodule writes the decoded effective data to be loaded into the sector position specified by the FLASH loading instruction;
(5.6)FLASH加载子模块对写入FLASH的数据进行正确性校验,如果正确,则返回加载成功的信息给加载与测试装置,本次加载完毕,回到步骤(5);否则结束本次操作,检测错误原因,回到步骤(4);(5.6) The FLASH loading sub-module checks the correctness of the data written into the FLASH, and if it is correct, returns the information that the loading is successful to the loading and testing device. After this loading is completed, return to step (5); otherwise end this time Operation, detection error cause, back to step (4);
(6)加载与测试装置将所有数据都正确写入图像处理机的FLASH之中后,DSP的当前运行程序接收用户的指令信息,判断自身是加载程序还是图像处理程序,若是加载程序,则按照前述方式A进行处理:若是图像处理程序,则按照前述方式B进行处理。(6) After the loading and testing device has correctly written all the data into the FLASH of the image processor, the current running program of the DSP receives the user's instruction information and judges whether it is a loading program or an image processing program. The above-mentioned way A is processed: if it is an image processing program, the above-mentioned way B is used for processing.
加载与测试装置与图像处理机所交互的主要数据有加载与测试装置发送给图像处理机的指令数据、加载与测试装置发送给图像处理机的被加载数据和图像处理机返回给主控机的状态消息数据三种,具体为:The main data interacted between the loading and testing device and the image processor include the instruction data sent by the loading and testing device to the image processor, the loaded data sent by the loading and testing device to the image processor, and the data returned by the image processor to the host computer. There are three types of status message data, specifically:
(1)加载与测试装置将通路检测指令发送给图像处理机;(1) The loading and testing device sends the path detection instruction to the image processor;
(2)加载与测试装置发送切换程序指令给图像处理机;(2) The loading and testing device sends a switching program instruction to the image processor;
(3)加载与测试装置发送文件数据更新指令给图像处理机;(3) The loading and testing device sends a file data update command to the image processor;
(4)加载与测试装置发送待加载文件数据给图像处理机;(4) The loading and testing device sends the file data to be loaded to the image processor;
(5)加载与测试装置发送测试板上器件指令字给图像处理机;(5) The loading and testing device sends the device instruction word on the test board to the image processor;
(6)加载与测试装置发送FLASH数据查看指令给图像处理机;(6) The loading and testing device sends the FLASH data viewing instruction to the image processor;
(7)图像处理机返回通路正常与否的信息给加载与测试装置;(7) The image processor returns information about whether the path is normal or not to the loading and testing device;
(8)图像处理机返回切换程序状态信息给加载与测试装置;(8) The image processor returns the switching program status information to the loading and testing device;
(9)图像处理机返回加载FLASH信息给加载与测试装置;(9) The image processor returns the loading FLASH information to the loading and testing device;
(10)图像处理机返回器件测试结果信息给加载与测试装置;(10) The image processor returns device test result information to the loading and testing device;
(11)图像处理机返回FLASH中存储的数据信息给加载与测试装置。(11) The image processor returns the data information stored in the FLASH to the loading and testing device.
为了保证加载方法的可靠性,本发明主要采取了以下几个措施:In order to ensure the reliability of the loading method, the present invention mainly takes the following measures:
(1)制定了一套由加载与测试装置与图像处理机共同遵循的通信协议;(1) Developed a set of communication protocols followed by the loading and testing device and the image processor;
将加载与测试装置与图像处理机所交互的数据定义为固定大小格式,每个数据包大小为32Bytes。加载与测试装置发送给图像处理机的指令包和图像处理机返回给加载与测试装置的状态消息包的格式定义相同,如图2所示,前三个字段为包头信息,分别表示:DSP编号、程序编号和指令类别,最后两个字段为16位循环校验码(Cyclic Redundancy Check,CRC),中间字段为具体的指令或状态字。The data exchanged between the loading and testing device and the image processor is defined as a fixed-size format, and the size of each data packet is 32Bytes. The instruction packet sent by the loading and testing device to the image processor and the status message packet returned by the image processor to the loading and testing device have the same format definition, as shown in Figure 2, the first three fields are packet header information, which respectively represent: DSP number , program number and instruction category, the last two fields are 16-bit cyclic check code (Cyclic Redundancy Check, CRC), and the middle field is a specific instruction or status word.
待加载数据包的格式定义如图3所示,包头包尾信息与指令包的包头包尾一致,文件包的第3,4字段是数据帧号。The format definition of the data packet to be loaded is shown in Figure 3. The header and tail information of the packet is consistent with the header and tail of the instruction packet, and the 3rd and 4th fields of the file packet are the data frame number.
(2)对加载与测试装置与图像处理机之间传送的数据包进行CRC校验;(2) carry out CRC check to the data packet transmitted between the loading and testing device and the image processor;
(3)对加载与测试装置发送给图像处理机的被加载程序模块数据包进行帧号校验,校验错误的数据包将不允许写入FLASH。(3) Check the frame number of the loaded program module data packet sent by the loading and testing device to the image processor, and the wrong data packet will not be allowed to be written into the FLASH.
(4)设定了常驻FLASH的加载程序模块。(4) The loader module that resides in FLASH is set.
即步骤(1)(2)中所提到的加载程序,该程序独立与其它的图像处理程序,专用于实现数据加载功能,其写入FLASH后一般不用更新,解决了数据加载失败导致加载与测试装置不能继续正常工作的问题。That is, the loading program mentioned in step (1) (2), this program is independent from other image processing programs, and is dedicated to realize the data loading function. After it is written into FLASH, it generally does not need to be updated, which solves the problem of data loading failure caused by loading and Problems with the test device not continuing to function properly.
(5)超时处理。(5) Overtime processing.
包含图像处理机超时和加载与测试装置超时两种。如果图像处理机超时,则主控机控制程序给出系统消息,提示用户“处理机超时无响应”,用户根据此提示进行故障检测。图像处理机上设置有看门狗电路,如果DSP超过一定时间没有运行,处理机将会自动重启。Contains image processor timeout and loading and testing device timeout. If the image processor times out, the control program of the master computer will give a system message, prompting the user that "the processor has timed out and has no response", and the user performs fault detection according to this prompt. The image processor is equipped with a watchdog circuit. If the DSP does not run for a certain period of time, the processor will automatically restart.
如果DSP在接收完一个文件包后30s内没有收到下一个文件包,则认为主控机超时,在DSP中设定一个时钟监视器,一旦时钟监视器被触发,DSP就放弃当前操作,回到初始状态。If the DSP does not receive the next file packet within 30s after receiving a file packet, it will be considered that the master computer has timed out, and a clock monitor is set in the DSP. Once the clock monitor is triggered, the DSP will give up the current operation and return to the initial state.
本发明不仅用于单DSP图像处理机,还适用于多DSP图像处理机,现以多DSP图像机为例说明实现上述方法的加载与测试装置。如图4所示,加载与测试装置包含一台RS232/RS422串口转换器、具备RS232串口的主控机、电气特性转换电路和加载程序,被加载图像处理机是一种基于多DSP+FPGA+FLASH的结构。The present invention is not only applicable to a single DSP image processor, but also applicable to a multi-DSP image processor. Now, the multi-DSP image processor is taken as an example to illustrate the loading and testing device for realizing the above method. As shown in Figure 4, the loading and testing device includes an RS232/RS422 serial port converter, a master computer with an RS232 serial port, an electrical characteristic conversion circuit, and a loading program. The loaded image processor is a multi-DSP+FPGA+ The structure of FLASH.
加载与测试装置和被加载图像处理机的层次结构,参考图5,从低到高依次为从低到高依次为:硬件层、硬件接口层、监控系统层、Windows设备驱动层、Windows操作系统层和应用层。For the hierarchical structure of the loading and testing device and the loaded image processor, refer to Figure 5, from low to high: hardware layer, hardware interface layer, monitoring system layer, Windows device driver layer, Windows operating system layer and application layer.
(1)硬件层:图像处理机及其板上各种硬件资源。(1) Hardware layer: the image processor and various hardware resources on its board.
(2)硬件接口层:又称硬件驱动层,由一系列经过封装的驱动函数组成,这些驱动函数直接对硬件进行操作,从而驱动硬件电路正常工作。它们向上提供的调用接口使用户不必关心底层硬件是如何工作的。(2) Hardware interface layer: Also known as the hardware driver layer, it consists of a series of encapsulated driver functions, which directly operate on the hardware, thereby driving the hardware circuit to work normally. The call interface they provide upwards makes users not concerned about how the underlying hardware works.
(3)监控系统层:监控程序用于控制整个图像处理机的运行,完成整个系统的任务调度,资源分配,数据的传递、命令的接收、解释和执行。(3) Monitoring system layer: The monitoring program is used to control the operation of the entire image processor, complete the task scheduling of the entire system, resource allocation, data transmission, command reception, interpretation and execution.
(4)Windows设备驱动层:介于应用层和监控软件层之间,控制程序和图像处理机之间所有数据通信要有Windows设备驱动层的支持,设备驱动层将应用层的数据和命令转变成IRP请求包,调用相应的处理例程完成控制程序和DSP的数据通信。(4) Windows device driver layer: Between the application layer and the monitoring software layer, all data communication between the control program and the image processor must be supported by the Windows device driver layer, and the device driver layer converts the data and commands of the application layer Into an IRP request packet, call the corresponding processing routine to complete the data communication between the control program and DSP.
(5)Windows操作系统层:主控机端控制台控制程序模块的运行环境。利用其消息循环机制处理控制程序模块的各种Windows窗口消息,同时调用设备驱动程序处理相应的IRP,是整个主控机控制程序模块的支撑环境。(5) Windows operating system layer: the operating environment of the console of the main control machine to control the program modules. Use its message loop mechanism to process various Windows window messages of the control program module, and at the same time call the device driver to process the corresponding IRP, which is the supporting environment for the entire main control computer control program module.
(6)应用层:主控机控制程序模块就处于该层,有良好的人机交互界面,用户通过该程序模块控制整个系统的运行和监控系统的状态。(6) Application layer: The master control program module is located in this layer, which has a good human-computer interaction interface, and the user controls the operation of the entire system and monitors the status of the system through the program module.
其中,(1)(2)(3)层的所有任务和功能的实现位于图像处理机上,(4)(5)(6)层的所有任务和功能的实现位于加载与测试装置上。Among them, all the tasks and functions of (1)(2)(3) layers are realized on the image processor, and all the tasks and functions of (4)(5)(6) layers are realized on the loading and testing device.
实现上述方法的数字图像机数据加载与测试装置,包括主控机、RS232/RS422串口转换器、电器特性转换电路和加载程序,下面对加载与测试装置的各组件详细介绍。The digital image machine data loading and testing device for realizing the above method includes a main control computer, an RS232/RS422 serial port converter, an electrical characteristic conversion circuit and a loading program. The components of the loading and testing device are introduced in detail below.
1、RS232/RS422串口转换器1. RS232/RS422 serial converter
串口转换器一端连接主控机的RS232端口,另一端连接图像处理机的电气转换电路。其作用是将主控机输出数据流转换为差分模式,便于长距离传输。One end of the serial port converter is connected to the RS232 port of the main control computer, and the other end is connected to the electrical conversion circuit of the image processor. Its function is to convert the output data stream of the main control computer into a differential mode, which is convenient for long-distance transmission.
2、主控机2. Main controller
主控机的控制程序模块在Visual C++6.0的环境下开发,向上与用户交互,向下调用Windows API(Application Programming Interface,应用编程接口)函数。要能向图像处理机发送协议规定的数据,接收并解析DSP返回的信息;搭建与用户交互的界面,根据用户操作,产生相关指令信息并且发送给图像处理机。接收到图像处理机返回的信息后,解析并且通知给用户。主控机控制程序模块的功能模块划分如图6所示,包含六个功能子模块,分别为:文件格式转换子模块、编码子模块、发送子模块、接收子模块、解析子模块和显示子模块。The control program module of the main control machine is developed in the environment of Visual C++6.0, interacts with the user upwards, and calls the Windows API (Application Programming Interface, application programming interface) function downwards. It is necessary to be able to send the data stipulated by the protocol to the image processor, receive and analyze the information returned by the DSP; build an interface for interacting with the user, generate relevant instruction information and send it to the image processor according to the user's operation. After receiving the information returned by the image processor, analyze and notify the user. The functional module division of the master control program module is shown in Figure 6, including six functional submodules, namely: file format conversion submodule, encoding submodule, sending submodule, receiving submodule, parsing submodule and display submodule module.
(1)文件格式转换子模块用于将用户输入的数据文件转换为FLASH所支持的文件格式,例如将由CCS编译生成的.out文件转换为.hex文件,文件格式转换的步骤如下:(1) The file format conversion sub-module is used to convert the data file input by the user into a file format supported by FLASH, for example, convert the .out file compiled by CCS into a .hex file. The steps of file format conversion are as follows:
①将文件的扩展名由.out改为.hex;①Change the file extension from .out to .hex;
②将.hex文件头去掉,分离出数据文件;②Remove the .hex file header and separate the data file;
③将转换完成后的.hex写入.out文件的目录下,即存入主控机硬盘。③Write the converted .hex into the directory of the .out file, that is, store it in the hard disk of the master computer.
(2)编码子模块接收用户输入的指令信息,读取主控机硬盘中的数据文件,按照通信协议分别对指令信息和数据文件信息进行编码,得到指令包和文件包。例如指令包(2) The encoding sub-module receives the instruction information input by the user, reads the data file in the hard disk of the master computer, encodes the instruction information and the data file information respectively according to the communication protocol, and obtains the instruction packet and the file packet. For example command package
00c000001ABCDEFGHIJKLMNOPQRSTU(CRC1)(CRC2),表示这是一条发送给DSP0的通路检测指令,并且DSP0中正在运行的应该是0号程序,最后两个字段CRC1、CRC2表示CRC校验码。00c000001ABCDEFGHIJKLMNOPQRSTU(CRC1)(CRC2) indicates that this is a channel detection instruction sent to DSP0, and the program No. 0 should be running in DSP0, and the last two fields CRC1 and CRC2 indicate the CRC check code.
11c000002200000000000000000000(CRC1)(CRC2),表示这是一条发送给DSP1的切换程序指令,DSP1中正在运行的是1号程序,要求DSP1将程序切换到2号。11c000002200000000000000000000(CRC1)(CRC2), which means that this is a switching program instruction sent to DSP1, and the program No. 1 is running in DSP1, and DSP1 is required to switch the program to No. 2.
20c000003100064010000000000000(CRC1)(CRC2),表示这是一条发送到DSP2的FLASH加载指令,待加载文件大小为0x1000Bytes,待加载到FLASH中的起始地址是0x64010000。20c000003100064010000000000000(CRC1)(CRC2), indicating that this is a FLASH loading instruction sent to DSP2, the size of the file to be loaded is 0x1000Bytes, and the starting address to be loaded into FLASH is 0x64010000.
例如文件包00dfe00010d24f353dfs5fgg5f3g4f(CRC1)(CRC2),表示这是一个发送到DSP0的文件包,帧号为0xfe(254),中间25个字段为有效文件数据。当剩余文件数据个数不足25Bytes时,加0补齐。For example, the file package 00dfe00010d24f353dfs5fgg5f3g4f(CRC1)(CRC2) means that this is a file package sent to DSP0, the frame number is 0xfe(254), and the middle 25 fields are valid file data. When the number of remaining file data is less than 25Bytes, add 0 to make up.
(3)发送子模块配置主控机串口,并将指令包和数据包发送给主控机串口。串口参数包括:串口名称、波特率、校验位、数据位和停止位。本发明采用的波特率是19200,校验位为0,数据位为8,停止位为0,11bits数据中的有效数据为8bit,串行数据格式如图7所示。(3) The sending sub-module configures the serial port of the main control computer, and sends the instruction packet and data packet to the serial port of the main control computer. Serial port parameters include: serial port name, baud rate, parity bit, data bit and stop bit. The baud rate adopted by the present invention is 19200, the parity bit is 0, the data bit is 8, the stop bit is 0, the valid data in the 11bits data is 8bit, and the serial data format is as shown in Figure 7.
(4)接收子模块通过主控机串口将图像处理机反馈的状态信息写入主控机的存储区。(4) The receiving sub-module writes the status information fed back by the image processor into the storage area of the main control computer through the serial port of the main control computer.
(5)解析子模块用于解析处理机返回的状态信息包。(5) The parsing sub-module is used for parsing the status information packet returned by the processor.
例如状态信息包e.g. status packet
02c000001ABCDEFGHIJKLMNOPQRSTU(CRC1)(CRC2),表示PC到DSP0之间的串口数据通路正确,且DSP0中正在运行的程序是2号程序。02c000001ABCDEFGHIJKLMNOPQRSTU(CRC1)(CRC2), indicating that the serial port data path between PC and DSP0 is correct, and the program running in DSP0 is program No. 2.
12c000002200000000000000000000(CRC1)(CRC2),表示DSP1已经成功切换到2号程序。12c000002200000000000000000000(CRC1)(CRC2), indicating that DSP1 has successfully switched to program No. 2.
20c000003510000000000000000000(CRC1)(CRC2),表示DSP2已经准备号接收待加载文件数据,DSP2片外的FLASH型号为SST28VF016。20c000003510000000000000000000(CRC1)(CRC2), indicating that DSP2 is ready to receive the file data to be loaded, and the FLASH model outside DSP2 is SST28VF016.
如果消息包不符合通信协议的规定,则认为该数据包是错误信息。If the message packet does not comply with the provisions of the communication protocol, it is considered that the data packet is an error message.
(6)显示子模块将解析子模块得到的解析结果显示到用户界面状态栏。例如:“PC到0号DSP的串口通路正确,DSP正在运行0号程序”,“处理机超时无响应,请检查数据通路是否连接或重启处理机”,“DSP写FLASH错误,请检查FLASH是否正确”等。(6) The display sub-module displays the analysis result obtained by the analysis sub-module in the status bar of the user interface. For example: "The serial port path between PC and No. 0 DSP is correct, and the DSP is running the No. Correct" etc.
3、电气特性转换电路3. Electrical characteristic conversion circuit
由于RS-422工作于差分模式,而图像处理机的FPGA工作于单端模式,因此需要在FPGA外围附加电气特性转换电路,使通信双方的电气特性匹配,例如MAXIM公司推出的一款专用于RS-422、RS-485通信的转换芯片MAX3490便可以实现这种功能。Since RS-422 works in differential mode, and the FPGA of the image processor works in single-ended mode, it is necessary to add an electrical characteristic conversion circuit around the FPGA to match the electrical characteristics of both communication parties. -422, RS-485 communication conversion chip MAX3490 can realize this function.
4、加载程序4. Load the program
加载程序主要是用于将待加载数据写入FLASH,本发明采用DSP制作厂商提供的仿真器和调试接口,例如采用TI公司的USB仿真器和JTAG端口,将其写到FLASH的首地址处。The loading program is mainly used to write the data to be loaded into the FLASH. The present invention adopts the emulator and the debugging interface provided by the DSP manufacturer, such as the USB emulator and the JTAG port of TI Company, to write it to the first address of the FLASH.
被加载图像处理机是一种基于多DSP+FPGA+FLASH的结构,包括1~4片FPGA(Field Programmable Gate Array,区域可编程门阵列),1~9片DSP,以及与DSP一一对应的NOR FLASH,其与加载与测试装置的连接方式见图8,下面将分别描述图像处理机各组件的工作原理:The loaded image processor is a structure based on multi-DSP+FPGA+FLASH, including 1 to 4 FPGAs (Field Programmable Gate Array, area programmable gate array), 1 to 9 DSPs, and one-to-one corresponding DSP NOR FLASH, its connection with the loading and testing device is shown in Figure 8. The working principle of each component of the image processor will be described below:
1、FPGA1. FPGA
FPGA一般用1~4片,分为主FPGA和从FPGA,与电气特性转换电路相连的FPGA为主FPGA,其余为从FPGA。主FPGA一方面将主控机传来的串行数据转换为并行,根据其包头信息(DSP编号)判断数据流向,将数据包传送给相应的DSP;另一方面将DSP返回的并行信息包转换为串行,并反馈给主控机。在主FPGA中构建通用异步收发器(Universal Asynchronous Receiver and Transmitter,UART),实现数据的串/并转换。从FPGA只需要判定数据流向以及转发数据,不需要进行串/并转换。FPGA在图像处理机中起到了构建数据通路的作用,实现DSP与主控机之间的数据交互。FPGA generally uses 1 to 4 pieces, which are divided into master FPGA and slave FPGA. The FPGA connected to the electrical characteristic conversion circuit is the master FPGA, and the rest are slave FPGAs. On the one hand, the main FPGA converts the serial data sent by the master computer into parallel, judges the data flow direction according to the packet header information (DSP number), and transmits the data packet to the corresponding DSP; on the other hand, converts the parallel information packet returned by the DSP It is serial and fed back to the host computer. Build a Universal Asynchronous Receiver and Transmitter (UART) in the main FPGA to realize data serial/parallel conversion. The slave FPGA only needs to determine the data flow direction and forward the data, and does not need to perform serial/parallel conversion. FPGA plays the role of constructing data path in the image processor, and realizes the data interaction between DSP and the host computer.
2、DSP和FLASH2. DSP and FLASH
DSP一般用1~9片,也分为主DSP和从DSP,具体分配由用户指定,但是与主FPGA相连的DSP一定为主DSP。主DSP与FPGA之间的数据通路由一对FIFO缓存(输入缓存FIFO和输出缓存FIFO)构建,主DSP和从DSP之间的数据通路由DSP自带的接口实现,例如TI C6000DSP的McBSP口,ADI SHARC系列DSP的Link口,两个TI DSP采用McBSP口的连接方式如图9所示。从DSP间的加载通道相互独立。DSP响应主控机的指令,执行相应的操作,是数据加载的主要执行者。DSP generally uses 1 to 9 slices, which are also divided into master DSP and slave DSP. The specific allocation is specified by the user, but the DSP connected to the master FPGA must be the master DSP. The data path between the master DSP and the FPGA is constructed by a pair of FIFO buffers (input buffer FIFO and output buffer FIFO), and the data path between the master DSP and the slave DSP is realized by the interface that comes with the DSP, such as the McBSP port of TI C6000DSP, The Link port of the ADI SHARC series DSP, and the connection method of two TI DSPs using the McBSP port are shown in Figure 9. The loading channels between the slave DSPs are independent of each other. DSP responds to the instructions of the host computer, performs corresponding operations, and is the main executor of data loading.
与主DSP和从DSP相连的FLASH均存储有加载程序模块和图像处理程序模块两种,如图10所示。由于NOR FLASH在编程之前需要将相应的扇区擦除,因此为了方便编程,将各数据存放到FLASH中的起始地址规定为某个扇区的起始地址,并根据各数据的大小和程序编号,为其分配固定的扇区位置。各数据在定型后一般变化较小,扇区分配考虑一定余量,分配后将不用更改。Both the FLASH connected with the main DSP and the slave DSP store two kinds of loading program modules and image processing program modules, as shown in Figure 10. Since NOR FLASH needs to erase the corresponding sector before programming, in order to facilitate programming, the start address of each data stored in FLASH is specified as the start address of a certain sector, and according to the size of each data and the program number, assigning it a fixed sector location. Each data generally changes little after being finalized, and sector allocation takes into account a certain margin, and there is no need to change it after allocation.
主DSP的加载程序子模块整体划分示意图参见图11,该加载程序的一个实例如图12所示,包括六个功能子模块:See Figure 11 for a schematic diagram of the overall division of the loader submodules of the main DSP. An example of the loader is shown in Figure 12, including six functional submodules:
(1)数据流向判断及转发子模块:用于判定主DSP收到的数据包是否需要转发给从DSP。具体为:判定数据包中的DSP编号信息是否对应当前主DSP编号,若是,则由主DSP对其进行处理,若不是,则将其转发给对应的从DSP。(1) Data flow direction judgment and forwarding sub-module: used to judge whether the data packet received by the master DSP needs to be forwarded to the slave DSP. Specifically: determine whether the DSP number information in the data packet corresponds to the current master DSP number, if so, the master DSP processes it, and if not, forwards it to the corresponding slave DSP.
(2)通路检测子模块,用于测试从主控机→图像处理机→主控机的数据通路是否正确,具体为:判断指令包中的握手数据是否与通信协议中的规定一致,如果一致,则返回通路正常消息包;如果不一致,表明通路传送的数据错误,返回通路不正常消息包,之后回到初始状态;(2) The path detection sub-module is used to test whether the data path from the master computer → image processor → master computer is correct. , return the channel normal message packet; if inconsistent, it indicates that the data transmitted by the channel is wrong, return the channel abnormal message packet, and then return to the initial state;
(3)FLASH加载子模块,用于将有效数据写入FLASH。FLASH加载子模块从数据加载指令中提取出待加载数据大小、该文件将写入FLASH的扇区起始地址、最多可烧写次数等信息,计算出数据包的个数,再检测DSP所挂载的FLASH类型,返回消息包给主控机端控制程序表明“DSP0已经准备好接收文件数据,DSP所挂载的FLASH型号为:XXXX”,之后打开时钟监视器。DSP接收到文件数据包后进行可靠性校验,将校验正确的数据提取出来存入烧写数组,丢掉校验不正确的数据包并记录错误数据包的个数。如果数据包完全接收正确,则可以进行下一步操作了,否则跳出该模块,回到初始状态。如果两个相邻的文件数据包的到达时间超过30s,便认为主控机超时,DSP触发时钟监视器跳出FLASH加载模块,回到起始状态。(3) The FLASH loading submodule is used to write valid data into the FLASH. The FLASH loading sub-module extracts the size of the data to be loaded from the data loading command, the starting address of the sector where the file will be written into the FLASH, the maximum number of programming times, etc., calculates the number of data packets, and then detects the The type of FLASH loaded, return a message packet to the host control program to indicate that "DSP0 is ready to receive file data, the type of FLASH mounted on the DSP is: XXXX", and then open the clock monitor. After the DSP receives the file data packet, it performs reliability verification, extracts the data with correct verification and stores it in the programming array, discards the data packets with incorrect verification and records the number of error data packets. If the data packet is completely received correctly, you can proceed to the next step, otherwise, jump out of this module and return to the initial state. If the arrival time of two adjacent file data packets exceeds 30s, it is considered that the main control machine is overtime, and the DSP triggers the clock monitor to jump out of the FLASH loading module and return to the initial state.
DSP接收数据包完毕后,关闭时钟监视器,调用FLASH加载模块的烧写函数开始写FLASH。写完后校验FLASH中数据与内存中的烧写文件数据是否一致,如果一致,则返回消息包“FLASH烧写成功完成”,并回到初始状态;如果不一致,表示写FLASH错误,如果没有超过可重复操作的最大次数,则再写一次,如果已经超过可重复操作次数依然没有写FLASH成功,则返回信息包“写FLASH错误”,之后回到初始状态,准备下一次操作。After the DSP receives the data packet, close the clock monitor, call the programming function of the FLASH loading module to start writing the FLASH. After writing, check whether the data in the FLASH is consistent with the programming file data in the memory. If they are consistent, return the message package "FLASH programming completed successfully" and return to the initial state; If the maximum number of repeatable operations is exceeded, write it again. If the number of repeatable operations has exceeded and the FLASH is still not written successfully, the information packet "Writing FLASH error" will be returned, and then return to the initial state to prepare for the next operation.
(4)切换程序子模块,用于图像处理机多程序模块之间的相互切换。切换方式具体为:先判断待切换的目标程序与DSP内存中正在运行的程序是否一致,若一致,则返回消息包“程序已成功启动”,若不一致,则返回消息包“正在切换到目标程序”,之后DSP复位,将目标程序从FLASH中加载到DSP内存。(4) The switching program sub-module is used for mutual switching among the multi-program modules of the image processor. The switching method is as follows: first judge whether the target program to be switched is consistent with the running program in the DSP memory, if they are consistent, return the message package "The program has been successfully started", if not, return the message package "Switching to the target program ", after which the DSP is reset, and the target program is loaded from the FLASH to the DSP memory.
(5)器件测试子模块,用于测试DSP所挂载的片外器件的工作状态,获取FLASH中所存放的数据等。挂载到DSP的常用器件有同步动态随机存取存储器(Synchronous Dynamic Random Access Memory,SDRAM)、FLASH、双口RAM(DualPort Random Access Memory,DPRAM)等。测试方法具体为:首先判定待测器件类型,再向待测器件写入一组递增的数据,再读出来,判断与写入数据是否相同,若相同,则表明该器件工作正常,否则认为该器件工作不正常。(5) The device test sub-module is used to test the working status of the off-chip devices mounted on the DSP, and obtain the data stored in the FLASH, etc. Common devices mounted to DSP include Synchronous Dynamic Random Access Memory (Synchronous Dynamic Random Access Memory, SDRAM), FLASH, Dual Port RAM (DualPort Random Access Memory, DPRAM), etc. The test method is as follows: first determine the type of the device to be tested, then write a set of incremental data to the device to be tested, and then read it out to judge whether it is the same as the written data. The device is not working properly.
(6)FLASH数据查看子模块:用于查看存放在FLASH中的数据内容。查看方法具体为:FLASH加载子模块先根据指令包中待获取数据的存放地址信息和大小信息,读取FLASH中的该段数据,再按照上述主控机控制程序模块中编码子模块对文件包进行编码的方法对数据进行编码,生成查看结果消息包,最后返回给主控机。(6) FLASH data viewing sub-module: used to view the data content stored in FLASH. The viewing method is as follows: the FLASH loading sub-module first reads the segment of data in the FLASH according to the storage address information and size information of the data to be obtained in the instruction package, and then performs the file package according to the encoding sub-module in the above-mentioned master control program module. The encoding method encodes the data, generates a view result message packet, and returns it to the host computer at last.
主DSP的图像处理程序包括通路检测子模块、切换程序子模块、流向判断子模块和图像处理子模块。其中通路检测子模块和切换程序子模块与前述主DSP加载程序的通路检测子模块、切换程序子模块的功能相同。此处的流向判断子模块与主DSP加载程序的流向判断及转发子模块的相同点在于:两者都需要判定数据包中的DSP编号信息是否对应当前主DSP编号;不同点在于:前者判定结果为不对应时,则返回提示切换到加载程序的状态信息,而后者判定结果为不对应时,则直接将数据转发给目标从DSP。图像处理子模块用于实现某种特定任务的图像处理算法。The image processing program of the main DSP includes a channel detection sub-module, a switching program sub-module, a flow direction judgment sub-module and an image processing sub-module. Wherein the path detection sub-module and the switching program sub-module have the same functions as the path detection sub-module and the switching program sub-module of the aforementioned main DSP loading program. The flow direction judgment submodule here is similar to the flow direction judgment and forwarding submodule of the main DSP loader in that: both need to determine whether the DSP number information in the data packet corresponds to the current main DSP number; the difference lies in: the former judgment result If it is not corresponding, it will return the status information prompting to switch to the loader, and when the latter judges that it is not corresponding, it will directly forward the data to the target slave DSP. The image processing sub-module is used to implement an image processing algorithm for a specific task.
图像处理机端的工作流程如下:The workflow on the image processor side is as follows:
主DSP和从DSP上电后都默认启动存储在FLASH首地址处的加载程序,如果超过规定时间,没有收到主控机数据,则认为用户当前不作FLASH加载操作,将程序自动切换到默认的图像处理程序,否则,继续运行加载程序对主控机任务数据作相应处理。After the main DSP and the slave DSP are powered on, both start the loading program stored at the first address of the FLASH by default. If the data from the main control computer is not received within the specified time, it will be considered that the user is not currently loading the FLASH, and the program will automatically switch to the default Image processing program, otherwise, continue to run the loading program to process the task data of the main control computer accordingly.
主DSP在执行图像处理程序的过程中,如果有主控机任务数据到,则图像处理程序停止当前操作,转而对主控机任务数据进行处理:主DSP调用图像处理程序的流向判断子模块判断数据包是否需要转发,若需要,则返回消息包提示用户切换到主DSP的加载程序,若不需要,则参考图14,按照如下步骤进行处理:During the execution of the image processing program by the main DSP, if the task data of the main control computer arrives, the image processing program stops the current operation and turns to process the task data of the main control computer: the main DSP calls the flow direction judgment submodule of the image processing program Determine whether the data packet needs to be forwarded, if necessary, return the message packet to prompt the user to switch to the loader of the main DSP, if not, refer to Figure 14, and process according to the following steps:
(101)若指令包中的命令字表明为检测通路指令,则运行图像处理程序的通路检测子模块。(101) If the command word in the instruction packet indicates a path detection instruction, run the path detection submodule of the image processing program.
(102)若指令包中的命令字表明为数据加载指令,则返回消息包提示用户切换到加载程序。(102) If the command word in the instruction packet indicates a data loading instruction, return a message packet to prompt the user to switch to the loading program.
(103)若指令包中的命令字表明为切换程序指令,则运行图像处理程序的切换程序子模块。(103) If the command word in the instruction packet indicates that it is a switch program command, run the switch program submodule of the image processing program.
(104)若指令包中的命令字表明为器件测试指令,则返回信息包提示用户切换到加载程序。(104) If the command word in the instruction packet indicates that it is a device test instruction, return the information packet to prompt the user to switch to the loading program.
(105)若指令包中的命令字表明为FLASH数据查看指令,则返回信息包提示用户切换到加载程序。(105) If the command word in the instruction packet indicates that it is a FLASH data viewing instruction, return the information packet to prompt the user to switch to the loading program.
主DSP在执行加载程序时,如果有主控机任务数据到,则加载程序对主控机传来的串口数据(指令包和数据包)作解析,调用加载程序的数据流向判定及转发子模块判定数据包是否需要转发,若需要,则转发数据包给对应的从DSP,若不需要,则参考图13按照下述步骤进行处理:When the main DSP executes the loading program, if the main control computer task data arrives, the loading program will analyze the serial port data (command packet and data packet) transmitted from the main control computer, and call the data flow determination and forwarding submodule of the loading program Determine whether the data packet needs to be forwarded, if necessary, then forward the data packet to the corresponding slave DSP, if not, then refer to Figure 13 to process according to the following steps:
(201)若指令包中的命令字表明为检测通路指令,则运行加载程序的通路检测子模块。(201) If the command word in the instruction packet indicates a path detection instruction, run the path detection submodule of the loading program.
(202)若指令包中的命令字表明为数据加载指令,则运行加载程序的FLASH加载子模块。(202) If the command word in the instruction packet indicates that it is a data loading instruction, then run the FLASH loading submodule of the loading program.
(203)若指令包中的命令字表明为切换程序指令,则运行加载程序的切换程序子模块。(203) If the command word in the instruction packet indicates that it is a switching program command, run the switching program submodule of the loading program.
(204)若指令包中的命令字表明为器件测试指令,则运行加载程序的器件测试子模块。(204) If the command word in the command packet indicates a device test command, run the device test submodule of the loading program.
(205)若指令包中的命令字表明为FLASH数据查看指令,则运行加载程序的FLASH数据查看子模块。(205) If the command word in the instruction packet indicates that it is a FLASH data viewing instruction, then run the FLASH data viewing submodule of the loading program.
图15和图16分别给出了从DSP的加载程序处理流程和图像处理程序处理流程,从DSP接收主DSP转发的指令包和数据包,对它们的后续操作与主DSP处理基本相同,区别有两点:a、从DSP不需要转发数据包给其它的DSP,因此从DSP的加载程序不包含数据流向判断及转发子模块,从DSP的图像处理程序不包含数据流向判断子模块;b、从DSP产生的信息包通过主DSP返回给主控机。Figure 15 and Figure 16 show the processing flow of the loading program and image processing program of the slave DSP respectively. The slave DSP receives the command packets and data packets forwarded by the master DSP, and the subsequent operations on them are basically the same as those of the master DSP, with some differences. Two points: a. The slave DSP does not need to forward data packets to other DSPs, so the loading program from the DSP does not include the data flow direction judgment and forwarding sub-module, and the image processing program from the DSP does not include the data flow direction judgment sub-module; b. The information packet produced by DSP is returned to the host computer through the main DSP.
本发明中,被加载图像处理机DSP的引导加载过程与华中科技大学图像识别与人工智能研究所郑伟等人申请的中国专利文件《多DSP多程序模块引导加载方法及其系统》中所提到的引导加载方法相同,该专利文件还提到了一种对DSP多程序模块进行切换的方法,但需要对电路板上的拨码开关进行操作才能实现。当处理机被封装后,板上的拨码开关也同时被封装了,将导致程序切换功能不可用。如果强行将按键连接出来,将影响系统的可靠性。本发明对这种方法做了改进,采用软件方式实现了DSP程序模块之间的切换。本实施例在与DSP相连的FPGA中设置一个可读写寄存器作为引导选择开关。DSP进行引导加载的时候读取该引导选择开关的值,根据这个值来启动相应的程序。In the present invention, the bootloading process of the loaded image processing machine DSP is the same as proposed in the Chinese patent document "Multi-DSP multi-program module bootloading method and its system" applied by Zheng Wei, Huazhong University of Science and Technology Institute of Image Recognition and Artificial Intelligence Institute. The bootloading method is the same as that mentioned above, and the patent document also mentions a method for switching the DSP multi-program module, but it can only be realized by operating the dial switch on the circuit board. When the processor is packaged, the DIP switch on the board is also packaged, which will cause the program switching function to be unavailable. If the key is connected forcibly, it will affect the reliability of the system. The present invention improves this method, and realizes the switch between DSP program modules by means of software. In this embodiment, a readable and writable register is set in the FPGA connected to the DSP as a boot selection switch. When the DSP performs bootloading, it reads the value of the boot selection switch, and starts the corresponding program according to this value.
具体方法如下:The specific method is as follows:
1)DSP当前运行的程序收到切换指令后,首先判断目标程序编号与正在运行的程序编号是否一致,若不一致,则将目标程序编号写入引导选择开关,进行下一步操作;若一致,则不进行下一步操作。1) After the currently running program of the DSP receives the switching command, it first judges whether the target program number is consistent with the running program number, if not, writes the target program number into the boot selection switch, and proceeds to the next step; if they are consistent, then Do not proceed to the next step.
2)关闭全局中断并清除中断控制寄存器。2) Close the global interrupt and clear the interrupt control register.
3)将DSP一级缓存中的数据设置为无效。3) The data in the
4)跳转到DSP内存地址0处执行。4) Jump to
5)DSP内存地址0处存放的是用户加载代码,所以DSP执行用户加载过程,将FLASH中存放的编号与引导选择开关值对应的程序数据载入内存,加载完毕。5) The
Claims (4)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009100632621A CN101609544B (en) | 2009-07-21 | 2009-07-21 | Method and device for loading and measuring data of image processing device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009100632621A CN101609544B (en) | 2009-07-21 | 2009-07-21 | Method and device for loading and measuring data of image processing device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101609544A true CN101609544A (en) | 2009-12-23 |
CN101609544B CN101609544B (en) | 2011-09-14 |
Family
ID=41483292
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2009100632621A Expired - Fee Related CN101609544B (en) | 2009-07-21 | 2009-07-21 | Method and device for loading and measuring data of image processing device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101609544B (en) |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102495746A (en) * | 2011-11-29 | 2012-06-13 | 中国航空工业集团公司第六三一研究所 | Onboard embedded computer data loading method |
CN102609331A (en) * | 2012-01-19 | 2012-07-25 | 苏州希图视鼎微电子有限公司 | File format of loading code in NAND flash |
CN102685396A (en) * | 2011-03-18 | 2012-09-19 | 新奥特(北京)视频技术有限公司 | Method and system for serial communication of controlled equipment in nonlinear edition system |
CN103176823A (en) * | 2013-03-04 | 2013-06-26 | 上海古鳌电子科技股份有限公司 | Image module with USB flash disk and internet access upgrading function and operation mode thereof |
CN103188306A (en) * | 2011-12-30 | 2013-07-03 | 中国移动通信集团公司 | Distributed preprocessing method and distributed preprocessing system |
CN103269123A (en) * | 2013-05-03 | 2013-08-28 | 国家电网公司 | A distribution network line operation monitoring system |
CN106528203A (en) * | 2016-10-10 | 2017-03-22 | 上海无线电设备研究所 | Method for automatic program programming of multiple DSP chips |
CN107885523A (en) * | 2017-11-10 | 2018-04-06 | 航宇救生装备有限公司 | A kind of serial ports upgrading software approach of fast and stable |
CN108829465A (en) * | 2018-06-27 | 2018-11-16 | 北京计算机技术及应用研究所 | A kind of local dynamic loading system and method based on direct read/write FLASH |
CN109597777A (en) * | 2018-12-11 | 2019-04-09 | 济南浪潮高新科技投资发展有限公司 | A kind of MCBSP interface inter-link device and method based on FPGA |
CN110990086A (en) * | 2019-11-26 | 2020-04-10 | 华中科技大学 | A coprocessor calling method and system for image target detection |
CN111030924A (en) * | 2019-11-26 | 2020-04-17 | 浙江吉城云创科技有限公司 | A gateway device, configuration method and working method |
CN111080637A (en) * | 2019-12-25 | 2020-04-28 | 深圳力维智联技术有限公司 | Cloud service-based advertisement remote method, device, system, product and medium |
CN112389592A (en) * | 2020-11-12 | 2021-02-23 | 中国人民解放军海军工程大学 | Actuating mechanism of unmanned ship and control method thereof |
-
2009
- 2009-07-21 CN CN2009100632621A patent/CN101609544B/en not_active Expired - Fee Related
Cited By (20)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102685396A (en) * | 2011-03-18 | 2012-09-19 | 新奥特(北京)视频技术有限公司 | Method and system for serial communication of controlled equipment in nonlinear edition system |
CN102685396B (en) * | 2011-03-18 | 2017-02-01 | 新奥特(北京)视频技术有限公司 | Method and system for serial communication of controlled equipment in nonlinear edition system |
CN102495746A (en) * | 2011-11-29 | 2012-06-13 | 中国航空工业集团公司第六三一研究所 | Onboard embedded computer data loading method |
CN103188306A (en) * | 2011-12-30 | 2013-07-03 | 中国移动通信集团公司 | Distributed preprocessing method and distributed preprocessing system |
CN103188306B (en) * | 2011-12-30 | 2016-04-27 | 中国移动通信集团公司 | Distributed preprocess method and system |
CN102609331A (en) * | 2012-01-19 | 2012-07-25 | 苏州希图视鼎微电子有限公司 | File format of loading code in NAND flash |
CN103176823A (en) * | 2013-03-04 | 2013-06-26 | 上海古鳌电子科技股份有限公司 | Image module with USB flash disk and internet access upgrading function and operation mode thereof |
CN103269123A (en) * | 2013-05-03 | 2013-08-28 | 国家电网公司 | A distribution network line operation monitoring system |
CN103269123B (en) * | 2013-05-03 | 2015-01-21 | 国家电网公司 | Power distribution network line operation monitoring system |
CN106528203B (en) * | 2016-10-10 | 2019-10-18 | 上海无线电设备研究所 | A kind of automated procedures programming method of multi-DSP chip |
CN106528203A (en) * | 2016-10-10 | 2017-03-22 | 上海无线电设备研究所 | Method for automatic program programming of multiple DSP chips |
CN107885523A (en) * | 2017-11-10 | 2018-04-06 | 航宇救生装备有限公司 | A kind of serial ports upgrading software approach of fast and stable |
CN108829465A (en) * | 2018-06-27 | 2018-11-16 | 北京计算机技术及应用研究所 | A kind of local dynamic loading system and method based on direct read/write FLASH |
CN108829465B (en) * | 2018-06-27 | 2021-01-08 | 北京计算机技术及应用研究所 | Local dynamic loading system and method based on direct read-write FLASH |
CN109597777A (en) * | 2018-12-11 | 2019-04-09 | 济南浪潮高新科技投资发展有限公司 | A kind of MCBSP interface inter-link device and method based on FPGA |
CN110990086A (en) * | 2019-11-26 | 2020-04-10 | 华中科技大学 | A coprocessor calling method and system for image target detection |
CN111030924A (en) * | 2019-11-26 | 2020-04-17 | 浙江吉城云创科技有限公司 | A gateway device, configuration method and working method |
CN111080637A (en) * | 2019-12-25 | 2020-04-28 | 深圳力维智联技术有限公司 | Cloud service-based advertisement remote method, device, system, product and medium |
CN112389592A (en) * | 2020-11-12 | 2021-02-23 | 中国人民解放军海军工程大学 | Actuating mechanism of unmanned ship and control method thereof |
CN112389592B (en) * | 2020-11-12 | 2021-09-03 | 中国人民解放军海军工程大学 | Actuating mechanism of unmanned ship and control method thereof |
Also Published As
Publication number | Publication date |
---|---|
CN101609544B (en) | 2011-09-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101609544A (en) | A data loading and testing method and device for an image processor | |
CN103729288B (en) | The adjustment method of application program under a kind of embedded multi-core environment | |
US9852038B2 (en) | Debugging system and debugging method of multi-core processor | |
US8572578B2 (en) | Script debugging | |
US20130326280A1 (en) | Debugging method, chip, board, and system | |
CN107562504A (en) | A kind of serial port implementing method of DSP program segmentings loading | |
CN112463614A (en) | Software virtualization test environment construction method based on hardware board card access | |
CN114138644A (en) | BMC (baseboard management controller) debugging method, monitoring method, system, device, equipment and medium | |
WO2013060064A1 (en) | Terminal for collecting electricity information and remote maintenance system | |
CN108427640A (en) | A method of debugging driver under User space | |
CN103853147B (en) | A kind of on-line debugging system of embedded system | |
CN101957787A (en) | Method for debugging blade server by using BMC module | |
CN109597653A (en) | Method, BIOS and the BMC of BIOS and BMC command interaction | |
CN106559288A (en) | A kind of quick fault testing method based on icmp packet | |
CN116627850B (en) | Function debugging method and device, storage medium and electronic equipment | |
CN109683964A (en) | Bios software debugging control program, system and server | |
CN105740139A (en) | Virtual environment based embedded software debugging method | |
CN111190852A (en) | PowerPC and Microblaze interaction system and interaction method based on double ports | |
CN100481093C (en) | System for verifying target and verification method thereof | |
CN103235921B (en) | A kind of computer system | |
CN114125941B (en) | Data packetizing method and device, electronic equipment and storage medium | |
CN111371799A (en) | Control method, device and equipment for MCTP controller to send and receive data | |
CN112559336B (en) | Method, device and system for self-adaptively debugging heterogeneous computing chip and main board chip | |
CN116521496A (en) | Method, system, computer device and storage medium for verifying server performance | |
CN103077046A (en) | Method for replacing serial port by internet access in computer system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20110914 Termination date: 20180721 |
|
CF01 | Termination of patent right due to non-payment of annual fee |