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'));
42 % Ask user setup variables
43 if ispref('rpp', 'CompilerRoot')
44 possiblePath = getpref('rpp', 'CompilerRoot');
46 if isunix, prefix='/usr/local'; else prefix='C:'; end
47 possiblePath = [prefix, '/ti/ccsv5/tools/compiler/arm_5.1.1'];
50 CompilerRoot = fix_slash(uigetdir(possiblePath, ...
51 ['CCS Compiler root ' ...
52 'directory: (<ccs_root>/tools/compiler/arm_5.X.X)']));
54 CompilerRoot = fix_slash(varargin{1});
56 CCSRoot = fullfile(fileparts(fileparts(fileparts(CompilerRoot))));
57 TargetRoot = fix_slash(currentPath);
58 RppLibRoot = fullfile(fileparts(TargetRoot), 'lib');
60 if ispc, ext='.exe'; else ext=''; end
61 armcl = fullfile(CompilerRoot, 'bin', ['armcl' ext]);
62 if ~exist(armcl, 'file'),
63 fprintf('Error: "%s" does not exist!\n', armcl);
67 % Remove old paths and preferences (if any)
69 oldTargetPath = getpref('rpp', 'TargetRoot');
70 rmpath(fullfile(oldTargetPath, '..', 'rpp'));
71 rmpath(fullfile(oldTargetPath, '..', 'demos'));
72 rmpath(fullfile(oldTargetPath, '..', 'blocks'));
76 % Add target system folders to Matlab path
77 addpath(fullfile(targetPath, 'rpp'));
78 addpath(fullfile(targetPath, 'demos'));
79 addpath(fullfile(targetPath, 'blocks'));
83 addpref('rpp', 'CompilerRoot', CompilerRoot);
84 addpref('rpp', 'CCSRoot' , CCSRoot);
85 addpref('rpp', 'TargetRoot' , TargetRoot);
86 addpref('rpp', 'RppLibRoot' , RppLibRoot);
89 % Generate blocks and library
96 % FIXME: Write and generate help
97 %cd('../help/source');
101 % Apply changes and finish
102 sl_refresh_customizations();
103 disp('<strong>RPP</strong> Target setup is complete!');
104 disp(' Current configuration:');
105 disp([' CompilerRoot : ', CompilerRoot]);
106 disp([' CCSRoot : ', CCSRoot]);
107 disp([' TargetRoot : ', TargetRoot]);
108 disp([' RppLibRoot : ', RppLibRoot]);
109 disp('Explore <a href="matlab:cd([getpref(''rpp'',''TargetRoot''),''/../demos''])">demos</a> directory.');
110 %disp('Explore <a href="matlab:cd([getpref(''rpp'',''TargetRoot''),''/../demos''])">demos</a> directory and access <a href="matlab:doc -classic">documentation</a>');
114 function path = fix_slash(path0)