📄 goto.m
字号:
function dummy = goto(cc,func,timeout)
% GOTO executes the target to the entry of a function
% GOTO(CC) places a breakpoint at the entry point to the 'main' function
% then restarts the target and waits for it to hit a breakpoint. If
% successful, this method will set the target's program counter (PC) to
% the beginning of main(). This permits the target to initialize any
% statically defined variables.
%
% GOTO(CC,FUNC) same as above, except in this form the target will halt
% upon reaching the specified target function: FUNC. The function is
% specified as a string.
%
% Notes - The GOTO will return upon reaching the first breakpoint that
% is encountered in the program execution. Therefore, it is possible that
% GOTO will complete with a target location other than the specified
% function if there are any existing breakpoints.
%
% See also RUN, INSERT, DELETE.
% Copyright 2002 The MathWorks, Inc.
% $Revision: 1.8 $ $Date: 2002/04/11 15:47:34 $
error(nargchk(1,3,nargin));
if ~ishandle(cc),
error('First Parameter must be a CCSDSP Handle');
end
if nargin==3 & ~isnumeric(timeout)
error('Third parameter must be a numeric');
end
if nargin >= 2,
if isempty(func) | ~ischar(func),
error('FUNC must be a string representation of the target function');
end
else
func = 'main';
end
restart(cc);
try
maininfo = list(cc,'function',func);
catch
if strncmp('??? GetVariable: Variable:',lasterr,26),
error(['Specified function : ''' func ''' was not available by the target ']);
else
error(lasterr);
end
end
lname = fieldnames(maininfo);
insert(cc,[maininfo.(lname{1}).address.start(1) 0],'break');
if nargin<=2, run(cc,'runtohalt');
else run(cc,'runtohalt',timeout);
end
if ~isequal( regread(cc,'pc','binary'),maininfo.(lname{1}).address.start(1))
warning(['A breakpoint before the function ''' func ''' was encountered.', ...
' Clear all breakpoints before ''' func '''.']);
return;
end
% [EOF] goto.m
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -