From b793c21892be7c11e628b1949fe9ec0c041e0fdc Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay <avr@gjlay.de> Date: Thu, 11 Jan 2024 14:41:17 +0100 Subject: [PATCH] AVR: Some minor improvements to the TEXI documentation. gcc/ * config/avr/avr-devices.cc (avr_texinfo): Adjust documentation for Reduced Tiny. * config/avr/gen-avr-mmcu-texi.cc (main): Add @anchor for each core. * doc/extend.texi (AVR Variable Attributes): Improve documentation of io, io_low and address attributes. * doc/invoke.texi (AVR Options): Add some anchors for external refs. * doc/avr-mmcu.texi: Rebuild. --- gcc/config/avr/avr-devices.cc | 4 ++-- gcc/config/avr/gen-avr-mmcu-texi.cc | 3 ++- gcc/doc/avr-mmcu.texi | 36 ++++++++++++++--------------- gcc/doc/extend.texi | 32 +++++++++++++++++-------- gcc/doc/invoke.texi | 3 +++ 5 files changed, 48 insertions(+), 30 deletions(-) diff --git a/gcc/config/avr/avr-devices.cc b/gcc/config/avr/avr-devices.cc index 627a7db54dc5..90846f3da21e 100644 --- a/gcc/config/avr/avr-devices.cc +++ b/gcc/config/avr/avr-devices.cc @@ -93,8 +93,8 @@ avr_texinfo[] = "``Enhanced'' devices with 3-byte PC, i.e.@: with more than 128@tie{}KiB " "of program memory." }, { ARCH_AVRTINY, - "``TINY'' Tiny core devices with 512@tie{}B up to 4@tie{}KiB of " - "program memory." }, + "``Reduced Tiny'' Tiny core devices with only 16 general purpose " + "registers and 512@tie{}B up to 4@tie{}KiB of program memory." }, { ARCH_AVRXMEGA2, "``XMEGA'' devices with more than 8@tie{}KiB and up to 64@tie{}KiB " "of program memory." }, diff --git a/gcc/config/avr/gen-avr-mmcu-texi.cc b/gcc/config/avr/gen-avr-mmcu-texi.cc index c756d69e89c8..d928236e1723 100644 --- a/gcc/config/avr/gen-avr-mmcu-texi.cc +++ b/gcc/config/avr/gen-avr-mmcu-texi.cc @@ -189,7 +189,8 @@ int main (void) for (i = 0; i < ARRAY_SIZE (avr_texinfo); i++) if (arch_id == avr_texinfo[i].arch_id) - printf ("@item %s\n%s\n", mcu->name, avr_texinfo[i].texinfo); + printf ("@item @anchor{%s}%s\n%s\n", mcu->name, mcu->name, + avr_texinfo[i].texinfo); } else if (arch_id == (enum avr_arch_id) mcu->arch_id) { diff --git a/gcc/doc/avr-mmcu.texi b/gcc/doc/avr-mmcu.texi index ddd429e082c8..c73ea53e6cea 100644 --- a/gcc/doc/avr-mmcu.texi +++ b/gcc/doc/avr-mmcu.texi @@ -12,71 +12,71 @@ @table @code -@item avr2 +@item @anchor{avr2}avr2 ``Classic'' devices with up to 8@tie{}KiB of program memory. @*@var{mcu}@tie{}= @code{attiny22}, @code{attiny26}, @code{at90s2313}, @code{at90s2323}, @code{at90s2333}, @code{at90s2343}, @code{at90s4414}, @code{at90s4433}, @code{at90s4434}, @code{at90c8534}, @code{at90s8515}, @code{at90s8535}. -@item avr25 +@item @anchor{avr25}avr25 ``Classic'' devices with up to 8@tie{}KiB of program memory and with the @code{MOVW} instruction. @*@var{mcu}@tie{}= @code{attiny13}, @code{attiny13a}, @code{attiny24}, @code{attiny24a}, @code{attiny25}, @code{attiny261}, @code{attiny261a}, @code{attiny2313}, @code{attiny2313a}, @code{attiny43u}, @code{attiny44}, @code{attiny44a}, @code{attiny45}, @code{attiny48}, @code{attiny441}, @code{attiny461}, @code{attiny461a}, @code{attiny4313}, @code{attiny84}, @code{attiny84a}, @code{attiny85}, @code{attiny87}, @code{attiny88}, @code{attiny828}, @code{attiny841}, @code{attiny861}, @code{attiny861a}, @code{ata5272}, @code{ata6616c}, @code{at86rf401}. -@item avr3 +@item @anchor{avr3}avr3 ``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of program memory. @*@var{mcu}@tie{}= @code{at76c711}, @code{at43usb355}. -@item avr31 +@item @anchor{avr31}avr31 ``Classic'' devices with 128@tie{}KiB of program memory. @*@var{mcu}@tie{}= @code{atmega103}, @code{at43usb320}. -@item avr35 +@item @anchor{avr35}avr35 ``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of program memory and with the @code{MOVW} instruction. @*@var{mcu}@tie{}= @code{attiny167}, @code{attiny1634}, @code{atmega8u2}, @code{atmega16u2}, @code{atmega32u2}, @code{ata5505}, @code{ata6617c}, @code{ata664251}, @code{at90usb82}, @code{at90usb162}. -@item avr4 +@item @anchor{avr4}avr4 ``Enhanced'' devices with up to 8@tie{}KiB of program memory. @*@var{mcu}@tie{}= @code{atmega48}, @code{atmega48a}, @code{atmega48p}, @code{atmega48pa}, @code{atmega48pb}, @code{atmega8}, @code{atmega8a}, @code{atmega8hva}, @code{atmega88}, @code{atmega88a}, @code{atmega88p}, @code{atmega88pa}, @code{atmega88pb}, @code{atmega8515}, @code{atmega8535}, @code{ata6285}, @code{ata6286}, @code{ata6289}, @code{ata6612c}, @code{at90pwm1}, @code{at90pwm2}, @code{at90pwm2b}, @code{at90pwm3}, @code{at90pwm3b}, @code{at90pwm81}. -@item avr5 +@item @anchor{avr5}avr5 ``Enhanced'' devices with 16@tie{}KiB up to 64@tie{}KiB of program memory. @*@var{mcu}@tie{}= @code{atmega16}, @code{atmega16a}, @code{atmega16hva}, @code{atmega16hva2}, @code{atmega16hvb}, @code{atmega16hvbrevb}, @code{atmega16m1}, @code{atmega16u4}, @code{atmega161}, @code{atmega162}, @code{atmega163}, @code{atmega164a}, @code{atmega164p}, @code{atmega164pa}, @code{atmega165}, @code{atmega165a}, @code{atmega165p}, @code{atmega165pa}, @code{atmega168}, @code{atmega168a}, @code{atmega168p}, @code{atmega168pa}, @code{atmega168pb}, @code{atmega169}, @code{atmega169a}, @code{atmega169p}, @code{atmega169pa}, @code{atmega32}, @code{atmega32a}, @code{atmega32c1}, @code{atmega32hvb}, @code{atmega32hvbrevb}, @code{atmega32m1}, @code{atmega32u4}, @code{atmega32u6}, @code{atmega323}, @code{atmega324a}, @code{atmega324p}, @code{atmega324pa}, @code{atmega324pb}, @code{atmega325}, @code{atmega325a}, @code{atmega325p}, @code{atmega325pa}, @code{atmega328}, @code{atmega328p}, @code{atmega328pb}, @code{atmega329}, @code{atmega329a}, @code{atmega329p}, @code{atmega329pa}, @code{atmega3250}, @code{atmega3250a}, @code{atmega3250p}, @code{atmega3250pa}, @code{atmega3290}, @code{atmega3290a}, @code{atmega3290p}, @code{atmega3290pa}, @code{atmega406}, @code{atmega64}, @code{atmega64a}, @code{atmega64c1}, @code{atmega64hve}, @code{atmega64hve2}, @code{atmega64m1}, @code{atmega64rfr2}, @code{atmega640}, @code{atmega644}, @code{atmega644a}, @code{atmega644p}, @code{atmega644pa}, @code{atmega644rfr2}, @code{atmega645}, @code{atmega645a}, @code{atmega645p}, @code{atmega649}, @code{atmega649a}, @code{atmega649p}, @code{atmega6450}, @code{atmega6450a}, @code{atmega6450p}, @code{atmega6490}, @code{atmega6490a}, @code{atmega6490p}, @code{ata5795}, @code{ata5790}, @code{ata5790n}, @code{ata5791}, @code{ata6613c}, @code{ata6614q}, @code{ata5782}, @code{ata5831}, @code{ata8210}, @code{ata8510}, @code{ata5702m322}, @code{at90pwm161}, @code{at90pwm216}, @code{at90pwm316}, @code{at90can32}, @code{at90can64}, @code{at90scr100}, @code{at90usb646}, @code{at90usb647}, @code{at94k}, @code{m3000}. -@item avr51 +@item @anchor{avr51}avr51 ``Enhanced'' devices with 128@tie{}KiB of program memory. @*@var{mcu}@tie{}= @code{atmega128}, @code{atmega128a}, @code{atmega128rfa1}, @code{atmega128rfr2}, @code{atmega1280}, @code{atmega1281}, @code{atmega1284}, @code{atmega1284p}, @code{atmega1284rfr2}, @code{at90can128}, @code{at90usb1286}, @code{at90usb1287}. -@item avr6 +@item @anchor{avr6}avr6 ``Enhanced'' devices with 3-byte PC, i.e.@: with more than 128@tie{}KiB of program memory. @*@var{mcu}@tie{}= @code{atmega256rfr2}, @code{atmega2560}, @code{atmega2561}, @code{atmega2564rfr2}. -@item avrxmega2 +@item @anchor{avrxmega2}avrxmega2 ``XMEGA'' devices with more than 8@tie{}KiB and up to 64@tie{}KiB of program memory. @*@var{mcu}@tie{}= @code{atxmega8e5}, @code{atxmega16a4}, @code{atxmega16a4u}, @code{atxmega16c4}, @code{atxmega16d4}, @code{atxmega16e5}, @code{atxmega32a4}, @code{atxmega32a4u}, @code{atxmega32c3}, @code{atxmega32c4}, @code{atxmega32d3}, @code{atxmega32d4}, @code{atxmega32e5}, @code{avr64da28}, @code{avr64da32}, @code{avr64da48}, @code{avr64da64}, @code{avr64db28}, @code{avr64db32}, @code{avr64db48}, @code{avr64db64}, @code{avr64dd14}, @code{avr64dd20}, @code{avr64dd28}, @code{avr64dd32}, @code{avr64ea28}, @code{avr64ea32}, @code{avr64ea48}. -@item avrxmega3 +@item @anchor{avrxmega3}avrxmega3 ``XMEGA'' devices with up to 64@tie{}KiB of combined program memory and RAM, and with program memory visible in the RAM address space. @*@var{mcu}@tie{}= @code{attiny202}, @code{attiny204}, @code{attiny212}, @code{attiny214}, @code{attiny402}, @code{attiny404}, @code{attiny406}, @code{attiny412}, @code{attiny414}, @code{attiny416}, @code{attiny417}, @code{attiny424}, @code{attiny426}, @code{attiny427}, @code{attiny804}, @code{attiny806}, @code{attiny807}, @code{attiny814}, @code{attiny816}, @code{attiny817}, @code{attiny824}, @code{attiny826}, @code{attiny827}, @code{attiny1604}, @code{attiny1606}, @code{attiny1607}, @code{attiny1614}, @code{attiny1616}, @code{attiny1617}, @code{attiny1624}, @code{attiny1626}, @code{attiny1627}, @code{attiny3214}, @code{attiny3216}, @code{attiny3217}, @code{attiny3224}, @code{attiny3226}, @code{attiny3227}, @code{atmega808}, @code{atmega809}, @code{atmega1608}, @code{atmega1609}, @code{atmega3208}, @code{atmega3209}, @code{atmega4808}, @code{atmega4809}, @code{avr16dd14}, @code{avr16dd20}, @code{avr16dd28}, @code{avr16dd32}, @code{avr32da28}, @code{avr32da32}, @code{avr32da48}, @code{avr32db28}, @code{avr32db32}, @code{avr32db48}, @code{avr32dd14}, @code{avr32dd20}, @code{avr32dd28}, @code{avr32dd32}. -@item avrxmega4 +@item @anchor{avrxmega4}avrxmega4 ``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB of program memory. @*@var{mcu}@tie{}= @code{atxmega64a3}, @code{atxmega64a3u}, @code{atxmega64a4u}, @code{atxmega64b1}, @code{atxmega64b3}, @code{atxmega64c3}, @code{atxmega64d3}, @code{atxmega64d4}, @code{avr128da28}, @code{avr128da32}, @code{avr128da48}, @code{avr128da64}, @code{avr128db28}, @code{avr128db32}, @code{avr128db48}, @code{avr128db64}. -@item avrxmega5 +@item @anchor{avrxmega5}avrxmega5 ``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB of program memory and more than 64@tie{}KiB of RAM. @*@var{mcu}@tie{}= @code{atxmega64a1}, @code{atxmega64a1u}. -@item avrxmega6 +@item @anchor{avrxmega6}avrxmega6 ``XMEGA'' devices with more than 128@tie{}KiB of program memory. @*@var{mcu}@tie{}= @code{atxmega128a3}, @code{atxmega128a3u}, @code{atxmega128b1}, @code{atxmega128b3}, @code{atxmega128c3}, @code{atxmega128d3}, @code{atxmega128d4}, @code{atxmega192a3}, @code{atxmega192a3u}, @code{atxmega192c3}, @code{atxmega192d3}, @code{atxmega256a3}, @code{atxmega256a3b}, @code{atxmega256a3bu}, @code{atxmega256a3u}, @code{atxmega256c3}, @code{atxmega256d3}, @code{atxmega384c3}, @code{atxmega384d3}. -@item avrxmega7 +@item @anchor{avrxmega7}avrxmega7 ``XMEGA'' devices with more than 128@tie{}KiB of program memory and more than 64@tie{}KiB of RAM. @*@var{mcu}@tie{}= @code{atxmega128a1}, @code{atxmega128a1u}, @code{atxmega128a4u}. -@item avrtiny -``TINY'' Tiny core devices with 512@tie{}B up to 4@tie{}KiB of program memory. +@item @anchor{avrtiny}avrtiny +``Reduced Tiny'' Tiny core devices with only 16 general purpose registers and 512@tie{}B up to 4@tie{}KiB of program memory. @*@var{mcu}@tie{}= @code{attiny4}, @code{attiny5}, @code{attiny9}, @code{attiny10}, @code{attiny102}, @code{attiny104}, @code{attiny20}, @code{attiny40}. -@item avr1 +@item @anchor{avr1}avr1 This ISA is implemented by the minimal AVR core and supported for assembler only. @*@var{mcu}@tie{}= @code{attiny11}, @code{attiny12}, @code{attiny15}, @code{attiny28}, @code{at90s1200}. diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 84eef411e2d9..eebff4071e83 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -8288,21 +8288,20 @@ at all. @item io @itemx io (@var{addr}) Variables with the @code{io} attribute are used to address -memory-mapped peripherals in the io address range. +memory-mapped peripherals in the I/O address range. +No memory is allocated. If an address is specified, the variable is assigned that address, and the value is interpreted as an address in the data address space. Example: @smallexample -volatile int porta __attribute__((io (0x22))); +volatile int porta __attribute__((io (__AVR_SFR_OFFSET__ + 0x2))); @end smallexample -The address specified in the address in the data address range. - -Otherwise, the variable it is not assigned an address, but the -compiler will still use in/out instructions where applicable, -assuming some other module assigns an address in the io address range. +Otherwise, the variable is not assigned an address, but the +compiler will still use @code{in} and @code{out} instructions where applicable, +assuming some other module assigns an address in the I/O address range. Example: @smallexample @@ -8320,13 +8319,28 @@ instructions. @cindex @code{address} variable attribute, AVR @item address @itemx address (@var{addr}) -Variables with the @code{address} attribute are used to address -memory-mapped peripherals that may lie outside the io address range. +Variables with the @code{address} attribute can be used to address +memory-mapped peripherals that may lie outside the I/O address range. +Just like with the @code{io} and @code{io_low} attributes, no memory is +allocated. @smallexample volatile int porta __attribute__((address (0x600))); @end smallexample +This attribute can also be used to define symbols in C/C++ +code which otherwise would require assembly, a linker description file +or command line options like @code{-Wl,--defsym,a_symbol=@var{value}}. +For example, +@smallexample +int a_symbol __attribute__((weak, address (1234))); +@end smallexample +will be compiled to +@smallexample +.weak a_symbol +a_symbol = 1234 +@end smallexample + @cindex @code{absdata} variable attribute, AVR @item absdata Variables in static storage and with the @code{absdata} attribute can diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 3d2a71109c2c..c1d01d32c1d0 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -23808,6 +23808,7 @@ Warn if the ISR is misspelled, i.e.@: without __vector prefix. Enabled by default. @end table +@anchor{eind} @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash @cindex @code{EIND} Pointers in the implementation are 16@tie{}bits wide. @@ -23944,6 +23945,7 @@ and the application be linked with @option{-Wl,--defsym,func_4=0x4}. Alternatively, @code{func_4} can be defined in the linker script. @end itemize +@anchor{ramp} @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers @cindex @code{RAMPD} @cindex @code{RAMPX} @@ -23986,6 +23988,7 @@ you must reset it to zero after the access. @end itemize +@anchor{avr-macros} @subsubsection AVR Built-in Macros GCC defines several built-in macros so that the user code can test -- GitLab