-/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2021 Free Software Foundation, Inc.
Contributed by Joern Rennecke
This file is part of GCC.
#define SPECFILE_USAGE_URL \
"https://gcc.gnu.org/gcc-5/changes.html"
-/* Return true iff STR starts with PREFIX. */
-
-static bool
-str_prefix_p (const char *str, const char *prefix)
-{
- return strncmp (str, prefix, strlen (prefix)) == 0;
-}
-
static const char header[] =
"#\n"
"# #include <avr/io.h>\n"
"#\n"
"# will include the desired device header. For ATmega8A the supplement\n"
- "# to *cpp would read\n"
+ "# to *cpp_avrlibc would read\n"
"#\n"
"# -D__AVR_DEV_LIB_NAME__=m8a\n"
"\n";
bool rcall = (mcu->dev_attribute & AVR_ISA_RCALL);
bool is_arch = mcu->macro == NULL;
bool is_device = ! is_arch;
+ int flash_pm_offset = 0;
+
+ if (arch->flash_pm_offset
+ && mcu->flash_pm_offset
+ && mcu->flash_pm_offset != arch->flash_pm_offset)
+ {
+ flash_pm_offset = mcu->flash_pm_offset;
+ }
if (is_arch
&& (ARCH_AVR2 == arch_id
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)
{
#if defined (WITH_AVRLIBC)
fprintf (f, "%s\n", help_dev_lib_name);
+
+ fprintf (f, "*cpp_avrlibc:\n");
+ fprintf (f, "\t-D__AVR_DEVICE_NAME__=%s", mcu->name);
+ fprintf (f, "\n\n");
#endif // WITH_AVRLIBC
+ fprintf (f, "*cpp_mcu:\n");
+ fprintf (f, "\t-D%s", mcu->macro);
+ if (flash_pm_offset)
+ {
+ fprintf (f, " -U__AVR_PM_BASE_ADDRESS__");
+ fprintf (f, " -D__AVR_PM_BASE_ADDRESS__=0x%x", flash_pm_offset);
+ }
+ fprintf (f, "\n\n");
+
fprintf (f, "*cpp:\n");
- fprintf (f, "\t-D%s -D__AVR_DEVICE_NAME__=%s", mcu->macro, mcu->name);
+ fprintf (f, "\t%%(cpp_mcu)");
+#if defined (WITH_AVRLIBC)
+ fprintf (f, " %%(cpp_avrlibc)");
+#endif // WITH_AVRLIBC
fprintf (f, "\n\n");
}