<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>prevention of running code from ram</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/88425/prevention-of-running-code-from-ram</link><description>Hi. Can the nrf52840 prevent running code from RAM ? in general ? I know there are bits of code in the nrf sdk that transform byte codes into a function (so it&amp;#39;s in ram) and then run it, but i want to prevent like in modern OSes running from the stack</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Tue, 31 May 2022 07:06:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/88425/prevention-of-running-code-from-ram" /><item><title>RE: prevention of running code from ram</title><link>https://test-devzone.nordicsemi.com/thread/370103?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 07:06:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2de109a3-6af5-4057-b07f-334bdddf86ed</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://developer.arm.com/documentation/ddi0439/b/Memory-Protection-Unit/About-the-MPU"&gt;MPU&lt;/a&gt; can be used to prevent code execution from RAM. If you use the nRF Connect SDK, which is Zephyr based, this is&amp;nbsp;prevented by default. See &lt;a href="https://docs.zephyrproject.org/latest/hardware/arch/arm_cortex_m.html#memory-map-and-mpu-considerations"&gt;Memory map and MPU considerations&lt;/a&gt;, specifically:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;One MPU region programs the entire SRAM area with privileged-only RW permissions. That is, an MPU region is utilized to disallow execute permissions on SRAM.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;If you are using the nRF5 SDK you have to enable this yourself, for instance using the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_mpu.html"&gt;MPU driver&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>