10

Okay, so I've got an Arduino which has a sketch flashed to it (that I do not have source code for) which I'd like to reverse-engineer, and I've successfully dumped the flash and disassembled part of it. I would like to be able to use a device like the Atmel mkII to single-step my Arduino, but I'm not having much luck figuring out the menu options for doing on-chip debugging using the mkII and Atmel Studio 6. Is this possible using Atmel Studio 6 and the mkII? Is there some other way to single-step an Arduino for which you don't have the original source code?

1
  • hard to say I stopped using JTAG a long time ago (now I use just boot-loader for Atmel's because it is more comfortable) and also AVR studio 5 stopped the native C++ support so I stay on 2.7.0 but In the past I had similar problem with ATMega168 and I solve it by self made emulator. So try to find one or write it yourself ... Also there were some C/C++ decompilers out there but you had to have the right one ... btw single step on real HW is not a good idea if it works with other HW stuff dependend on timing – Spektre May 23 '14 at 14:24
3

I'm not familiar with that tool, so I don't have an answer for your specific question. But here are two pieces of advice:

1) there are many arduino simulators that you can use to single-step thru the code.

2) The Arduino is small and simple enough that you should be able to reverse engineer it using only the (dis)assembly and your brain. (Unlike the x86, which has hundreds ways to make your life complicated.) Yes, it takes time, but the more you do it, the faster you become.

Just start scan through the listing. Try to find small, self-contained subroutines. Figure out what their input and outputs looks like. Make a guess as to what their function is. ("LED blink", "checksum routine", "bit-bang an extra I2C bus", "check for button press") Soon, it will snowball, and the higher level routines will be easier to understand because you know what the lower ones do. Sometimes you'll hit the limits of your knowledge, but you can make educated guesses based on what you know the software does. (i.e. "this must where it does a Fourier transform")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.