AdduinoISP to program Flash, EEprom, etc.

Has anyone modified ArduinoISP to create a standalone programmer that can program a blank AtMega328 using data stored in the arduinoISP sketch? I understand that I may have to run this from an ArduinoMega to have enough flash to store flash.hex, eeprom,hex, etc.

Are you trying to make a "cloner"?

Yes. That might be a good name for it. But I am not cloning the device that is acting as the AVR Programmer.

It is more like using Disc Copy. Start with a flash image and end up with a lot of micros with the same flash image.

Copy Eeprom also.

Do you know of a cloner that I can modify?

I vaguely recall reading about a "bootloader cloner". You may be able to modify something like that.

But it really isn't too difficult to run AVRDUDE from the command-line. Insert new processor into breadboard(?). Use up-arrow to recall AVRDUDE command. Press ENTER. Wait a few seconds. Repeat.

I am building an end of line functional test system using an Arduino Mega. There are several tests that need to be performed after the product is programmed. This is an attempt to make the lowest cost EOL tester that I can, and incorporating the ability to program the product into the functional test controller (the mega1280) would allow it to be wrapped up into one small package with no external programmer. This approach will also give me the ability to control the flash content.

I have seen the Priio and another, but of course they are external units. I suppose that I may be able to interface to one of them with an additional serial port on the Mega.

I have made some progress with the task at hand, but am having much difficulty in bringing all of the pieces together. If this has not been done before, the I will continue development.

Also, I do not want to spend the $ on a PC dedicated to programming parts.

Has anyone modified ArduinoISP to create a standalone programmer that can program a blank AtMega328 using data stored in the arduinoISP sketch?

Yes. I have a sketch that will burn optiboot into whichever of mega8, mega168, mega328 you connect up. Maybe (needs more testing, but works at least some of the time :-))

Since optiboot is relatively small, I just included the .hex files in the sketch as character strings, and wrote some code
to read them (optiboot fits in RAM, too…)

/*
 * Read an intel hex image from a string in pgm memory.
 * We assume that the image does not exceed the 512 bytes that we have
 * allowed for it to have.  that would be bad.
 * Also read other data from the image, such as fuse and protecttion byte
 * values during programming, and for after we're done.
 */
void read_image (image_t *ip)
{
  uint16_t len, totlen=0, addr;
  char *hextext = &ip->image_hexcode[0];
  target_startaddr = 0;
  target_pagesize = pgm_read_byte(&ip->image_pagesize);
  byte b, cksum = 0;
  while (1) {
    if (pgm_read_byte(hextext++) != ':') {
      error("No colon");
      break;
    }
    len = hexton(pgm_read_byte(hextext++));
    len = (len<<4) + hexton(pgm_read_byte(hextext++));
    cksum = len;

    b = hexton(pgm_read_byte(hextext++)); /* record type */
    b = (b<<4) + hexton(pgm_read_byte(hextext++));
    cksum += b;
    addr = b;
    b = hexton(pgm_read_byte(hextext++)); /* record type */
    b = (b<<4) + hexton(pgm_read_byte(hextext++));
    cksum += b;
    addr = (addr << 8) + b;
    if (target_startaddr == 0) {
      target_startaddr = addr;
      fp("\n  Start address at ");
      Serial.println(addr, HEX);
    } else if (addr == 0) {
      break;
    }

    b = hexton(pgm_read_byte(hextext++)); /* record type */
    b = (b<<4) + hexton(pgm_read_byte(hextext++));
    cksum += b;

    for (byte i=0; i < len; i++) {
      b = hexton(pgm_read_byte(hextext++));
      b = (b<<4) + hexton(pgm_read_byte(hextext++));
      if (addr - target_startaddr >= sizeof(target_code)) {
      error("Code extends beyond allowed range");
      break;
      }
      target_code[addr++ - target_startaddr] = b;
      cksum += b;
      Serial.print(b, HEX);
      Serial.write(' ');
      totlen++;
      if (totlen >= sizeof(target_code)) {
        error("Too much code");
        break;
      }
    }
    b = hexton(pgm_read_byte(hextext++)); /* checksum */
    b = (b<<4) + hexton(pgm_read_byte(hextext++));
    cksum += b;
    if (cksum != 0) {
      error("Bad checksum: ");
      Serial.print(cksum, HEX);
    }
    if (pgm_read_byte(hextext++) != '\n') {
      error("No end of line");
      break;
    }
    Serial.println();
  }
  fp("\nTotal bytes read: ");
  Serial.println(totlen);
}
image_t PROGMEM image_328 = {
    {"optiboot_atmega328.hex"},
    {"atmega328"},
    0x950F,                        /* Signature bytes for 328P */
    {0x3F,0xFF,0xDE,0x05,0},
    {0x0F,0,0,0,0},
    128,
    {
      ":107E000084B714BE81FFE6D085E08093810082E0D4\n"
      ":107E10008093C00088E18093C10086E08093C20017\n"
      ":107E200080E18093C4008EE0CFD0259A86E020E3E5\n"
      ":107E30003CEF91E0309385002093840096BBB09B8B\n"
      ":107E4000FECF1D9AA8958150A9F7DD24D394A5E013\n"
      ":107E5000EA2EF1E1FF2EABD0813421F481E0C5D0D0\n"
      ":107E600083E020C0823411F484E103C0853419F426\n"
      ":107E700085E0BBD091C0853581F499D0082F10E002\n"
      ":107E800096D090E0982F8827802B912B880F991FF0\n"
      ":107E900090930102809300027EC0863529F484E02D\n"
      ":107EA000A4D080E07CD078C0843609F04EC087D062\n"
      ":107EB000E0910002F091010280E7E030F80718F449\n"
      ":107EC00083E087BFE895C0E0D1E071D089938091CD\n"
      ":107ED00002028150809302028823B9F7E0910002E8\n"
      ":107EE000F091010280E7E030F80718F083E087BFE7\n"
      ":107EF000E89575D007B600FCFDCF40910002509187\n"
      ":107F00000102A0E0B1E02C9130E011968C91119724\n"
      ":107F100090E0982F8827822B932B1296FA010C0160\n"
      ":107F2000D7BEE89511244E5F5F4FF1E0A038BF0740\n"
      ":107F300051F7E0910002F0910102E7BEE89507B623\n"
      ":107F400000FCFDCFF7BEE89527C08437B9F437D0E1\n"
      ":107F500046D0E0910002F09101023196F0930102C7\n"
      ":107F6000E09300023197E4918E2F19D080910202A4\n"
      ":107F7000815080930202882361F70EC0853739F45F\n"
      ":107F80002ED08EE10CD085E90AD08FE08BCF8135E1\n"
      ":107F900011F488E019D023D080E101D05CCF982F74\n"
      ":107FA0008091C00085FFFCCF9093C6000895A895EE\n"
      ":107FB0008091C00087FFFCCF8091C6000895F7DF55\n"
      ":107FC000F6DF80930202F3CFE0E6F0E098E19083E1\n"
      ":107FD0008083089580E0F8DFEE27FF270994E7DF2C\n"
      ":107FE000803209F0F7DF84E1DACF1F93182FDFDF4B\n"
      ":0A7FF0001150E9F7F4DF1F91089526\n"
      ":0400000300007E007B\n"
      ":00000001FF\n"
    }
};

Thanks. I'll check that out. Never heard of Optiboot, but it looks interesting.

I am making good progress with modifying ArduinoISP. I'll publish here in a week or so.

(optiboot is the new 512byte bootload for arduino (vs 2k for the old bootloader.) So my program can be used to upgrade existing arduinos to the new bootloader to free up 1.5k of code space.)