Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to add support for ATmega328PB to avr-gcc and avrdude

Adding support for ATmega328PB to avr-gcc and avrdude

avr-gcc

  1. Download ATmega's support pack from Microchip's website

  2. Unzip the relevant files

     unzip -j Atmel.ATmega_DFP.x.y.zzz.atpack \
     gcc/dev/atmega328pb/avr5/crtatmega328pb.o \
     gcc/dev/atmega328pb/avr5/libatmega328pb.a \
     include/avr/iom328pb.h
    
  3. Place the .o and .a files in /usr/avr/lib/avr5/

  4. Place the .h file in /usr/avr/include/avr/

  5. Add the following to /usr/avr/include/avr/io.h

     #elif defined (__AVR_ATmega328PB__) || defined (__AVR_ATmega328__)
     #  include <avr/iom328pb.h>
    

All set. Ready to compile.

avrdude

Add the following to /etc/avrdude.conf, right below the definition for ATmega328P.

part parent "m328"
	id          = "m328pb";
	desc        = "ATmega328PB";
	signature   = 0x1e 0x95 0x16;

	ocdrev      = 1;
;

Happy flashing!

@sauttefk

This comment has been minimized.

Copy link

@sauttefk sauttefk commented Dec 16, 2020

typo: arv-gcc -> avr-gcc

@goncalor

This comment has been minimized.

Copy link
Owner Author

@goncalor goncalor commented Dec 16, 2020

Ha! Fixed! Thanks :)

@andyjpb

This comment has been minimized.

Copy link

@andyjpb andyjpb commented Feb 26, 2021

Thanks for this!
I found it really helpful. I've subsequently found a cleaner way for users to provide the pack files to the compiler without modifying the /usr/... directories maintained by the package manager.
If you're interested, I've documented the process here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930195#60
My examples are for the new 0-series and 1-series chips but I have been using atmega328pb recently as well and there's a note about how it applies to that.

@MucaGinger

This comment has been minimized.

Copy link

@MucaGinger MucaGinger commented Mar 2, 2021

Hi!

Where to unzip these files I downloaded from Microchip's website? Where do I enter these commands like in 2. ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment