Adding ATMega328PB support to avr-gcc?

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My two available platforms are Mac and Raspberry Pi. On the mac, I'm using crosspack. It's quite old, but it still works for most things (or at least the bugs are easy to work around). On the R-Pi, I'm using the avrtools package.

 

Neither responds properly to -mmcu=atmega328pb. Both *do* properly understand -mmcu=attiny841 - the second newest part I've come across. I particularly want to support some of the new features of the PB, like the second UART.

 

Is it possible to add support for the PB to an existing avr-gcc installation? Does anyone have a patch set or anything of the sort?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is an Arduino BSP and OptiBoot for mega328PB via

http://static.watterott.com/logo.jpg

Watterott electronic

Wattuino Pro Mini PB 5V/16MHz (ATmega328PB)

http://www.watterott.com/en/Wattuino-pro-mini-PB-5V-16MHz

Browse the two links about mid-page.

 

crosspack -

A possible alternative is PlatformIO (Python wrap of the AVR GCC toolchain) though not certain it has mega328PB.

http://docs.platformio.org/en/stable/platforms/atmelavr.html#packages

 

Xcode -

embedXcode may be worth a look; assume it uses the Arduino toolchain so not certain on mega328PB (might extend from mega328P).

Picture

embedXcode

Home

http://embedxcode.weebly.com/

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Imagecraft 8.24 has a mega168pb.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know how much this will help, but the attached zip contains iom328pb.h.  Strangely enough, io.h does not support the MEGA328PB.  However, board.h does.  I include all three files for your perusal.

 

Hope this helps!

 

Attachment(s): 

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:

Imagecraft 8.24 has a mega168pb.

There are Mac OSX and ARM (Rpi) builds of it are there?

 

As for adding CPUs to an issue of GCC. It used to be close to impossible to add to an already built compiler but from about 4.6 onwards the compiler has had the support for individual devices "broken out" so they can be easily added and Atmel now have "parts packs" that can add new devices to existing compilers. But I'm afraid that if you have an old Cross Pack (probably a 4.3?) you are out of luck.

 

Your best hope is to read this:

 

https://gcc.gnu.org/wiki/avr-gcc...

 

And see if anything there is applicable to your situation.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use studio 4 , and just added addresses doe the port E registers, (that was all extra I needed) and then let everything else be set for an old 328

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> but from about 4.6 onwards the compiler has had the support for individual devices "broken out"

 

This feature is officially supported since avr-gcc v5, cf. the respective release notes

 

http://gcc.gnu.org/gcc-5/changes...

 

 

 

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can get recent builds of avr-gcc from Atmel at http://distribute.atmel.no/tools...

I think that the latest verstion (3.5.3) supports 328pb without having to specify a "parts pack" in the compile command.

At least at the compiler level - I had to add symlinks for libatmega328pb.a and crtatmega328pb.o (but those should be identical to the 328p versions, I think.)

(this is an Atmel build of avr-gcc 4.9.2, not a stop all the way to gcc5...)

 

Last Edited: Mon. Jul 25, 2016 - 09:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, westfw, I downloaded the 3.5.3 tools and the toolchain at least accepts -mmcu=atmega328pb. The only trouble now is that libc doesn't know what a 328pb is.

 

There's a libc download there too, but I don't see any mention of "328pb" in there either.

 

P.s. To install the thing like Crosspack, I moved the untar'd directory to /usr/local and then added a new file into /etc/paths.d with /usr/local/avr8-gnu-toolchain-darwin_x86_64/bin in it. Having done that, the avr-* tools are automatically in the path.

 

P.p.s., I did a google search and found a proper iom328pb.h. I hacked io.h myself to add the include for it with the existing pattern. Then, as westfw did, I made symlinks from the crt and lib 328p files to 328pb. I then patched my project to add a few ifdef's for the architectural differences (USART -> USART0 for the vectors, PRR -> PRR0/PRR1). That done, I've got a .hex that looks the part. I'll have to try a 328pb now on the board and see if it works. Of course, the next issue will be finding an avrdude.conf fragment for the 328pb, but I'll try googling for that first.

 

Last Edited: Sun. Sep 4, 2016 - 05:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nsayer wrote:
Of course, the next issue will be finding an avrdude.conf fragment for the 328pb, but I'll try googling for that first.

https://github.com/watterott/ATmega328PB-Testing/blob/master/hardware/atmega328pb/avr/tools/avrdude.conf

via

http://static.watterott.com/logo.jpg

Watterott electronic

Wattuino Pro Mini PB 5V/16MHz (ATmega328PB)

http://www.watterott.com/en/Wattuino-pro-mini-PB-5V-16MHz

...

The ATmega328PB microcontroller is currently not directly supported from the Arduino IDE.
Further infos about this here:

(GitHub)

...

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you ever get this to work, adding support for Atmega328pb? Looking for a solution, running Crosspack on OSX10.6.8.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can install Atmel's packs into a CLI tool chain using the instructions here:  https://www.avrfreaks.net/comment/2526416#comment-2526416

Does this work with Crosspack?  I've been running Atmels "Toolchain for Darwin" on a more recent MacOS for quite a while now...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:

You can install Atmel's packs into a CLI tool chain using the instructions here:  https://www.avrfreaks.net/comment/2526416#comment-2526416

Does this work with Crosspack?  I've been running Atmels "Toolchain for Darwin" on a more recent MacOS for quite a while now...

 

 

Thanks westfw!

 

Will try, and see if I can get that to work.