1 % Copyright (C) 2013-2014 Czech Technical University in Prague
4 % - Michal Horn <hornmich@fel.cvut.cz>
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.
11 % File : rpp_generate_lib.m
13 % Generates library rpp_lib.slx for targets
16 % http://www.mathworks.com/help/matlab/ref/mex.html
17 % http://www.mathworks.com/help/matlab/matlab_external/custom-building-mex-files.html
19 %% This array contains a set of blocks, which are distributed
20 %% with the [platform TMS570 RPP. The blocks names are derived
21 %% from the names of their slx files without the .slx suffix.
45 %% This array contains a list of all targets, for which the
46 %% library will be generated.
47 %% Each record contains two items:
48 %% 1. the name of the directory containing the generated
49 %% library for the target,
50 %% 2. the reference to the list of blocks assigned to the
53 {'_tms570_rpp', tms570_rpp_blocks}
56 resultLibName = 'rpp_lib';
58 for i=1:length(targets),
59 disp(['Generating library for target: ', targets{i}{1}]);
60 libFilePath=[targets{i}{1}, '/', resultLibName, '.slx'];
61 load_system(libFilePath);
62 set_param(resultLibName, 'Lock', 'off');
63 blocks = find_system(resultLibName, 'Type', 'block');
64 disp('Removing old blocks:');
65 for j=1:length(blocks),
66 disp([' ', blocks{j}]);
67 delete_block(blocks{j});
69 disp('Adding new blocks:');
70 for j=1:length(targets{i}{2}),
71 blockFilePath=[targets{i}{2}{j}, '.slx'];
72 disp([' from: ', blockFilePath, ':']);
73 load_system(blockFilePath)
74 blocks = find_system(targets{i}{2}{j}, 'Type', 'block');
75 for k=1:length(blocks),
76 [tok, blockName] = strtok(blocks{k}, '/');
77 blockName = [resultLibName, blockName];
78 disp([' ', blocks{k}, ' as ', blockName]);
79 add_block(blocks{k}, blockName);
81 close_system(blockFilePath, 0);
83 disp(['Closing and saving file ', libFilePath]);
84 set_param(resultLibName, 'Lock', 'on');
85 close_system(libFilePath, 1);