Author Topic: Intel Hex File viewer/editor  (Read 34840 times)

0 Members and 1 Guest are viewing this topic.

Offline forrestcTopic starter

  • Supporter
  • ****
  • Posts: 653
  • Country: us
Intel Hex File viewer/editor
« on: October 27, 2016, 11:08:42 am »
I occasionally (like right now) need to dig into an Intel Hex file.   Although I can open it up in a text editor and read it manually, I would rather use a tool intended for this purpose.

Does anyone know of a tool which is designed for this?

One note:  I have had luck over the years loading these into various programming tools and viewing the resulting hex image.  The problem with this hex file in particular is that it apparently has generated data outside the address range that the tool I'd normally use, which is why I need to dig into this with something else.  Unfortunately, this is a very large .hex file so I'm having problems finding the problem.  I might end up just writing some code to find the error, but would rather not go to those lengths.
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1988
  • Country: dk
Re: Intel Hex File viewer/editor
« Reply #1 on: October 27, 2016, 02:27:11 pm »
I occasionally (like right now) need to dig into an Intel Hex file.   Although I can open it up in a text editor and read it manually, I would rather use a tool intended for this purpose.

Does anyone know of a tool which is designed for this?

One note:  I have had luck over the years loading these into various programming tools and viewing the resulting hex image.  The problem with this hex file in particular is that it apparently has generated data outside the address range that the tool I'd normally use, which is why I need to dig into this with something else.  Unfortunately, this is a very large .hex file so I'm having problems finding the problem.  I might end up just writing some code to find the error, but would rather not go to those lengths.

Convert it to binary (srectools)
http://srecord.sourceforge.net/

Use a standard hex file editor , and convert it back (srectools)

/Bingo
 
The following users thanked this post: 0db

Offline leeatljs

  • Contributor
  • Posts: 31
  • Country: gb
Re: Intel Hex File viewer/editor
« Reply #2 on: October 27, 2016, 02:57:25 pm »
Tiny Hexer from http://www.mirkes.de/ imports / exports intel hex, allows editing, comparing, all sorts of stuff.
Is also a general hex editor.
Does Motorola S records too.
 

Online voltsandjolts

  • Supporter
  • ****
  • Posts: 2298
  • Country: gb
Re: Intel Hex File viewer/editor
« Reply #3 on: October 27, 2016, 03:31:47 pm »
You could just use the application software for a device programmer.

e.g. Galep software in demo mode does what you want http://www.conitec.net/hardware/down/G5setup_20638.exe
 
The following users thanked this post: wraper

Offline stj

  • Super Contributor
  • ***
  • Posts: 2155
  • Country: gb
