[I] [FEATURE] Support for Arm FPU Lazy Stacking [nuttx]</span></a></span> </h1> <p class="darkgray font13"> <span class="sender pipe"><a href="/search?l=commits@nuttx.apache.org&q=from:%22via+GitHub%22" rel="nofollow"><span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">via GitHub</span></span></a></span> <span class="date"><a href="/search?l=commits@nuttx.apache.org&q=date:20260202" rel="nofollow">Mon, 02 Feb 2026 18:14:17 -0800</a></span> </p> </div> <div itemprop="articleBody" class="msgBody"> <!--X-Body-of-Message--> <pre> 964849768qq opened a new issue, #18313: URL: <a rel="nofollow" href="https://github.com/apache/nuttx/issues/18313">https://github.com/apache/nuttx/issues/18313</a></pre><pre> ### Is your feature request related to a problem? Please describe. **Description** Currently, NuttX saves/restores all FPU registers during every context switch, even when tasks don't use the FPU. This adds unnecessary overhead. Modern Cortex-M processors support FPU Lazy Stacking, which delays FPU register preservation until actual FPU usage is detected. **Problem** When FPU is enabled, each context switch saves 17 additional FPU registers (S0-S15 + FPSCR), adding ~100 bytes of stack usage and increasing switch time. This is inefficient for tasks that don't use floating-point operations. Hardware Support **Cortex-M4/M7/M33/M55/M85 processors already support Lazy Stacking via:** 1. FPCCR.LSPENbit to enable/disable lazy stacking 2. FPCCR.LSPACTbit indicating pending lazy save 3. Automatic detection of FPU instruction usage **Proposed Implementation** - Configuration Option: Add CONFIG_ARCH_FPU_LAZYSTACKINGto enable/disable - FPU Context Management: 1. Only allocate FPU save area when task actually uses FPU 2. Set CONTROL.FPCA=0initially for all tasks 3. Enable FPCCR.LSPENduring system initialization **Exception Handling:** - Monitor UFSR.LSPACT flag for pending lazy saves - Handle automatic FPU stacking in UsageFault **Task Creation:** - Mark tasks as "FPU-unused" by default - Update flag on first FPU instruction **Benefits** - Reduced context switch time​ for non-FPU tasks - Lower stack memory usage​ (no FPU save area until needed) - Better real-time performance​ for interrupt handlers - Compatibility​ with existing code (transparent to applications) ### Describe the solution you'd like Official support for lazy stacking ### Describe alternatives you've considered _No response_ ### Verification - [x] I have verified before submitting the report. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org </pre> </div> <div class="msgButtons margintopdouble"> <ul class="overflow"> <li class="msgButtonItems"><a class="button buttonleft " accesskey="p" href="msg155107.html">Previous message</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="c" href="index.html#155109">View by thread</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="i" href="maillist.html#155109">View by date</a></li> <li class="msgButtonItems textalignright"><a class="button buttonright " accesskey="n" href="msg155265.html">Next message</a></li> </ul> </div> <a name="tslice"></a> <div class="tSliceList margintopdouble"> <ul class="icons monospace"> <li class="icons-email tSliceCur"><span class="subject">[I] [FEATURE] <title>Support for Arm FPU Lazy Stacking [n...</span> <span class="sender italic">via GitHub</span></li> <li><ul> <li class="icons-email"><span class="subject"><a href="msg155265.html">Re: [I] [FEATURE] Support for Arm FPU Lazy Stacking [nuttx...</a></span> <span class="sender italic">via GitHub</span></li> </ul> </ul> </div> <div class="overflow msgActions margintopdouble"> <div class="msgReply" > <h2> Reply via email to </h2> <form method="POST" action="/mailto.php"> <input type="hidden" name="subject" value="[I] [FEATURE] <title>Support for Arm FPU Lazy Stacking [nuttx]"> <input type="hidden" name="msgid" value="I_kwDODZiUac7nx0wp@gitbox.apache.org"> <input type="hidden" name="relpath" value="commits@nuttx.apache.org/msg155109.html"> <input type="submit" value=" via GitHub "> </form> </div> </div> </div> <div class="aside" role="complementary"> <div class="logo"> <a href="/"><img src="/logo.png" width=247 height=88 alt="The Mail Archive"></a> </div> <form class="overflow" action="/search" method="get"> <input type="hidden" name="l" value="commits@nuttx.apache.org"> <label class="hidden" for="q">Search the site</label> <input class="submittext" type="text" id="q" name="q" placeholder="Search commits"> <input class="submitbutton" name="submit" type="image" src="/submit.png" alt="Submit"> </form> <div class="nav margintop" id="nav" role="navigation"> <ul class="icons font16"> <li class="icons-home"><a href="/">The Mail Archive home</a></li> <li class="icons-list"><a href="/commits@nuttx.apache.org/">commits - all messages</a></li> <li class="icons-about"><a href="/commits@nuttx.apache.org/info.html">commits - about the list</a></li> <li class="icons-expand"><a href="/search?l=commits@nuttx.apache.org&q=subject:%22%5C%5BI%5C%5D+%5C%5BFEATURE%5C%5D+%3Ctitle%3ESupport+for+Arm+FPU+Lazy+Stacking+%5C%5Bnuttx%5C%5D%22&o=newest&f=1" title="e" id="e">Expand</a></li> <li class="icons-prev"><a href="msg155107.html" title="p">Previous message</a></li> <li class="icons-next"><a href="msg155265.html" title="n">Next message</a></li> </ul> </div> <div class="listlogo margintopdouble"> </div> <div class="margintopdouble"> </div> </div> </div> <div class="footer" role="contentinfo"> <ul> <li><a href="/">The Mail Archive home</a></li> <li><a href="/faq.html#newlist">Add your mailing list</a></li> <li><a href="/faq.html">FAQ</a></li> <li><a href="/faq.html#support">Support</a></li> <li><a href="/faq.html#privacy">Privacy</a></li> <li class="darkgray">I_kwDODZiUac7nx0wp@gitbox.apache.org</li> </ul> </div> </body> </html> <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'9c91ed2a8fdf51a8',t:'MTc3MDI4OTQ2MA=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script>