Arduino Board serial Number

How can I change the arduino board serial number using averdud or avrgc++ without recompiling the sketch again.

I think that the serial number is saved somewhere in the flash memory. close to the bootloader so is there a part to updat that part of the flash memory using the cmd, averdud or avr gc++ ?

thansk

Which board?

If it's an Uno/Mega, the serial number is in the 16u2, and I think changing it requires recompiling the 16u2 firmware....

It is a Arduino Micro (ATmega32U4 ). Is there away to change the serial number without recompiling the firmware ? I wanna be able to keep track of my .hex files using the date stamp

Is putting a version in your sketch not an option?

Further, the constants DATE and TIME refer to the date/time when the sketch was compiled. Can be useful if you upload using avrdude from the command line (else you have to recompile for an upload resulting in a different date/time).

Are you sure that your Arduino HAS a serial number?
I can't find any reference to loading one up in the core source code, and my (admittedly ancient) leonardo doesn't seem to be reporting an Serial Number to my Mac...

sterretje:
Is putting a version in your sketch not an option?

Further, the constants DATE and TIME refer to the date/time when the sketch was compiled. Can be useful if you upload using avrdude from the command line (else you have to recompile for an upload resulting in a different date/time).

Yes but still i wont be able to find out which chip has which hex file unless I have to save all the hex files

If i added cont date and time, How can I recall them ?

westfw:
Are you sure that your Arduino HAS a serial number?
I can't find any reference to loading one up in the core source code, and my (admittedly ancient) leonardo doesn't seem to be reporting an Serial Number to my Mac...

Yes It does, I had to do few modification to some of the core code and the bootloader that allowed me to add a descriptor to the device. Please refer to my other post (adding a PID and VID to Arduino Micro)

bemin:
Yes but still i wont be able to find out which chip has which hex file unless I have to save all the hex files

Indeed, it's what I do when I release a new version. But you need an ICSP programmer for it.

bemin:
If i added cont date and time, How can I recall them ?

void setup()
{
  Serial.begin(57600);
  Serial.print("Compile date: "); Serial.println(__DATE__);
  Serial.print("Compile time: "); Serial.println(__TIME__);
}

void loop()
{

}

I had to do few modification to some of the core code and the bootloader

So... You've successfully modified the bootloader to include your own VID/PID/SerialNum, and maybe the USB core as well. You have not shown anyone this modified code, and now you want help changing the serialnumber (which doesn't exist in standard arduino code) without re-compiling? As part of uploading? after the sketch is uploaded?

Probably the easiest way it to add additional changes to your code to look for an "updated serial number" at a particular additional flash page or EEPROM location, if you have those available.

if (get_serialnum_magicnumber() == SERNUM_PRESENT) {
    usb_sernum_info = get_serialnum_new();
}

westfw:
So... You've successfully modified the bootloader to include your own VID/PID/SerialNum, and maybe the USB core as well. You have not shown anyone this modified code, and now you want help changing the serialnumber (which doesn't exist in standard arduino code) without re-compiling? As part of uploading? after the sketch is uploaded?

Yes I was successfully able to do all that and I also build my own Labview app to burn the bootloader and upload the sketch. However, I am still missing to main points

1- Is the ability to update the serial number without recompliling
2- ability to compile the sketch using my averdud or agc++ so i can build in in my labview app

sterretje:
Indeed, it's what I do when I release a new version. But you need an ICSP programmer for it.

void setup()

{
 Serial.begin(57600);
 Serial.print("Compile date: "); Serial.println(DATE);
 Serial.print("Compile time: "); Serial.println(TIME);
}

void loop()
{

}

Interesting idea never thought about it ! But does that required m keeping each single hex file tho>?

Yes; if you ever want to go back to an earlier release. My versioning skills are poor so I use directories for each version. One of the subdirectories in these directories contains notes, documentation and the hex file of the final release of that version.

If you use a proper versioning system (e.g. git), you should be able to retrieve earlier hex files (if you did check them in) just like you would extract earlier versions of the software.

yes, but still that won't really work in my situation. DO you know if there is away to use averdud to write to flash memory in the atmega32u4 ?

if I can do that, then I can determine the location that contains the serial number and i can change it using averdud or a makefile