Adding 328PB to IDE1.8.8

I went to the hex file of the Nano's bootloader and looked for anything that might be 1E950F. I couldn't find anything. So I don't know how it's hard coded.

In arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/avr/include/avr/iom328p.h:

/* Signature */
#define SIGNATURE_0 0x1E
#define SIGNATURE_1 0x95
#if defined(__AVR_ATmega328__)
#  define SIGNATURE_2 0x14
#else /* ATmega328P */
#  define SIGNATURE_2 0x0F
#endif

In bootloaders/optiboot/optiboot.c:

    /* Get device signature bytes  */
    else if(ch == STK_READ_SIGN) {
      // READ SIGN - return what Avrdude wants to hear
      verifySpace();
      putch(SIGNATURE_0);
      putch(SIGNATURE_1);
      putch(SIGNATURE_2);
    }
1 Like

Ok, but then it seems to me that I should find somewhere in the bootloader hex files at least one byte with the value 0x1E. But when I look at both the Nano old bootloader and the Optiboot bootloader, I don't find a 1E in either one. So I'm still puzzled.

You assumed, but apparently did not check. Did you not look at the listing file to see what's generated?

   /* Get device signature bytes  */
    else if(ch == STK_READ_SIGN) {
    7f74:       85 37           cpi     r24, 0x75       ; 117
    7f76:       39 f4           brne    .+14            ; 0x7f86 <main+0x186>
      // READ SIGN - return what Avrdude wants to hear
      verifySpace();
    7f78:       28 d0           rcall   .+80            ; 0x7fca <verifySpace>
      putch(SIGNATURE_0);
    7f7a:       8e e1           ldi     r24, 0x1E       ; 30
    7f7c:       0c d0           rcall   .+24            ; 0x7f96 <putch>
      putch(SIGNATURE_1);
    7f7e:       85 e9           ldi     r24, 0x95       ; 149
    7f80:       0a d0           rcall   .+20            ; 0x7f96 <putch>
      putch(SIGNATURE_2);
    7f82:       8f e0           ldi     r24, 0x0F       ; 15
    7f84:       7a cf           rjmp    .-268           ; 0x7e7a <main+0x7a>
    }
1 Like

I obviously don't know how AVR assembler works. I was expecting an instruction that loads the value 0x1E into a register would have 1E somewhere in the instruction. But apparently it doesn't work that way. Anyway, thanks for clarifying this for me.

So then the 328PB chip that I received probably has the same bootloader that's found on a regular Pro Mini. I mean, byte-for-byte identical.