From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 11CAB3858CD1; Thu, 28 Dec 2023 08:59:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 11CAB3858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703753942; bh=IF6uKWKjMLuEdDFk1Whc/Suk+gBwfHaG5nPIz9yNzSI=; h=From:To:Subject:Date:From; b=YIYea0FXA4krrgwX+oXhweaz8Gug7hYWmcOu2KYM/6Bm/T5BIJ5Jz9CsdkJa+Efay xeWcRiwh6eiDQjLPbAJmkPMQ5BC3NuJ2vCCNKdPD9lQMU0OMJLJrFO7yMJRa31IIwK KD681sKAwW5+5y2U2EAebgpo4Vq+Gaxw43I2yxD8= From: "kirdyankinsp at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kirdyankinsp at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113161 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 exampl= e, functions used in interrupts) are often copied from slow FLASH memory to RA= M at startup for faster execution. How to do it: https://www.st.com/resource/en/application_note/dm00083249-use-stm32f3-stm3= 2g4-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 loc= ated in slow (Flash) memory can be called. Which the programmer certainly doesn= =E2=80=99t want. If programmer copies a function into RAM, he of course wants everythi= ng 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 issu= e a warning.=