Keil Logo

Technical Support

On-Line Manuals

µVision User's Guide

About µVision User Interface Creating Applications Debugging Start Debugging Start Energy Measurement without Debug Application Program Execution Debug Windows and Dialogs Breakpoints Window Call Stack and Locals Window Code Coverage Command Window Component Viewer Disassembly Window Event Recorder Setup Event Recorder Event Recorder Window Events Filtering Event Statistics Window Event Viewer Execution Profiler Instruction Trace Window System Analyzer Usage tips Restrictions Logic Analyzer Setup Setup in Detail Restrictions Cortex-M Trace Configuration Memory Map Memory Window Performance Analyzer Registers Window Serial Window Debug (printf) Viewer Symbols Window System Viewer Adding System Viewer Windows System and Thread Viewer Thread States Toolbox Trace Data Window Trace Navigation Trace Exceptions Event Counters ULINKplus Window Watch Window Core Peripherals Cortex-M0 and Cortex-M0+ Nested Vector Interrupt Controller System Control and Configuration System Tick Timer Fault Reports (Cortex-M0+ only) Cortex-M3, Cortex-M4, and Cortex-M7 Nested Vector Interrupt Controller System Control and Configuration System Tick Timer Fault Reports Memory Protection Unit Cortex-M23 and Cortex-M33 Nested Vector Interrupt Controller System Control and Configuration System Tick Timer Fault Reports Memory Protection Unit Security Attribution Unit Debug Scripting Expressions Constants System Variables Peripheral Variables I/O Ports Serial Ports Program Variables (Symbols) Fully Qualified Symbols Non-Qualified Symbols Literal Symbols Using Symbols Line Numbers Bit Addresses Type Specifications Operators Differences between µVision and C Expression Examples Code and Data Trace (Cortex-M) Trace Features Configuring Trace Tracepoint Expressions Tracepoint Intrinsics Tracepoint Limitations Tracepoint Marks Tips and Tricks Review Peripherals and CPU Configuration Simulate I/O Ports Simulate Interrupts and Clock Inputs Simulate external I/O Devices Assign Serial I/O to a PC COM Port Check Illegal Memory Access Command Input from File Preset I/O Ports or Memory Contents Write Debug Output to a File Keyboard Shortcuts TPIU Initialization after RESET (Cortex-M) Prevent Opening Files Show Japanese Messages Debug Commands Debug Functions Simulation Flash Programming Dialogs Utilities Command Line Example Programs Appendix

Debug Scripting

µVision provides a powerful scripting language that allows you to create complex debug scripts. The scripting language is identical to the C programming language with a few exceptions.

Debugger script files are plain text files (usually referred to as INI scripts) that can contain:

Typically, debug script files are used to configure the debugger or to setup or initialize something prior to running the program. When using debug adapters, such as the ULINKplus, you can also setup the power measurement or the I/Os. A debug script template for ULINKplus is located on your installation drive at [installation_path]\ARM\ULINK\Template\. The default [installation_path] is C:\Keil_v5.

To make an INI file simple to change and reconfigure, add Configuration Wizard syntax to the file.

Define Toolbox buttons to execute associated debug commands or debug functions.

Example


/*---------------------------------------------*/
/* Set Watchpoints                       */
/*---------------------------------------------*/
ws myvar
ws myvar2

/*----------------------------------------------*/
/* Create a Signal Function               */
/*----------------------------------------------*/
signal void bob(void) {
  while (1) {
    twatch (5000);             // Delay for 5,000 clocks)
    P1 = ~P1;                   // Toggle P1 Pins
  }
}

/*------------------------------------------------*/
/* Executes upon software RESET;     */
/*  (Use the function name as is)         */
/*------------------------------------------------*/
FUNC void OnResetExec (void)  {  //
   EnableTPIU();                 // call the initialization function
}

/*------------------------------------------------*/
/* Change the program start address  */
/*------------------------------------------------*/
$=0x1000

/*-------------------------------------------------*/
/* Configure Toolbox buttons               */
/*------------------------------------------------*/
define button "Send Bob's signal", "bob"

/*-------------------------------------------------*/
/* Run the Program (stop at main)      */
/*------------------------------------------------*/
g, main

Running debug scripts

There are two ways to execute a debug script:

  1. Executed on entering the debug session when configured as Initialization File in the Options for Target - Debug window.
  2. Executed manually from the Command window using the INCLUDE command.

Which one you choose depends on when you want to run the debug script. When µVision enters the debug mode, the following happens:

  1. The debugger loads the file set in the field Project - Options for Target - Output Name of Executable when Load Application at Startup is enabled.
  2. Restores Debug Session Settings for enabled dialogs.
  3. Executes the commands in the Initialization File.
  4. Executes the instructions until reaching main() when Run to main() is enabled or the command g, main is found in the Initialization File.

Notes

  • If you do not want to interfere with debug enter, you can run the script using the INCLUDE command from the Command window.
  • If you are using an Initialization file, disable Run to main() in the Options for Target - Debug window.

Related Knowledgebase Articles

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.