[SOLVED] RTT not working when FreeRTOS taking too much space

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] RTT not working when FreeRTOS taking too much space

    Hello,
    I am working on STM32L431VC. I am using FreeRTOS and RTT technology to read logs from code. In FreeRTOS there is special #define (configTOTAL_HEAP_SIZE) to determine how much RAM FreeRTOS will use.
    Recently I had to change this value from 20kB to 30kB. I noticed that RTT (and with it SystemView) stopped working. The clear root cause could be that I run out of RAM on my system.
    But this is not a case, my STM32L431VC has 64kB of RAM, and with configTOTAL_HEAP_SIZE = 30 kB I can still allocate (with malloc) 20 kB in main() so probably 20kB is more then enough for RTT.

    I found similar problem on nordic semi webpage devzone.nordicsemi.com/f/nordi…sing-more-than-8kb-of-ram but increasing the BUFFER_SIZE_UP to 2048 (which helped) do not work for me.


    has anyone encountered such a problem? I will be very grateful for any help.



    Best,

    Marcin
  • Hello Marcin,

    Thank you for your inquiry.
    Such an issue is not known to us.
    Could you provide us with an example project for reproduction purposes?
    We have a couple of NUCLEO-L432KC which we could use for testing.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hello Nino,
    sorry for the delay. It actually should be easy to reproduce. To test it on empty project I just generated new project with STM32CubeMX (+FreeRTOS),
    then I added RTT files. On my test board:
    when
    #define configTOTAL_HEAP_SIZE ((size_t)10000) RTT working
    and when
    #define configTOTAL_HEAP_SIZE ((size_t)40000) RTT not working


    I am adding my whole project to this reply.

    Thanks for any help/ideas.


    Marcin
    Files
    • RAM_test.zip

      (968.72 kB, downloaded 678 times, last: )
  • Just to add to my previous comment:
    I made today really a lot of tests and I found out something very strange. I was looking for different dependencies (I mean I was wondering why changing configTOTAL_HEAP_SIZE influence RTT).

    And it turns out that making configTOTAL_HEAP_SIZE bigger is pushing

    .bss._acDownBuffer
    .bss._acUpBuffer
    down in my RAM memory. I do not know why but somewhere around values:

    .bss._acDownBuffer
    0x20006fec 0x800 Src\SEGGER_RTT.o
    .bss._acUpBuffer
    0x200077ec 0x800 Src\SEGGER_RTT.o

    RTT stops working. I took this idea and I moved RTT to the beginning of RAM (with #define SEGGER_RTT_SECTION ".rtt" and putting .rtt section in linker file)
    And after this change it is working (I can make configTOTAL_HEAP_SIZE as big as I want again).


    Maybe it will be some help to figure out what is going on.


    Marcin
  • Ok, so I know what happened. RTT Viewer did not managed to find RTT Control block.
    So if you have similar problems like I do you have 2 solutions:

    1. Move RTT buffers to beginning of RAM with help of linker file
    2. Check your map file and look for _SEGGER_RTT memory address. Then in RTT viewer set not "Auto Detection" in RTT Control Block but "Address" and put memory address you found in map file.


    All the best,
    Marcin
  • Hello Marcin,

    Great to hear that you are up and running again.
    As you correctly found out J-Link Software will only search for RTT control block on a predefined area (usually RAM that is available 100 % after each boot).
    Some devices might have multiple RAM areas or even external RAM. In that case auto detect will sometimes not work so the RTT control block address has to be added manually.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.