<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://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>Define a section to consistently place rtt</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/117706/define-a-section-to-consistently-place-rtt</link><description>NCS 2.7 with sysbuild + mcuboot 
 NRF52840 (custom boards) 
 In my previous projects with NRF5 SDK I found it was very helpful to define a section in the linker so the rtt control block is always placed in the same place. This way when updating between</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Feb 2025 23:47:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/117706/define-a-section-to-consistently-place-rtt" /><item><title>RE: Define a section to consistently place rtt</title><link>https://devzone.nordicsemi.com/thread/522538?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2025 23:47:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:860f646e-091a-44d3-aabd-5be955d6b39a</guid><dc:creator>Anthony Ambuehl</dc:creator><description>&lt;p&gt;I&amp;#39;m using NCS 2.6.0, possibly its a difference in the versions.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In my environment I find&amp;nbsp; in modules/debug/segger/SEGGER/SEGGER_RTT.c this code:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#ifndef SEGGER_RTT_BUFFER_SECTION
#if defined(SEGGER_RTT_SECTION)
#define SEGGER_RTT_BUFFER_SECTION SEGGER_RTT_SECTION
#endif
#endif

&amp;lt;snip&amp;gt;

#if defined(SEGGER_RTT_SECTION) || defined (SEGGER_RTT_BUFFER_SECTION)
#if ((defined __GNUC__) || (defined __clang__))
#define SEGGER_RTT_PUT_SECTION(Var, Section) __attribute__ ((section (Section))) Var
#elif (defined __ICCARM__) || (defined __ICCRX__)
#define SEGGER_RTT_PUT_SECTION(Var, Section) RTT_PRAGMA(location=Section) \
Var
#elif (defined __CC_ARM)
#define SEGGER_RTT_PUT_SECTION(Var, Section) __attribute__ ((section (Section), zero_init)) Var
#else
#error &amp;quot;Section placement not supported for this compiler.&amp;quot;
#endif
#else
#define SEGGER_RTT_PUT_SECTION(Var, Section) Var
#endif

&amp;lt;snip&amp;gt;



#if defined(SEGGER_RTT_SECTION)
#define SEGGER_RTT_PUT_CB_SECTION(Var) SEGGER_RTT_PUT_SECTION(Var, SEGGER_RTT_SECTION)
#else
#define SEGGER_RTT_PUT_CB_SECTION(Var) Var
#endif

