% Authors:
% - Carlos Jenkins <carlos@jenkins.co.cr>
%
-% This document contains proprietary information belonging to Czech
-% Technical University in Prague. Passing on and copying of this
-% document, and communication of its contents is not permitted
-% without prior written authorization.
+% Permission is hereby granted, free of charge, to any person
+% obtaining a copy of this software and associated documentation
+% files (the "Software"), to deal in the Software without
+% restriction, including without limitation the rights to use,
+% copy, modify, merge, publish, distribute, sublicense, and/or sell
+% copies of the Software, and to permit persons to whom the
+% Software is furnished to do so, subject to the following
+% conditions:
+
+% The above copyright notice and this permission notice shall be
+% included in all copies or substantial portions of the Software.
+
+% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+% OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+% HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+% WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+% FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+% OTHER DEALINGS IN THE SOFTWARE.
%
% File : rpp_setup.m
% Abstract:
currentPath = pwd();
targetPath = currentPath(1:end-length('/rpp'));
- % Add target system folders to Matlab path
- addpath(fullfile(targetPath, 'rpp'));
- addpath(fullfile(targetPath, 'demos'));
- addpath(fullfile(targetPath, 'blocks'));
- %addpath(fullfile(targetPath, 'help'));
- savepath();
+ if ~exist(fullfile(targetPath, 'rpp', 'rpp_setup.m'), 'file'),
+ error('rpp:wrong_setup_dir', ['rpp_setup called from directory ' ...
+ 'other than .../rpp/rpp']);
+ end
if nargin == 0,
% Ask user setup variables
return;
end
- % Save preferences
+ % Remove old paths and preferences (if any)
if ispref('rpp')
+ oldTargetPath = getpref('rpp', 'TargetRoot');
+ rmpath(fullfile(oldTargetPath, '..', 'rpp'));
+ rmpath(fullfile(oldTargetPath, '..', 'demos'));
+ rmpath(fullfile(oldTargetPath, '..', 'blocks'));
rmpref('rpp');
end
+
+ % Add target system folders to Matlab path
+ addpath(fullfile(targetPath, 'rpp'));
+ addpath(fullfile(targetPath, 'demos'));
+ addpath(fullfile(targetPath, 'blocks'));
+ savepath();
+
+ % Save preferences
addpref('rpp', 'CompilerRoot', CompilerRoot);
addpref('rpp', 'CCSRoot' , CCSRoot);
addpref('rpp', 'TargetRoot' , TargetRoot);
addpref('rpp', 'RppLibRoot' , RppLibRoot);
- % Generate blocks
+ % Generate blocks and library
cd('../blocks');
compile_blocks();
rpp_generate_lib();
disp([' CCSRoot : ', CCSRoot]);
disp([' TargetRoot : ', TargetRoot]);
disp([' RppLibRoot : ', RppLibRoot]);
+ disp([' Hardware : ', rpp_get_target]);
disp('Explore <a href="matlab:cd([getpref(''rpp'',''TargetRoot''),''/../demos''])">demos</a> directory.');
%disp('Explore <a href="matlab:cd([getpref(''rpp'',''TargetRoot''),''/../demos''])">demos</a> directory and access <a href="matlab:doc -classic">documentation</a>');
end