debug scripts
TRANSCRIPT
-
8/14/2019 Debug Scripts
1/12
Debugger Enhancementsusing
Debug Scripts
---Siva.J
-
8/14/2019 Debug Scripts
2/12
What is debug script?
Functions to extend the capabilities of the
Vision2 debugger.
Used to generate external interrupts, logmemory contents to a file, update analog
input values periodically, and input serial
data to the on-chip serial port.
Utilizes a subset of the C programming
language.
-
8/14/2019 Debug Scripts
3/12
Capabilities & Restrictions
Flow control statements if, else, while,
do, switch, case, break, continue, and
goto may be used.
Variables are declared in the same way as
they are declared in ANSI C.
Arrays are not allowed.
Type of the file is Initialization File (.ini)
-
8/14/2019 Debug Scripts
4/12
How to use?
To invoke or run a debug function you
must type the name of the function and
any required parameters in the command
window.
Supports the three classes of functions:
Predefined Functions,
User Functions, and
Signal Functions.
-
8/14/2019 Debug Scripts
5/12
Predefined Functions Provided to assist the user and signal functions
you create. void rwatch (address) Delay execution of
signal function until the specified memoryaddress is read.
void wwatch (address) Delay execution ofsignal function until the specified memoryaddress is written.
void swatch (ulong states) Delay execution of
signal function for the specified number ofseconds.
void twatch (float seconds) Delay execution ofsignal function for the specified number of CPU
states.
-
8/14/2019 Debug Scripts
6/12
Predefined Functions (contd.)
uchar _RBYTE (address) Read charonspecified memory address
uint _RWORD (address) Read int on
specified memory address ulong _RDWORD (address) Read long on
specified memory address
float _RFLOAT (address) Read float on
specified memory address double _RDOUBLE (address) Read double on
specified memory address
-
8/14/2019 Debug Scripts
7/12
Predefined Functions (contd.)void _WBYTE (address, ucharval) Write charon
specified memory address
void _WWORD (address, uint val) Write int onspecified memory address
void _WDWORD (address, ulong val) Write longon specified memory address
void _WFLOAT (address, float val) Write floaton specified memory address
void _WDOUBLE (address, double val) Write
double on specified memory addressThe swatch function may be called only from
within a signal function.
Calls outside a signal function are not allowed and
result in an error message.
-
8/14/2019 Debug Scripts
8/12
User Functions User functions are functions you create to use with
the Vision2 debugger.User functions begin with FUNC keyword
FUNC return_type fname (parameter_list)
{ statements }
return_type may be: bit, char, float, int, long,uchar, uint, ulong, void. If no return type isspecified the type int is assumed.
Fname is the name of the function.
parameter_list is the list of arguments that arepassed to the function.
statementsare instructions the function carries out.
-
8/14/2019 Debug Scripts
9/12
Restrictions for User Functions
Functions with a non-void return type
must return a value.
User functions may not invoke signal
functions or the twatch function.
The value of a local object is undefined
until a value is assigned to it.
-
8/14/2019 Debug Scripts
10/12
-
8/14/2019 Debug Scripts
11/12
Signal Functions (contd.)
Signal functions begin with the SIGNAL keyword.SIGNAL void fname (parameter_list)
{ statements }
Fname is the name of the function.
Parameter is the list of arguments that are passedto the function.
Statements are instructions the function carries
out.The function definition is complete when thenumber of open braces is balanced with thenumber of the closing braces (}).
-
8/14/2019 Debug Scripts
12/12
Restrictions for Signal Functions
The return type of a signal function mustbe void.
A signal function may have a maximum ofeight function parameters.
A signal function may invoke otherpredefined functions and user functions.
A signal function may not invoke another
signal function. A maximum of 64 signal functions may be
active simultaneously.