Define a section to consistently place rtt

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 different versions of the application or when running through the bootloader (if rtt output is enabled) the debugger always find the rtt control block.

How would I define this in zephyr?  It seems like I need to add a linker ld script.

I tried adding it to my pm_static.yml but it doesn't appear to interface all the way to the linker.

rtt:
  address: 0x2003F800
  end_address: 0x2003FC00
  region: sram_primary
  size: 0x400

Parents
  • I think I have this working.  In my board dts file I added:

    / {
        sram@2003FB00 {
            compatible = "zephyr,memory-region";
            reg = <0x2003FB00 0x500>;
            zephyr,memory-region = "rtt";
            status = "okay";
        };
    };
    In my application CMakeLists.txt  I added:
    zephyr_compile_definitions(SEGGER_RTT_SECTION="rtt")
    When I run a single image build I see this in my zephyr/zephyr_pre0.map
    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)
  • I also need to get this to work with sysbuild for a multi image build.  I'm hoping this will work in my pm_static.yml:

    rtt:
    address: 0x2003FB00
    end_address: 0x20040000
    region: sram_primary
    size: 0x500

Reply Children
Related