https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113161

            Bug ID: 113161
           Summary: Add a special "ramfunc" attribute for sections in the
                    linker script (*.ld files)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kirdyankinsp at gmail dot com
  Target Milestone: ---

In embedded systems (microcontrollers), time-critical functions (for example,
functions used in interrupts) are often copied from slow FLASH memory to RAM at
startup for faster execution.
How to do it:
https://www.st.com/resource/en/application_note/dm00083249-use-stm32f3-stm32g4-ccm-sram-with-iar-ewarm-keil-mdk-arm-and-gnu-based
-toolchains-stmicroelectronics.pdf
In this case, a problem is possible: inside such a function, a function located
in slow (Flash) memory can be called. Which the programmer certainly doesn’t
want. If programmer copies a function into RAM, he of course wants everything
that this function performs to be in RAM too.
I propose to add a warning output about calling a function located in slow
memory from a function located in fast memory.
Here's how it works in the IAR compiler:
"C:foo.c",44 Warning[Ta023]:
   Call to a non __ramfunc function (foo()) from within a __ramfunc function
foo2();

I think for this it is necessary to add a special attribute for sections in the
linker script, which will indicate to the linker that all functions in this
section must call functions from the same section, otherwise they will issue a
warning.
  • [Bug target/113161] New: Add a ... kirdyankinsp at gmail dot com via Gcc-bugs

Reply via email to