Matlab Help

Status
Not open for further replies.

wuchy143

Member
Hi,

I am trying to manipulate a binary file(bootrom .bin file) so that I can put it into a .txt file in order to get it into the correct format to compare against another .txt file. Essentially I am trying to make the format of both files match by manipulating one. (don't ask why i'm doing this, long story)

I'm sure this is very simple, but, I am trying to import the .bin file into matlab, use fopen and then use textscan to get the file into an array. I also think I need to convert from dec2hex as well but one step at a time.

Can anyone point me in the right direction. Matlab keeps spitting back jibberish.

Thanks, I appreciate the help.
 

Attachments

  • BinFile.jpg
    736 KB · Views: 111
  • Output.jpg
    1.5 MB · Views: 97
What format is the text file you are wanting to compare to?

There is no direct way to convert binary to text, it must be re-coded - and there are many different possible coding representations.
The commonest for such as ROM data would be Motorola S record format or Intel hex.

Info on both in this document: **broken link removed**
 
I apologize for the delay. Dang holidays.

Anyway, I attached the format of the file I want to compare to. In the beginning it is all 0000's but there is indeed data further down which I am interested in.

Just so I am fully understanding, you are saying that Matlab isn't capable of reading in a binary file(the one I attached) and then massaging it to a .txt file?

The way that I was able to pull the attached ".txt" file(i only show a screen shot - its too big) was to get the particular single board computer to boot up its kernel and then I type, " mr 0xFF800000 0x00800000" over my terminal window. It takes hours for it to dump all its contents of the bootrom chip but I didn't design this board so it's the only way I know to grab the bootrom off of it. Before I dumped it I set my terminal window to dump to a log file so then I just rename it to a .txt and waalaaa its in a format I can compare to.

If there are better ways of doing what I am doing please say. I'm just doing what I know.

Thanks again for the response!
 

Attachments

  • AssetFormat.PNG
    16.9 KB · Views: 104
Part of the problem & confusion is that you are not dealing with a "binary file" - they are just text files, containing hexadecimal representations of binary data.

What you actually need is nearer a text editor macro to reformat the text to the same column layout format in each file.
I'll see what I can come up with..
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…