当前位置:网站首页>Batch multiple files into one hex
Batch multiple files into one hex
2022-04-23 01:46:00 【Traceless rain】
Because the project contains boot Procedure area ,boot Data area ,APP Procedure area ,APP Data area , This is shown below

Therefore, multiple files need to be combined into one when producing and distributing hex download .
Through Baidu, there are several schemes as follows :
1、 adopt J-Falsh Tools , The multiple Bin File composition one hex( Specific operation method , Please Baidu );
2、 Through batch tools ( be used fsutil.exe、cat.exe and hbin.exe) The multiple Bin File composition one Bin file , Then convert it into a hex, Please refer to :bin File merge tool (UBIN) Usage method _u012572552 The blog of -CSDN Blog ;
3、 Through batch tools (srec_cat.exe) The multiple Hex Synthesis of a hex file , Please refer to :STM32 Batch multiple hex File merge , Re pass STM32CubeProg Download at the same time .
Through my actual operation , The scheme was chosen 3, use SRecord Tools ( link : Baidu SkyDrive Please enter the extraction code Extraction code : ux8q) Realized the function .
As for why to choose the scheme 3, Because the plan 2 synthesis Bin When it comes to documentation , You need to calculate the offset , I'm in trouble , It's a personal preference , It's your choice ; programme 1 Too complicated , In case of wrong address , The file is wrong , Each generation hex You have to verify .
Operation steps :
One 、 according to APP Program generation BOOT Parameter area :
because BOOT The procedure is based on BOOT Check the parameter area APP Procedure area , Judge APP Whether there are programs in the program area , Jump or not . So I wrote a gadget , according to app.bin file , Yield BootConfig.bin file . According to your actual project needs , Decide whether to produce BootConfig File and file format .
Two 、 hold BIN Document production HEX file
@echo off
@Rem COPYRIGHT (C)2020 LIUDULAB, Inc., All Rights Reserved
@Rem Author: farmer00
@Rem Version: 1.0
@Rem Date: 4-14-2020
@Rem Convert Bin file to Hex File
set varRootPath=%cd%
set varCatToolPath=%varRootPath%\tool\srec_cat.exe
set varCmpToolPath=%varRootPath%\tool\srec_cmp.exe
set varInfoToolPath=%varRootPath%\tool\srec_info.exe
set varSrcFile=%varRootPath%\src\test.bin
set varOutFile=%varRootPath%\output\test.hex
set varOffset=0x10000
@Rem print srec_cat version
echo ------------------------------------------------------------------
%varCatToolPath% -VERSion
echo ------------------------------------------------------------------
@Rem Bin--->Hex
Rem %varCatToolPath% %varSrcFile% -binary -offset %varOffset% -o -hex-dump
%varCatToolPath% %varSrcFile% -binary -offset %varOffset% -o %varOutFile% -intel
echo Bin File had been convert to Hex file!
pause
3、 ... and 、 How many HEX Synthesis of a HEX
set varSrcFile21=%varRootPath%\src\123.hex
set varSrcFile22=%varRootPath%\src\345.hex
set varSrcFile23=%varRootPath%\src\567.hex
set varOutFile21=%varRootPath%\output\789_%year%%month%%day%.hex
@Rem Hex--->Hex
%varCatToolPath% %varSrcFile21% -intel %varSrcFile22% -intel %varSrcFile23% -intel -o %varOutFile21% -intel
Get the current time :
set "year=%date:~0,4%"
set "month=%date:~5,2%"
set "day=%date:~8,2%"
set "hour_ten=%time:~0,1%"
set "hour_one=%time:~1,1%"
set "minute=%time:~3,2%"
set "second=%time:~6,2%"
Delete some intermediate files :
del %varSrcFile% /s
del %varOutFile% /s
del %varOutFile11% /s
<----------------------------------------------------2021.10.13--------------------------------------------------------->
Yesterday, I called... Through a batch program SRecord The tool implements bin File transfer HEX,HEX Merge files into one production release file , But there is one in it “ Annoying steps ”, Need to use my own development MFC Tools according to APP Generate bootConfig.bin file , Then you can merge through batch processing . For those who pursue perfection , This is unbearable , How to solve it ?
At first I was wondering if I could put MFC The functions inside are transplanted to batch processing , So look at the batch Syntax , How to define a function , How to call functions, etc , Find it too difficult ; So I changed my mind , Since there are SRecord Tools , Can I develop a similar tool , Realize the function I want , So look for it win32 Console program data , Please have a look at : How to use VS2010 Create a new one Win32 Console application project , I found , Looked at the , hold MFC Function transplantation to Win32 Console program , Too simple. .
Yes? LOG Print ? Please have a look at : stay Win32 Used in applications Console Console output information ( primary )
How to call win32 The console program passes in parameters ? Please have a look at :_tmain(int argc, _TCHAR* ARGV[]) The usage of the next command line parameter
Here's the thing to note :
1)argc This parameter does not need to be passed in manually , The system will automatically transfer in ;argc Used to count the number of parameters , Because the path is the default Parameters of , therefore argc At least for 1
2)argv[0] Indicates the path and name of the input program , That is, when you write the full path name of the tool , Call tool , As The first parameter input ;
3)argv[1],argv[2]... Indicates the parameters you entered .

