Segger Ozone problem - variables out of scope - cannot "watch" or "graph"

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

    • Segger Ozone problem - variables out of scope - cannot "watch" or "graph"

      Hey everyone,

      I'm pretty new to the world of Segger but so far I'm really happy with it. There's one problem I encounter when using Segger's Ozone tool. I'd like to graph the value of a local variable but Ozone is telling me the following:


      Source Code

      1. Warning (4091): expression "cntr" cannot be graphed: the expression contains at least one operand with an unknown data location.

      When I try to add it to the "Watched Data", the "Location" tab tells me <outofscope>.

      I double checked all the operands, I'm just using ++, % and logical comparison ==, all allowed according to UM08025, p. 145. cntr is basically just a counter that resets after x iterations. This variable is local, declared and defined inside a FreeRTOS Task Function (of course outside the while(1) loop). In fact all other variables declared and defined inside this function/task are not reachable by Ozone with the same error message. What am I doing wrong?

      Thank you very much in advance!
      Tom
    • Hello,

      Thank you for your inquiry.
      Local variables can only be tracked while in the scope of the function where they are initialized and used.
      Outside of that scope the corresponding memory range might be used for something else by the application.
      If you want to track a variable over multiple functions declare it as static outside of the function scope.
      Then it should work.

      Best regards,
      Nino
      Please read the forum rules before posting: Forum Rules

      Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
      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 contact us per e-mail.
      Alternatively our support system can be used as well: segger.com/ticket/
    • Dear Nino,

      thank you very much for replying. I'm just wondering how variables can be out of scope inside a task of FreeRTOS which is always running and never gets quit. It would be fatal if the memory location is used for something else. Do I miss something?`

      Could you maybe reply to the following question as well: I own a J-Link Plus, so if I'd like to trace the task calls this can only be done by using the ETB of the uC, right? If the uC (in my case STM32F412) does not support ETB, I can't trace these calls, correct?

      Thanks in advance & best regards
      Tom
    • Hello,


      tronic wrote:

      thank you very much for replying. I'm just wondering how variables can be out of scope inside a task of FreeRTOS which is always running and never gets quit. It would be fatal if the memory location is used for something else. Do I miss something?`
      Is it running all the time? No scheduler action or interrupts in between or similar? Does it not work declaring the variable in a static scope?


      tronic wrote:

      Could you maybe reply to the following question as well: I own a J-Link Plus, so if I'd like to trace the task calls this can only be done by using the ETB of the uC, right? If the uC (in my case STM32F412) does not support ETB, I can't trace these calls, correct?
      With an ETB you would get more than just task calls. This enables you to get all instructions executed and analyzed, including task calls.
      The STM32F4 has an ETM + trace port though. This will generate an instruction trace stream that can be read by our J-Trace PRO probe:
      segger.com/products/debug-probes/j-trace/

      However if you are only interested into following the task flow of your application in a visual way code instrumentation might be the correct pick for you.
      For this our free tool SystemView can be used:
      segger.com/products/development-tools/systemview/

      More information about the different trace types can be found here:
      wiki.segger.com/General_information_about_tracing

      Best regards,
      Nino
      Please read the forum rules before posting: Forum Rules

      Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
      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 contact us per e-mail.
      Alternatively our support system can be used as well: segger.com/ticket/