This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] AM2634: How to debug / monitor a variable in running state

Part Number: AM2634

How can I see a variable changing it's value in real-time/ in running state?

How can I plot a variable graph based on time?

  • The FAQ on how to -

    1. Debug / Monitor a variable in running state (see visually if there is a change)
    2. Plot a variable graph based on time (if possible)

    Debug / Monitor a variable in running state (see visually if there is a change)

    1. To monitor a variable during run-time without halting the target, memory browser can be used while accessing the Debug Access Port (DAP).
           (For more information regarding the DAP support refer to section 14.1.3.3.1 DAP in AM263x TRM.)

      1. For the memory browser to access the variable, the variable must be global.
        If the variable is present in RAM.

        • You can directly search for the address in Memory Browser.

        • Otherwise, a Cache write back invalidate needs to be done.
              (Refer AM263x MCU+ SDK User Guide → Driver Porting Layer → Cache)

          /*
           * Declare variable globally and get it's address and size
           */
          uint32_t counter;
          void * addr = &counter;
          uint32_t size = sizeof(counter);
           
           
          /*
           * Declared the value of the variable in main function and decrementing it for this example.
           */
           
          counter = 100;
           
          while(counter)
          {
              counter--;
              DebugP_log("Counter: %u\r\n", counter);
              CacheP_wbInv(addr, size, CacheP_TYPE_ALL); /* Cache write back invalidate - flush contents of cache to memory so that a DMA or HW peripheral can see the data */
          }

        • Now, follow the below steps for continuous monitoring:
        • Launch the .ccxml file of AM263xCC as explained in the MCU App guide - CCS_Target_Launch - https://software-dl.ti.com/mcu-plus-sdk/esd/AM263X/latest/exports/docs/api_guide_am263x/CCS_LAUNCH_PAGE.html#CCS_LAUNCH

        • Connect to R50_0 core and load your .out file. Before resuming the execution, follow the rest of the steps.

        • You will see the AM263X target configuration in the "Debug" window. Right click on the .ccxml and choose “Show all cores”.


        • Connect DAP if it is not already connected.



        • Go to View → Memory Browser


        • Select CS_DAP_0 → Select System View → Pin it to the Browser → Select the Continuous Refresh Option → Enter the memory address of the variable


        • Now resume the core execution and you can view the values of global variables updating in real-time, without the need to pause the R5 core.
                   

      2. If your variable is found in TCM.

        • Refer Table 2-1 in AM263x TRM for DEVICE memory map to access TCM memory from DAP.


        • As memory access in TCM is pretty fast, add some delay in the code to monitor the variable.

          /* Variable in TCM */
          uint32_t counter __attribute__((__section__(".tcmVarSection")));
           
           
           
          /*
           * Declared the value of the variable in main function and decrementing it for this example.
           */
              counter = 100;
           
              while(counter)
              {
                  counter--;
                  DebugP_log("Counter: %u\r\n", counter);
                  ClockP_sleep(1);
              }
           
          }

        • Select CS_DAP_0 → Select System View → Pin it to the Browser → Select the Continuous Refresh Option → Search for the corresponding address in memory browser


        • Now resume the core execution and you can view the values of global variables updating in real-time, without the need to pause the R5 core.
                

    Plot a variable graph based on time

    To plot a variable graph based on time.

    1. Add the variable to the expressions window → Right Click and select Graph


    2. Check the Graph Properties to see if Start Address is set as address of the variable


    3. Select continuous refresh


    4. Now Resume the core execution and you can view your variable changing with time as a line graph during run-time.