mirror of https://github.com/thesofproject/sof.git
Tools: Tune: Prevent topology1 blob export to increase blob size
The increase of non-32bit aligned blob sizes needs to be removed because it can cause mismatch of blob binary header vs. actual size. Instead error if blob size is not multiple of four bytes. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
parent
e235fbf9be
commit
d526f7372c
|
@ -10,11 +10,14 @@ if nargin < 4
|
|||
comment = 'Exported EQ';
|
||||
end
|
||||
|
||||
%% Pad blob length to multiple of four bytes
|
||||
n_orig = length(blob8);
|
||||
n_new = ceil(n_orig/4)*4;
|
||||
blob8_new = zeros(1, n_new);
|
||||
blob8_new(1:n_orig) = blob8;
|
||||
%% Check that blob length is multiple of 32 bits
|
||||
n_blob = length(blob8);
|
||||
n_test = ceil(n_blob/4)*4;
|
||||
if (n_blob ~= n_test)
|
||||
fprintf(1, 'Error: ´Blob length %d is not multiple of 32 bits\n', ...
|
||||
n_blob);
|
||||
error('Failed.');
|
||||
end
|
||||
|
||||
%% Write blob
|
||||
fh = fopen(fn, 'w');
|
||||
|
@ -22,22 +25,23 @@ nl = 8;
|
|||
fprintf(fh, '# %s %s\n', comment, date());
|
||||
fprintf(fh, 'CONTROLBYTES_PRIV(%s,\n', priv);
|
||||
fprintf(fh, '` bytes "');
|
||||
for i = 1:nl:n_new
|
||||
for i = 1:nl:n_blob
|
||||
if i > 1
|
||||
fprintf(fh, '` ');
|
||||
end
|
||||
for j = 0:nl-1
|
||||
n = i + j;
|
||||
if n < n_new
|
||||
fprintf(fh, '0x%02x,', blob8_new(n));
|
||||
if n < n_blob
|
||||
fprintf(fh, '0x%02x,', blob8(n));
|
||||
end
|
||||
if n == n_new
|
||||
fprintf(fh, '0x%02x"', blob8_new(n));
|
||||
if n == n_blob
|
||||
fprintf(fh, '0x%02x"', blob8(n));
|
||||
end
|
||||
end
|
||||
fprintf(fh, '''\n');
|
||||
end
|
||||
fprintf(fh, ')\n');
|
||||
fclose(fh);
|
||||
fprintf('Blob size %d was written to file %s\n', n_blob, fn);
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue