当前位置:网站首页>srec_cat 常用参数的使用
srec_cat 常用参数的使用
2022-07-26 16:07:00 【大橙子疯】
前言
下面介绍映像文件工具 srec_cat 的使用,如何通过相关参数实现自己需要的功能。
下载链接:SRecord
使用方式
文件类型
在输入文件和输出文件文件时要指明文件类型,常用的如:
test.hex -intel
test.bin -binary
文件转换
可以通过该软件进入文件类型转换。
如hex文件转bin文件:
srec_cat.exe stm32.hex -intel -offset 0x08000000 -o stm32.bin -binary
将 stm32.hex 从 0x08000000 地址开始转成 bin 文件。
bin文件转hex文件:
srec_cat.exe stm32.bin -binary -offset 0x08000000 -o stm32.hex -intel
将 stm32.bin 偏移 0x08000000 地址开始转成 hex 文件。
文件截取
如果需要文件部分内容截取,可以使用参数-crop。
srec_cat.exe stm32.hex -intel -crop 0x08000000 0x08003FFF -o stm32_app.hex -intel
将 stm32.hex 文件中 0x08000000 - 0x08003FFF 中有效的数据生成一个新的文件 stm32_app.hex,如果代码结束地址是 0x0800 1FFF,那么新生成的文件代码范围是 0x08000000 - 0x08001FFF。
内容填充
字符串
如果想在文件指定的位置填充字符串信息等,如版本信息
srec_cat.exe -generate 0x08000000 0x08000005 -repeat-string STM32 stm32.hex -intel -exclude 0x08000000 0x08000005 -o stm32_new.hex -intel
在 0x08000000 0x08000005 的范围内重复填充 “STM32”字符串信息,和 stm32.hex (排除了 0x08000000 0x08000005 范围内数据)进行合并,生成新的文件 stm32_new.hex
- -generate:数据生成器参数,即地址范围-数据源
- -repeat-string:字符串参数,后面接入字符串参数
- -exclude:排除过滤器参数,不包括某一范围内存的数据
- 重复:如果字符串长度小于预留的范围,则重复填充,比如将 0x14 改为 0x16,则 0x15和0x16地址对应的数据为 ‘ST’
数字
如果想在文件指定的位置填充数字信息等,如文件大小
srec_cat.exe -generate 0x08 0x0C -constant-l-e 0x123456 4 stm32.bin -Binary -exclude 0x08 0x0C -o stm32_new.bin -Binary
在 0x08~0x0C 的范围内填充按照 4 字节重复填充16进制数字 0x123456,和 stm32.bin (排除了 0x08~0x0C 范围内数据)进行合并,生成新的文件 stm32_new.bin
- -constant-l-e:数字值字节宽度参数,即值-字节宽度
- 重复:如果对齐长度小于预留的范围,则重复填充,比如将 0x0C 改为 0x0D,则 0x0D地址对应的数据为 0x56(小端模式)
边栏推荐
- Is it safe for Guoyuan futures to open an account online? What is the account opening process?
- Clojure 运行原理之编译器剖析
- 想让照片中的云飘起来?视频编辑服务一键动效3步就能实现
- [tool sharing] automatic generation of file directory structure tool mddir
- C语言重点知识总结
- 2022 latest Tibet Construction scaffolder (construction special operation) simulation exam questions and answers
- A firefox/chrome plug-in that visualizes browser history
- Clojure operation principle bytecode generation
- Robot hand eye calibration ax=xb (eye to hand and eye in hand) and plane nine point calibration
- 【ARM学习(9) arm 编译器了解学习(armcc/armclang)】
猜你喜欢

PAT甲级 1046 Shortest Distance

13 years of senior developers share a year of learning rust experience: from the necessary bibliography to code practice

HaWe screw cartridge check valve RK4

Bugku login2

Pat grade a 1044 shopping in Mars

FTP协议

综合设计一个OPPE主页--布局与初始化

Yushenle's learning record: the first project of SOC FPGA -hello world

Sql语句——单行注释与多行注释
![[ten thousand words long text] Based on LSM tree thought Net 6.0 C # realize kV database (case version)](/img/84/640de0bf779cd45498204909be56d1.png)
[ten thousand words long text] Based on LSM tree thought Net 6.0 C # realize kV database (case version)
随机推荐
[RCTF2015]EasySQL
A firefox/chrome plug-in that visualizes browser history
Bugku login1
综合设计一个OPPE主页--布局与初始化
[arm learning (9) ARM compiler understanding learning (armcc/armclang)]
基于NoCode构建简历编辑器
vscode批量删除
想让照片中的云飘起来?视频编辑服务一键动效3步就能实现
Re7: reading papers fla/mlac learning to predict charges for critical cases with legal basis
How to configure tke cluster node Max pod
Analyzing method and proc in Ruby
Linux Installation mysql8.0.29 detailed tutorial
工作流引擎在vivo营销自动化中的应用实践
The "nuclear bomb level" log4j vulnerability is still widespread and has a continuing impact
PAT甲级 1046 Shortest Distance
Pat grade a 1050 string subtraction
I would like to ask you guys, how to specify the character set of MySQL CDC tables? I can't find the corresponding connector parameters on the official website. I read one
Simulation of three-phase voltage source inverter based on SISOTOOL pole assignment PI parameters and pless
Class initialization mechanism of JVM
First knowledge of OpenGL (3) fragment shader