本文主要是介绍Hexview工具使用说明,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一般Davinci工具都会在Misc路径下面配一个hexview工具。Hexview工具是免安装的,功能非常强大,可以打开并解析hex文件和srec文件,哪怕这两种文件格式不一样,解析出来的结果是一样的。
文件描述
_examples是例子
_expdatproc是用来生成expdatproc.dll文件的源代码,主要用来生成校验码
disclaimer.txt是权限声明
gl_inst.dll和InfoWindow2.dll都是动态库,删除了就打不开了
hexview.exe是执行文件,我们打开的就是它
license.liz是秘钥,也是要留着的
ReferenceManual_HexView.pdf是说明文件,里面有具体的操作说明
查看文件
将对应的文件拖动进去就行,里面会显示文件分多少块,每块多大,从什么地址开始,具体内容是什么。
删除文件内容
Edit->delete,根据格式填写要删除的内容。
填充数据
Edit->Fill block data,写入要填充的地址和填充内容。
合并文件
将第一个文件拖进去打开,file->merge,选择要合并的第二个文件,选择第二个文件要填入的范围和偏移地址,生成后保存即可。它支持hex和srec格式之间的合并。
校验数据
Edit->Create a checksum value
选择要校验的范围、类型、校验码放置的地址,就能计算出校验码,并且插入进去hex文件里面。
我们可以查看或者修改具体的计算方式,在expdat_csum.c文件里面我们能看到DoCalculateChecksum函数。
/*********************************************************************************************************************** DoCalculateChecksum()**********************************************************************************************************************/
/*! \brief Does the checksum operation.* \details This function runs the checksum calculation. It can be called several times.* At least three times per block (see actionState).* \param[in] info: The workspace for the operation.* \param[in] actionState: One of the three action states in sequence: * csumActionBegin: Initialises the checksum operation.* csumActionDoData: Performs the operation on the given data of a block.* Can be called multiple times, one time per data block (continuous address space).* csumActionEnd: Concludes the checksum operation and provides the result.* \return True if operation was successful* False otherwise.* \note This is an exported interface function of the DLL intended to be called from the EXE.* If the return value is false, then the exState contains a more detailed error indication.**********************************************************************************************************************/
DLL_FUNC(bool) DoCalculateChecksum(TExportDataInfo *info,EChecksumAction actionState)
{bool result=false;/* Check for interface version */if (info->DllInterfaceVersion != DllInterfaceVersion){info->exState = ExportStateDllInterfaceVersionError;return false;}// Default error info.info->exState = ExportStateUnknownActionItemOrActionType;if (actionState==CSumActionBegin){/* Initialise the workspace per operation */result = BeginChecksumCalculation(info);}else if (actionState==CSumActionDoData){/* Run the checksum calculation */result = DoChecksumCalculation(info);}else if (actionState==CSumActionEnd){/* Conclude the checksum calculation and provide the results */info->expDatResultSize = EXPDAT_RESULTS_MAXSIZE;result = EndChecksumCalculation(info, info->expDatResults, &(info->expDatResultSize));/* A copy is placed in a special buffer for the commandline */if (result==true){info->segOutData = (char *)info->expDatResults;info->segOutLength = info->expDatResultSize; // 2 byte data in output.}else{info->expDatResultSize = 0;}}return result;
}
明显就是按照顺序执行BeginChecksumCalculation、DoChecksumCalculation和EndChecksumCalculation的。
BeginChecksumCalculation根据checksum的类型设定校验之前的初始值。
DoChecksumCalculation就是重头戏,用初始值跟代码里面要校验的内容累加起来,每种checksum类型累加的条件和方法都不太一样,BE就是大端,LE就是小端。
EndChecksumCalculation把累加后的结果取出响应的长度放到结果当中。
遇到的问题
打开hexview.exe软件,提示错误如下:
或者是这一个
后来发现是电脑把这几个工具给删除了,所以要注意备份不然就救不回来了。
这篇关于Hexview工具使用说明的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!