]> rtime.felk.cvut.cz Git - pes-rpp/rpp-simulink.git/commitdiff
Add script for reconfiguring target file in demos
authorMichal Horn <hornmich@fel.cvut.cz>
Thu, 23 Apr 2015 09:41:15 +0000 (11:41 +0200)
committerMichal Horn <hornmich@fel.cvut.cz>
Thu, 23 Apr 2015 09:41:15 +0000 (11:41 +0200)
rpp/demos/Makefile
rpp/demos/Makefile.var [new file with mode: 0644]
rpp/demos/rpp_demos_set_tg.m [new file with mode: 0644]

index d15c79d6caebcf94de6aff068402a99559a3f5b7..e94ce25aa0ea33bbe7bb87ffc029ba72ac1735c1 100644 (file)
 # Abstract:
 #     Build demos
 
+include Makefile.var
+
 MODELS=$(wildcard *.slx)
 BUILD_DIRS=$(MODELS:%.slx=%_rpp)
 
-all: lib
+all: lib set-target
        matlab -nojvm -r "try; rpp_build_demos(); catch ME, disp(getReport(ME)); exit(1); end; exit(0)"
 
 %_rpp: %.slx lib
@@ -23,6 +25,9 @@ all: lib
 
 lib:
        $(MAKE) -C ../lib rpp-lib.lib
-
+       
+set-target:
+       matlab -nojvm -r "try; rpp_demos_set_tg($(rpp_target_file), $(rpp_demo_set)); catch ME, disp(getReport(ME)); exit(1); end; exit(0)"
+       
 clean:
        rm -rf $(BUILD_DIRS)
diff --git a/rpp/demos/Makefile.var b/rpp/demos/Makefile.var
new file mode 100644 (file)
index 0000000..2719ca1
--- /dev/null
@@ -0,0 +1,47 @@
+# Copyright (C) 2013 Czech Technical University in Prague
+#
+# Authors:
+#     - Michal Horn <hornmich@fel.cvut.cz>
+#
+# 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.
+#
+# File : Makefile.var
+# Abstract:
+#     Variables defining sets of demos for targets
+
+include ../lib/Makefile.var
+
+rpp_demo_set = $(rpp_$(TARGET)_demos)
+
+rpp_target_file = $(rpp_$(TARGET)_target_file)
+
+rpp_rm48_hdk_demos =           \
+       'adc_demo_hdk',                 \
+       'can_ext_mode_demo',    \
+       'can_simple_demo',              \
+       'cantransmit',                  \
+       'continuous_hdk',               \
+       'demo_board_hdk',               \
+       'echo_char',                    \
+       'gio_demo_hdk',                 \
+       'hello_world',                  \
+       'multirate_st_hdk'
+       
+rpp_rm48_hdk_target_file = 'rpp_rm48_hdk.tlc'
+
+rpp_tms570_hdk_demos =                 \
+       'adc_demo_hdk',                 \
+       'can_ext_mode_demo',    \
+       'can_simple_demo',              \
+       'cantransmit',                  \
+       'continuous_hdk',               \
+       'demo_board_hdk',               \
+       'echo_char',                    \
+       'gio_demo_hdk',                 \
+       'hello_world',                  \
+       'multirate_st_hdk'
+
+rpp_tms570_hdk_target_file = 'rpp_tms570_hdk.tlc'
diff --git a/rpp/demos/rpp_demos_set_tg.m b/rpp/demos/rpp_demos_set_tg.m
new file mode 100644 (file)
index 0000000..91772e0
--- /dev/null
@@ -0,0 +1,45 @@
+% Copyright (C) 2013-2014 Czech Technical University in Prague
+%
+% Authors:
+%     - Michal Horn <hornmich@fel.cvut.cz>
+%
+% 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.
+%
+% File : rpp_demos_set_tg.m
+% Abstract:
+%     Set target file for demo, preserving selected solver and
+%     continuous time support
+%
+% References:
+%     http://www.mathworks.com/help/matlab/ref/mex.html
+%     http://www.mathworks.com/help/matlab/matlab_external/custom-building-mex-files.html
+
+
+function rpp_demos_set_tg(varargin)
+       d = fullfile(getpref('rpp', 'TargetRoot'), '..', 'demos');
+       cd(d)
+       
+       if nargin > 1,
+               reqTarget = varargin{1};
+               demos_set_tg(reqTarget, varargin)
+       else
+               error('Not enough arguments for the function.');
+       end
+
+function demos_set_tg(reqTg, files)
+       for i=2:length(files),
+               disp(['Processing system: ', files{i}]);
+               load_system(files{i});
+               continuousTime = get_param(files{i}, 'SupportContinuousTime');
+               solver = get_param(files{i}, 'Solver');
+               disp(['    Set SystemTargetFile to ', reqTg, ' with continuousTime ', continuousTime, ' and solver ', solver]);
+               set_param(files{i}, 'SystemTargetFile', reqTg);
+               set_param(files{i}, 'SupportContinuousTime', continuousTime);
+               set_param(files{i}, 'Solver', solver);
+               disp('    Saving and closing model.');
+               close_system(files{i}, 1);
+       end
+