Edit HEX file

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

Ok, ok. I'm a C guy, so sue me. I don't use AVR Studio (4) very much, other than for simulation because my trusty Programmer's Notepad and WinAVR has everything I need.

A freind's asked me for info on editing HEX files with AVR Studio, something which i've never found it nessesary to do. I can open the HEX and view the dissasembly as normal - and simulate it, etc - but how do I edit the instructions? Can I do it with AVR Studio, or will I have to download a dedicated disassebler and ASM editor?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why would you ever want to edit the HEX unless it's a program for which you don't have the source - in which case "why not? is it your code to edit?" It'd be far easier to edit the source and the re-assemble/compile it to make a new .hex/.elf file.

If he really MUST work with only the .hex then two ideas:

1) In one of the forum here there's been a recent thread about a utility called DisAVR - find that - download the .exe then run it to convert the .hex you have to .asm source which can be loaded, edited and assembled in AVR Studio

2) Just load the .hex into AVR studio and look at the disassembly view. Right click on it and locate the "display" sub menu. Remove the ticks from all the items there to "clean up" the code listing the select it all and Ctrl-C to copy it. Go to a text editor (perhaps the ASM editor within AVR studio) and Ctrl-V to paste the ASM in. It will need some tidying up (like removing the address column) to make it into usable asm

I think (1) is better than (2)!!

Either way you are going to end up wiht a .asm source file with no comments in it at all which will make the code very difficult to read. It would be FAR better to try and locate the original source and edit/assemble that - which brings me back to paragraph1 above!

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Beat me why he needs to exactly, they ask I try to help.

Ok, he's sent me the dissasembled HEX which he's . He and I can open it with AVRStudio now as an ASM file, but build's greyed out. How do you compile with this new-fangled non-C whatsit!?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Don't just open the file. In AVR Studio on the Project menu select "Project Wizard" then [new project]. Select "Atmel AVR assembler", give a location and a project name then. Probably easiest to leave "create initial folder" and "create initial file" ticked. [finish]

You now see the editor with a blank
.asm - just paste your ASM code into this.

Now you can use [build] to build the project.

If you decided not to "create initial file" then there'll be no file to edit but at the tree on the left there is "source files", right click this, select "add files to project" and point it at the .asm file you have already created.

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kudos, i've sent him your reply (with credit, of course). Will get back to you on the result.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!