7444 views|13 replies

5

Posts

0

Resources
The OP
 

Can I create a C program with only a hex file? [Copy link]

 
Can I create a C program with only a hex file?
This post is from 51mcu

Latest reply

Nowadays, for general products, as long as you know the functions you want, they can be realized through MCU+peripheral hardware. There is no need to copy other people's things, which is a waste of time and money!   Details Published on 2019-10-16 11:22
 

1790

Posts

0

Resources
2
 
The burning file can be in other formats, for example, the burning format of Hetai chip is .MTP
This post is from 51mcu
 
 
 

6040

Posts

204

Resources
3
 
I can't figure out a C program.
This post is from 51mcu
 
 
 

5791

Posts

44

Resources
4
 
I am a beginner, this is how I do it. I don't know if the masters have other ideas.
This post is from 51mcu
 
 
 

3980

Posts

0

Resources
5
 
Decompiling is like analyzing a pile of shit to understand the digestion (compilation) process of food (source code). If you don’t know the digestion principle, you can’t perfectly reverse it. Similarly, if you don’t know the compilation principle of the compilation tool, you can’t perfectly reverse it.
This post is from 51mcu
 
 
 

2145

Posts

8

Resources
6
 
This post was last edited by wsmysyn on 2018-12-27 10:55 Hex is actually almost the same as the program burned into the flash. In the intel hex-80 format, I remember that it is roughly the address offset, then the length, then the binary program code stored in the sram, and finally a checksum. The data actually written into the sram can be extracted through the tool. . Then the extracted data can be converted from binary code to assembly form using a disassembly tool. (If you have enough experience, you can manually calculate the execution process of the code based on the MCS51 instruction set, the program entry address, and the interrupt vector entry address.) If you have enough experience, you can reverse the code from the assembly code to C language. Disadvantages: 1. As you can see from the above description, it is possible to convert from hex to C language, but if you use hex to convert it into someone's original C file, it is absolutely impossible. 2. Is the disassembly tool intelligent? Because the code generated by compilation and linking is not necessarily stored in continuous space. If the decompilation tool cannot identify it, it is likely to disassemble the discontinuous area as part of the code, which may cause disassembly errors and affect analysis. However, the binary file generated by hex can be manually intervened, the offset address can be calculated manually, and the disassembly can be started at the specified offset address. 3. It is easier to convert more obvious assembly statements into C. For example, 90E6017480F0 can be directly written as a C language sentence: IFCONFIG = 0x80; However, the original C language has a more complex syntax, which is difficult to see from the assembler. There are also some function parameter passing, etc., and you need to read the assembly code carefully to determine what parameters are passed. 4. In summary, the above steps cannot be omitted from hex to C. Can it be converted to C? The answer is possible. How difficult is it? Look at the length of the code, estimate the complexity of the source code, and your own knowledge reserves. However, if you have the time for analysis, you might as well write it yourself. . Advantages: 1. Through analysis, you have mastered the MCS-51 instruction set and can calculate the CPU execution process by hand based on the binary code. 2. By calculating the CPU execution process by hand, you have mastered the firmware working process of 8051 at the binary level 3. You understand how the machine instructions corresponding to the C language statements are implemented. 4. That's it...


This post is from 51mcu

赞赏

1

查看全部赞赏

 
Personal signature坐而言不如起而行
 
 

7422

Posts

2

Resources
7
 
Disassemble and reverse the process step by step. There may be tools for x86 and arm, but for others, you can only rely on yourself.
This post is from 51mcu
 
 
 

13

Posts

0

Resources
8
 
First use IDA, then manually rewrite it into C code
This post is from 51mcu
 
 
 

305

Posts

0

Resources
9
 
It's not easy to do, decompile is very difficult.
This post is from 51mcu
 
Personal signature单价1元含税的USB和Touchkey单片机CH551G已大批量出货,试样QQ:1258305301
 
 

67

Posts

0

Resources
10
 
Now the real copy is never to copy the source code. If you know your function, just write one yourself.
This post is from 51mcu
 
 
 

5

Posts

0

Resources
11
 
I don't know how long I've been working on some algorithms but I still haven't figured them out. I'll just work on them slowly.
This post is from 51mcu
 
 
 

10

Posts

0

Resources
12
 
If you are not a professional, don't do it. It's better to write it yourself if you have the time. ------------------------------------------------------------------------------------ Direct search: USB to TTL wireless version
This post is from 51mcu
 
 
 

4005

Posts

0

Resources
13
 
Well, it's a pile of shit
This post is from 51mcu
 
 
 

19

Posts

4

Resources
14
 

Nowadays, for general products, as long as you know the functions you want, they can be realized through MCU+peripheral hardware. There is no need to copy other people's things, which is a waste of time and money!

This post is from 51mcu
 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list