Notifications
Clear all

Read unknown program loaded on an Arduino

6 Posts
4 Users
2 Likes
773 Views
(@scott-morgan)
Member
Joined: 5 years ago
Posts: 10
Topic starter  

Is there a way to pick up an arduino off the bench and read what the program is uploaded on it?


   
Quote
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1076
 

Hi Scott

Unfortunately, it isn't that easy.

The "programs" you create for the Arduino are not loaded onto the board as they appear in your editor. Instead, they are compiled into machine code, and then that is loaded to the Arduino.  So the Arduino just has the final compiled code on it.

There are decompilers and disassemblers that can make an attempt at going through a dump of the code to try and figure out what the original program was, but they are complex and they seldom work properly.

😎

Bill

 

 

"Never trust a computer you can’t throw out a window." — Steve Wozniak


   
ReplyQuote
(@scott-morgan)
Member
Joined: 5 years ago
Posts: 10
Topic starter  

@dronebot-workshop -- A reply from someone on Arduino's site told me to include a "Title" to be sent to the serial port that can be cross referenced to a list made in a word document. This could be used to find what I did in the program and hence have some idea what's on the chip. It's worth doing for uploads that are mine anyway. I sure do appreciate your personal reply, as well as the effort you put into the videos and articles you do. I put in a subject request for "batteries".  I do look forward to all of your work.


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@scott-morgan

A reply from someone on Arduino's site told me to include a "Title" to be sent to the serial port that can be cross referenced to a list made in a word document.

What a great suggestion, thanks for passing it on.

 


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1037
 

I include this as part of all my sketches.  I believe I got this snippet of code from something RoboPi posted quite awhile ago.

/*
* Date: YYYYMMDD
* Programmer:
* Purpose:
* Notes: (as needed)
*/

#define __FILENAME__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)

void setup()
{
Serial.begin(9600);
// Print splash sheet to monitor
Serial.print("Source file: ");
Serial.println(__FILENAME__); // Source file name
Serial.print("Compile date: ");
Serial.println(__DATE__);
Serial.print("Compile time: ");
Serial.println(__TIME__);
Serial.println("\n");
}

That way, with the serial monitor connected I get a reminder as to where to look for the sketch that is loaded on that particular chip.

SteveG


   
ReplyQuote
(@scott-morgan)
Member
Joined: 5 years ago
Posts: 10
Topic starter  

@codecage -- Excellent thing to do for future reference. Others also told me to immediately tag the board with a stick on tag. I like your permanent serial monitor idea better. Thanks for the help.


   
ReplyQuote