Am 16.11.19 um 18:36 schrieb Jeff Law:
On 11/8/19 9:19 AM, Georg-Johann Lay wrote:
Hi,
this patch adds support for a few more AVR devices. Because the offset
where flash is seen in RAM deviates from the settings for the family
(and hence also from the linker script defaults), a new field in
avr_mcu_t is needed to express this so that specs can be generated
appropriately.
The AVR_MCU lines in avr-mcus.def are longer than 80 chars because it's
easier to maintain 1 device = 1 line entries. And it's easier to scan
them with the awk scripts.
Ok for trunk?
Johann
Add support for AVR devices from the 0-series.
* config/avr/avr-arch.h (avr_mcu_t) <flash_pm_offset>: New field.
* config/avr/avr-devices.c (avr_mcu_types): Adjust initializers.
* config/avr/avr-mcus.def (AVR_MCU): Add respective field.
* config/avr/specs.h (LINK_SPEC) <%(link_pm_base_address)>: Add.
* config/avr/gen-avr-mmcu-specs.c (print_mcu)
<*cpp, *cpp_mcu, *cpp_avrlibc, *link_pm_base_address>: Emit code
for spec definitions.
* doc/avr-mmcu.texi: Regenerate.
OK
jeff
Also applied the following patchlet atop of this. It adds the
definition of __RODATA_PM_OFFSET__ at a different place so that
the generated specs file also works with older versions of
the compiler. For the current version, it is an no-op.
Johann
Make 0-series device specs work with older versions of avr-gcc.
PR target/92545
* config/avr/specs.h (LINK_SPEC) <%(link_pm_base_address)>: Remove.
* config/avr/gen-avr-mmcu-specs.c (print_mcu)
<*link_pm_base_address>: Don't write spec.
<*link_arch>: Add --defsym=__RODATA_PM_OFFSET__= as needed.
Index: config/avr/gen-avr-mmcu-specs.c
===================================================================
--- config/avr/gen-avr-mmcu-specs.c (revision 278477)
+++ config/avr/gen-avr-mmcu-specs.c (revision 278478)
@@ -253,7 +253,11 @@ bool is_arch = mcu->macro == NULL;
fprintf (f, "*link_relax:\n\t%s\n\n", LINK_RELAX_SPEC);
- fprintf (f, "*link_arch:\n\t%s\n\n", LINK_ARCH_SPEC);
+ fprintf (f, "*link_arch:\n\t%s", LINK_ARCH_SPEC);
+ if (is_device
+ && flash_pm_offset)
+ fprintf (f, " --defsym=__RODATA_PM_OFFSET__=0x%x", flash_pm_offset);
+ fprintf (f, "\n\n");
if (is_device)
{
@@ -270,14 +274,6 @@ bool is_arch = mcu->macro == NULL;
fprintf (f, "\n\n");
}
- if (is_device
- && flash_pm_offset)
- {
- fprintf (f, "*link_pm_base_address:\n");
- fprintf (f, "\t--defsym=__RODATA_PM_OFFSET__=0x%x", flash_pm_offset);
- fprintf (f, "\n\n");
- }
-
// Specs known to GCC.
if (is_device)
Index: config/avr/specs.h
===================================================================
--- config/avr/specs.h (revision 278477)
+++ config/avr/specs.h (revision 278478)
@@ -68,7 +68,6 @@ along with GCC; see the file COPYING3.
"%(link_text_start) " \
"%(link_relax) " \
"%(link_pmem_wrap) " \
- "%(link_pm_base_address) " \
"%{shared:%eshared is not supported} "
#undef LIB_SPEC