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
Reply
  • 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
Children
  • 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

  • I didn't need to add anything for the rtt block in the partition manager static configuration.  The zephyr,memory-region did it all.

  •   

    Hi, I tried to place the RTT control block as per your note above.

    In the project folder's CMakeLists.txt, I added:

    zephyr_compile_definitions(SEGGER_RTT_SECTION="rtt")

    and in the overlay in the project boards folder, added:





    However, I got the following in the zephyr_pre0.map and the SEGGER_RTT isn't being located to the specified address. I'm using NCS 2.9.0.


    What am I missing? How do we specify SEGGER_RTT to use the "rtt" memory region?


    btw - I have RTT logging both for the app and MCUBoot. Other than a minor glitch, app/MCUBoot logging seems to ok.



    Thanks!


  • I'm using NCS 2.6.0, possibly its a difference in the versions.  

    In my environment I find  in modules/debug/segger/SEGGER/SEGGER_RTT.c this code:

    Does your environment have the same?