Bug 21472 - [avr] Add new emulation for ATtiny416 et al.
Summary: [avr] Add new emulation for ATtiny416 et al.
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.29
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-08 11:11 UTC by Georg-Johann Lay
Modified: 2021-09-28 02:47 UTC (History)
2 users (show)

See Also:
Host:
Target: avr
Build:
Last reconfirmed:


Attachments
binutils-avrxmega3.diff: Proposed patch (2.67 KB, patch)
2017-05-08 11:20 UTC, Georg-Johann Lay
Details | Diff
binutils-avrxmega3-pr21472-doc.diff: Round-up of documentation. (760 bytes, patch)
2017-07-03 09:34 UTC, Georg-Johann Lay
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Georg-Johann Lay 2017-05-08 11:11:44 UTC
WHilst the ISA of AVR ATtiny416 / 417 / 816 / 817 would fit avrxmega2, these sevices feature the flash being accessible via the SRAM address range and instructions.  This means that .rodata need not to be part of .data which is the case for all other AVR devices (except avrtiny).

Using SRAM addresses for .rodata requires that such SRAM addresses are offset by 0x8000 compared to the flash addresses as accessible by LPM, for example like so:

__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : 0x8000;


  .text   :
  {
     ...   
  }  > text
  .rodata ADDR(.text) + SIZEOF (.text) + __RODATA_PM_OFFSET__ :
  {
    *(.rodata)
    *(.rodata*)
    *(.gnu.linkonce.r*)
  } AT> text
  .data :
  {
     ...

Consequently, we want a new emulation to support that feature in an optimal way.
Comment 1 Georg-Johann Lay 2017-05-08 11:20:13 UTC
Created attachment 10041 [details]
binutils-avrxmega3.diff: Proposed patch

ld/
	Upgrade the currently unused emulation avrxmega3 to one which
	supports avrxmega2 devices with flash memory visible in the
	SRAM address range.

	PR21472
	* scripttempl/avr_rodata.sc: New file.
	* emulparams/avrxmega3.sh (SCRIPT_NAME): Use avr_rodata.
	(RODATA_PM_OFFSET): Set to 0x8000.

gas/
	PR21472
	* config/tc-avr.c (mcu_types): Add entries for: attiny416,
	attiny417, attiny816, attiny817.
Comment 2 Sourceware Commits 2017-05-19 14:08:15 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f4203b2b8830e66e5229b7f9d30cd29b088566b5

commit f4203b2b8830e66e5229b7f9d30cd29b088566b5
Author: eorg-Johann Lay <avr@gjlay.de>
Date:   Fri May 19 15:06:33 2017 +0100

    Update avrxmega3 linker emulation to support avrxmega2 devices with flash memory visible in the SRAM address range.
    
        PR ld/21472
    ld  * emulparams/avrxmega3.sh (RODATA_PM_OFFSET): Set to 0x8000.
        * scripttempl/avr.sc
        (__RODATA_PM_OFFSET__) [RODATA_PM_OFFSET]: Use RODATA_PM_OFFSET
        as default if not already defined.
        (.data) [!RODATA_PM_OFFSET]: Don't include .rodata and friends.
        (.rodata) [RODATA_PM_OFFSET]: Put at an offset of
        __RODATA_PM_OFFSET__.
    
    gas * config/tc-avr.c (mcu_types): Add entries for: attiny416,
         attiny417, attiny816, attiny817.
Comment 3 Georg-Johann Lay 2017-07-03 09:34:45 UTC
Created attachment 10237 [details]
binutils-avrxmega3-pr21472-doc.diff: Round-up of documentation.

gas/
	PR ld/21472
	* config/tc-avr.c (mcu_types): Add entries for: attiny212,
	attiny214, attiny412, attiny414, attiny814, attiny1614,
	attiny1616, attiny1617, attiny3214, attiny3216, attiny3217.
	(md_show_usage): Adjust doc for "avrxmega3".
	* doc/c-avr.texi (AVR options) [-mmcu=]: Adjust doc for avrxmega3.
	Add MCUs: attiny212, attiny214, attiny412, attiny414, attiny416,
	attiny417, attiny814, attiny816, attiny817, attiny1614,
	attiny1616, attiny1617, attiny3214, attiny3216, attiny3217.
Comment 4 Sourceware Commits 2017-07-17 09:25:27 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f27dadca0ad18d5a0ba032c3d3f6a60ea55d887b

commit f27dadca0ad18d5a0ba032c3d3f6a60ea55d887b
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Mon Jul 17 10:23:10 2017 +0100

    Update assembler documentation on some AVR cores.
    
    	PR 21472
    	* config/tc-avr.c (mcu_types): Add entries for: attiny212,
    	attiny214, attiny412, attiny414, attiny814, attiny1614,
    	attiny1616, attiny1617, attiny3214, attiny3216, attiny3217.
    	(md_show_usage): Adjust doc for "avrxmega3".
    	* doc/c-avr.texi (AVR options) [-mmcu=]: Adjust doc for avrxmega3.
    	Add MCUs: attiny212, attiny214, attiny412, attiny414, attiny416,
    	attiny417, attiny814, attiny816, attiny817, attiny1614,
    	attiny1616, attiny1617, attiny3214, attiny3216, attiny3217.
Comment 5 Georg-Johann Lay 2019-04-30 20:00:24 UTC
Added in 2.29
Comment 6 Mehmet gelisin 2021-09-10 19:36:32 UTC Comment hidden (spam)
Comment 7 Roman Jay Almaza 2021-09-28 02:47:38 UTC Comment hidden (spam)