diff --git a/alsoneeded/Info.txt b/alsoneeded/Info.txt new file mode 100644 index 0000000..2997aaf --- /dev/null +++ b/alsoneeded/Info.txt @@ -0,0 +1,11 @@ +These need to replace the normal versions of these files - there doesn't appear to already be a way to do this - or it wasn't readily apparent to me (I see another version of eeprom.h in the avrlibc patches - but it doesn't get included in the packages that the build scripts generate- and a good thing that is too too, because it would be incompatible with megaAVR 0-series, tinyAVR 0-series and 1-series too). I've made a set of packages for my own use by assembling from windows kit (I couldn't get cross compiling working) but would love to see these get rolled in. + + +eeprom.h is from avr3.6.2.1759 (from microchip site) - it fixes the error when using eeprom_is_read() macro from this library. + +power.h was from discussion on #66 and has been tested. + +Have also included the modified linker scripts to fix #67. This uses the slightly safer approach that was posted in one of those threads of making sure the symbol is defined before trying to use it, though I'm not sure how that could end up happening. + +It's not clear to me which of the linker scripts, potentially, could possible end up being used - so this includes the linker scripts for all the tinyAVR 0-series, tinyAVR 1-series, megaAVR 0-series (avrxmega3) and the DA series parts (avrxmega4) + diff --git a/alsoneeded/avrxmega3.xbn b/alsoneeded/avrxmega3.xbn new file mode 100644 index 0000000..c0f915b --- /dev/null +++ b/alsoneeded/avrxmega3.xbn @@ -0,0 +1,268 @@ +/* Script for -N: mix text and data on same page; don't align data */ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ +OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") +OUTPUT_ARCH(avr:103) +__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 1024K; +__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xffa0; +__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K; +__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K; +__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K; +__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K; +__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K; +__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : 0x8000; +__DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : 0x802000; +MEMORY +{ + text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__ + data (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__ + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__ + fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__ + lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__ + signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__ + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__ +} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + /* Internal text space or external memory. */ + .text : + { + *(.vectors) + KEEP(*(.vectors)) + /* For data that needs to reside in the lower 64k of progmem. */ + *(.progmem.gcc*) + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ + . = ALIGN(2); + __trampolines_start = . ; + /* The jump trampolines for the 16-bit limited relocs will reside here. */ + *(.trampolines) + *(.trampolines*) + __trampolines_end = . ; + /* avr-libc expects these data to reside in lower 64K. */ + *libprintf_flt.a:*(.progmem.data) + *libc.a:*(.progmem.data) + *(.progmem*) + . = ALIGN(2); + /* For future tablejump instruction arrays for 3 byte pc devices. + We don't relax jump/call instructions within these sections. */ + *(.jumptables) + *(.jumptables*) + /* For code that needs to reside in the lower 128k progmem. */ + *(.lowtext) + *(.lowtext*) + __ctors_start = . ; + *(.ctors) + __ctors_end = . ; + __dtors_start = . ; + *(.dtors) + __dtors_end = . ; + KEEP(SORT(*)(.ctors)) + KEEP(SORT(*)(.dtors)) + /* From this point on, we don't bother about wether the insns are + below or above the 16 bits boundary. */ + *(.init0) /* Start here after reset. */ + KEEP (*(.init0)) + *(.init1) + KEEP (*(.init1)) + *(.init2) /* Clear __zero_reg__, set up stack pointer. */ + KEEP (*(.init2)) + *(.init3) + KEEP (*(.init3)) + *(.init4) /* Initialize data and BSS. */ + KEEP (*(.init4)) + *(.init5) + KEEP (*(.init5)) + *(.init6) /* C++ constructors. */ + KEEP (*(.init6)) + *(.init7) + KEEP (*(.init7)) + *(.init8) + KEEP (*(.init8)) + *(.init9) /* Call main(). */ + KEEP (*(.init9)) + *(.text) + . = ALIGN(2); + *(.text.*) + . = ALIGN(2); + *(.fini9) /* _exit() starts here. */ + KEEP (*(.fini9)) + *(.fini8) + KEEP (*(.fini8)) + *(.fini7) + KEEP (*(.fini7)) + *(.fini6) /* C++ destructors. */ + KEEP (*(.fini6)) + *(.fini5) + KEEP (*(.fini5)) + *(.fini4) + KEEP (*(.fini4)) + *(.fini3) + KEEP (*(.fini3)) + *(.fini2) + KEEP (*(.fini2)) + *(.fini1) + KEEP (*(.fini1)) + *(.fini0) /* Infinite loop after program termination. */ + KEEP (*(.fini0)) + _etext = . ; + } > text + .rodata ADDR(.text) + SIZEOF (.text) + __RODATA_PM_OFFSET__ : + { + *(.rodata) + *(.rodata*) + *(.gnu.linkonce.r*) + } AT> text + .data : + { + PROVIDE (__data_start = .) ; + *(.data) + *(.data*) + *(.gnu.linkonce.d*) + . = ALIGN(2); + _edata = . ; + PROVIDE (__data_end = .) ; + } > data AT> text + .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss)) + { + PROVIDE (__bss_start = .) ; + *(.bss) + *(.bss*) + *(COMMON) + PROVIDE (__bss_end = .) ; + } > data + __data_load_start = LOADADDR(.data); + __data_load_end = __data_load_start + SIZEOF(.data); + /* Global data not cleared after reset. */ + .noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit)) + { + PROVIDE (__noinit_start = .) ; + *(.noinit*) + PROVIDE (__noinit_end = .) ; + _end = . ; + PROVIDE (__heap_start = .) ; + } > data + .eeprom : + { + /* See .data above... */ + KEEP(*(.eeprom*)) + __eeprom_end = . ; + } > eeprom + .fuse : + { + KEEP(*(.fuse)) + KEEP(*(.lfuse)) + KEEP(*(.hfuse)) + KEEP(*(.efuse)) + } > fuse + .lock : + { + KEEP(*(.lock*)) + } > lock + .signature : + { + KEEP(*(.signature*)) + } > signature + .user_signatures : + { + KEEP(*(.user_signatures*)) + } > user_signatures + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } +} diff --git a/alsoneeded/avrxmega3.xn b/alsoneeded/avrxmega3.xn new file mode 100644 index 0000000..722fdf1 --- /dev/null +++ b/alsoneeded/avrxmega3.xn @@ -0,0 +1,268 @@ +/* Script for -n: mix text and data on same page */ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ +OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") +OUTPUT_ARCH(avr:103) +__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 1024K; +__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xffa0; +__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K; +__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K; +__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K; +__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K; +__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K; +__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : 0x8000; +__DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : 0x802000; +MEMORY +{ + text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__ + data (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__ + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__ + fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__ + lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__ + signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__ + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__ +} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + /* Internal text space or external memory. */ + .text : + { + *(.vectors) + KEEP(*(.vectors)) + /* For data that needs to reside in the lower 64k of progmem. */ + *(.progmem.gcc*) + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ + . = ALIGN(2); + __trampolines_start = . ; + /* The jump trampolines for the 16-bit limited relocs will reside here. */ + *(.trampolines) + *(.trampolines*) + __trampolines_end = . ; + /* avr-libc expects these data to reside in lower 64K. */ + *libprintf_flt.a:*(.progmem.data) + *libc.a:*(.progmem.data) + *(.progmem*) + . = ALIGN(2); + /* For future tablejump instruction arrays for 3 byte pc devices. + We don't relax jump/call instructions within these sections. */ + *(.jumptables) + *(.jumptables*) + /* For code that needs to reside in the lower 128k progmem. */ + *(.lowtext) + *(.lowtext*) + __ctors_start = . ; + *(.ctors) + __ctors_end = . ; + __dtors_start = . ; + *(.dtors) + __dtors_end = . ; + KEEP(SORT(*)(.ctors)) + KEEP(SORT(*)(.dtors)) + /* From this point on, we don't bother about wether the insns are + below or above the 16 bits boundary. */ + *(.init0) /* Start here after reset. */ + KEEP (*(.init0)) + *(.init1) + KEEP (*(.init1)) + *(.init2) /* Clear __zero_reg__, set up stack pointer. */ + KEEP (*(.init2)) + *(.init3) + KEEP (*(.init3)) + *(.init4) /* Initialize data and BSS. */ + KEEP (*(.init4)) + *(.init5) + KEEP (*(.init5)) + *(.init6) /* C++ constructors. */ + KEEP (*(.init6)) + *(.init7) + KEEP (*(.init7)) + *(.init8) + KEEP (*(.init8)) + *(.init9) /* Call main(). */ + KEEP (*(.init9)) + *(.text) + . = ALIGN(2); + *(.text.*) + . = ALIGN(2); + *(.fini9) /* _exit() starts here. */ + KEEP (*(.fini9)) + *(.fini8) + KEEP (*(.fini8)) + *(.fini7) + KEEP (*(.fini7)) + *(.fini6) /* C++ destructors. */ + KEEP (*(.fini6)) + *(.fini5) + KEEP (*(.fini5)) + *(.fini4) + KEEP (*(.fini4)) + *(.fini3) + KEEP (*(.fini3)) + *(.fini2) + KEEP (*(.fini2)) + *(.fini1) + KEEP (*(.fini1)) + *(.fini0) /* Infinite loop after program termination. */ + KEEP (*(.fini0)) + _etext = . ; + } > text + .rodata ADDR(.text) + SIZEOF (.text) + __RODATA_PM_OFFSET__ : + { + *(.rodata) + *(.rodata*) + *(.gnu.linkonce.r*) + } AT> text + .data : + { + PROVIDE (__data_start = .) ; + *(.data) + *(.data*) + *(.gnu.linkonce.d*) + . = ALIGN(2); + _edata = . ; + PROVIDE (__data_end = .) ; + } > data AT> text + .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss)) + { + PROVIDE (__bss_start = .) ; + *(.bss) + *(.bss*) + *(COMMON) + PROVIDE (__bss_end = .) ; + } > data + __data_load_start = LOADADDR(.data); + __data_load_end = __data_load_start + SIZEOF(.data); + /* Global data not cleared after reset. */ + .noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit)) + { + PROVIDE (__noinit_start = .) ; + *(.noinit*) + PROVIDE (__noinit_end = .) ; + _end = . ; + PROVIDE (__heap_start = .) ; + } > data + .eeprom : + { + /* See .data above... */ + KEEP(*(.eeprom*)) + __eeprom_end = . ; + } > eeprom + .fuse : + { + KEEP(*(.fuse)) + KEEP(*(.lfuse)) + KEEP(*(.hfuse)) + KEEP(*(.efuse)) + } > fuse + .lock : + { + KEEP(*(.lock*)) + } > lock + .signature : + { + KEEP(*(.signature*)) + } > signature + .user_signatures : + { + KEEP(*(.user_signatures*)) + } > user_signatures + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } +} diff --git a/alsoneeded/avrxmega3.xr b/alsoneeded/avrxmega3.xr new file mode 100644 index 0000000..3695777 --- /dev/null +++ b/alsoneeded/avrxmega3.xr @@ -0,0 +1,219 @@ +/* Script for ld -r: link without relocation */ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ +OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") +OUTPUT_ARCH(avr:103) +__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 1024K; +__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xffa0; +__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K; +__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K; +__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K; +__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K; +__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K; +__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : 0x8000; +__DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : 0x802000; +MEMORY +{ + text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__ + data (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__ + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__ + fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__ + lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__ + signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__ + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__ +} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + .hash 0 : { *(.hash) } + .dynsym 0 : { *(.dynsym) } + .dynstr 0 : { *(.dynstr) } + .gnu.version 0 : { *(.gnu.version) } + .gnu.version_d 0 : { *(.gnu.version_d) } + .gnu.version_r 0 : { *(.gnu.version_r) } + .rel.init 0 : { *(.rel.init) } + .rela.init 0 : { *(.rela.init) } + .rel.text 0 : + { + *(.rel.text) + } + .rela.text 0 : + { + *(.rela.text) + } + .rel.fini 0 : { *(.rel.fini) } + .rela.fini 0 : { *(.rela.fini) } + .rel.rodata 0 : + { + *(.rel.rodata) + } + .rela.rodata 0 : + { + *(.rela.rodata) + } + .rel.data 0 : + { + *(.rel.data) + } + .rela.data 0 : + { + *(.rela.data) + } + .rel.ctors 0 : { *(.rel.ctors) } + .rela.ctors 0 : { *(.rela.ctors) } + .rel.dtors 0 : { *(.rel.dtors) } + .rela.dtors 0 : { *(.rela.dtors) } + .rel.got 0 : { *(.rel.got) } + .rela.got 0 : { *(.rela.got) } + .rel.bss 0 : { *(.rel.bss) } + .rela.bss 0 : { *(.rela.bss) } + .rel.plt 0 : { *(.rel.plt) } + .rela.plt 0 : { *(.rela.plt) } + /* Internal text space or external memory. */ + .text 0 : + { + *(.vectors) + KEEP(*(.vectors)) + /* For data that needs to reside in the lower 64k of progmem. */ + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ + /* The jump trampolines for the 16-bit limited relocs will reside here. */ + *(.trampolines) + /* avr-libc expects these data to reside in lower 64K. */ + /* For future tablejump instruction arrays for 3 byte pc devices. + We don't relax jump/call instructions within these sections. */ + *(.jumptables) + /* For code that needs to reside in the lower 128k progmem. */ + *(.lowtext) + KEEP(SORT(*)(.ctors)) + KEEP(SORT(*)(.dtors)) + /* From this point on, we don't bother about wether the insns are + below or above the 16 bits boundary. */ + *(.init0) /* Start here after reset. */ + KEEP (*(.init0)) + *(.init1) + KEEP (*(.init1)) + *(.init2) /* Clear __zero_reg__, set up stack pointer. */ + KEEP (*(.init2)) + *(.init3) + KEEP (*(.init3)) + *(.init4) /* Initialize data and BSS. */ + KEEP (*(.init4)) + *(.init5) + KEEP (*(.init5)) + *(.init6) /* C++ constructors. */ + KEEP (*(.init6)) + *(.init7) + KEEP (*(.init7)) + *(.init8) + KEEP (*(.init8)) + *(.init9) /* Call main(). */ + KEEP (*(.init9)) + *(.text) + *(.fini9) /* _exit() starts here. */ + KEEP (*(.fini9)) + *(.fini8) + KEEP (*(.fini8)) + *(.fini7) + KEEP (*(.fini7)) + *(.fini6) /* C++ destructors. */ + KEEP (*(.fini6)) + *(.fini5) + KEEP (*(.fini5)) + *(.fini4) + KEEP (*(.fini4)) + *(.fini3) + KEEP (*(.fini3)) + *(.fini2) + KEEP (*(.fini2)) + *(.fini1) + KEEP (*(.fini1)) + *(.fini0) /* Infinite loop after program termination. */ + KEEP (*(.fini0)) + } + .rodata 0 : + { + *(.rodata) + *(.gnu.linkonce.r*) + } + .data 0 : + { + *(.data) + *(.gnu.linkonce.d*) + } + .bss 0 : + { + *(.bss) + *(COMMON) + } + /* Global data not cleared after reset. */ + .noinit 0: + { + *(.noinit*) + } + .eeprom 0: + { + /* See .data above... */ + KEEP(*(.eeprom*)) + } + .fuse 0: + { + KEEP(*(.fuse)) + KEEP(*(.lfuse)) + KEEP(*(.hfuse)) + KEEP(*(.efuse)) + } + .lock 0: + { + KEEP(*(.lock*)) + } + .signature 0: + { + KEEP(*(.signature*)) + } + .user_signatures 0: + { + KEEP(*(.user_signatures*)) + } + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } +} diff --git a/alsoneeded/avrxmega3.xu b/alsoneeded/avrxmega3.xu new file mode 100644 index 0000000..364dc3f --- /dev/null +++ b/alsoneeded/avrxmega3.xu @@ -0,0 +1,227 @@ +/* Script for ld -Ur: link w/out relocation, do create constructors */ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ +OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") +OUTPUT_ARCH(avr:103) +__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 1024K; +__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xffa0; +__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K; +__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K; +__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K; +__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K; +__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K; +__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : 0x8000; +__DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : 0x802000; +MEMORY +{ + text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__ + data (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__ + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__ + fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__ + lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__ + signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__ + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__ +} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + .hash 0 : { *(.hash) } + .dynsym 0 : { *(.dynsym) } + .dynstr 0 : { *(.dynstr) } + .gnu.version 0 : { *(.gnu.version) } + .gnu.version_d 0 : { *(.gnu.version_d) } + .gnu.version_r 0 : { *(.gnu.version_r) } + .rel.init 0 : { *(.rel.init) } + .rela.init 0 : { *(.rela.init) } + .rel.text 0 : + { + *(.rel.text) + } + .rela.text 0 : + { + *(.rela.text) + } + .rel.fini 0 : { *(.rel.fini) } + .rela.fini 0 : { *(.rela.fini) } + .rel.rodata 0 : + { + *(.rel.rodata) + } + .rela.rodata 0 : + { + *(.rela.rodata) + } + .rel.data 0 : + { + *(.rel.data) + } + .rela.data 0 : + { + *(.rela.data) + } + .rel.ctors 0 : { *(.rel.ctors) } + .rela.ctors 0 : { *(.rela.ctors) } + .rel.dtors 0 : { *(.rel.dtors) } + .rela.dtors 0 : { *(.rela.dtors) } + .rel.got 0 : { *(.rel.got) } + .rela.got 0 : { *(.rela.got) } + .rel.bss 0 : { *(.rel.bss) } + .rela.bss 0 : { *(.rela.bss) } + .rel.plt 0 : { *(.rel.plt) } + .rela.plt 0 : { *(.rela.plt) } + /* Internal text space or external memory. */ + .text 0 : + { + *(.vectors) + KEEP(*(.vectors)) + /* For data that needs to reside in the lower 64k of progmem. */ + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ + __trampolines_start = . ; + /* The jump trampolines for the 16-bit limited relocs will reside here. */ + *(.trampolines) + __trampolines_end = . ; + /* avr-libc expects these data to reside in lower 64K. */ + /* For future tablejump instruction arrays for 3 byte pc devices. + We don't relax jump/call instructions within these sections. */ + *(.jumptables) + /* For code that needs to reside in the lower 128k progmem. */ + *(.lowtext) + __ctors_start = . ; + *(.ctors) + __ctors_end = . ; + __dtors_start = . ; + *(.dtors) + __dtors_end = . ; + KEEP(SORT(*)(.ctors)) + KEEP(SORT(*)(.dtors)) + /* From this point on, we don't bother about wether the insns are + below or above the 16 bits boundary. */ + *(.init0) /* Start here after reset. */ + KEEP (*(.init0)) + *(.init1) + KEEP (*(.init1)) + *(.init2) /* Clear __zero_reg__, set up stack pointer. */ + KEEP (*(.init2)) + *(.init3) + KEEP (*(.init3)) + *(.init4) /* Initialize data and BSS. */ + KEEP (*(.init4)) + *(.init5) + KEEP (*(.init5)) + *(.init6) /* C++ constructors. */ + KEEP (*(.init6)) + *(.init7) + KEEP (*(.init7)) + *(.init8) + KEEP (*(.init8)) + *(.init9) /* Call main(). */ + KEEP (*(.init9)) + *(.text) + *(.fini9) /* _exit() starts here. */ + KEEP (*(.fini9)) + *(.fini8) + KEEP (*(.fini8)) + *(.fini7) + KEEP (*(.fini7)) + *(.fini6) /* C++ destructors. */ + KEEP (*(.fini6)) + *(.fini5) + KEEP (*(.fini5)) + *(.fini4) + KEEP (*(.fini4)) + *(.fini3) + KEEP (*(.fini3)) + *(.fini2) + KEEP (*(.fini2)) + *(.fini1) + KEEP (*(.fini1)) + *(.fini0) /* Infinite loop after program termination. */ + KEEP (*(.fini0)) + } + .rodata 0 : + { + *(.rodata) + *(.gnu.linkonce.r*) + } + .data 0 : + { + *(.data) + *(.gnu.linkonce.d*) + } + .bss 0 : + { + *(.bss) + *(COMMON) + } + /* Global data not cleared after reset. */ + .noinit 0: + { + *(.noinit*) + } + .eeprom 0: + { + /* See .data above... */ + KEEP(*(.eeprom*)) + } + .fuse 0: + { + KEEP(*(.fuse)) + KEEP(*(.lfuse)) + KEEP(*(.hfuse)) + KEEP(*(.efuse)) + } + .lock 0: + { + KEEP(*(.lock*)) + } + .signature 0: + { + KEEP(*(.signature*)) + } + .user_signatures 0: + { + KEEP(*(.user_signatures*)) + } + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } +} diff --git a/alsoneeded/avrxmega4.xbn b/alsoneeded/avrxmega4.xbn new file mode 100644 index 0000000..ad73533 --- /dev/null +++ b/alsoneeded/avrxmega4.xbn @@ -0,0 +1,264 @@ +/* Script for -N: mix text and data on same page; don't align data */ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ +OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") +OUTPUT_ARCH(avr:104) +__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 1024K; +__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xffa0; +__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K; +__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K; +__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K; +__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K; +__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K; +__DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : 0x802000; +MEMORY +{ + text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__ + data (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__ + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__ + fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__ + lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__ + signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__ + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__ +} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + /* Internal text space or external memory. */ + .text : + { + *(.vectors) + KEEP(*(.vectors)) + /* For data that needs to reside in the lower 64k of progmem. */ + *(.progmem.gcc*) + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ + . = ALIGN(2); + __trampolines_start = . ; + /* The jump trampolines for the 16-bit limited relocs will reside here. */ + *(.trampolines) + *(.trampolines*) + __trampolines_end = . ; + /* avr-libc expects these data to reside in lower 64K. */ + *libprintf_flt.a:*(.progmem.data) + *libc.a:*(.progmem.data) + *(.progmem*) + . = ALIGN(2); + /* For future tablejump instruction arrays for 3 byte pc devices. + We don't relax jump/call instructions within these sections. */ + *(.jumptables) + *(.jumptables*) + /* For code that needs to reside in the lower 128k progmem. */ + *(.lowtext) + *(.lowtext*) + __ctors_start = . ; + *(.ctors) + __ctors_end = . ; + __dtors_start = . ; + *(.dtors) + __dtors_end = . ; + KEEP(SORT(*)(.ctors)) + KEEP(SORT(*)(.dtors)) + /* From this point on, we don't bother about wether the insns are + below or above the 16 bits boundary. */ + *(.init0) /* Start here after reset. */ + KEEP (*(.init0)) + *(.init1) + KEEP (*(.init1)) + *(.init2) /* Clear __zero_reg__, set up stack pointer. */ + KEEP (*(.init2)) + *(.init3) + KEEP (*(.init3)) + *(.init4) /* Initialize data and BSS. */ + KEEP (*(.init4)) + *(.init5) + KEEP (*(.init5)) + *(.init6) /* C++ constructors. */ + KEEP (*(.init6)) + *(.init7) + KEEP (*(.init7)) + *(.init8) + KEEP (*(.init8)) + *(.init9) /* Call main(). */ + KEEP (*(.init9)) + *(.text) + . = ALIGN(2); + *(.text.*) + . = ALIGN(2); + *(.fini9) /* _exit() starts here. */ + KEEP (*(.fini9)) + *(.fini8) + KEEP (*(.fini8)) + *(.fini7) + KEEP (*(.fini7)) + *(.fini6) /* C++ destructors. */ + KEEP (*(.fini6)) + *(.fini5) + KEEP (*(.fini5)) + *(.fini4) + KEEP (*(.fini4)) + *(.fini3) + KEEP (*(.fini3)) + *(.fini2) + KEEP (*(.fini2)) + *(.fini1) + KEEP (*(.fini1)) + *(.fini0) /* Infinite loop after program termination. */ + KEEP (*(.fini0)) + _etext = . ; + } > text + .data : + { + PROVIDE (__data_start = .) ; + *(.data) + *(.data*) + *(.gnu.linkonce.d*) + *(.rodata) /* We need to include .rodata here if gcc is used */ + *(.rodata*) /* with -fdata-sections. */ + *(.gnu.linkonce.r*) + . = ALIGN(2); + _edata = . ; + PROVIDE (__data_end = .) ; + } > data AT> text + .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss)) + { + PROVIDE (__bss_start = .) ; + *(.bss) + *(.bss*) + *(COMMON) + PROVIDE (__bss_end = .) ; + } > data + __data_load_start = LOADADDR(.data); + __data_load_end = __data_load_start + SIZEOF(.data); + /* Global data not cleared after reset. */ + .noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit)) + { + PROVIDE (__noinit_start = .) ; + *(.noinit*) + PROVIDE (__noinit_end = .) ; + _end = . ; + PROVIDE (__heap_start = .) ; + } > data + .eeprom : + { + /* See .data above... */ + KEEP(*(.eeprom*)) + __eeprom_end = . ; + } > eeprom + .fuse : + { + KEEP(*(.fuse)) + KEEP(*(.lfuse)) + KEEP(*(.hfuse)) + KEEP(*(.efuse)) + } > fuse + .lock : + { + KEEP(*(.lock*)) + } > lock + .signature : + { + KEEP(*(.signature*)) + } > signature + .user_signatures : + { + KEEP(*(.user_signatures*)) + } > user_signatures + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } +} diff --git a/alsoneeded/avrxmega4.xn b/alsoneeded/avrxmega4.xn new file mode 100644 index 0000000..13113b2 --- /dev/null +++ b/alsoneeded/avrxmega4.xn @@ -0,0 +1,265 @@ +/* Script for -n: mix text and data on same page */ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ +OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") +OUTPUT_ARCH(avr:104) +__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 1024K; +__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xffa0; +__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K; +__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K; +__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K; +__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K; +__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K; +__DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : 0x802000; + +MEMORY +{ + text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__ + data (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__ + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__ + fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__ + lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__ + signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__ + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__ +} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + /* Internal text space or external memory. */ + .text : + { + *(.vectors) + KEEP(*(.vectors)) + /* For data that needs to reside in the lower 64k of progmem. */ + *(.progmem.gcc*) + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ + . = ALIGN(2); + __trampolines_start = . ; + /* The jump trampolines for the 16-bit limited relocs will reside here. */ + *(.trampolines) + *(.trampolines*) + __trampolines_end = . ; + /* avr-libc expects these data to reside in lower 64K. */ + *libprintf_flt.a:*(.progmem.data) + *libc.a:*(.progmem.data) + *(.progmem*) + . = ALIGN(2); + /* For future tablejump instruction arrays for 3 byte pc devices. + We don't relax jump/call instructions within these sections. */ + *(.jumptables) + *(.jumptables*) + /* For code that needs to reside in the lower 128k progmem. */ + *(.lowtext) + *(.lowtext*) + __ctors_start = . ; + *(.ctors) + __ctors_end = . ; + __dtors_start = . ; + *(.dtors) + __dtors_end = . ; + KEEP(SORT(*)(.ctors)) + KEEP(SORT(*)(.dtors)) + /* From this point on, we don't bother about wether the insns are + below or above the 16 bits boundary. */ + *(.init0) /* Start here after reset. */ + KEEP (*(.init0)) + *(.init1) + KEEP (*(.init1)) + *(.init2) /* Clear __zero_reg__, set up stack pointer. */ + KEEP (*(.init2)) + *(.init3) + KEEP (*(.init3)) + *(.init4) /* Initialize data and BSS. */ + KEEP (*(.init4)) + *(.init5) + KEEP (*(.init5)) + *(.init6) /* C++ constructors. */ + KEEP (*(.init6)) + *(.init7) + KEEP (*(.init7)) + *(.init8) + KEEP (*(.init8)) + *(.init9) /* Call main(). */ + KEEP (*(.init9)) + *(.text) + . = ALIGN(2); + *(.text.*) + . = ALIGN(2); + *(.fini9) /* _exit() starts here. */ + KEEP (*(.fini9)) + *(.fini8) + KEEP (*(.fini8)) + *(.fini7) + KEEP (*(.fini7)) + *(.fini6) /* C++ destructors. */ + KEEP (*(.fini6)) + *(.fini5) + KEEP (*(.fini5)) + *(.fini4) + KEEP (*(.fini4)) + *(.fini3) + KEEP (*(.fini3)) + *(.fini2) + KEEP (*(.fini2)) + *(.fini1) + KEEP (*(.fini1)) + *(.fini0) /* Infinite loop after program termination. */ + KEEP (*(.fini0)) + _etext = . ; + } > text + .data : + { + PROVIDE (__data_start = .) ; + *(.data) + *(.data*) + *(.gnu.linkonce.d*) + *(.rodata) /* We need to include .rodata here if gcc is used */ + *(.rodata*) /* with -fdata-sections. */ + *(.gnu.linkonce.r*) + . = ALIGN(2); + _edata = . ; + PROVIDE (__data_end = .) ; + } > data AT> text + .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss)) + { + PROVIDE (__bss_start = .) ; + *(.bss) + *(.bss*) + *(COMMON) + PROVIDE (__bss_end = .) ; + } > data + __data_load_start = LOADADDR(.data); + __data_load_end = __data_load_start + SIZEOF(.data); + /* Global data not cleared after reset. */ + .noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit)) + { + PROVIDE (__noinit_start = .) ; + *(.noinit*) + PROVIDE (__noinit_end = .) ; + _end = . ; + PROVIDE (__heap_start = .) ; + } > data + .eeprom : + { + /* See .data above... */ + KEEP(*(.eeprom*)) + __eeprom_end = . ; + } > eeprom + .fuse : + { + KEEP(*(.fuse)) + KEEP(*(.lfuse)) + KEEP(*(.hfuse)) + KEEP(*(.efuse)) + } > fuse + .lock : + { + KEEP(*(.lock*)) + } > lock + .signature : + { + KEEP(*(.signature*)) + } > signature + .user_signatures : + { + KEEP(*(.user_signatures*)) + } > user_signatures + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } +} diff --git a/alsoneeded/avrxmega4.xr b/alsoneeded/avrxmega4.xr new file mode 100644 index 0000000..a201389 --- /dev/null +++ b/alsoneeded/avrxmega4.xr @@ -0,0 +1,216 @@ +/* Script for ld -r: link without relocation */ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ +OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") +OUTPUT_ARCH(avr:104) +__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 1024K; +__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xffa0; +__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K; +__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K; +__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K; +__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K; +__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K; +__DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : 0x802000; +MEMORY +{ + text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__ + data (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__ + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__ + fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__ + lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__ + signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__ + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__ +} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + .hash 0 : { *(.hash) } + .dynsym 0 : { *(.dynsym) } + .dynstr 0 : { *(.dynstr) } + .gnu.version 0 : { *(.gnu.version) } + .gnu.version_d 0 : { *(.gnu.version_d) } + .gnu.version_r 0 : { *(.gnu.version_r) } + .rel.init 0 : { *(.rel.init) } + .rela.init 0 : { *(.rela.init) } + .rel.text 0 : + { + *(.rel.text) + } + .rela.text 0 : + { + *(.rela.text) + } + .rel.fini 0 : { *(.rel.fini) } + .rela.fini 0 : { *(.rela.fini) } + .rel.rodata 0 : + { + *(.rel.rodata) + } + .rela.rodata 0 : + { + *(.rela.rodata) + } + .rel.data 0 : + { + *(.rel.data) + } + .rela.data 0 : + { + *(.rela.data) + } + .rel.ctors 0 : { *(.rel.ctors) } + .rela.ctors 0 : { *(.rela.ctors) } + .rel.dtors 0 : { *(.rel.dtors) } + .rela.dtors 0 : { *(.rela.dtors) } + .rel.got 0 : { *(.rel.got) } + .rela.got 0 : { *(.rela.got) } + .rel.bss 0 : { *(.rel.bss) } + .rela.bss 0 : { *(.rela.bss) } + .rel.plt 0 : { *(.rel.plt) } + .rela.plt 0 : { *(.rela.plt) } + /* Internal text space or external memory. */ + .text 0 : + { + *(.vectors) + KEEP(*(.vectors)) + /* For data that needs to reside in the lower 64k of progmem. */ + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ + /* The jump trampolines for the 16-bit limited relocs will reside here. */ + *(.trampolines) + /* avr-libc expects these data to reside in lower 64K. */ + /* For future tablejump instruction arrays for 3 byte pc devices. + We don't relax jump/call instructions within these sections. */ + *(.jumptables) + /* For code that needs to reside in the lower 128k progmem. */ + *(.lowtext) + KEEP(SORT(*)(.ctors)) + KEEP(SORT(*)(.dtors)) + /* From this point on, we don't bother about wether the insns are + below or above the 16 bits boundary. */ + *(.init0) /* Start here after reset. */ + KEEP (*(.init0)) + *(.init1) + KEEP (*(.init1)) + *(.init2) /* Clear __zero_reg__, set up stack pointer. */ + KEEP (*(.init2)) + *(.init3) + KEEP (*(.init3)) + *(.init4) /* Initialize data and BSS. */ + KEEP (*(.init4)) + *(.init5) + KEEP (*(.init5)) + *(.init6) /* C++ constructors. */ + KEEP (*(.init6)) + *(.init7) + KEEP (*(.init7)) + *(.init8) + KEEP (*(.init8)) + *(.init9) /* Call main(). */ + KEEP (*(.init9)) + *(.text) + *(.fini9) /* _exit() starts here. */ + KEEP (*(.fini9)) + *(.fini8) + KEEP (*(.fini8)) + *(.fini7) + KEEP (*(.fini7)) + *(.fini6) /* C++ destructors. */ + KEEP (*(.fini6)) + *(.fini5) + KEEP (*(.fini5)) + *(.fini4) + KEEP (*(.fini4)) + *(.fini3) + KEEP (*(.fini3)) + *(.fini2) + KEEP (*(.fini2)) + *(.fini1) + KEEP (*(.fini1)) + *(.fini0) /* Infinite loop after program termination. */ + KEEP (*(.fini0)) + } + .data 0 : + { + *(.data) + *(.gnu.linkonce.d*) + *(.rodata) /* We need to include .rodata here if gcc is used */ + /* with -fdata-sections. */ + *(.gnu.linkonce.r*) + } + .bss 0 : + { + *(.bss) + *(COMMON) + } + /* Global data not cleared after reset. */ + .noinit 0: + { + *(.noinit*) + } + .eeprom 0: + { + /* See .data above... */ + KEEP(*(.eeprom*)) + } + .fuse 0: + { + KEEP(*(.fuse)) + KEEP(*(.lfuse)) + KEEP(*(.hfuse)) + KEEP(*(.efuse)) + } + .lock 0: + { + KEEP(*(.lock*)) + } + .signature 0: + { + KEEP(*(.signature*)) + } + .user_signatures 0: + { + KEEP(*(.user_signatures*)) + } + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } +} diff --git a/alsoneeded/avrxmega4.xu b/alsoneeded/avrxmega4.xu new file mode 100644 index 0000000..430f269 --- /dev/null +++ b/alsoneeded/avrxmega4.xu @@ -0,0 +1,224 @@ +/* Script for ld -Ur: link w/out relocation, do create constructors */ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ +OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") +OUTPUT_ARCH(avr:104) +__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 1024K; +__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xffa0; +__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K; +__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K; +__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K; +__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K; +__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K; +__DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : 0x802000; +MEMORY +{ + text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__ + data (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__ + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__ + fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__ + lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__ + signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__ + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__ +} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + .hash 0 : { *(.hash) } + .dynsym 0 : { *(.dynsym) } + .dynstr 0 : { *(.dynstr) } + .gnu.version 0 : { *(.gnu.version) } + .gnu.version_d 0 : { *(.gnu.version_d) } + .gnu.version_r 0 : { *(.gnu.version_r) } + .rel.init 0 : { *(.rel.init) } + .rela.init 0 : { *(.rela.init) } + .rel.text 0 : + { + *(.rel.text) + } + .rela.text 0 : + { + *(.rela.text) + } + .rel.fini 0 : { *(.rel.fini) } + .rela.fini 0 : { *(.rela.fini) } + .rel.rodata 0 : + { + *(.rel.rodata) + } + .rela.rodata 0 : + { + *(.rela.rodata) + } + .rel.data 0 : + { + *(.rel.data) + } + .rela.data 0 : + { + *(.rela.data) + } + .rel.ctors 0 : { *(.rel.ctors) } + .rela.ctors 0 : { *(.rela.ctors) } + .rel.dtors 0 : { *(.rel.dtors) } + .rela.dtors 0 : { *(.rela.dtors) } + .rel.got 0 : { *(.rel.got) } + .rela.got 0 : { *(.rela.got) } + .rel.bss 0 : { *(.rel.bss) } + .rela.bss 0 : { *(.rela.bss) } + .rel.plt 0 : { *(.rel.plt) } + .rela.plt 0 : { *(.rela.plt) } + /* Internal text space or external memory. */ + .text 0 : + { + *(.vectors) + KEEP(*(.vectors)) + /* For data that needs to reside in the lower 64k of progmem. */ + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ + __trampolines_start = . ; + /* The jump trampolines for the 16-bit limited relocs will reside here. */ + *(.trampolines) + __trampolines_end = . ; + /* avr-libc expects these data to reside in lower 64K. */ + /* For future tablejump instruction arrays for 3 byte pc devices. + We don't relax jump/call instructions within these sections. */ + *(.jumptables) + /* For code that needs to reside in the lower 128k progmem. */ + *(.lowtext) + __ctors_start = . ; + *(.ctors) + __ctors_end = . ; + __dtors_start = . ; + *(.dtors) + __dtors_end = . ; + KEEP(SORT(*)(.ctors)) + KEEP(SORT(*)(.dtors)) + /* From this point on, we don't bother about wether the insns are + below or above the 16 bits boundary. */ + *(.init0) /* Start here after reset. */ + KEEP (*(.init0)) + *(.init1) + KEEP (*(.init1)) + *(.init2) /* Clear __zero_reg__, set up stack pointer. */ + KEEP (*(.init2)) + *(.init3) + KEEP (*(.init3)) + *(.init4) /* Initialize data and BSS. */ + KEEP (*(.init4)) + *(.init5) + KEEP (*(.init5)) + *(.init6) /* C++ constructors. */ + KEEP (*(.init6)) + *(.init7) + KEEP (*(.init7)) + *(.init8) + KEEP (*(.init8)) + *(.init9) /* Call main(). */ + KEEP (*(.init9)) + *(.text) + *(.fini9) /* _exit() starts here. */ + KEEP (*(.fini9)) + *(.fini8) + KEEP (*(.fini8)) + *(.fini7) + KEEP (*(.fini7)) + *(.fini6) /* C++ destructors. */ + KEEP (*(.fini6)) + *(.fini5) + KEEP (*(.fini5)) + *(.fini4) + KEEP (*(.fini4)) + *(.fini3) + KEEP (*(.fini3)) + *(.fini2) + KEEP (*(.fini2)) + *(.fini1) + KEEP (*(.fini1)) + *(.fini0) /* Infinite loop after program termination. */ + KEEP (*(.fini0)) + } + .data 0 : + { + *(.data) + *(.gnu.linkonce.d*) + *(.rodata) /* We need to include .rodata here if gcc is used */ + /* with -fdata-sections. */ + *(.gnu.linkonce.r*) + } + .bss 0 : + { + *(.bss) + *(COMMON) + } + /* Global data not cleared after reset. */ + .noinit 0: + { + *(.noinit*) + } + .eeprom 0: + { + /* See .data above... */ + KEEP(*(.eeprom*)) + } + .fuse 0: + { + KEEP(*(.fuse)) + KEEP(*(.lfuse)) + KEEP(*(.hfuse)) + KEEP(*(.efuse)) + } + .lock 0: + { + KEEP(*(.lock*)) + } + .signature 0: + { + KEEP(*(.signature*)) + } + .user_signatures 0: + { + KEEP(*(.user_signatures*)) + } + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } +} diff --git a/alsoneeded/eeprom.h b/alsoneeded/eeprom.h new file mode 100644 index 0000000..6f435d3 --- /dev/null +++ b/alsoneeded/eeprom.h @@ -0,0 +1,248 @@ +/* Copyright (c) 2002, 2003, 2004, 2007 Marek Michalkiewicz + Copyright (c) 2005, 2006 Bjoern Haase + Copyright (c) 2008 Atmel Corporation + Copyright (c) 2008 Wouter van Gulik + Copyright (c) 2009 Dmitry Xmelkov + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + +/* $Id$ */ + +#ifndef _AVR_EEPROM_H_ +#define _AVR_EEPROM_H_ 1 + +#include + +#if !E2END && !defined(__DOXYGEN__) && !defined(__COMPILING_AVR_LIBC__) +# warning "Device does not have EEPROM available." +#else + +#if defined (EEAR) && !defined (EEARL) && !defined (EEARH) +#define EEARL EEAR +#endif + +#ifndef __ASSEMBLER__ + +#include /* size_t */ +#include + +/** \defgroup avr_eeprom : EEPROM handling + \code #include \endcode + + This header file declares the interface to some simple library + routines suitable for handling the data EEPROM contained in the + AVR microcontrollers. The implementation uses a simple polled + mode interface. Applications that require interrupt-controlled + EEPROM access to ensure that no time will be wasted in spinloops + will have to deploy their own implementation. + + \par Notes: + + - In addition to the write functions there is a set of update ones. + This functions read each byte first and skip the burning if the + old value is the same with new. The scaning direction is from + high address to low, to obtain quick return in common cases. + + - All of the read/write functions first make sure the EEPROM is + ready to be accessed. Since this may cause long delays if a + write operation is still pending, time-critical applications + should first poll the EEPROM e. g. using eeprom_is_ready() before + attempting any actual I/O. But this functions are not wait until + SELFPRGEN in SPMCSR becomes zero. Do this manually, if your + softwate contains the Flash burning. + + - As these functions modify IO registers, they are known to be + non-reentrant. If any of these functions are used from both, + standard and interrupt context, the applications must ensure + proper protection (e.g. by disabling interrupts before accessing + them). + + - All write functions force erase_and_write programming mode. + + - For Xmega the EEPROM start address is 0, like other architectures. + The reading functions add the 0x2000 value to use EEPROM mapping into + data space. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __ATTR_PURE__ +# ifdef __DOXYGEN__ +# define __ATTR_PURE__ +# else +# define __ATTR_PURE__ __attribute__((__pure__)) +# endif +#endif + +/** \def EEMEM + \ingroup avr_eeprom + Attribute expression causing a variable to be allocated within the + .eeprom section. */ +#define EEMEM __attribute__((section(".eeprom"))) + +/** \def eeprom_is_ready + \ingroup avr_eeprom + \returns 1 if EEPROM is ready for a new read/write operation, 0 if not. + */ +#if defined (__DOXYGEN__) +# define eeprom_is_ready() +#elif defined (NVM_STATUS) +# define eeprom_is_ready() bit_is_clear (NVM_STATUS, NVM_NVMBUSY_bp) +#elif defined (NVMCTRL_STATUS) +# define eeprom_is_ready() bit_is_clear (NVMCTRL_STATUS, NVMCTRL_EEBUSY_bp) +#elif defined (DEECR) +# define eeprom_is_ready() bit_is_clear (DEECR, BSY) +#elif defined (EEPE) +# define eeprom_is_ready() bit_is_clear (EECR, EEPE) +#else +# define eeprom_is_ready() bit_is_clear (EECR, EEWE) +#endif + + +/** \def eeprom_busy_wait + \ingroup avr_eeprom + Loops until the eeprom is no longer busy. + \returns Nothing. + */ +#define eeprom_busy_wait() do {} while (!eeprom_is_ready()) + + +/** \ingroup avr_eeprom + Read one byte from EEPROM address \a __p. + */ +uint8_t eeprom_read_byte (const uint8_t *__p) __ATTR_PURE__; + +/** \ingroup avr_eeprom + Read one 16-bit word (little endian) from EEPROM address \a __p. + */ +uint16_t eeprom_read_word (const uint16_t *__p) __ATTR_PURE__; + +/** \ingroup avr_eeprom + Read one 32-bit double word (little endian) from EEPROM address \a __p. + */ +uint32_t eeprom_read_dword (const uint32_t *__p) __ATTR_PURE__; + +/** \ingroup avr_eeprom + Read one float value (little endian) from EEPROM address \a __p. + */ +float eeprom_read_float (const float *__p) __ATTR_PURE__; + +/** \ingroup avr_eeprom + Read a block of \a __n bytes from EEPROM address \a __src to SRAM + \a __dst. + */ +void eeprom_read_block (void *__dst, const void *__src, size_t __n); + + +/** \ingroup avr_eeprom + Write a byte \a __value to EEPROM address \a __p. + */ +void eeprom_write_byte (uint8_t *__p, uint8_t __value); + +/** \ingroup avr_eeprom + Write a word \a __value to EEPROM address \a __p. + */ +void eeprom_write_word (uint16_t *__p, uint16_t __value); + +/** \ingroup avr_eeprom + Write a 32-bit double word \a __value to EEPROM address \a __p. + */ +void eeprom_write_dword (uint32_t *__p, uint32_t __value); + +/** \ingroup avr_eeprom + Write a float \a __value to EEPROM address \a __p. + */ +void eeprom_write_float (float *__p, float __value); + +/** \ingroup avr_eeprom + Write a block of \a __n bytes to EEPROM address \a __dst from \a __src. + \note The argument order is mismatch with common functions like strcpy(). + */ +void eeprom_write_block (const void *__src, void *__dst, size_t __n); + + +/** \ingroup avr_eeprom + Update a byte \a __value to EEPROM address \a __p. + */ +void eeprom_update_byte (uint8_t *__p, uint8_t __value); + +/** \ingroup avr_eeprom + Update a word \a __value to EEPROM address \a __p. + */ +void eeprom_update_word (uint16_t *__p, uint16_t __value); + +/** \ingroup avr_eeprom + Update a 32-bit double word \a __value to EEPROM address \a __p. + */ +void eeprom_update_dword (uint32_t *__p, uint32_t __value); + +/** \ingroup avr_eeprom + Update a float \a __value to EEPROM address \a __p. + */ +void eeprom_update_float (float *__p, float __value); + +/** \ingroup avr_eeprom + Update a block of \a __n bytes to EEPROM address \a __dst from \a __src. + \note The argument order is mismatch with common functions like strcpy(). + */ +void eeprom_update_block (const void *__src, void *__dst, size_t __n); + + +/** \name IAR C compatibility defines */ +/*@{*/ + +/** \def _EEPUT + \ingroup avr_eeprom + Write a byte to EEPROM. Compatibility define for IAR C. */ +#define _EEPUT(addr, val) eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val)) + +/** \def __EEPUT + \ingroup avr_eeprom + Write a byte to EEPROM. Compatibility define for IAR C. */ +#define __EEPUT(addr, val) eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val)) + +/** \def _EEGET + \ingroup avr_eeprom + Read a byte from EEPROM. Compatibility define for IAR C. */ +#define _EEGET(var, addr) (var) = eeprom_read_byte ((const uint8_t *)(addr)) + +/** \def __EEGET + \ingroup avr_eeprom + Read a byte from EEPROM. Compatibility define for IAR C. */ +#define __EEGET(var, addr) (var) = eeprom_read_byte ((const uint8_t *)(addr)) + +/*@}*/ + +#ifdef __cplusplus +} +#endif + +#endif /* !__ASSEMBLER__ */ +#endif /* E2END || defined(__DOXYGEN__) || defined(__COMPILING_AVR_LIBC__) */ +#endif /* !_AVR_EEPROM_H_ */ diff --git a/alsoneeded/power.h b/alsoneeded/power.h new file mode 100644 index 0000000..d2c9a73 --- /dev/null +++ b/alsoneeded/power.h @@ -0,0 +1,1946 @@ +/* Copyright (c) 2006, 2007, 2008 Eric B. Weddington + Copyright (c) 2011 Fr�d�ric Nadeau + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + +/* $Id$ */ + +#ifndef _AVR_POWER_H_ +#define _AVR_POWER_H_ 1 + +#include +#include + + +/** \file */ +/** \defgroup avr_power : Power Reduction Management + +\code #include \endcode + +Many AVRs contain a Power Reduction Register (PRR) or Registers (PRRx) that +allow you to reduce power consumption by disabling or enabling various on-board +peripherals as needed. Some devices have the XTAL Divide Control Register +(XDIV) which offer similar functionality as System Clock Prescale +Register (CLKPR). + +There are many macros in this header file that provide an easy interface +to enable or disable on-board peripherals to reduce power. See the table below. + +\note Not all AVR devices have a Power Reduction Register (for example +the ATmega8). On those devices without a Power Reduction Register, the +power reduction macros are not available.. + +\note Not all AVR devices contain the same peripherals (for example, the LCD +interface), or they will be named differently (for example, USART and +USART0). Please consult your device's datasheet, or the header file, to +find out which macros are applicable to your device. + +\note For device using the XTAL Divide Control Register (XDIV), when prescaler +is used, Timer/Counter0 can only be used in asynchronous mode. Keep in mind +that Timer/Counter0 source shall be less than �th of peripheral clock. +Therefore, when using a typical 32.768 kHz crystal, one shall not scale +the clock below 131.072 kHz. + +*/ + + +/** \addtogroup avr_power + +\anchor avr_powermacros + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Power MacroDescription
power_aca_disable()Disable the Analog Comparator on PortA.
power_aca_enable()Enable the Analog Comparator on PortA.
power_adc_enable()Enable the Analog to Digital Converter module.
power_adc_disable()Disable the Analog to Digital Converter module.
power_adca_disable()Disable the Analog to Digital Converter module on PortA
power_adca_enable()Enable the Analog to Digital Converter module on PortA
power_evsys_disable()Disable the EVSYS module
power_evsys_enable()Enable the EVSYS module
power_hiresc_disable()Disable the HIRES module on PortC
power_hiresc_enable()Enable the HIRES module on PortC
power_lcd_enable()Enable the LCD module.
power_lcd_disable().Disable the LCD module.
power_pga_enable()Enable the Programmable Gain Amplifier module.
power_pga_disable()Disable the Programmable Gain Amplifier module.
power_pscr_enable()Enable the Reduced Power Stage Controller module.
power_pscr_disable()Disable the Reduced Power Stage Controller module.
power_psc0_enable()Enable the Power Stage Controller 0 module.
power_psc0_disable()Disable the Power Stage Controller 0 module.
power_psc1_enable()Enable the Power Stage Controller 1 module.
power_psc1_disable()Disable the Power Stage Controller 1 module.
power_psc2_enable()Enable the Power Stage Controller 2 module.
power_psc2_disable()Disable the Power Stage Controller 2 module.
power_ram0_enable()Enable the SRAM block 0 .
power_ram0_disable()Disable the SRAM block 0.
power_ram1_enable()Enable the SRAM block 1 .
power_ram1_disable()Disable the SRAM block 1.
power_ram2_enable()Enable the SRAM block 2 .
power_ram2_disable()Disable the SRAM block 2.
power_ram3_enable()Enable the SRAM block 3 .
power_ram3_disable()Disable the SRAM block 3.
power_rtc_disable()Disable the RTC module
power_rtc_enable()Enable the RTC module
power_spi_enable()Enable the Serial Peripheral Interface module.
power_spi_disable()Disable the Serial Peripheral Interface module.
power_spic_disable()Disable the SPI module on PortC
power_spic_enable()Enable the SPI module on PortC
power_spid_disable()Disable the SPI module on PortD
power_spid_enable()Enable the SPI module on PortD
power_tc0c_disable()Disable the TC0 module on PortC
power_tc0c_enable()Enable the TC0 module on PortC
power_tc0d_disable()Disable the TC0 module on PortD
power_tc0d_enable()Enable the TC0 module on PortD
power_tc0e_disable()Disable the TC0 module on PortE
power_tc0e_enable()Enable the TC0 module on PortE
power_tc0f_disable()Disable the TC0 module on PortF
power_tc0f_enable()Enable the TC0 module on PortF
power_tc1c_disable()Disable the TC1 module on PortC
power_tc1c_enable()Enable the TC1 module on PortC
power_twic_disable()Disable the Two Wire Interface module on PortC
power_twic_enable()Enable the Two Wire Interface module on PortC
power_twie_disable()Disable the Two Wire Interface module on PortE
power_twie_enable()Enable the Two Wire Interface module on PortE
power_timer0_enable()Enable the Timer 0 module.
power_timer0_disable()Disable the Timer 0 module.
power_timer1_enable()Enable the Timer 1 module.
power_timer1_disable()Disable the Timer 1 module.
power_timer2_enable()Enable the Timer 2 module.
power_timer2_disable()Disable the Timer 2 module.
power_timer3_enable()Enable the Timer 3 module.
power_timer3_disable()Disable the Timer 3 module.
power_timer4_enable()Enable the Timer 4 module.
power_timer4_disable()Disable the Timer 4 module.
power_timer5_enable()Enable the Timer 5 module.
power_timer5_disable()Disable the Timer 5 module.
power_twi_enable()Enable the Two Wire Interface module.
power_twi_disable()Disable the Two Wire Interface module.
power_usart_enable()Enable the USART module.
power_usart_disable()Disable the USART module.
power_usart0_enable()Enable the USART 0 module.
power_usart0_disable()Disable the USART 0 module.
power_usart1_enable()Enable the USART 1 module.
power_usart1_disable()Disable the USART 1 module.
power_usart2_enable()Enable the USART 2 module.
power_usart2_disable()Disable the USART 2 module.
power_usart3_enable()Enable the USART 3 module.
power_usart3_disable()Disable the USART 3 module.
power_usartc0_disable() Disable the USART0 module on PortC
power_usartc0_enable() Enable the USART0 module on PortC
power_usartd0_disable() Disable the USART0 module on PortD
power_usartd0_enable() Enable the USART0 module on PortD
power_usarte0_disable() Disable the USART0 module on PortE
power_usarte0_enable() Enable the USART0 module on PortE
power_usartf0_disable() Disable the USART0 module on PortF
power_usartf0_enable() Enable the USART0 module on PortF
power_usb_enable()Enable the USB module.
power_usb_disable()Disable the USB module.
power_usi_enable()Enable the Universal Serial Interface module.
power_usi_disable()Disable the Universal Serial Interface module.
power_vadc_enable()Enable the Voltage ADC module.
power_vadc_disable()Disable the Voltage ADC module.
power_all_enable()Enable all modules.
power_all_disable()Disable all modules.
+
+
+ +@} */ + +#if defined(__AVR_HAVE_PRR_PRADC) +#define power_adc_enable() (PRR &= (uint8_t)~(1 << PRADC)) +#define power_adc_disable() (PRR |= (uint8_t)(1 << PRADC)) +#endif + +#if defined(__AVR_HAVE_PRR_PRCAN) +#define power_can_enable() (PRR &= (uint8_t)~(1 << PRCAN)) +#define power_can_disable() (PRR |= (uint8_t)(1 << PRCAN)) +#endif + +#if defined(__AVR_HAVE_PRR_PRLCD) +#define power_lcd_enable() (PRR &= (uint8_t)~(1 << PRLCD)) +#define power_lcd_disable() (PRR |= (uint8_t)(1 << PRLCD)) +#endif + +#if defined(__AVR_HAVE_PRR_PRLIN) +#define power_lin_enable() (PRR &= (uint8_t)~(1 << PRLIN)) +#define power_lin_disable() (PRR |= (uint8_t)(1 << PRLIN)) +#endif + +#if defined(__AVR_HAVE_PRR_PRPSC) +#define power_psc_enable() (PRR &= (uint8_t)~(1 << PRPSC)) +#define power_psc_disable() (PRR |= (uint8_t)(1 << PRPSC)) +#endif + +#if defined(__AVR_HAVE_PRR_PRPSC0) +#define power_psc0_enable() (PRR &= (uint8_t)~(1 << PRPSC0)) +#define power_psc0_disable() (PRR |= (uint8_t)(1 << PRPSC0)) +#endif + +#if defined(__AVR_HAVE_PRR_PRPSC1) +#define power_psc1_enable() (PRR &= (uint8_t)~(1 << PRPSC1)) +#define power_psc1_disable() (PRR |= (uint8_t)(1 << PRPSC1)) +#endif + +#if defined(__AVR_HAVE_PRR_PRPSC2) +#define power_psc2_enable() (PRR &= (uint8_t)~(1 << PRPSC2)) +#define power_psc2_disable() (PRR |= (uint8_t)(1 << PRPSC2)) +#endif + +#if defined(__AVR_HAVE_PRR_PRPSCR) +#define power_pscr_enable() (PRR &= (uint8_t)~(1 << PRPSCR)) +#define power_pscr_disable() (PRR |= (uint8_t)(1 << PRPSCR)) +#endif + +#if defined(__AVR_HAVE_PRR_PRSPI) +#define power_spi_enable() (PRR &= (uint8_t)~(1 << PRSPI)) +#define power_spi_disable() (PRR |= (uint8_t)(1 << PRSPI)) +#endif + +#if defined(__AVR_HAVE_PRR_PRTIM0) +#define power_timer0_enable() (PRR &= (uint8_t)~(1 << PRTIM0)) +#define power_timer0_disable() (PRR |= (uint8_t)(1 << PRTIM0)) +#endif + +#if defined(__AVR_HAVE_PRR_PRTIM1) +#define power_timer1_enable() (PRR &= (uint8_t)~(1 << PRTIM1)) +#define power_timer1_disable() (PRR |= (uint8_t)(1 << PRTIM1)) +#endif + +#if defined(__AVR_HAVE_PRR_PRTIM2) +#define power_timer2_enable() (PRR &= (uint8_t)~(1 << PRTIM2)) +#define power_timer2_disable() (PRR |= (uint8_t)(1 << PRTIM2)) +#endif + +#if defined(__AVR_HAVE_PRR_PRTWI) +#define power_twi_enable() (PRR &= (uint8_t)~(1 << PRTWI)) +#define power_twi_disable() (PRR |= (uint8_t)(1 << PRTWI)) +#endif + +#if defined(__AVR_HAVE_PRR_PRUSART) +#define power_usart_enable() (PRR &= (uint8_t)~(1 << PRUSART)) +#define power_usart_disable() (PRR |= (uint8_t)(1 << PRUSART)) +#endif + +#if defined(__AVR_HAVE_PRR_PRUSART0) +#define power_usart0_enable() (PRR &= (uint8_t)~(1 << PRUSART0)) +#define power_usart0_disable() (PRR |= (uint8_t)(1 << PRUSART0)) +#endif + +#if defined(__AVR_HAVE_PRR_PRUSART1) +#define power_usart1_enable() (PRR &= (uint8_t)~(1 << PRUSART1)) +#define power_usart1_disable() (PRR |= (uint8_t)(1 << PRUSART1)) +#endif + +#if defined(__AVR_HAVE_PRR_PRUSI) +#define power_usi_enable() (PRR &= (uint8_t)~(1 << PRUSI)) +#define power_usi_disable() (PRR |= (uint8_t)(1 << PRUSI)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRADC) +#define power_adc_enable() (PRR0 &= (uint8_t)~(1 << PRADC)) +#define power_adc_disable() (PRR0 |= (uint8_t)(1 << PRADC)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRCO) +#define power_clock_output_enable() (PRR0 &= (uint8_t)~(1 << PRCO)) +#define power_clock_output_disable() (PRR0 |= (uint8_t)(1 << PRCO)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRCRC) +#define power_crc_enable() (PRR0 &= (uint8_t)~(1 << PRCRC)) +#define power_crc_disable() (PRR0 |= (uint8_t)(1 << PRCRC)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRCU) +#define power_crypto_enable() (PRR0 &= (uint8_t)~(1 << PRCU)) +#define power_crypto_disable() (PRR0 |= (uint8_t)(1 << PRCU)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRDS) +#define power_irdriver_enable() (PRR0 &= (uint8_t)~(1 << PRDS)) +#define power_irdriver_disable() (PRR0 |= (uint8_t)(1 << PRDS)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRLFR) +#define power_lfreceiver_enable() (PRR0 &= (uint8_t)~(1 << PRLFR)) +#define power_lfreceiver_disable() (PRR0 |= (uint8_t)(1 << PRLFR)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRLFRS) +#define power_lfrs_enable() (PRR0 &= (uint8_t)~(1 << PRLFRS)) +#define power_lfrs_disable() (PRR0 |= (uint8_t)(1 << PRLFRS)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRLIN) +#define power_lin_enable() (PRR0 &= (uint8_t)~(1 << PRLIN)) +#define power_lin_disable() (PRR0 |= (uint8_t)(1 << PRLIN)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRPGA) +#define power_pga_enable() (PRR0 &= (uint8_t)~(1 << PRPGA)) +#define power_pga_disable() (PRR0 |= (uint8_t)(1 << PRPGA)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRRXDC) +#define power_receive_dsp_control_enable() (PRR0 &= (uint8_t)~(1 << PRRXDC)) +#define power_receive_dsp_control_disable() (PRR0 |= (uint8_t)(1 << PRRXDC)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRSPI) +#define power_spi_enable() (PRR0 &= (uint8_t)~(1 << PRSPI)) +#define power_spi_disable() (PRR0 |= (uint8_t)(1 << PRSPI)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRSPI0) +#define power_spi_enable() (PRR0 &= (uint8_t)~(1 << PRSPI0)) +#define power_spi_disable() (PRR0 |= (uint8_t)(1 << PRSPI0)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRT0) +#define power_timer0_enable() (PRR0 &= (uint8_t)~(1 << PRT0)) +#define power_timer0_disable() (PRR0 |= (uint8_t)(1 << PRT0)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRTIM0) +#define power_timer0_enable() (PRR0 &= (uint8_t)~(1 << PRTIM0)) +#define power_timer0_disable() (PRR0 |= (uint8_t)(1 << PRTIM0)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRT1) +#define power_timer1_enable() (PRR0 &= (uint8_t)~(1 << PRT1)) +#define power_timer1_disable() (PRR0 |= (uint8_t)(1 << PRT1)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRTIM1) +#define power_timer1_enable() (PRR0 &= (uint8_t)~(1 << PRTIM1)) +#define power_timer1_disable() (PRR0 |= (uint8_t)(1 << PRTIM1)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRT2) +#define power_timer2_enable() (PRR0 &= (uint8_t)~(1 << PRT2)) +#define power_timer2_disable() (PRR0 |= (uint8_t)(1 << PRT2)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRTIM2) +#define power_timer2_enable() (PRR0 &= (uint8_t)~(1 << PRTIM2)) +#define power_timer2_disable() (PRR0 |= (uint8_t)(1 << PRTIM2)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRT3) +#define power_timer3_enable() (PRR0 &= (uint8_t)~(1 << PRT3)) +#define power_timer3_disable() (PRR0 |= (uint8_t)(1 << PRT3)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRTM) +#define power_timermodulator_enable() (PRR0 &= (uint8_t)~(1 << PRTM)) +#define power_timermodulator_disable() (PRR0 |= (uint8_t)(1 << PRTM)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRTWI) +#define power_twi_enable() (PRR0 &= (uint8_t)~(1 << PRTWI)) +#define power_twi_disable() (PRR0 |= (uint8_t)(1 << PRTWI)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRTWI0) +#define power_twi_enable() (PRR0 &= (uint8_t)~(1 << PRTWI0)) +#define power_twi_disable() (PRR0 |= (uint8_t)(1 << PRTWI0)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRTWI1) +#define power_twi1_enable() (PRR0 &= (uint8_t)~(1 << PRTWI1)) +#define power_twi1_disable() (PRR0 |= (uint8_t)(1 << PRTWI1)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRTXDC) +#define power_transmit_dsp_control_enable() (PRR0 &= (uint8_t)~(1 << PRTXDC)) +#define power_transmit_dsp_control_disable() (PRR0 |= (uint8_t)(1 << PRTXDC)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRUSART0) +#define power_usart0_enable() (PRR0 &= (uint8_t)~(1 << PRUSART0)) +#define power_usart0_disable() (PRR0 |= (uint8_t)(1 << PRUSART0)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRUSART1) +#define power_usart1_enable() (PRR0 &= (uint8_t)~(1 << PRUSART1)) +#define power_usart1_disable() (PRR0 |= (uint8_t)(1 << PRUSART1)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRVADC) +#define power_vadc_enable() (PRR0 &= (uint8_t)~(1 << PRVADC)) +#define power_vadc_disable() (PRR0 |= (uint8_t)(1 << PRVADC)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRVM) +#define power_voltage_monitor_enable() (PRR0 &= (uint8_t)~(1 << PRVM)) +#define power_voltage_monitor_disable() (PRR0 |= (uint8_t)(1 << PRVM)) +#endif + +#if defined(__AVR_HAVE_PRR0_PRVRM) +#define power_vrm_enable() (PRR0 &= (uint8_t)~(1 << PRVRM)) +#define power_vrm_disable() (PRR0 |= (uint8_t)(1 << PRVRM)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRAES) +#define power_aes_enable() (PRR1 &= (uint8_t)~(1 << PRAES)) +#define power_aes_disable() (PRR1 |= (uint8_t)(1 << PRAES)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRCI) +#define power_cinterface_enable() (PRR1 &= (uint8_t)~(1 << PRCI)) +#define power_cinterface_disable() (PRR1 |= (uint8_t)(1 << PRCI)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRHSSPI) +#define power_hsspi_enable() (PRR1 &= (uint8_t)~(1 << PRHSSPI)) +#define power_hsspi_disable() (PRR1 |= (uint8_t)(1 << PRHSSPI)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRKB) +#define power_kb_enable() (PRR1 &= (uint8_t)~(1 << PRKB)) +#define power_kb_disable() (PRR1 |= (uint8_t)(1 << PRKB)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRLFPH) +#define power_lfph_enable() (PRR1 &= (uint8_t)~(1 << PRLFPH)) +#define power_lfph_disable() (PRR1 |= (uint8_t)(1 << PRLFPH)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRLFR) +#define power_lfreceiver_enable() (PRR1 &= (uint8_t)~(1 << PRLFR)) +#define power_lfreceiver_disable() (PRR1 |= (uint8_t)(1 << PRLFR)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRLFTP) +#define power_lftp_enable() (PRR1 &= (uint8_t)~(1 << PRLFTP)) +#define power_lftp_disable() (PRR1 |= (uint8_t)(1 << PRLFTP)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRSCI) +#define power_sci_enable() (PRR1 &= (uint8_t)~(1 << PRSCI)) +#define power_sci_disable() (PRR1 |= (uint8_t)(1 << PRSCI)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRSPI) +#define power_spi_enable() (PRR1 &= (uint8_t)~(1 << PRSPI)) +#define power_spi_disable() (PRR1 |= (uint8_t)(1 << PRSPI)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRSPI1) +#define power_spi1_enable() (PRR1 &= (uint8_t)~(1 << PRSPI1)) +#define power_spi1_disable() (PRR1 |= (uint8_t)(1 << PRSPI1)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRT1) +#define power_timer1_enable() (PRR1 &= (uint8_t)~(1 << PRT1)) +#define power_timer1_disable() (PRR1 |= (uint8_t)(1 << PRT1)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRT2) +#define power_timer2_enable() (PRR1 &= (uint8_t)~(1 << PRT2)) +#define power_timer2_disable() (PRR1 |= (uint8_t)(1 << PRT2)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRT3) +#define power_timer3_enable() (PRR1 &= (uint8_t)~(1 << PRT3)) +#define power_timer3_disable() (PRR1 |= (uint8_t)(1 << PRT3)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRT4) +#define power_timer4_enable() (PRR1 &= (uint8_t)~(1 << PRT4)) +#define power_timer4_disable() (PRR1 |= (uint8_t)(1 << PRT4)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRT5) +#define power_timer5_enable() (PRR1 &= (uint8_t)~(1 << PRT5)) +#define power_timer5_disable() (PRR1 |= (uint8_t)(1 << PRT5)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRTIM3) +#define power_timer3_enable() (PRR1 &= (uint8_t)~(1 << PRTIM3)) +#define power_timer3_disable() (PRR1 |= (uint8_t)(1 << PRTIM3)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRTIM4) +#define power_timer4_enable() (PRR1 &= (uint8_t)~(1 << PRTIM4)) +#define power_timer4_disable() (PRR1 |= (uint8_t)(1 << PRTIM4)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRTIM5) +#define power_timer5_enable() (PRR1 &= (uint8_t)~(1 << PRTIM5)) +#define power_timer5_disable() (PRR1 |= (uint8_t)(1 << PRTIM5)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRTRX24) +#define power_transceiver_enable() (PRR1 &= (uint8_t)~(1 << PRTRX24)) +#define power_transceiver_disable() (PRR1 |= (uint8_t)(1 << PRTRX24)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRTWI1) +#define power_twi1_enable() (PRR1 &= (uint8_t)~(1 << PRTWI1)) +#define power_twi1_disable() (PRR1 |= (uint8_t)(1 << PRTWI1)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRUSART1) +#define power_usart1_enable() (PRR1 &= (uint8_t)~(1 << PRUSART1)) +#define power_usart1_disable() (PRR1 |= (uint8_t)(1 << PRUSART1)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRUSART2) +#define power_usart2_enable() (PRR1 &= (uint8_t)~(1 << PRUSART2)) +#define power_usart2_disable() (PRR1 |= (uint8_t)(1 << PRUSART2)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRUSART3) +#define power_usart3_enable() (PRR1 &= (uint8_t)~(1 << PRUSART3)) +#define power_usart3_disable() (PRR1 |= (uint8_t)(1 << PRUSART3)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRUSB) +#define power_usb_enable() (PRR1 &= (uint8_t)~(1 << PRUSB)) +#define power_usb_disable() (PRR1 |= (uint8_t)(1 << PRUSB)) +#endif + +#if defined(__AVR_HAVE_PRR1_PRUSBH) +#define power_usbh_enable() (PRR1 &= (uint8_t)~(1 << PRUSBH)) +#define power_usbh_disable() (PRR1 |= (uint8_t)(1 << PRUSBH)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRDF) +#define power_data_fifo_enable() (PRR2 &= (uint8_t)~(1 << PRDF)) +#define power_data_fifo_disable() (PRR2 |= (uint8_t)(1 << PRDF)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRIDS) +#define power_id_scan_enable() (PRR2 &= (uint8_t)~(1 << PRIDS)) +#define power_id_scan_disable() (PRR2 |= (uint8_t)(1 << PRIDS)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRRAM0) +#define power_ram0_enable() (PRR2 &= (uint8_t)~(1 << PRRAM0)) +#define power_ram0_disable() (PRR2 |= (uint8_t)(1 << PRRAM0)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRRAM1) +#define power_ram1_enable() (PRR2 &= (uint8_t)~(1 << PRRAM1)) +#define power_ram1_disable() (PRR2 |= (uint8_t)(1 << PRRAM1)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRRAM2) +#define power_ram2_enable() (PRR2 &= (uint8_t)~(1 << PRRAM2)) +#define power_ram2_disable() (PRR2 |= (uint8_t)(1 << PRRAM2)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRRAM3) +#define power_ram3_enable() (PRR2 &= (uint8_t)~(1 << PRRAM3)) +#define power_ram3_disable() (PRR2 |= (uint8_t)(1 << PRRAM3)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRRS) +#define power_rssi_buffer_enable() (PRR2 &= (uint8_t)~(1 << PRRS)) +#define power_rssi_buffer_disable() (PRR2 |= (uint8_t)(1 << PRRS)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRSF) +#define power_preamble_rssi_fifo_enable() (PRR2 &= (uint8_t)~(1 << PRSF)) +#define power_preamble_rssi_fifo_disable() (PRR2 |= (uint8_t)(1 << PRSF)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRSPI1) +#define power_spi1_enable() (PRR2 &= (uint8_t)~(1 << PRSPI1)) +#define power_spi1_disable() (PRR2 |= (uint8_t)(1 << PRSPI1)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRSPI2) +#define power_spi2_enable() (PRR2 &= (uint8_t)~(1 << PRSPI2)) +#define power_spi2_disable() (PRR2 |= (uint8_t)(1 << PRSPI2)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRSSM) +#define power_sequencer_state_machine_enable() (PRR2 &= (uint8_t)~(1 << PRSSM)) +#define power_sequencer_state_machine_disable() (PRR2 |= (uint8_t)(1 << PRSSM)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRTM) +#define power_tx_modulator_enable() (PRR2 &= (uint8_t)~(1 << PRTM)) +#define power_tx_modulator_disable() (PRR2 |= (uint8_t)(1 << PRTM)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRTWI1) +#define power_twi1_enable() (PRR2 &= (uint8_t)~(1 << PRTWI1)) +#define power_twi1_disable() (PRR2 |= (uint8_t)(1 << PRTWI1)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRTWI2) +#define power_twi2_enable() (PRR2 &= (uint8_t)~(1 << PRTWI2)) +#define power_twi2_disable() (PRR2 |= (uint8_t)(1 << PRTWI2)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRUSART2) +#define power_usart2_enable() (PRR2 &= (uint8_t)~(1 << PRUSART2)) +#define power_usart2_disable() (PRR2 |= (uint8_t)(1 << PRUSART2)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRXA) +#define power_rx_buffer_A_enable() (PRR2 &= (uint8_t)~(1 << PRXA)) +#define power_rx_buffer_A_disable() (PRR2 |= (uint8_t)(1 << PRXA)) +#endif + +#if defined(__AVR_HAVE_PRR2_PRXB) +#define power_rx_buffer_B_enable() (PRR2 &= (uint8_t)~(1 << PRXB)) +#define power_rx_buffer_B_disable() (PRR2 |= (uint8_t)(1 << PRXB)) +#endif + +#if defined(__AVR_HAVE_PRGEN_AES) +#define power_aes_enable() (PR_PRGEN &= (uint8_t)~(PR_AES_bm)) +#define power_aes_disable() (PR_PRGEN |= (uint8_t)PR_AES_bm) +#endif + +#if defined(__AVR_HAVE_PRGEN_DMA) +#define power_dma_enable() (PR_PRGEN &= (uint8_t)~(PR_DMA_bm)) +#define power_dma_disable() (PR_PRGEN |= (uint8_t)PR_DMA_bm) +#endif + +#if defined(__AVR_HAVE_PRGEN_EBI) +#define power_ebi_enable() (PR_PRGEN &= (uint8_t)~(PR_EBI_bm)) +#define power_ebi_disable() (PR_PRGEN |= (uint8_t)PR_EBI_bm) +#endif + +#if defined(__AVR_HAVE_PRGEN_EDMA) +#define power_edma_enable() (PR_PRGEN &= (uint8_t)~(PR_EDMA_bm)) +#define power_edma_disable() (PR_PRGEN |= (uint8_t)PR_EDMA_bm) +#endif + +#if defined(__AVR_HAVE_PRGEN_EVSYS) +#define power_evsys_enable() (PR_PRGEN &= (uint8_t)~(PR_EVSYS_bm)) +#define power_evsys_disable() (PR_PRGEN |= (uint8_t)PR_EVSYS_bm) +#endif + +#if defined(__AVR_HAVE_PRGEN_LCD) +#define power_lcd_enable() (PR_PRGEN &= (uint8_t)~(PR_LCD_bm)) +#define power_lcd_disable() (PR_PRGEN |= (uint8_t)PR_LCD_bm) +#endif + +#if defined(__AVR_HAVE_PRGEN_RTC) +#define power_rtc_enable() (PR_PRGEN &= (uint8_t)~(PR_RTC_bm)) +#define power_rtc_disable() (PR_PRGEN |= (uint8_t)PR_RTC_bm) +#endif + +#if defined(__AVR_HAVE_PRGEN_USB) +#define power_usb_enable() (PR_PRGEN &= (uint8_t)~(PR_USB_bm)) +#define power_usb_disable() (PR_PRGEN &= (uint8_t)(PR_USB_bm)) +#endif + +#if defined(__AVR_HAVE_PRGEN_XCL) +#define power_xcl_enable() (PR_PRGEN &= (uint8_t)~(PR_XCL_bm)) +#define power_xcl_disable() (PR_PRGEN |= (uint8_t)PR_XCL_bm) +#endif + +#if defined(__AVR_HAVE_PRPA_AC) +#define power_aca_enable() (PR_PRPA &= (uint8_t)~(PR_AC_bm)) +#define power_aca_disable() (PR_PRPA |= (uint8_t)PR_AC_bm) +#endif + +#if defined(__AVR_HAVE_PRPA_ADC) +#define power_adca_enable() (PR_PRPA &= (uint8_t)~(PR_ADC_bm)) +#define power_adca_disable() (PR_PRPA |= (uint8_t)PR_ADC_bm) +#endif + +#if defined(__AVR_HAVE_PRPA_DAC) +#define power_daca_enable() (PR_PRPA &= (uint8_t)~(PR_DAC_bm)) +#define power_daca_disable() (PR_PRPA |= (uint8_t)PR_DAC_bm) +#endif + +#if defined(__AVR_HAVE_PRPB_AC) +#define power_acb_enable() (PR_PRPB &= (uint8_t)~(PR_AC_bm)) +#define power_acb_disable() (PR_PRPB |= (uint8_t)PR_AC_bm) +#endif + +#if defined(__AVR_HAVE_PRPB_ADC) +#define power_adcb_enable() (PR_PRPB &= (uint8_t)~(PR_ADC_bm)) +#define power_adcb_disable() (PR_PRPB |= (uint8_t)PR_ADC_bm) +#endif + +#if defined(__AVR_HAVE_PRPB_DAC) +#define power_dacb_enable() (PR_PRPB &= (uint8_t)~(PR_DAC_bm)) +#define power_dacb_disable() (PR_PRPB |= (uint8_t)PR_DAC_bm) +#endif + +#if defined(__AVR_HAVE_PRPC_HIRES) +#define power_hiresc_enable() (PR_PRPC &= (uint8_t)~(PR_HIRES_bm)) +#define power_hiresc_disable() (PR_PRPC |= (uint8_t)PR_HIRES_bm) +#endif + +#if defined(__AVR_HAVE_PRPC_SPI) +#define power_spic_enable() (PR_PRPC &= (uint8_t)~(PR_SPI_bm)) +#define power_spic_disable() (PR_PRPC |= (uint8_t)PR_SPI_bm) +#endif + +#if defined(__AVR_HAVE_PRPC_TC0) +#define power_tc0c_enable() (PR_PRPC &= (uint8_t)~(PR_TC0_bm)) +#define power_tc0c_disable() (PR_PRPC |= (uint8_t)PR_TC0_bm) +#endif + +#if defined(__AVR_HAVE_PRPC_TC1) +#define power_tc1c_enable() (PR_PRPC &= (uint8_t)~(PR_TC1_bm)) +#define power_tc1c_disable() (PR_PRPC |= (uint8_t)PR_TC1_bm) +#endif + +#if defined(__AVR_HAVE_PRPC_TC4) +#define power_tc4c_enable() (PR_PRPC &= (uint8_t)~(PR_TC4_bm)) +#define power_tc4c_disable() (PR_PRPC |= (uint8_t)PR_TC4_bm) +#endif + +#if defined(__AVR_HAVE_PRPC_TC5) +#define power_tc5c_enable() (PR_PRPC &= (uint8_t)~(PR_TC5_bm)) +#define power_tc5c_disable() (PR_PRPC |= (uint8_t)PR_TC5_bm) +#endif + +#if defined(__AVR_HAVE_PRPC_TWI) +#define power_twic_enable() (PR_PRPC &= (uint8_t)~(PR_TWI_bm)) +#define power_twic_disable() (PR_PRPC |= (uint8_t)PR_TWI_bm) +#endif + +#if defined(__AVR_HAVE_PRPC_USART0) +#define power_usartc0_enable() (PR_PRPC &= (uint8_t)~(PR_USART0_bm)) +#define power_usartc0_disable() (PR_PRPC |= (uint8_t)PR_USART0_bm) +#endif + +#if defined(__AVR_HAVE_PRPC_USART1) +#define power_usartc1_enable() (PR_PRPC &= (uint8_t)~(PR_USART1_bm)) +#define power_usartc1_disable() (PR_PRPC |= (uint8_t)PR_USART1_bm) +#endif + +#if defined(__AVR_HAVE_PRPD_HIRES) +#define power_hiresd_enable() (PR_PRPD &= (uint8_t)~(PR_HIRES_bm)) +#define power_hiresd_disable() (PR_PRPD |= (uint8_t)PR_HIRES_bm) +#endif + +#if defined(__AVR_HAVE_PRPD_SPI) +#define power_spid_enable() (PR_PRPD &= (uint8_t)~(PR_SPI_bm)) +#define power_spid_disable() (PR_PRPD |= (uint8_t)PR_SPI_bm) +#endif + +#if defined(__AVR_HAVE_PRPD_TC0) +#define power_tc0d_enable() (PR_PRPD &= (uint8_t)~(PR_TC0_bm)) +#define power_tc0d_disable() (PR_PRPD |= (uint8_t)PR_TC0_bm) +#endif + +#if defined(__AVR_HAVE_PRPD_TC1) +#define power_tc1d_enable() (PR_PRPD &= (uint8_t)~(PR_TC1_bm)) +#define power_tc1d_disable() (PR_PRPD |= (uint8_t)PR_TC1_bm) +#endif + +#if defined(__AVR_HAVE_PRPD_TC5) +#define power_tc5d_enable() (PR_PRPD &= (uint8_t)~(PR_TC5_bm)) +#define power_tc5d_disable() (PR_PRPD |= (uint8_t)PR_TC5_bm) +#endif + +#if defined(__AVR_HAVE_PRPD_TWI) +#define power_twid_enable() (PR_PRPD &= (uint8_t)~(PR_TWI_bm)) +#define power_twid_disable() (PR_PRPD |= (uint8_t)PR_TWI_bm) +#endif + +#if defined(__AVR_HAVE_PRPD_USART0) +#define power_usartd0_enable() (PR_PRPD &= (uint8_t)~(PR_USART0_bm)) +#define power_usartd0_disable() (PR_PRPD |= (uint8_t)PR_USART0_bm) +#endif + +#if defined(__AVR_HAVE_PRPD_USART1) +#define power_usartd1_enable() (PR_PRPD &= (uint8_t)~(PR_USART1_bm)) +#define power_usartd1_disable() (PR_PRPD |= (uint8_t)PR_USART1_bm) +#endif + +#if defined(__AVR_HAVE_PRPE_HIRES) +#define power_hirese_enable() (PR_PRPE &= (uint8_t)~(PR_HIRES_bm)) +#define power_hirese_disable() (PR_PRPE |= (uint8_t)PR_HIRES_bm) +#endif + +#if defined(__AVR_HAVE_PRPE_SPI) +#define power_spie_enable() (PR_PRPE &= (uint8_t)~(PR_SPI_bm)) +#define power_spie_disable() (PR_PRPE |= (uint8_t)PR_SPI_bm) +#endif + +#if defined(__AVR_HAVE_PRPE_TC0) +#define power_tc0e_enable() (PR_PRPE &= (uint8_t)~(PR_TC0_bm)) +#define power_tc0e_disable() (PR_PRPE |= (uint8_t)PR_TC0_bm) +#endif + +#if defined(__AVR_HAVE_PRPE_TC1) +#define power_tc1e_enable() (PR_PRPE &= (uint8_t)~(PR_TC1_bm)) +#define power_tc1e_disable() (PR_PRPE |= (uint8_t)PR_TC1_bm) +#endif + +#if defined(__AVR_HAVE_PRPE_TWI) +#define power_twie_enable() (PR_PRPE &= (uint8_t)~(PR_TWI_bm)) +#define power_twie_disable() (PR_PRPE |= (uint8_t)PR_TWI_bm) +#endif + +#if defined(__AVR_HAVE_PRPE_USART0) +#define power_usarte0_enable() (PR_PRPE &= (uint8_t)~(PR_USART0_bm)) +#define power_usarte0_disable() (PR_PRPE |= (uint8_t)PR_USART0_bm) +#endif + +#if defined(__AVR_HAVE_PRPE_USART1) +#define power_usarte1_enable() (PR_PRPE &= (uint8_t)~(PR_USART1_bm)) +#define power_usarte1_disable() (PR_PRPE |= (uint8_t)PR_USART1_bm) +#endif + +#if defined(__AVR_HAVE_PRPF_HIRES) +#define power_hiresf_enable() (PR_PRPF &= (uint8_t)~(PR_HIRES_bm)) +#define power_hiresf_disable() (PR_PRPF |= (uint8_t)PR_HIRES_bm) +#endif + +#if defined(__AVR_HAVE_PRPF_SPI) +#define power_spif_enable() (PR_PRPF &= (uint8_t)~(PR_SPI_bm)) +#define power_spif_disable() (PR_PRPF |= (uint8_t)PR_SPI_bm) +#endif + +#if defined(__AVR_HAVE_PRPF_TC0) +#define power_tc0f_enable() (PR_PRPF &= (uint8_t)~(PR_TC0_bm)) +#define power_tc0f_disable() (PR_PRPF |= (uint8_t)PR_TC0_bm) +#endif + +#if defined(__AVR_HAVE_PRPF_TC1) +#define power_tc1f_enable() (PR_PRPF &= (uint8_t)~(PR_TC1_bm)) +#define power_tc1f_disable() (PR_PRPF |= (uint8_t)PR_TC1_bm) +#endif + +#if defined(__AVR_HAVE_PRPF_TWI) +#define power_twif_enable() (PR_PRPF &= (uint8_t)~(PR_TWI_bm)) +#define power_twif_disable() (PR_PRPF |= (uint8_t)PR_TWI_bm) +#endif + +#if defined(__AVR_HAVE_PRPF_USART0) +#define power_usartf0_enable() (PR_PRPF &= (uint8_t)~(PR_USART0_bm)) +#define power_usartf0_disable() (PR_PRPF |= (uint8_t)PR_USART0_bm) +#endif + +#if defined(__AVR_HAVE_PRPF_USART1) +#define power_usartf1_enable() (PR_PRPF &= (uint8_t)~(PR_USART1_bm)) +#define power_usartf1_disable() (PR_PRPF |= (uint8_t)PR_USART1_bm) +#endif + +static __inline void +__attribute__ ((__always_inline__)) +__power_all_enable() +{ +#ifdef __AVR_HAVE_PRR + PRR &= (uint8_t)~(__AVR_HAVE_PRR); +#endif + +#ifdef __AVR_HAVE_PRR0 + PRR0 &= (uint8_t)~(__AVR_HAVE_PRR0); +#endif + +#ifdef __AVR_HAVE_PRR1 + PRR1 &= (uint8_t)~(__AVR_HAVE_PRR1); +#endif + +#ifdef __AVR_HAVE_PRR2 + PRR2 &= (uint8_t)~(__AVR_HAVE_PRR2); +#endif + +#ifdef __AVR_HAVE_PRGEN + PR_PRGEN &= (uint8_t)~(__AVR_HAVE_PRGEN); +#endif + +#ifdef __AVR_HAVE_PRPA + PR_PRPA &= (uint8_t)~(__AVR_HAVE_PRPA); +#endif + +#ifdef __AVR_HAVE_PRPB + PR_PRPB &= (uint8_t)~(__AVR_HAVE_PRPB); +#endif + +#ifdef __AVR_HAVE_PRPC + PR_PRPC &= (uint8_t)~(__AVR_HAVE_PRPC); +#endif + +#ifdef __AVR_HAVE_PRPD + PR_PRPD &= (uint8_t)~(__AVR_HAVE_PRPD); +#endif + +#ifdef __AVR_HAVE_PRPE + PR_PRPE &= (uint8_t)~(__AVR_HAVE_PRPE); +#endif + +#ifdef __AVR_HAVE_PRPF + PR_PRPF &= (uint8_t)~(__AVR_HAVE_PRPF); +#endif +} + +static __inline void +__attribute__ ((__always_inline__)) +__power_all_disable() +{ +#ifdef __AVR_HAVE_PRR + PRR |= (uint8_t)(__AVR_HAVE_PRR); +#endif + +#ifdef __AVR_HAVE_PRR0 + PRR0 |= (uint8_t)(__AVR_HAVE_PRR0); +#endif + +#ifdef __AVR_HAVE_PRR1 + PRR1 |= (uint8_t)(__AVR_HAVE_PRR1); +#endif + +#ifdef __AVR_HAVE_PRR2 + PRR2 |= (uint8_t)(__AVR_HAVE_PRR2); +#endif + +#ifdef __AVR_HAVE_PRGEN + PR_PRGEN |= (uint8_t)(__AVR_HAVE_PRGEN); +#endif + +#ifdef __AVR_HAVE_PRPA + PR_PRPA |= (uint8_t)(__AVR_HAVE_PRPA); +#endif + +#ifdef __AVR_HAVE_PRPB + PR_PRPB |= (uint8_t)(__AVR_HAVE_PRPB); +#endif + +#ifdef __AVR_HAVE_PRPC + PR_PRPC |= (uint8_t)(__AVR_HAVE_PRPC); +#endif + +#ifdef __AVR_HAVE_PRPD + PR_PRPD |= (uint8_t)(__AVR_HAVE_PRPD); +#endif + +#ifdef __AVR_HAVE_PRPE + PR_PRPE |= (uint8_t)(__AVR_HAVE_PRPE); +#endif + +#ifdef __AVR_HAVE_PRPF + PR_PRPF |= (uint8_t)(__AVR_HAVE_PRPF); +#endif +} + +#ifndef __DOXYGEN__ +#ifndef power_all_enable +#define power_all_enable() __power_all_enable() +#endif + +#ifndef power_all_disable +#define power_all_disable() __power_all_disable() +#endif +#endif /* !__DOXYGEN__ */ + + +#if defined(__AVR_AT90CAN32__) \ +|| defined(__AVR_AT90CAN64__) \ +|| defined(__AVR_AT90CAN128__) \ +|| defined(__AVR_AT90PWM1__) \ +|| defined(__AVR_AT90PWM2__) \ +|| defined(__AVR_AT90PWM2B__) \ +|| defined(__AVR_AT90PWM3__) \ +|| defined(__AVR_AT90PWM3B__) \ +|| defined(__AVR_AT90PWM81__) \ +|| defined(__AVR_AT90PWM161__) \ +|| defined(__AVR_AT90PWM216__) \ +|| defined(__AVR_AT90PWM316__) \ +|| defined(__AVR_AT90SCR100__) \ +|| defined(__AVR_AT90USB646__) \ +|| defined(__AVR_AT90USB647__) \ +|| defined(__AVR_AT90USB82__) \ +|| defined(__AVR_AT90USB1286__) \ +|| defined(__AVR_AT90USB1287__) \ +|| defined(__AVR_AT90USB162__) \ +|| defined(__AVR_ATA5505__) \ +|| defined(__AVR_ATA5272__) \ +|| defined(__AVR_ATA6617C__) \ +|| defined(__AVR_ATA664251__) \ +|| defined(__AVR_ATmega1280__) \ +|| defined(__AVR_ATmega1281__) \ +|| defined(__AVR_ATmega1284__) \ +|| defined(__AVR_ATmega128RFA1__) \ +|| defined(__AVR_ATmega1284RFR2__) \ +|| defined(__AVR_ATmega128RFR2__) \ +|| defined(__AVR_ATmega1284P__) \ +|| defined(__AVR_ATmega162__) \ +|| defined(__AVR_ATmega164A__) \ +|| defined(__AVR_ATmega164P__) \ +|| defined(__AVR_ATmega164PA__) \ +|| defined(__AVR_ATmega165__) \ +|| defined(__AVR_ATmega165A__) \ +|| defined(__AVR_ATmega165P__) \ +|| defined(__AVR_ATmega165PA__) \ +|| defined(__AVR_ATmega168__) \ +|| defined(__AVR_ATmega168A__) \ +|| defined(__AVR_ATmega168P__) \ +|| defined(__AVR_ATmega168PA__) \ +|| defined(__AVR_ATmega168PB__) \ +|| defined(__AVR_ATmega169__) \ +|| defined(__AVR_ATmega169A__) \ +|| defined(__AVR_ATmega169P__) \ +|| defined(__AVR_ATmega169PA__) \ +|| defined(__AVR_ATmega16M1__) \ +|| defined(__AVR_ATmega16U2__) \ +|| defined(__AVR_ATmega16U4__) \ +|| defined(__AVR_ATmega2560__) \ +|| defined(__AVR_ATmega2561__) \ +|| defined(__AVR_ATmega2564RFR2__) \ +|| defined(__AVR_ATmega256RFR2__) \ +|| defined(__AVR_ATmega324A__) \ +|| defined(__AVR_ATmega324P__) \ +|| defined(__AVR_ATmega324PA__) \ +|| defined(__AVR_ATmega324PB__) \ +|| defined(__AVR_ATmega325__) \ +|| defined(__AVR_ATmega325A__) \ +|| defined(__AVR_ATmega325P__) \ +|| defined(__AVR_ATmega325PA__) \ +|| defined(__AVR_ATmega3250__) \ +|| defined(__AVR_ATmega3250A__) \ +|| defined(__AVR_ATmega3250P__) \ +|| defined(__AVR_ATmega3250PA__) \ +|| defined(__AVR_ATmega328__) \ +|| defined(__AVR_ATmega328P__) \ +|| defined(__AVR_ATmega328PB__) \ +|| defined(__AVR_ATmega329__) \ +|| defined(__AVR_ATmega329A__) \ +|| defined(__AVR_ATmega329P__) \ +|| defined(__AVR_ATmega329PA__) \ +|| defined(__AVR_ATmega3290__) \ +|| defined(__AVR_ATmega3290A__) \ +|| defined(__AVR_ATmega3290P__) \ +|| defined(__AVR_ATmega3290PA__) \ +|| defined(__AVR_ATmega32C1__) \ +|| defined(__AVR_ATmega32M1__) \ +|| defined(__AVR_ATmega32U2__) \ +|| defined(__AVR_ATmega32U4__) \ +|| defined(__AVR_ATmega32U6__) \ +|| defined(__AVR_ATmega48__) \ +|| defined(__AVR_ATmega48A__) \ +|| defined(__AVR_ATmega48PA__) \ +|| defined(__AVR_ATmega48PB__) \ +|| defined(__AVR_ATmega48P__) \ +|| defined(__AVR_ATmega640__) \ +|| defined(__AVR_ATmega649P__) \ +|| defined(__AVR_ATmega644__) \ +|| defined(__AVR_ATmega644A__) \ +|| defined(__AVR_ATmega644P__) \ +|| defined(__AVR_ATmega644PA__) \ +|| defined(__AVR_ATmega645__) \ +|| defined(__AVR_ATmega645A__) \ +|| defined(__AVR_ATmega645P__) \ +|| defined(__AVR_ATmega6450__) \ +|| defined(__AVR_ATmega6450A__) \ +|| defined(__AVR_ATmega6450P__) \ +|| defined(__AVR_ATmega649__) \ +|| defined(__AVR_ATmega649A__) \ +|| defined(__AVR_ATmega64M1__) \ +|| defined(__AVR_ATmega64C1__) \ +|| defined(__AVR_ATmega88A__) \ +|| defined(__AVR_ATmega88PA__) \ +|| defined(__AVR_ATmega88PB__) \ +|| defined(__AVR_ATmega6490__) \ +|| defined(__AVR_ATmega6490A__) \ +|| defined(__AVR_ATmega6490P__) \ +|| defined(__AVR_ATmega644RFR2__) \ +|| defined(__AVR_ATmega64RFR2__) \ +|| defined(__AVR_ATmega88__) \ +|| defined(__AVR_ATmega88P__) \ +|| defined(__AVR_ATmega8U2__) \ +|| defined(__AVR_ATmega16U2__) \ +|| defined(__AVR_ATmega32U2__) \ +|| defined(__AVR_ATtiny48__) \ +|| defined(__AVR_ATtiny88__) \ +|| defined(__AVR_ATtiny87__) \ +|| defined(__AVR_ATtiny167__) \ +|| defined(__DOXYGEN__) + + +/** \addtogroup avr_power + +Some of the newer AVRs contain a System Clock Prescale Register (CLKPR) that +allows you to decrease the system clock frequency and the power consumption +when the need for processing power is low. +On some earlier AVRs (ATmega103, ATmega64, ATmega128), similar +functionality can be achieved through the XTAL Divide Control Register. +Below are two macros and an enumerated type that can be used to +interface to the Clock Prescale Register or +XTAL Divide Control Register. + +\note Not all AVR devices have a clock prescaler. On those devices +without a Clock Prescale Register or XTAL Divide Control Register, these +macros are not available. +*/ + + +/** \addtogroup avr_power +\code +typedef enum +{ + clock_div_1 = 0, + clock_div_2 = 1, + clock_div_4 = 2, + clock_div_8 = 3, + clock_div_16 = 4, + clock_div_32 = 5, + clock_div_64 = 6, + clock_div_128 = 7, + clock_div_256 = 8, + clock_div_1_rc = 15, // ATmega128RFA1 only +} clock_div_t; +\endcode +Clock prescaler setting enumerations for device using +System Clock Prescale Register. + +\code +typedef enum +{ + clock_div_1 = 1, + clock_div_2 = 2, + clock_div_4 = 4, + clock_div_8 = 8, + clock_div_16 = 16, + clock_div_32 = 32, + clock_div_64 = 64, + clock_div_128 = 128 +} clock_div_t; +\endcode +Clock prescaler setting enumerations for device using +XTAL Divide Control Register. + +*/ +#ifndef __DOXYGEN__ +typedef enum +{ + clock_div_1 = 0, + clock_div_2 = 1, + clock_div_4 = 2, + clock_div_8 = 3, + clock_div_16 = 4, + clock_div_32 = 5, + clock_div_64 = 6, + clock_div_128 = 7, + clock_div_256 = 8 +#if defined(__AVR_ATmega128RFA1__) \ +|| defined(__AVR_ATmega2564RFR2__) \ +|| defined(__AVR_ATmega1284RFR2__) \ +|| defined(__AVR_ATmega644RFR2__) \ +|| defined(__AVR_ATmega256RFR2__) \ +|| defined(__AVR_ATmega128RFR2__) \ +|| defined(__AVR_ATmega64RFR2__) + , clock_div_1_rc = 15 +#endif +} clock_div_t; + +static __inline__ void clock_prescale_set(clock_div_t) __attribute__((__always_inline__)); +#endif /* !__DOXYGEN__ */ + +/** + \ingroup avr_power + \fn clock_prescale_set(clock_div_t x) + +Set the clock prescaler register select bits, selecting a system clock +division setting. This function is inlined, even if compiler +optimizations are disabled. + +The type of \c x is \c clock_div_t. + +\note For device with XTAL Divide Control Register (XDIV), \c x can actually range +from 1 to 129. Thus, one does not need to use \c clock_div_t type as argument. +*/ +void clock_prescale_set(clock_div_t __x) +{ + uint8_t __tmp = _BV(CLKPCE); + __asm__ __volatile__ ( + "in __tmp_reg__,__SREG__" "\n\t" + "cli" "\n\t" + "sts %1, %0" "\n\t" + "sts %1, %2" "\n\t" + "out __SREG__, __tmp_reg__" + : /* no outputs */ + : "d" (__tmp), + "M" (_SFR_MEM_ADDR(CLKPR)), + "d" (__x) + : "r0"); +} + +/** \addtogroup avr_power +\def clock_prescale_get() +Gets and returns the clock prescaler register setting. The return type is \c clock_div_t. + +\note For device with XTAL Divide Control Register (XDIV), return can actually +range from 1 to 129. Care should be taken has the return value could differ from the +typedef enum clock_div_t. This should only happen if clock_prescale_set was previously +called with a value other than those defined by \c clock_div_t. +*/ +#define clock_prescale_get() (clock_div_t)(CLKPR & (uint8_t)((1< 129)) + { + return;//Invalid value. + } + else + { + uint8_t __tmp = 0; + //Algo explained: + //1 - Clear XDIV in order for it to accept a new value (actually only + // XDIVEN need to be cleared, but clearing XDIV is faster than + // read-modify-write since we will rewrite XDIV later anyway) + //2 - wait 8 clock cycle for stability, see datasheet erreta + //3 - Exist if requested prescaller is 1 + //4 - Calculate XDIV6..0 value = 129 - __x + //5 - Set XDIVEN bit in calculated value + //6 - write XDIV with calculated value + //7 - wait 8 clock cycle for stability, see datasheet erreta + __asm__ __volatile__ ( + "in __tmp_reg__,__SREG__" "\n\t" + "cli" "\n\t" + "out %1, __zero_reg__" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "cpi %0, 0x01" "\n\t" + "breq L_%=" "\n\t" + "ldi %2, 0x81" "\n\t" //129 + "sub %2, %0" "\n\t" + "ori %2, 0x80" "\n\t" //128 + "out %1, %2" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "nop" "\n\t" + "L_%=: " "out __SREG__, __tmp_reg__" + : /* no outputs */ + :"d" (__x), + "I" (_SFR_IO_ADDR(XDIV)), + "d" (__tmp) + : "r0"); + } +} + +static __inline__ clock_div_t clock_prescale_get(void) __attribute__((__always_inline__)); + +clock_div_t clock_prescale_get(void) +{ + if(bit_is_clear(XDIV, XDIVEN)) + { + return 1; + } + else + { + return (clock_div_t)(129 - (XDIV & 0x7F)); + } +} + +#elif defined(__AVR_ATtiny4__) \ +|| defined(__AVR_ATtiny5__) \ +|| defined(__AVR_ATtiny9__) \ +|| defined(__AVR_ATtiny10__) \ +|| defined(__AVR_ATtiny20__) \ +|| defined(__AVR_ATtiny40__) \ + +typedef enum +{ + clock_div_1 = 0, + clock_div_2 = 1, + clock_div_4 = 2, + clock_div_8 = 3, + clock_div_16 = 4, + clock_div_32 = 5, + clock_div_64 = 6, + clock_div_128 = 7, + clock_div_256 = 8 +} clock_div_t; + +static __inline__ void clock_prescale_set(clock_div_t) __attribute__((__always_inline__)); + +void clock_prescale_set(clock_div_t __x) +{ + uint8_t __tmp = 0xD8; + __asm__ __volatile__ ( + "in __tmp_reg__,__SREG__" "\n\t" + "cli" "\n\t" + "out %1, %0" "\n\t" + "out %2, %3" "\n\t" + "out __SREG__, __tmp_reg__" + : /* no outputs */ + : "d" (__tmp), + "I" (_SFR_IO_ADDR(CCP)), + "I" (_SFR_IO_ADDR(CLKPSR)), + "d" (__x) + : "r16"); +} + +#define clock_prescale_get() (clock_div_t)(CLKPSR & (uint8_t)((1< ../objdir/avr/include/avr/io.h + fi +done +echo "ENDING THE MAGIC" +#NEW_ALL_FILES=`find ../objdir` + +#echo "NEW FILES ADDED: " +#diff <(echo "$ALL_FILES" ) <(echo "$NEW_ALL_FILES") + +cd .. + diff --git a/atpack.build.bash b/atpack.build.bash index f3ee5af..fe199bd 100755 --- a/atpack.build.bash +++ b/atpack.build.bash @@ -5,18 +5,20 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. source build.conf +wget ${ATMEL_ATMEGA_PACK_URL} + mkdir -p atpack cd atpack rm -rf * diff --git a/atpack.tiny.build.bash b/atpack.tiny.build.bash index e69db0a..ea04675 100755 --- a/atpack.tiny.build.bash +++ b/atpack.tiny.build.bash @@ -5,18 +5,20 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. source build.conf +wget ${ATMEL_ATTINY_PACK_URL} + mkdir -p atpack cd atpack rm -rf * diff --git a/build.conf b/build.conf index 9fd31c3..f9b2fa1 100644 --- a/build.conf +++ b/build.conf @@ -21,11 +21,15 @@ MPFR_VERSION=3.1.0 ATMEL_ATMEGA_PACK_VERSION=1.4.351 ATMEL_ATMEGA_PACK_FILENAME=Atmel.ATmega_DFP.${ATMEL_ATMEGA_PACK_VERSION} -ATMEL_ATMEGA_PACK_URL=${ATMEL_PACKS_SOURCES}/${ATMEL_ATMEGA_PACK_FILENAME}.atpack +ATMEL_ATMEGA_PACK_URL=${ATMEL_PACKS_SOURCES}${ATMEL_ATMEGA_PACK_FILENAME}.atpack ATMEL_ATTINY_PACK_VERSION=1.4.310 ATMEL_ATTINY_PACK_FILENAME=Atmel.ATtiny_DFP.${ATMEL_ATTINY_PACK_VERSION} -ATMEL_ATTINY_PACK_URL=${ATMEL_PACKS_SOURCES}/${ATMEL_ATTINY_PACK_FILENAME}.atpack +ATMEL_ATTINY_PACK_URL=${ATMEL_PACKS_SOURCES}${ATMEL_ATTINY_PACK_FILENAME}.atpack + +ATMEL_DX_PACK_VERSION=1.0.27 +ATMEL_DX_PACK_FILENAME=Atmel.AVR-Dx_DFP.${ATMEL_DX_PACK_VERSION} +ATMEL_DX_PACK_URL=${ATMEL_PACKS_SOURCES}${ATMEL_DX_PACK_FILENAME}.atpack # With any luck, you don't need to edit the below ################################################################################ diff --git a/package-avr-gcc.bash b/package-avr-gcc.bash index 5f4610d..960c9bc 100755 --- a/package-avr-gcc.bash +++ b/package-avr-gcc.bash @@ -99,15 +99,10 @@ rm -rf toolsdir objdir *-build rm -rf objdir/{info,man,share} -if [[ -f ${ATMEL_ATMEGA_PACK_FILENAME}.atpack ]] ; then -#add extra files from atpack (only if the package is altrady there) ${BASH} ./atpack.build.bash -fi - -if [[ -f ${ATMEL_ATTINY_PACK_FILENAME}.atpack ]] ; then -#add extra files from atpack (only if the package is altrady there) ${BASH} ./atpack.tiny.build.bash -fi +${BASH} ./atpack.Dx.build.bash + # if producing a windows build, compress as zip and # copy *toolchain-precompiled* content to any folder containing a .exe