]> rtime.felk.cvut.cz Git - pes-rpp/rpp-simulink.git/blob - rpp/rpp/rpp_download.m
Implemented a temporal compilation system fix to get the FreeRTOS sources files compi...
[pes-rpp/rpp-simulink.git] / rpp / rpp / rpp_download.m
1 % Copyright (C) 2013 Czech Technical University in Prague
2 %
3 % Authors:
4 %     - Carlos Jenkins <carlos@jenkins.co.cr>
5 %
6 % This program is free software; you can redistribute it and/or modify
7 % it under the terms of the GNU General Public License as published by
8 % the Free Software Foundation; either version 2 of the License, or
9 % (at your option) any later version.
10 %
11 % This program is distributed in the hope that it will be useful,
12 % but WITHOUT ANY WARRANTY; without even the implied warranty of
13 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 % GNU General Public License for more details.
15 %
16 % You should have received a copy of the GNU General Public License
17 % along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 %
19 % File : rpp_download.m
20 % Abstract:
21 %     Code download utility for Simulink RPP Target.
22 %
23 % References:
24 %     loadti utility wiki at http://processors.wiki.ti.com/index.php/Loadti
25 %     Readme file in <cssroot>/ccs_base/scripting/examples/loadti/readme.txt
26
27
28 % FIXME: Adapt file
29
30
31
32 function rpp_download(modelName, buildDirectory)
33
34     CCSRoot    = getpref('rpp', 'CCSRoot');
35     RppLibRoot = getpref('rpp', 'RppLibRoot');
36
37     %TODO: parse the EXE_FILE_EXT from target_tools.mk
38     outfile     = fullfile(buildDirectory, [modelName, '.out']);
39     downloadLog = fullfile(buildDirectory, 'download.log');
40
41     if isunix
42
43         disp(['### Downloading ', modelName, ' to RPP board...']);
44
45         % -a,   --async-run             Run the specified executable and return without halting
46         % -r,   --reset                 Reset target before run
47         % -c,   --cfg-file=CONFIG_FILE  Target setup config file
48         system(['LD_PRELOAD="', ...
49                 CCSRoot, '/ccs_base/DebugServer/bin/libti_xpcom.so" "', ...
50                 CCSRoot, '/ccs_base/scripting/examples/loadti/loadti.sh" -a -r ', ...
51                 '-c "', RppLibRoot, '/TMS570LS3137.ccxml" ', ...
52                 '"', outfile, ...
53                 '" 2> "', downloadLog, '"']);
54
55         disp(['Done. <a href="matlab:open(''', downloadLog, ''')">Open download log.</a>']);
56
57     else
58         disp(['### Sorry code download is available for UNIX systems only.']);
59         disp(['###     -> Add support for non UNIX systems in <targetroot>/rpp/rpp_download.m file.']);
60     end
61 end