Reading Compiled Code Out of an Atmega128A

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

I am using Atmel Studio 7.0 to write code for an Atmega 128A. I have a micro-controller that is programmed the way I want it but for the life of me I cannot member which version of the code I loaded onto it. Is there a way to pull the code out so that I know which version I am using? I have not set any security protocols but obviously it is compiled.

J.

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

 

Tools -> Device Programming

Greg Muth

Portland, OR, US

Atmel Studio 7.0 on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

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

Greg_Muth wrote:
Tools -> Device Programming

Then read the flash into a file, then disassemble it into assembly language, then compare that to what the compiler generates for each version!!!

 

I hope you like staring at lots of op codes.

 

Jim

 

 

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

ki0bk wrote:
I hope you like staring at lots of op codes.

Surely there are more straightforward approaches.  Let's assume OP has access to a full set of ISP tools, at least enough to facilitate this task -- besides "download", one would need to "upload"/read flash and store it.

 

Now, among the first ways I would go from there is to "normalize" the read flash image and the various .HEX or equivalent from the builds of the various versions.  Then use some type of compare tool.  If normalized to a .HEX format, one could use a text compare tool.

 

IMO the most straightforward approach is to use ISP and do a verify with the flash contents of the chip against build result A and B and C and ... until one matches.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

And this is why those of us who have been doing this a while embed a text string with build information into the binary.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

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

You are correct, that is horribly monotonous. Is there a way to copy it from one controller to another?

J.

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

Is it me or does this sound a lot like "the dog ate my homework"?

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

fredmellon wrote:
You are correct, that is horribly monotonous. Is there a way to copy it from one controller to another?

Sure, if the the unit you want to clone has not been locked...

 

Just read the flash + eeprom(if needed) contents to files, note fuses settings also, and then use these files to program the new boards.

 

Jim

 

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

If you have several versions of your code simply load the elf or hex file in the programming dialog and do a VERIFY. If they match the response will be OK. If they do not match you will get FAIL back from the programmer.

Jim

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

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

clawson wrote:
Is it me or does this sound a lot like "the dog ate my homework"?

That's what I thought about this recent thread: http://www.avrfreaks.net/forum/s...

 

Here, perhaps OP is just unfamiliar with ISP tools?  Sounds a bit strange; if one put a programmed AVR aside for a while one would assume it contained the code from the latest source -- as it

fredmellon wrote:
is programmed the way I want it

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.