public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kirdyankinsp at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/113161] New: Add a special "ramfunc" attribute for sections in the linker script (*.ld files)
Date: Thu, 28 Dec 2023 08:58:54 +0000	[thread overview]
Message-ID: <bug-113161-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2023-12-28  8:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28  8:58 kirdyankinsp at gmail dot com [this message]
2023-12-28 18:41 ` [Bug target/113161] " pinskia at gcc dot gnu.org
2024-02-08  9:46 ` kirdyankinsp at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113161-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).