Setting Up Instrumented Trace in MPLAB® X IDE

To set up MPLAB® X IDE to use trace for the MPLAB® REAL ICE™ In-Circuit Emulator:

  1. Right-click on the project name and select Properties. In the Project Properties dialog box, click on Real ICE under Categories.
  2. Under Option categories, select Clock. For data capture and trace, the emulator needs to know the instruction cycle speed.
  3. Under Option categories, select Trace and Profiling.
  4. Under Data Collection Selection, choose User Instrumented Trace.
  5. Under Communications Medium, choose either Native, I/O PORT, or SPI trace.
  6. Set up any other trace-related options. (See Trace and Profiling Options.)
  7. Click OK.

Next, enter trace macros into your application code.

  • To record a PC location, click on or highlight a line of code and then right-click to select Insert Language Line Trace from the pop-up menu, where Language can be either C or ASM. This causes the following macro line to be inserted above the selected line:
    __TRACE(id);
    where id is a line trace number auto-generated during the build. For more information, see More on Trace/Log ID Numbers.

Note: Inserting a macro into code may modify the logic flow of the program. Check that braces are present wherever they are necessary.

  • The recording of a variable value is performed similarly. First, highlight the variable name or expression. Then, right-click to select Log Selected Language Value from the pop-up menu, where Language can be either C or ASM. This causes the following macro line to be inserted above the line containing the variable:
    __LOG(id,selected variable);
    where id is a log number that was auto-generated during the build and the selected variable is the highlighted variable. For more information, see More on Trace/Log ID Numbers.
  • To remove a tracepoint, simply highlight and then delete the Trace/Log macro.
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.