Easy Way to a Toolchain for the Atmega328PB

A project log for *uino Mini Super (Atmega328PB)

Next Gen Arduino Mini Pro with Atmega328PB

Andre MoehlAndre Moehl 01/29/2016 at 16:290 Comments

After compiling a lot time the avr toolchain by myself, I found an easier solution.

I tried the gcc version 6.0.0, 4.8.9 and 4.9.2. There is are some problems with the gcc. every time i patched the new device, the gcc doesn't know about the Atmega328pb. It means, the device is never shown in the call:

$ avr-gcc --target-help

but I always could compile the for this device, so the gcc itself knew about. I used the information from the Patch, which someone from Atmel send to the gcc-developer. As someone want to know about all the patches, I did, I wrote all down. But just now, I want to describe the easy way.

Thanks to Atmel, they provide a toolchain for Windows and Linux. Because I am working with Linux, I downloaded the toolchain there:

This toolchain contains the gcc 4.9.2 with a few patches from the 6.0.0 version. I don't know exactly, which patches, but I analysed their compiling script (

But luckily, they have a finished toolchain. But now we need to add the device. These informations are int the AVR device pack:

But aware, these files are outdated already, there Atmel Studio has newer one.

In the end, I found 3 different header files. In one file, there were some Register missing.

Here is the another Pack Link, which is newer: - Atmel ATmega Series Device Support (1.0.91)

We need the following files:

  1. libatmega328pb.a
  2. iom328pb.h
  3. crtatmega328pb.o

Put the lib and the crtatmega328pb.o into "/avr/lib".
Put the io*.h into "avr/include/avr"

Done !

I also patched the "io.h", but this seems not necessary since the header file can build the filename by itself, when it is not found.

I put everything into Arduino, so I could easy see, if it's working. Because i made my own PCB, I made my own board.txt. Mini



## Super Mini w/ ATmega328PB
## -------------------------
and my own variant "pins_arduino.h". About that, later.

Finally I need to patch the avrdude.conf:

Simply add below the Atmega328 Part:

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

    ocdrev              = 1;

Later I explain about the bootloader...