from
Estimating memory footprint of generated code
by Roger Aarenstrup
This tool outputs the code size and data footprint for code generated with Embedded Coder(TM).
|
| get_footprint(file_path, file_names)
|
function out_str = get_footprint(file_path, file_names)
data_tot = 0;
text_tot = 0;
out_str = '';
for idx = 1:length(file_names)
[a, out{idx}] = dos(['dumpbin ' file_path filesep file_names{idx}]);
data_size{idx} = get_size(out{idx}, '.data');
text_size{idx} = get_size(out{idx}, '.text');
data_tot = data_tot + hex2dec(data_size{idx});
text_tot = text_tot + hex2dec(text_size{idx});
[outstr errmsg] = sprintf('--- %-35s .text 0x%-10s .data 0x%-10s\n', file_names{idx}, ...
text_size{idx}, data_size{idx});
out_str = [out_str outstr];
end
[outstr errmsg] = sprintf('=== Total size in bytes (dec): .text %-12s .data %-10s\n', ...
num2str(text_tot), num2str(data_tot));
out_str = [out_str outstr];
|
|
Contact us at files@mathworks.com