A brief analysis of STM32's hex file

Publisher:Serendipity66Latest update time:2016-12-27 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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


Keywords:STM32 Reference address:A brief analysis of STM32's hex file

Previous article:The relationship between multiplexing and re-imaging of STM32 pins
Next article:VC++2010 reads BIN file

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号