[patch #9543] Add avrxmega3 devices.

classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
URL:
  <http://savannah.nongnu.org/patch/?9543>

                 Summary: Add avrxmega3 devices.
                 Project: AVR C Runtime Library
            Submitted by: cbalint
            Submitted on: Wed 17 Jan 2018 03:29:03 PM UTC
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

* 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 Atmel.ATtiny_DFP.1.3.169.atpack.zip
.xml (.atdf) files.

  - iotn*.h are from latest
avr8-gnu-toolchain-osx-3.6.1.495-darwin.any.x86_64.tar.gz (
http://distribute.atmel.no/tools/opensource/Atmel-AVR-GNU-Toolchain/3.6.1/ ).

  - ChangeLog-2017

* Changed files:
   - include/avr/io.h
   - include/avr/Makefile.am
   - devtools/generate_iosym.sh
   - devtools/gen-avr-lib-tree.sh
   - avr-libc/configure.ac
   - ChangeLog
   



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 17 Jan 2018 03:29:03 PM UTC  Name: avrxmega3.patch.bz2  Size: 285KiB
  By: cbalint
Add avrxmega3 devices.
<http://savannah.nongnu.org/patch/download.php?file_id=42937>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #1, patch #9543 (project avr-libc):

> 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.


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Additional Item Attachment, patch #9543 (project avr-libc):

File name: avrxmega3-v2.patch.bz2         Size:284 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #2, patch #9543 (project avr-libc):

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.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #3, patch #9543 (project avr-libc):

Johann, Joerg,

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




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #4, patch #9543 (project avr-libc):

With that patch, avr-libc fails to build:

++
Making all in avrxmega3
make[4]: Entering directory
'/srv/local/gnu/build/avrlibc-trunk/avr/lib/avrxmega3'
Making all in attiny1614
make[5]: Entering directory
'/srv/local/gnu/build/avrlibc-trunk/avr/lib/avrxmega3/attiny1614'
/local/gnu/install/gcc-8/bin/avr-gcc -DHAVE_CONFIG_H -I.
-I../../../../../../source/avrlibc-trunk/avr/lib/avrxmega3/attiny1614
-I../../../..  -I../../../../../../source/avrlibc-trunk/common
-I../../../../../../source/avrlibc-trunk/include -I../../../../include  -Wall
-W -Wstrict-prototypes -mmcu=attiny1614  -mcall-prologues -Os  -MT
eewr_block_xmega.o -MD -MP -MF .deps/eewr_block_xmega.Tpo -c -o
eewr_block_xmega.o
../../../../../../source/avrlibc-trunk/libc/misc/eewr_block_xmega.c
../../../../../../source/avrlibc-trunk/libc/misc/eewr_block_xmega.c: In
function 'eeprom_write_page':
../../../../../../source/avrlibc-trunk/libc/misc/eewr_block_xmega.c:26:13:
error: 'NVM' undeclared (first use in this function)
   } while ((NVM.STATUS & NVM_NVMBUSY_bm) == NVM_NVMBUSY_bm);
             ^~~
../../../../../../source/avrlibc-trunk/libc/misc/eewr_block_xmega.c:26:13:
note: each undeclared identifier is reported only once for each function it
appears in
../../../../../../source/avrlibc-trunk/libc/misc/eewr_block_xmega.c:26:26:
error: 'NVM_NVMBUSY_bm' undeclared (first use in this function); did you mean
'RTC_CMPBUSY_bm'?
   } while ((NVM.STATUS & NVM_NVMBUSY_bm) == NVM_NVMBUSY_bm);
                          ^~~~~~~~~~~~~~
                          RTC_CMPBUSY_bm
../../../../../../source/avrlibc-trunk/libc/misc/eewr_block_xmega.c:58:13:
error: 'NVM_CMD_ERASE_WRITE_EEPROM_PAGE_gc' undeclared (first use in this
function)
   NVM.CMD = NVM_CMD_ERASE_WRITE_EEPROM_PAGE_gc;
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../../source/avrlibc-trunk/libc/misc/eewr_block_xmega.c:59:29:
error: 'NVM_CMDEX_bm' undeclared (first use in this function); did you mean
'TCD_CMPDEN_bm'?
   ccp_write_io (&NVM.CTRLA, NVM_CMDEX_bm);
                             ^~~~~~~~~~~~
                             TCD_CMPDEN_bm
Makefile:632: recipe for target 'eewr_block_xmega.o' failed
--

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

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Additional Item Attachment, patch #9543 (project avr-libc):

File name: avrxmega3-v3.patch.bz2         Size:284 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #5, patch #9543 (project avr-libc):

* Compiles with avrxmega3-v3.patch.bz2 .
+ Backports changes from Atmel 3.6.1 [1] toolchain:

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

[1]
http://distribute.atmel.no/tools/opensource/Atmel-AVR-GNU-Toolchain/3.6.1/


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Additional Item Attachment, patch #9543 (project avr-libc):

File name: avrxmega3-v4.diff.bz2          Size:283 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #6, patch #9543 (project avr-libc):

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


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Additional Item Attachment, patch #9543 (project avr-libc):

File name: attiny16161-disasm.txt.bz2     Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #7, patch #9543 (project avr-libc):

Johann,


- 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
https://github.com/mraardvark/pyupdi, you probably already know that.



    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #8, patch #9543 (project avr-libc):

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:


$ echo 'int main(){}' | avr-gcc -xc - -Wl,-u,eeprom_write_block
-mmcu=attiny1616
/srv/local/gnu/install/gcc-8/bin/../lib/gcc/avr/8.0.1/../../../../avr/lib/avrxmega3/libattiny1616.a(eewr_block_xmega.o):
In function `eeprom_write_block':
eewr_block_xmega.c:(.text.avr-libc+0x80): undefined reference to
`_PROTECTED_WRITE_SPM'
collect2: error: ld returned 1 exit status




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Additional Item Attachment, patch #9543 (project avr-libc):

File name: avrxmega3-v5.diff.bz2          Size:284 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #9, patch #9543 (project avr-libc):

Johann,

Uploaded avrxmega3-v5.diff.bz2 .

* Add _PROTECTED_WRITE_SPM in xmega.h (as per Atmel's upstream 3.6.1).


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #10, patch #9543 (project avr-libc):

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.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #11, patch #9543 (project avr-libc):



* 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.




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #12, patch #9543 (project avr-libc):

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.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Additional Item Attachment, patch #9543 (project avr-libc):

File name: avrxmega3-v6.diff.bz2          Size:292 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|

[patch #9543] Add avrxmega3 devices.

Georg-Johann Lay-3
Follow-up Comment #13, patch #9543 (project avr-libc):

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.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9543>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
12