Some time ago, I needed to use BIN files, so I also looked up HEX files for reference and checked some online information. If there are any similarities, it is just a coincidence and there is reference. . .
Main topic: The HEX file format is as follows
�[Data length 1 Byte][Data address 2 Byte][Data type 1 Byte][Data n Byte][Check 1 Byte]��
Analyze the following specific example
: 020000040800F2
: This is �, which is the colon
02. This indicates the length of the data content in this line of data area, that is, the data content is two bytes. In the following <0800>,
0000 is the address to which the data is to be sent. It depends on the specific data type
. 04 explains the data type of the entire line of data. There are mainly these types
: '00' Data Record data
'01' End of File Record file end mark
'02' Extended Segment Address Record extended segment address
'03' Start Segment Address Record starting extended address
'04' Extended Linear Address Record extended linear address, which is the base address
'05' Start Linear Address Record program starting address, which is the program entry address (main)
0800 This is the base address (0x0800<<16)
F2 is the data checksum
�� is the line feed symbol
Next, analyze this line of data
: 1000000078050020450100084D0100084F01000857
10 is the data length of the data area. A total of 16 data 78 05 00 20 45 01 00 08 4D 01 00 08 4F 01 00 08
0000 Data address
00 Data type description
57 Data checksum
This line means that the data area <78050020450100084D0100084F010008> should be written to the address (0x0800<<16+0x0000).
For example, this line
: 1000100051010008530100085501000800000000CC
This line of data is similar to the line above, which means that the data area <51010008530100085501000800000000> should be written to the address (0x0800<<16+0x0010).
Note: Because the data of STM32 is stored in little-endian format, 10 00 should be regarded as 0x0010.
At the end of the file, there are two lines like this
: 0400000508000131BD
:00000001FF
According to the above analysis
: 0400000508000131BD This is the entry address of the interpreter at 0x08000131. I don’t understand why it is not written in little-endian format. Although this line of data is not transmitted to the MCU
: 00000001FF This is the sign of the end of the file.
The difference between HEX and BIN files is the address. BIN files do not carry address information. For example, the BIN file generated from the above hex file
Previous article:The relationship between multiplexing and re-imaging of STM32 pins
Next article:VC++2010 reads BIN file
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Please answer my question: What is the role of capacitor in this synchronous buck circuit?
- RT-Thread's new book is here, full of useful information
- 【Resistors】How to quickly read the color ring? Calculate the resistance value?
- MSP432 Serial Port Settings
- Practice together in 2021 + tomorrow will be better
- TMS320C66x dual loop and multiple loop optimization summary
- Can anyone share the third-party extension library of mixly?
- 【Perf-V Evaluation】Chip Temperature Collection
- [Domestic RISC-V Linux Board Fang·Starlight VisionFive Trial Report] Successfully communicated with DWIN screen
- Looking for unboxing test of AWR1642BOOST