public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-8300] AVR: Always define __AVR_PM_BASE_ADDRESS__ in specs provided the core has it.
@ 2024-02-08 11:04 Georg-Johann Lay
  0 siblings, 0 replies; only message in thread
From: Georg-Johann Lay @ 2024-02-08 11:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:818a7590bdeecb217414a1acdd7cbec11c51ba66

commit r13-8300-g818a7590bdeecb217414a1acdd7cbec11c51ba66
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Thu Feb 8 11:39:53 2024 +0100

    AVR: Always define __AVR_PM_BASE_ADDRESS__ in specs provided the core has it.
    
    gcc/
            * config/avr/gen-avr-mmcu-specs.cc (print_mcu) <*cpp_mcu>: Spec always
            defines __AVR_PM_BASE_ADDRESS__ if the core has it.
    
    (cherry picked from commit e515d813f080fb4c4e70d3c7b01815a909893688)

Diff:
---
 gcc/config/avr/gen-avr-mmcu-specs.cc | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/gcc/config/avr/gen-avr-mmcu-specs.cc b/gcc/config/avr/gen-avr-mmcu-specs.cc
index 9344246cb720..38d18931aa10 100644
--- a/gcc/config/avr/gen-avr-mmcu-specs.cc
+++ b/gcc/config/avr/gen-avr-mmcu-specs.cc
@@ -132,13 +132,21 @@ print_mcu (const avr_mcu_t *mcu)
   bool rcall = (mcu->dev_attribute & AVR_ISA_RCALL);
   bool is_arch = mcu->macro == NULL;
   bool is_device = ! is_arch;
-  int flash_pm_offset = 0;
+  int rodata_pm_offset = 0;
+  int pm_base_address = 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;
+      rodata_pm_offset = mcu->flash_pm_offset;
+    }
+
+  if (arch->flash_pm_offset)
+    {
+      pm_base_address = mcu->flash_pm_offset
+	? mcu->flash_pm_offset
+	: arch->flash_pm_offset;
     }
 
   if (is_arch
@@ -255,8 +263,8 @@ print_mcu (const avr_mcu_t *mcu)
 
   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);
+      && rodata_pm_offset)
+    fprintf (f, " --defsym=__RODATA_PM_OFFSET__=0x%x", rodata_pm_offset);
   fprintf (f, "\n\n");
 
   if (is_device)
@@ -293,10 +301,10 @@ print_mcu (const avr_mcu_t *mcu)
 
       fprintf (f, "*cpp_mcu:\n");
       fprintf (f, "\t-D%s", mcu->macro);
-      if (flash_pm_offset)
+      if (pm_base_address)
 	{
 	  fprintf (f, " -U__AVR_PM_BASE_ADDRESS__");
-	  fprintf (f, " -D__AVR_PM_BASE_ADDRESS__=0x%x", flash_pm_offset);
+	  fprintf (f, " -D__AVR_PM_BASE_ADDRESS__=0x%x", pm_base_address);
 	}
       fprintf (f, "\n\n");

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-08 11:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-08 11:04 [gcc r13-8300] AVR: Always define __AVR_PM_BASE_ADDRESS__ in specs provided the core has it Georg-Johann Lay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).