#if defined(SEGGER_RTT_BUFFER_SECTION)
#define SEGGER_RTT_PUT_BUFFER_SECTION(Var) SEGGER_RTT_PUT_SECTION(Var, SEGGER_RTT_BUFFER_SECTION)
#else
#define SEGGER_RTT_PUT_BUFFER_SECTION(Var) Var
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Does your environment have the same?&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Define a section to consistently place rtt</title><link>https://devzone.nordicsemi.com/thread/522119?ContentTypeID=1</link><pubDate>Mon, 10 Feb 2025 03:09:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a028e778-8197-4b54-bf48-8479767deb1f</guid><dc:creator>zpm1066</dc:creator><description>&lt;p&gt;&lt;span style="background-color:#eeeeee;"&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/anthony.asterisk"&gt;Anthony Ambuehl&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hi, I tried to place the RTT control block as per your note above.&lt;/p&gt;
&lt;p&gt;In the project folder&amp;#39;s CMakeLists.txt, I added:&lt;br /&gt;&lt;br /&gt;zephyr_compile_definitions(SEGGER_RTT_SECTION=&amp;quot;rtt&amp;quot;)&lt;br /&gt;&lt;br /&gt;and in the overlay in the project boards folder, added:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
    sram@2003FB00 {
        compatible = &amp;quot;zephyr,memory-region&amp;quot;;
        reg = &amp;lt;0x2003FB00 0x500&amp;gt;;
        zephyr,memory-region = &amp;quot;rtt&amp;quot;;
        status = &amp;quot;okay&amp;quot;;
    };
};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;However, I&amp;nbsp;got the following in the&amp;nbsp;zephyr_pre0.map and the SEGGER_RTT isn&amp;#39;t being located to the specified address.&amp;nbsp;I&amp;#39;m using&amp;nbsp;NCS 2.9.0.&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1739156089998v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;What am I missing? How do we specify SEGGER_RTT to use the &amp;quot;rtt&amp;quot; memory region?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;btw - I have RTT logging both for the app and MCUBoot. Other than a minor glitch, app/MCUBoot logging seems to ok.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting MCUboot v2.1.0-dev-12e5ee106034 ***
*** Using nRF Connect SDK v2.9.0-7787b2649840 ***
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
I: Starting bootloader
I: Primary image: magic=good, swap_type=0x4, copy_done=0x1, image_ok=0x1
I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Image index: 0, Swap type: test
I: Starting swap using move algorithm.
I: Bootloader chainload address offset: 0x16000
I: Jumping to the first image slot
44] &amp;lt;inf&amp;gt; mcumgr_img_grp: Erased 0x1000 bytes of image slot trailer
[00:02:37.191,741] &amp;lt;inf&amp;gt; mcuboot_util: Image index: 0, Swap type: none
[00:02:37.192,108] &amp;lt;inf&amp;gt; mcuboot_util: Image index: 0, Swap type: test
[00:02:46.936,798] &amp;lt;inf&amp;gt; mcuboot_util: Image index: 0, Swap type: test
0m
[00:34:59.613,952] &amp;lt;inf&amp;gt; mcuboot_util: Image index: 0, Swap type: revert
*** Booting My Application v1.3.0 - unknown commit ***
*** Using nRF Connect SDK v2.9.0-7787b2649840 ***
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
[00:00:08.496,063] &amp;lt;inf&amp;gt; mcuboot_util: Image index: 0, Swap type: revert&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Define a section to consistently place rtt</title><link>https://devzone.nordicsemi.com/thread/517347?ContentTypeID=1</link><pubDate>Wed, 08 Jan 2025 00:37:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c806a699-0bc1-4506-88a1-62bc244c9854</guid><dc:creator>Anthony Ambuehl</dc:creator><description>&lt;p&gt;I didn&amp;#39;t need to add anything for the rtt block in the partition manager static configuration.&amp;nbsp; The zephyr,memory-region did it all.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Define a section to consistently place rtt</title><link>https://devzone.nordicsemi.com/thread/517085?ContentTypeID=1</link><pubDate>Mon, 06 Jan 2025 18:37:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acca1fb6-57aa-4806-a59f-a181bc3895cb</guid><dc:creator>Anthony Ambuehl</dc:creator><description>&lt;p&gt;I also need to get this to work with sysbuild for a multi image build.&amp;nbsp; I&amp;#39;m hoping this will work in my pm_static.yml:&lt;/p&gt;
&lt;p&gt;rtt:&lt;br /&gt; address: 0x2003FB00&lt;br /&gt; end_address: 0x20040000&lt;br /&gt; region: sram_primary&lt;br /&gt; size: 0x500&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Define a section to consistently place rtt</title><link>https://devzone.nordicsemi.com/thread/517084?ContentTypeID=1</link><pubDate>Mon, 06 Jan 2025 18:23:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f39dc99-7e26-4bc6-a4ec-6029b64642e9</guid><dc:creator>Anthony Ambuehl</dc:creator><description>&lt;p&gt;I think I have this working.&amp;nbsp; In my board dts file I added:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;/&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;sram&lt;/span&gt;&lt;span&gt;@&lt;/span&gt;&lt;span&gt;2003FB00&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;compatible&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;zephyr,memory-region&amp;quot;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;reg&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &amp;lt;&lt;/span&gt;&lt;span&gt;0x2003FB00&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0x500&lt;/span&gt;&lt;span&gt;&amp;gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;zephyr,memory-region&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;rtt&amp;quot;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;status&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;okay&amp;quot;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; };&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;};&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;In my application CMakeLists.txt&amp;nbsp; I added:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;zephyr_compile_definitions(SEGGER_RTT_SECTION=&lt;/span&gt;&lt;span&gt;&amp;quot;rtt&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;When I run a single image build I see this in my zephyr/zephyr_pre0.map&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;rtt             0x000000002003fb00      0x4b8
                0x000000002003fb00                __rtt_start = .
 *(SORT_BY_ALIGNMENT(rtt))
 rtt            0x000000002003fb00      0x4b8 modules/segger/libmodules__segger.a(SEGGER_RTT.c.obj)
                0x000000002003ff10                _SEGGER_RTT
 *(SORT_BY_ALIGNMENT(rtt.*))
                0x000000002003ffb8                __rtt_end = .
                0x00000000000004b8                __rtt_size = (__rtt_end - __rtt_start)
                0x000000002003fb00                __rtt_load_start = LOADADDR (rtt)&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>