1 % Copyright (C) 2013, 2014, 2015 Czech Technical University in Prague
4 % - Carlos Jenkins <carlos@jenkins.co.cr>
6 % This document contains proprietary information belonging to Czech
7 % Technical University in Prague. Passing on and copying of this
8 % document, and communication of its contents is not permitted
9 % without prior written authorization.
13 % RPP Target install script.
15 % This script configures RPP target for use. It stores the location of
16 % armcl compiler and other location of other directories needed for
17 % proper function of the target. Finally, it compiles S-Function
18 % for RPP target blocks.
20 % RPP_SETUP RPP Target install script
21 % RPP_SETUP asks for the path to the Code Composer Studio's compiler.
22 % RPP_SETUP(PATH) uses the PATH argument as the path to the
26 % IMPORTANT: This script _MUST_ be run by user after extracting the target
27 % package and before using the target. To execute:
30 % 2. Change directory (cd) to this file folder.
31 % 3. Execute rpp_setup on command window.
36 function rpp_setup(varargin)
37 % Get current target path in user's filesystem
39 targetPath = currentPath(1:end-length('/rpp'));
41 if ~exist(fullfile(targetPath, 'rpp', 'rpp_setup.m'), 'file'),
42 error('rpp:wrong_setup_dir', ['rpp_setup called from directory ' ...
43 'other than .../rpp/rpp']);
47 % Ask user setup variables
48 if ispref('rpp', 'CompilerRoot')
49 possiblePath = getpref('rpp', 'CompilerRoot');
51 if isunix, prefix='/usr/local'; else prefix='C:'; end
52 possiblePath = [prefix, '/ti/ccsv5/tools/compiler/arm_5.1.1'];
55 CompilerRoot = fix_slash(uigetdir(possiblePath, ...
56 ['CCS Compiler root ' ...
57 'directory: (<ccs_root>/tools/compiler/arm_5.X.X)']));
59 CompilerRoot = fix_slash(varargin{1});
61 CCSRoot = fullfile(fileparts(fileparts(fileparts(CompilerRoot))));
62 TargetRoot = fix_slash(currentPath);
63 RppLibRoot = fullfile(fileparts(TargetRoot), 'lib');
65 if ispc, ext='.exe'; else ext=''; end
66 armcl = fullfile(CompilerRoot, 'bin', ['armcl' ext]);
67 if ~exist(armcl, 'file'),
68 fprintf('Error: "%s" does not exist!\n', armcl);
72 % Remove old paths and preferences (if any)
74 oldTargetPath = getpref('rpp', 'TargetRoot');
75 rmpath(fullfile(oldTargetPath, '..', 'rpp'));
76 rmpath(fullfile(oldTargetPath, '..', 'demos'));
77 rmpath(fullfile(oldTargetPath, '..', 'blocks'));
81 % Add target system folders to Matlab path
82 addpath(fullfile(targetPath, 'rpp'));
83 addpath(fullfile(targetPath, 'demos'));
84 addpath(fullfile(targetPath, 'blocks'));
88 addpref('rpp', 'CompilerRoot', CompilerRoot);
89 addpref('rpp', 'CCSRoot' , CCSRoot);
90 addpref('rpp', 'TargetRoot' , TargetRoot);
91 addpref('rpp', 'RppLibRoot' , RppLibRoot);
94 % Generate blocks and library
101 % FIXME: Write and generate help
102 %cd('../help/source');
106 % Apply changes and finish
107 sl_refresh_customizations();
108 disp('<strong>RPP</strong> Target setup is complete!');
109 disp(' Current configuration:');
110 disp([' CompilerRoot : ', CompilerRoot]);
111 disp([' CCSRoot : ', CCSRoot]);
112 disp([' TargetRoot : ', TargetRoot]);
113 disp([' RppLibRoot : ', RppLibRoot]);
114 disp('Explore <a href="matlab:cd([getpref(''rpp'',''TargetRoot''),''/../demos''])">demos</a> directory.');
115 %disp('Explore <a href="matlab:cd([getpref(''rpp'',''TargetRoot''),''/../demos''])">demos</a> directory and access <a href="matlab:doc -classic">documentation</a>');
119 function path = fix_slash(path0)