@@ -357,6 +357,37 @@ int write_logs_dictionary(struct image *image)
357357 for (i = 0 ; i < image -> num_modules ; i ++ ) {
358358 struct module * module = & image -> module [i ];
359359
360+ /* extract fw_version from fw_ready message located
361+ * in .fw_ready section
362+ */
363+ if (module -> fw_ready_index > 0 ) {
364+ Elf32_Shdr * section =
365+ & module -> section [module -> fw_ready_index ];
366+
367+ buffer = calloc (1 , sizeof (struct sof_ipc_fw_ready ));
368+ if (!buffer )
369+ return - ENOMEM ;
370+
371+ fseek (module -> fd , section -> sh_offset , SEEK_SET );
372+ size_t count = fread (buffer , 1 ,
373+ sizeof (struct sof_ipc_fw_ready ), module -> fd );
374+
375+ if (count != sizeof (struct sof_ipc_fw_ready )) {
376+ fprintf (stderr ,
377+ "error: can't read ready section %d\n" ,
378+ - errno );
379+ ret = - errno ;
380+ goto out ;
381+ }
382+
383+ memcpy (& header .version ,
384+ & ((struct sof_ipc_fw_ready * )buffer )-> version ,
385+ sizeof (header .version ));
386+
387+ free (buffer );
388+ buffer = NULL ;
389+ }
390+
360391 if (module -> logs_index > 0 ) {
361392 Elf32_Shdr * section = & module -> section [module -> logs_index ];
362393
@@ -374,7 +405,8 @@ int write_logs_dictionary(struct image *image)
374405 size_t count = fread (buffer , 1 , section -> sh_size ,
375406 module -> fd );
376407 if (count != section -> sh_size ) {
377- fprintf (stderr , "error: can't read section %d\n" ,
408+ fprintf (stderr ,
409+ "error: can't read logs section %d\n" ,
378410 - errno );
379411 ret = - errno ;
380412 goto out ;
@@ -388,8 +420,10 @@ int write_logs_dictionary(struct image *image)
388420 goto out ;
389421 }
390422
391- fprintf (stdout , "logs dictionary: size %d\n \n" ,
423+ fprintf (stdout , "logs dictionary: size %u \n" ,
392424 header .data_length + header .data_offset );
425+ fprintf (stdout , "including fw version of size: %lu\n\n" ,
426+ sizeof (header .version ));
393427 }
394428 }
395429out :
0 commit comments