patchAVR C Runtime Library - Patches: patch #9543, Add avrxmega3 devices.


You are not allowed to post comments on this tracker with your current authentication level.

patch #9543: Add avrxmega3 devices.

Submitted by:  Balint Cristian <cbalint>
Submitted on:  Wed 17 Jan 2018 03:29:03 PM UTC  
Category:  None Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open

( Jump to the original submission)

Tue 12 Mar 2019 09:25:37 PM UTC, comment #20:

I too have successfully used this patch to add support for ATtiny814 to my avr-libc. Can it be considered for mainline merging sometime please? This would help improve the uptake of these new chips.

Paul Evans <leonerd>
Thu 21 Feb 2019 11:57:45 AM UTC, comment #19:

I have successfully used this patch with the ATtiny817 which works well. Are there concrete plans to get this merged?


Sven <svenschwermer>
Tue 25 Dec 2018 07:04:19 PM UTC, comment #18:
  • Updated avrxmega3-v9.diff.bz2 with latest AVR8X devices.
  • Rebased on .ATDF from latest Atmel.ATtiny_DFP.1.3.229.atpack

The python header generator still generate 1:1 as upstream. Validated against latest (9/28/2018) avr8-gnu-toolchain- by DIFF-ing, and difference is cosmetic only.

Balint Cristian <cbalint>
Sun 01 Jul 2018 01:44:39 PM UTC, comment #17:
  • Updated avrxmega3-v8.diff.bz2 with latest AVR8X devices.
  • Rebased on .ATDF from latest

(file #44476)

Balint Cristian <cbalint>
Sat 31 Mar 2018 10:00:09 AM UTC, comment #16:

That compiles fine but for some warnings.

Unfortunately I am not in a position to test the set up. I am building an Ada toolchain. I guess little of this stuff will be used, since I make Ada spec files with the MCU specifics.
But if you have some piece of program and tell me howto I will gladly compile and see whether the generated code makes sense or not.

You might also want to tell me what to do about some of the warnings, then I will patch for it.
This is the most annoying one:

ctype.h is full of them.

Enjoy your Easter holiday.


jan de kruyf <deikruve>
Sat 31 Mar 2018 12:06:46 AM UTC, comment #15:


  • Can try v7 of patch ?

I missed a # sign in header generator, included a fix for generator and also reincluded generated header files. It was my mistake during assamble of V6 patch.

Balint Cristian <cbalint>
Fri 30 Mar 2018 04:52:28 PM UTC, comment #14:

Cristian, hello.

I just tried to compile avr-libc svn2546 with patches from avrxmega3-v6.diff.bz2. compiler gcc8.0.1 built for avr.

I get some errors which are at least partly from this patch.
I did not get any strange messages before this just some warnings.
Also the last time I built it without the patch it looked right.

Could you have a look at it?

Cheers, Jan.

jan de kruyf <deikruve>
Tue 23 Jan 2018 02:09:12 PM UTC, comment #13:

The avrxmega3-v6.diff.bz2 includes a ATDF parser for AVR8X.

- The new parser addition does:

  • Generates iotn*.h just from atdf schema.
  • Parse only AVR8X family types (constrained in script).
  • Adds few alieases (hardcoded) as older coding-style.
  • Headers generated are functional the same as Atmel's 3.6.1.
  • Parser license is BSD (the very avr-libc one).

- BTW, One of main difference BSD vs Apache would be that Apache license grants patents (patents will not circumvent the license terms). But I am not lawyer.

Balint Cristian <cbalint>
Fri 19 Jan 2018 10:42:09 AM UTC, comment #12:

Mixing the licenses is doable, it's just a little cumbersome
since we need to LICENSE documents then at the toplevel.

If #b is not too much work, it would be my personally preferred
solution, as it makes us completely independent from Microchip.
They've chosen to distribute their own version of the headers
independently from us anyway.

Joerg Wunsch <joerg_wunsch>
Project Administrator
Fri 19 Jan 2018 10:33:27 AM UTC, comment #11:
  • The Apache license on io*.h might expose a problem.

- Some possible solutions.

a) Mchip/Atmel right now mixes BSD+Apache in their packages, so avr-libc could do it too ? (not a lawyer).