版权声明
本文为[Traceless rain]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230143119606.html
边栏推荐
- (product resources) mingdeyang ad8488 module high performance digital X-ray FMC interface 128 analog channel high-speed ADC chip
- Jerry's factors that usually affect CPU performance test results are: [article]
- mb_substr()、mb_strpos()函数(故事篇)
- DFS parity pruning
- Self taught programming, don't read theory books foolishly, programmer: it's all left over by others
- 教程】如何用GCC“零汇编”白嫖MDK
- Learning methods and career development guide (2022 Edition)
- 学习方法与职业发展指南(2022年版)
- [experience tutorial] Alipay balance automatically transferred to the balance of treasure how to set off, cancel Alipay balance automatically transferred to balance treasure?
- Update description of the latest process engine flowable 6.7.2
猜你喜欢

VSCODE + PHP Debug + 名字空间指引

FL studio20. 8 the latest Chinese version installation and download graphic tutorial

电子采购如何成为供应链中的增值功能?

教程】如何用GCC“零汇编”白嫖MDK

W801 / w800 WiFi socket development (I) - UDP

Technology cloud report: cloud computing has entered the "second half". Where is the way out for domestic cloud?

客户端项目管理经常面临的挑战

W801/W800-wifi-socket开发(一)-UDP

DO447管理用户和团队的访问

Encrypted compressed backup bat script
随机推荐
UVC camera encapsulation class
d盘分给C盘后,数据库恢复挂起怎么办,求各位解答
揭秘被Arm编译器所隐藏的浮点运算
How can e-procurement become a value-added function in the supply chain?
Update description of the latest process engine flowable 6.7.2
Rôles attributs personnels Abréviations
科技云报道:云计算进入“下半场”,国产云的出路在哪儿?
The most understandable life cycle of dependency injection
Digital collection platform settled in digital collection platform to develop SaaS platform of digital collection
The leader / teacher asks to fill in the EXCEL form document. How to edit the word / Excel file on the mobile phone and fill in the Excel / word electronic document?
Longest common subsequence (record path version)
Instructions for Jerry's reset IO maintenance level [chapter]
After disk D is distributed to Disk C, what should I do if the database recovery hangs? Please answer
领导/老师让填写电子excel表格文档可手机上如何编辑word/excel文件填写excel/word电子文档?
哪些代码需要做单元测试?
Find number (DFS)
The sixth season of 2022, the perfect children's model IPA national race leads the yuanuniverse track
Level 4 city area table xlsx, SQL file, domestic, provincial, county, street, township level 4 address in China (name, linkage ID, level, end level or not (1-yes))
keil mdk中文乱码,两种解决方法,字体不再难看
2022 Saison 6 perfect Kid Model IPA national race Leading the Meta - Universe Track