Beginner

Hi,
I'm just new to this.
I have a .HEX file and I'd like to view it. Can I use Arduino? I've tried to open the file and it won't work as it's not .ino or .pde

Can I use Arduino?

If you mean open it in the IDE then no. There are many HEX editors and viewers available for download from the Web.

You may be able to read the file using a program written on the Arduino. What do you want to do with the data in the file ?

Hi,
Basically we have a .hex file that has been pre-installed to a board and has been used for years ok.
It controls a stepper motor.
I want to change the settings on this stepper motor to complete more turns.
I thought that if I could see the code in front of me it would help me understand what the basics are.
Can you recommend a .hex viewer?

You can view the contents of the HEX file but you will not be able to see the source code that created it. You may be able to disassemble the HEX data to assembly language if that is good enough for you. You may be better off starting from scratch and writing the program again based on your requirements.

I use HexEdit on my Windows system but others are available.

Hi,
What is the source code?
Sorry for dum questions!

Source code is the original C/C++ program
Because of the compilation process, it is not easily possible to reconstitute source from object (hex) code.

Hi,

If I was given the original source code what would the file/folder look like?

I have a number of files handed to me at the same time as the hex file.

It would look like a C or C++ program, possibly with the extension ".c", ".cpp", ".ino" or even ".pde"

SECURWRIGHT:
Hi,

If I was given the original source code what would the file/folder look like?

I have a number of files handed to me at the same time as the hex file.

Depends on the language that was used. Files with extensions like '.c', '.c++', '.cpp' are possibilities; could just as well be written in assembly and you will see extensions in the line of '.asm'. There can be makefiles there as well.

AWOL currently assumes that your board is an Arduino (or clone). Is it an Arduino? If not, it's highly unlikely that you will find ino and pde files. You posted on the Arduino forum site so it is more than likely the case but this is just to confirm that you are indeed on the right forum :wink:

vim <hex_file_name>

boolrules:
vim <hex_file_name>

Can you explain that to the OP, please.

...R

Windows? You should be able to open it with WordPad.

"I have a .HEX file and I'd like to view it."
Use Notepad++ from https://notepad-plus-plus.org/
Without seeing the source code the .hex was created from, editing the hex file and achieving a useful result may be difficult.

type: "vim, space, the-name-of-the-hex-file"
If you don't have vim, install it. If you need vim with buttons and stuff, install gvim.
The text highlighting is automatic and really helpful.

boolrules:
The text highlighting is automatic and really helpful.

For a hex file? :smiley:

Yes. Address, Type, Data, Checksum, etc. It's always especially hard for me to pick out the address column without re-counting all the time. (I can usually find the checksum though)

boolrules:
Yes. Address, Type, Data, Checksum, etc. It's always especially hard for me to pick out the address column without re-counting all the time. (I can usually find the checksum though)

Sorry, I was a bit confused. Thought that we were talking binary data; but you're referring to a file in Intel HEX format.

Fair point.

Question: do you need a special rc file for it or does vim do it already for you?

No, I'm probably confused. You can still use vim/gvim to read a binary file (not to be confused with "binary mode").
Just : vim . You will have a mess.
Enter:
:%!xxd
You will get something like:

0000310: 0000 0000 0000 0000 005f 4954 4d5f 6465  ........._ITM_de
0000320: 7265 6769 7374 6572 544d 436c 6f6e 6554  registerTMCloneT
0000330: 6162 6c65 005f 5f67 6d6f 6e5f 7374 6172  able.__gmon_star

If you install vim/gvim you get xxd also.
gvim has a button: Tools -> Convert to HEX (it just runs :%!xxd)
The elvis editor (another vi variant) is cool in that it automatically detects a binary file and opens in the above format.

Syntax highlighting for .hex files is already set-up.

SECURWRIGHT:
Hi,
I'm just new to this.
I have a .HEX file and I'd like to view it. Can I use Arduino? I've tried to open the file and it won't work as it's not .ino or .pde

Maybe you could pack the files in a zip and upload them as attachement ? Would be helpful i guess.

boolrules:
No, I'm probably confused. You can still use vim/gvim to read a binary file (not to be confused with "binary mode").

I don't see highlighting :smiley:

But don't worry, I have maintained a Slackware webserver (and the websites on it) for 6 years, work occasionally on RedHat systems and run Ubuntu at home. So I know the vi family :wink:

boolrules:
Syntax highlighting for .hex files is already set-up.

Will try it one day.