b) Make new headers from scratch based from docs. A simple one (no fancy struct), just simple enumerations.

  • I incline to choose #b, and i am willing to do the task if You all here agree. Probably wise would be to have a common avr8x.h and some alias files that adds extras for each particular devices.
Balint Cristian <cbalint>
Thu 18 Jan 2018 04:32:53 PM UTC, comment #10:

Ok, better now. At least the trivial example builds now.

Some final notes on xmega.h:

Constraint "d" for [ccp_ioreg] resp. [ccp_spm_mask] could be relaxed to the less restrictive "r".

And from a strict point of view, both _PROTECTED_WRITE and _PROTECTED_WRITE_SPM are clobbering memory.

Georg-Johann Lay <gjlayde>
Thu 18 Jan 2018 03:53:50 PM UTC, comment #9:


Uploaded avrxmega3-v5.diff.bz2 .

  • Add _PROTECTED_WRITE_SPM in xmega.h (as per Atmel's upstream 3.6.1).
Balint Cristian <cbalint>
Thu 18 Jan 2018 03:10:27 PM UTC, comment #8:

There must still be missing something, at least _PROTECTED_WRITE_SPM. Apart from a build warning for a missing prototype, it's neither resolved by a macro nor my a symbol:

Georg-Johann Lay <gjlayde>
Thu 18 Jan 2018 02:07:09 PM UTC, comment #7:


- Thank you for the quick review.
- I believe your proposed changes are fine.

  • The task presented here is fairly easy to do, all basic ingredients are Atmel's upstream stuff. Not sure why they are not collaborating with you guys. They started to keep lots of changes on their own fork (their changes have no logs or names).
  • Perhaps migrating to a more collaborative platform like github would help this project a lot.
  • I attached outputs of a sample main() program for atn1616 target that looks good to me [attiny16161-disasm.txt.bz2]. Cannot validate yet on real device (waiting for real chip samples) .
  • I am working on avrdude & USBASP-firmware too for support UPDI

too (is quite similar to TPI). As reference for UPDI there is, you probably already know that.

Balint Cristian <cbalint>
Thu 18 Jan 2018 11:50:34 AM UTC, comment #6:

Thanks, I can build avr-libc now and a quick test looks good.

Regarding the changes to eewr_block_xmega.c, maybe it's clearer to special-case the different NVM flavours instead of #define + #undef + #define chains?

I allowed me to attach a respective patch as avrxmega3-v4.diff.bz2

Georg-Johann Lay <gjlayde>
Wed 17 Jan 2018 05:13:17 PM UTC, comment #5:
  • Compiles with avrxmega3-v3.patch.bz2 .

+ Backports changes from Atmel 3.6.1 [1] toolchain:

- eedef.h
- eewr_block_xmega.c
- eewr_byte.S


Balint Cristian <cbalint>
Wed 17 Jan 2018 04:15:45 PM UTC, comment #4:

With that patch, avr-libc fails to build:

Notice that avr-gcc defines AVR_XMEGA for these devices (in case that matters).

Georg-Johann Lay <gjlayde>
Wed 17 Jan 2018 04:14:14 PM UTC, comment #3:

Johann, Joerg,

* Attached avrxmega3-v2.patch.bz2 to add ChangeLog as new file.

Balint Cristian <cbalint>
Wed 17 Jan 2018 04:12:13 PM UTC, comment #2:

I agree with Johann's comment regarding ChangeLog, though it's
not too hard to simply extract the text from the diff.

It might be the first commit in 2018, so it's going to be a
completely new ChangeLog file anyway.

Joerg Wunsch <joerg_wunsch>
Project Administrator
Wed 17 Jan 2018 03:56:18 PM UTC, comment #1:

> Changed files: [...] ChangeLog

The delta to ChangeLog is not reasonable, too much lines affected.

Usually, ChangeLog is prone to conflicts as each push is touching it; hence it might be more comfortable to supply it as plain text snipped and leave it out of the patch.

Georg-Johann Lay <gjlayde>
Wed 17 Jan 2018 03:29:03 PM UTC, original submission:
  • This patch adds support for avrxmega3 devices already supported by latest gcc8 compiler:

attiny1614, attiny1616, attiny1617, attiny212, attiny214,
attiny3214, attiny3216, attiny3217, attiny412, attiny414,
attiny416, attiny417, attiny814, attiny816, attiny817 .

  • New files:

- attinny*.S are generated from latest .xml (.atdf) files.

- iotn*.h are from latest avr8-gnu-toolchain-osx- ( ).

- ChangeLog-2017

  • Changed files:

- include/avr/io.h
- include/avr/
- devtools/
- devtools/
- avr-libc/
- ChangeLog

Balint Cristian <cbalint>


Attached Files
file #45738:  avrxmega3-v9.diff.bz2 added by cbalint (455KiB - application/x-bzip)
file #44476:  avrxmega3-v8.diff.bz2 added by cbalint (456KiB - application/x-bzip - Newer AVR8X devices.)
file #43735:  avrxmega3-v7.diff.bz2 added by cbalint (292KiB - application/x-bzip - V7 of patch)
file #43034:  avrxmega3-v6.diff.bz2 added by cbalint (292KiB - application/x-bzip - V6 of patch [includes ioavr8x.h gen])
file #42957:  avrxmega3-v5.diff.bz2 added by cbalint (284KiB - application/x-bzip - V5 patch [add _PROTECTED_WRITE_SPM])
file #42956:  attiny16161-disasm.txt.bz2 added by cbalint (2KiB - application/x-bzip - ATTINY1616 sample disasm prog.)
file #42952:  avrxmega3-v4.diff.bz2 added by gjlayde (284KiB - application/x-bzip - Avoid #define + #undef + #define chains)
file #42939:  avrxmega3-v3.patch.bz2 added by cbalint (285KiB - application/x-bzip - Patch V3 [backports Atmel's NVM])
file #42938:  avrxmega3-v2.patch.bz2 added by cbalint (284KiB - application/x-bzip - Fixed ChangeLog [now as new file].)
file #42937:  avrxmega3.patch.bz2 added by cbalint (285KiB - application/x-bzip - Add avrxmega3 devices.)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by leonerd (Posted a comment)
  • -email is unavailable- added by svenschwermer (Posted a comment)
  • -email is unavailable- added by deikruve (Posted a comment)
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by gjlayde (Posted a comment)
  • -email is unavailable- added by cbalint (Submitted the item)
  • -email is unavailable- added by cbalint (Add avrxmega3 devices.)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-25 cbalint Attached File- => Added avrxmega3-v9.diff.bz2, #45738
    2018-07-01 cbalint Attached File- => Added avrxmega3-v8.diff.bz2, #44476
    2018-03-31 cbalint Attached File- => Added avrxmega3-v7.diff.bz2, #43735
    2018-01-23 cbalint Attached File- => Added avrxmega3-v6.diff.bz2, #43034
    2018-01-18 cbalint Attached File- => Added avrxmega3-v5.diff.bz2, #42957
    2018-01-18 cbalint Attached File- => Added attiny16161-disasm.txt.bz2, #42956
    2018-01-18 gjlayde Attached File- => Added avrxmega3-v4.diff.bz2, #42952
    2018-01-17 cbalint Attached File- => Added avrxmega3-v3.patch.bz2, #42939
    2018-01-17 cbalint Attached File- => Added avrxmega3-v2.patch.bz2, #42938
    2018-01-17 cbalint Attached File- => Added avrxmega3.patch.bz2, #42937
        Carbon-Copy- => Added -email is unavailable-

    Back to the top

    Powered by Savane 3.4