public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113161] New: Add a special "ramfunc" attribute for sections in the linker script (*.ld files)
@ 2023-12-28  8:58 kirdyankinsp at gmail dot com
  2023-12-28 18:41 ` [Bug target/113161] " pinskia at gcc dot gnu.org
  2024-02-08  9:46 ` kirdyankinsp at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: kirdyankinsp at gmail dot com @ 2023-12-28  8:58 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/113161] Add a special "ramfunc" attribute for sections in the linker script (*.ld files)
  2023-12-28  8:58 [Bug target/113161] New: Add a special "ramfunc" attribute for sections in the linker script (*.ld files) kirdyankinsp at gmail dot com
@ 2023-12-28 18:41 ` pinskia at gcc dot gnu.org
  2024-02-08  9:46 ` kirdyankinsp at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-28 18:41 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
           Severity|normal                      |enhancement

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The Linux kernel handles this without an attribute via an external program that
checks the section after the compiling.  Maybe for your use case you could
reuse that ...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/113161] Add a special "ramfunc" attribute for sections in the linker script (*.ld files)
  2023-12-28  8:58 [Bug target/113161] New: Add a special "ramfunc" attribute for sections in the linker script (*.ld files) kirdyankinsp at gmail dot com
  2023-12-28 18:41 ` [Bug target/113161] " pinskia at gcc dot gnu.org
@ 2024-02-08  9:46 ` kirdyankinsp at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: kirdyankinsp at gmail dot com @ 2024-02-08  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Sergey Kirdyankin <kirdyankinsp at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> The Linux kernel handles this without an attribute via an external program
> that checks the section after the compiling.  Maybe for your use case you
> could reuse that ...

please tell me what is the name of this program

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-08  9:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-28  8:58 [Bug target/113161] New: Add a special "ramfunc" attribute for sections in the linker script (*.ld files) kirdyankinsp at gmail dot com
2023-12-28 18:41 ` [Bug target/113161] " pinskia at gcc dot gnu.org
2024-02-08  9:46 ` kirdyankinsp at gmail dot com

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).