Re: Intel Hex File viewer/editor
« Reply #4 on: October 28, 2016, 05:41:19 pm »
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Intel Hex File viewer/editor
« Reply #5 on: October 28, 2016, 06:12:37 pm »
 I made a custom grammar file for Synalyze It! Pro, which is a very slick macOS hex editor. (It's in the Mac App Store, fairly expensive but you can also get the non-pro version for $10, which will work for the majority of users.)

There's also a sister application for Windows/Linux that uses the same grammar files. It's called Hexinator.
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8517
  • Country: us
    • SiliconValleyGarage
Re: Intel Hex File viewer/editor
« Reply #6 on: October 28, 2016, 06:13:12 pm »
You could just use the application software for a device programmer.

e.g. Galep software in demo mode does what you want http://www.conitec.net/hardware/down/G5setup_20638.exe

jup. best option. get the control software for a dataman programmer. those can run in demo mode. load hex file, edit , save back as hex file.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline ehughes

  • Frequent Contributor
  • **
  • Posts: 409
  • Country: us
Re: Intel Hex File viewer/editor
« Reply #7 on: October 29, 2016, 01:31:58 am »
 

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1476
  • Country: gb
Re: Intel Hex File viewer/editor
« Reply #8 on: October 29, 2016, 01:04:09 pm »
Tiny Hexer from http://www.mirkes.de/ imports / exports intel hex, allows editing, comparing, all sorts of stuff.
Is also a general hex editor.
Does Motorola S records too.

While Tiny Hexer is a great program, and does do that, don't download it from that link. The original author shut down his website years ago and what exists now is just a scummy domain holding page full of ads.

Best place to find and download it is from a shareware/freeware archive site. And even then be very careful.
 

Offline newbrain

  • Super Contributor
  • ***
  • Posts: 1719
  • Country: se
Re: Intel Hex File viewer/editor
« Reply #9 on: October 29, 2016, 01:52:45 pm »
If you happen to like Emacs, there's this.
It shows the address (while in data) or the field type you are on on the mode line, and can recalculate the checksum after editing.


Nandemo wa shiranai wa yo, shitteru koto dake.
 
The following users thanked this post: Palmitoxico

Offline jesuscf

  • Frequent Contributor
  • **
  • Posts: 499
  • Country: ca
Re: Intel Hex File viewer/editor
« Reply #10 on: October 30, 2016, 01:45:57 pm »
Quartus II Prime also comes with a nice Intel-Hex editor.  Of course, only if you have it installed already as it is quite a big program.
Homer: Kids, there's three ways to do things; the right way, the wrong way and the Max Power way!
Bart: Isn't that the wrong way?
Homer: Yeah, but faster!
 

Offline jesuscf

  • Frequent Contributor
  • **
  • Posts: 499
  • Country: ca
Re: Intel Hex File viewer/editor
« Reply #11 on: October 30, 2016, 02:32:33 pm »
Just came across this one:

http://www.catch22.net/software/hexedit

Looks nice and includes source code:

http://github.com/strobejb/HexEdit
Homer: Kids, there's three ways to do things; the right way, the wrong way and the Max Power way!
Bart: Isn't that the wrong way?
Homer: Yeah, but faster!
 
The following users thanked this post: BravoV

Offline andy1

  • Contributor
  • Posts: 25
  • Country: fi
Re: Intel Hex File viewer/editor
« Reply #12 on: October 30, 2016, 05:29:03 pm »
There is also Kaitai Struct http://kaitai.io/ with which can quite quickly code a parser for this kind of reading, also has visualizer which can open the file and show the structures like in hex editor or you can just make a nice python etc. parser with it.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16853
  • Country: lv
Re: Intel Hex File viewer/editor
« Reply #13 on: October 30, 2016, 05:44:52 pm »
Most of the "HEX" editors suggested certainly are pretty useless for editing intel HEX. Even if they can import/export intel HEX, they do it in crippled way. They will shift data address space to make start address being 0, although it wasn't in the original file and will fill any empty address space too. The result of it will be a useless file which cannot be programmed to target device.
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1575
  • Country: de
Re: Intel Hex File viewer/editor
« Reply #14 on: October 30, 2016, 05:48:46 pm »
Also note that a hex file of an 32bit controller can result in a BIN file of 4Gigabyte. A typical hex editor will fill all the gaps with zeroes, even the initial gap, if e.g. the first data is located at address 0x40000000.
This quickly results in unusable crap. Then again, for typical microcontroller stuff where the 1st flash block starts at 0, this might be not an issue.
Trying is the first step towards failure - Homer J. Simpson
 

Offline forrestcTopic starter

  • Supporter
  • ****
  • Posts: 653
  • Country: us
Re: Intel Hex File viewer/editor
« Reply #15 on: October 31, 2016, 10:38:54 am »
Also note that a hex file of an 32bit controller can result in a BIN file of 4Gigabyte. A typical hex editor will fill all the gaps with zeroes, even the initial gap, if e.g. the first data is located at address 0x40000000.
This quickly results in unusable crap. Then again, for typical microcontroller stuff where the 1st flash block starts at 0, this might be not an issue.

When I originally asked the question, I really was hoping to find effectively a 'sparse file editor'.   I.E. one which works like a hex editor, but only shows lines/addresses which actually exist in the file.   I'm still hopeful.   But I agree - a 'traditional' hex file editor, even one which will read Intel HEX files correctly are not that useful.

I did come across the srecord tools which solved my immediate need - getting a list of all of the ranges which were covered in the .hex file.  I was able to compare these ranges to the memory map of my device and find the mangled linker file which was filling some nonexistent addresses with 0xff's.  Depending on the editor, this may have been invisible - since some editors choose to use 0xff as the fill value instead of 0x00.  Not to mention that this area was up around 0x1FC00000, with other data scattered all around the 4GB memory map - so I would have had a lot of fun finding this needle in the haystack.



 

 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Intel Hex File viewer/editor
« Reply #16 on: October 31, 2016, 11:51:51 am »
Depending on the editor, this may have been invisible

why don't you write by yourself ?
custom need, custom tool
 

Offline forrestcTopic starter

  • Supporter
  • ****
  • Posts: 653
  • Country: us
Re: Intel Hex File viewer/editor
« Reply #17 on: November 23, 2016, 01:39:48 am »
Depending on the editor, this may have been invisible

why don't you write by yourself ?
custom need, custom tool

Sorry, just catching up on my posts, been traveling....

Actually this isn't a custom need.   The definition of what I'm looking for is a editor which will open a .hex file, interpret it, and then allow you to view/edit it, without making up data in the process.  This should be something at least a good portion of those who work with .hex files should want/need.

The problem is that the existing tools I've found seem to not work that well for this purpose, specifically because instead of showing only what is in the hex file, they choose to create a very large virtual memory space, fill it with either 0xff or 0x00, and then load the data from the hex file into it.   This effectively creates data which doesn't exist.  Many hex files simply don't include data for the entire memory space of a part, or for many parts, the valid memory space itself isn't contiguous.   Most programming tools which allow you to load .hex files and view/edit it will show you the resulting data they would program - not the exact data included in the .hex file.

So, the tool that is needed is a gui editor for a .hex file which understands the meaning of the .hex file and preserves it.   If the hex file contains 3-4 non-contiguous segments, the editor should display only the data contained in the .hex file, not make up data which isn't contained in the .hex file.
 

Offline jpittner

  • Contributor
  • Posts: 14
  • Country: cz
Re: Intel Hex File viewer/editor
« Reply #18 on: November 23, 2016, 12:38:45 pm »
It should be possible to use objcopy (cross-version like arm-elf/objcopy etc.) to convert the ihex back to elf object file format for given architecture and than use cross-version of objdump to display memory sections, disassemble etc. According to man page, objcopy should be able to convert between any two formats. I gave it a quick test on AVR:
avr-objcopy -O elf32-avr -I ihex project.hex test.out
file test.out
test.out: ELF 32-bit LSB relocatable, Atmel AVR 8-bit, version 1 (SYSV), stripped
avr-objdump -D test.out
...gives assembly section by section
 

Offline micha2070

  • Newbie
  • Posts: 1
  • Country: de
Re: Intel Hex File viewer/editor
« Reply #19 on: June 05, 2018, 10:15:04 am »
 

Offline baldrick9

  • Newbie
  • Posts: 5
Re: Intel Hex File viewer/editor
« Reply #20 on: May 09, 2020, 09:17:27 am »
Good ol' Notepad++ shows Intel Hex colour coded 'n all! - https://notepad-plus-plus.org/
 
The following users thanked this post: I wanted a rude username

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4032
  • Country: nz
Re: Intel Hex File viewer/editor
« Reply #21 on: May 09, 2020, 12:22:18 pm »
It should be possible to use objcopy (cross-version like arm-elf/objcopy etc.) to convert the ihex back to elf object file format for given architecture and than use cross-version of objdump to display memory sections, disassemble etc. According to man page, objcopy should be able to convert between any two formats. I gave it a quick test on AVR:
avr-objcopy -O elf32-avr -I ihex project.hex test.out
file test.out
test.out: ELF 32-bit LSB relocatable, Atmel AVR 8-bit, version 1 (SYSV), stripped
avr-objdump -D test.out
...gives assembly section by section

There's no need for that -- objdump recognizes and uses hex files automatically. You only need to tell it what ISA to disassemble e.g.
Code: [Select]
riscv64-unknown-elf-objdump -m riscv -D foo.hex
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14464
  • Country: fr
Re: Intel Hex File viewer/editor
« Reply #22 on: May 09, 2020, 01:29:07 pm »
Also, on Windows, I use HxD, which can open binary files and import Hex and S-rec files as well.

https://mh-nexus.de/en/hxd/
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16853
  • Country: lv
Re: Intel Hex File viewer/editor
« Reply #23 on: May 09, 2020, 01:37:24 pm »
Also, on Windows, I use HxD, which can open binary files and import Hex and S-rec files as well.

https://mh-nexus.de/en/hxd/
It can open it, yes. The problem with that was already mentioned many times. It will simply fill empty address spaces, which makes in completely unusable for editing in most cases when there is actually a reason for using intel hex.
 

Offline MustardMan

  • Contributor
  • Posts: 43
  • Country: au
Re: Intel Hex File viewer/editor
« Reply #24 on: August 28, 2020, 04:57:35 am »
Was a solution to this problem ever found?

I have the same problem... wanting to edit a HEX file (not a BINary file) without expanding it.

Notepad++ sure does nice colouring of a HEX file, but it shows nothing of the contents. I want it to look like a BINary file editor with the HEX on the left and the BIN on the right. But I don't want to have to expand my HEX to BIN to do so. As was so correctly pointed out, many HEX files contain stuff with large segments of unused memory, one-liners with interrupt vector entries etc, and some with address ranges outside the memory map.

The problem I've been running into is that most people call binary editors 'hex editors' so google searches are next to useless.

Did the suggestion (by micha2070) of  https://github.com/micha2070/intelHex work? I don't want to install more bloatware (java) simply to try this and find it is just like every other binary file editor out there.

In my searching I did come across a program called "HEXit" by HSE electronics, but the licencing model looks way over the top for something that should be quite a simple program, so I have not tried it.

Cheers, MM
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf