当前位置:网站首页>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(小端模式)
边栏推荐
- Collection of open source expert opinions on trusted privacy computing framework "argot"
- Pat grade a 1049 counting ones
- Test cases should never be used casually, recording the thinking caused by the exception of a test case
- 终于有人把红蓝对抗讲明白了
- How to test the circle of friends (mind map)
- Pandora IOT development board learning (RT thread) - Experiment 17 esp8266 experiment (learning notes)
- What is GPIO and what is its use
- DTS搭载全新自研内核,突破两地三中心架构的关键技术|腾讯云数据库
- The solution to the display disorder of several events files in the tensorboard
- 2022年全国最新消防设施操作员(高级消防设施操作员)考试试题及答案
猜你喜欢

2022 latest Tibet Construction scaffolder (construction special operation) simulation exam questions and answers

Advanced CAD exercises (I)
![[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)
![[BJDCTF2020]Easy MD5](/img/6a/61a4b5624c33f1f334bea344cfa2c8.png)
[BJDCTF2020]Easy MD5
![[arm learning (9) ARM compiler understanding learning (armcc/armclang)]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[arm learning (9) ARM compiler understanding learning (armcc/armclang)]

Parker solenoid valve d1vw020dnypz5

Google Earth Engine——MERRA-2 M2T1NXAER:1980-2022年气溶胶逐日数据集

Collection of open source expert opinions on trusted privacy computing framework "argot"

可信隐私计算框架“隐语”开源专家观点集锦

ACL-IJCAI-SIGIR顶级会议论文报告会(AIS 2022)笔记3:对话和生成
随机推荐
First knowledge of OpenGL (2) compilation shaders
Is it safe for Guoyuan futures to open an account online? What is the account opening process?
Clojure Web Development -- ring user guide
Compiler analysis of clojure operation principle
PAT甲级 1046 Shortest Distance
《硅谷之谜》读后感
How to configure tke cluster node Max pod
一款可视化浏览器历史的 Firefox/Chrome 插件
综合设计一个OPPE主页--布局与初始化
There are six ways to help you deal with the simpledateformat class, which is not a thread safety problem
A firefox/chrome plug-in that visualizes browser history
Botu PLC Sequential switch function block (SCL)
Simulation of three-phase voltage source inverter based on SISOTOOL pole assignment PI parameters and pless
Class initialization mechanism of JVM
[RCTF2015]EasySQL
C语言重点知识总结
面试时候常说的复杂度到底是什么?
How to test the circle of friends (mind map)
Pat grade a 1050 string subtraction
[BJDCTF2020]Easy MD5