cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F303 Bin File

Nikitha Rakala
Associate II
Posted on March 05, 2018 at 04:01

I was analyzing my program bin file to locate the Stack address, PC, Interrupts and Program code and the data section.

Everything looked sorted until interrupts, When it came to the  program code and Data section, i wasn't able to find two distinguished locations. Instead, the data section was merged up in between the program code. 

Can some one help me understand how i can trace out and distinguished the code section and .data section from my bin file? 

0690X00000609ulQAA.png

Thanks for your support!

Nikitha

8 REPLIES 8
Andrew Neil
Chief II
Posted on March 05, 2018 at 10:09

Use the Map file (linker listing) to see how memory has been used

Posted on March 10, 2018 at 13:44

Thanks Neil.

But my question was on identifying the sections in the bin file.

Through my map file i understand the begin and end address of the data section(say 0x20000000 to 0x20000400 )

and the code section.

with reference to the snapshot of the bin file , i saw these addresses (

0x20000000 to 0x20000400

) were scattered around instead of being bundled somewhere in the bin file.

Please let me know your thoughts.

Posted on March 10, 2018 at 13:49

That makes no sense!

A bin file is just a byte-for-byte image - things cannot be 'scattered around' out of order!

Are you sure you're not talking about a Hex ('Intel Hex', to be precise) file?

Or some other format?

Posted on March 12, 2018 at 14:23

I'm not sure where i'm going wrong. Please correct me..

My expectation of how the binary file should be :

0690X0000060A4WQAU.png

Reference : 

http://tmdarwen.com/blog/in-depth-analysis-of-an-arm-cortex-m4-program

 

But , when i look at my bin file, the format seemed right till the vectors table. However, program code and data section wern't the same way as in the above reference.

0690X0000060A4bQAE.png

This is a snap shot of my binary - Address of data section : 20000000, 20000454, 200016C8 - these wernt exactly at the end of my bin file.

What i'm trying to accomplish is - decoding a bin file and how all the relevant info is structured in it. How to locate vectors, data section and program code in my binary file.

Thanks for your prompt replies. Would really appreciate your support on this.

Posted on March 12, 2018 at 14:29

That makes no sense!

Correct - unless the BIN file is the ONLY artifact the O.P. has.

And what could that mean ?

Posted on March 12, 2018 at 17:59

Your question still doesn't make much sense.

Nikitha Rakala wrote:

What i'm trying to accomplish is - decoding a bin file and how all the relevant info is structured in it. 

Unless you're actually writing your own linker, what is the point of this?

What is the actual object of this exercise? What are you trying to achieve by this? What is your goal?  

http://www.catb.org/~esr/faqs/smart-questions.html&sharpgoal

How to locate vectors

The locations of the vectors - including initial SP, and the Reset Vector (initial PC) - is defined by the hardware.

 data section and program code in my binary file

These are entirely arbitrary.

For a specific toolchain, you can RTFM if you want - but it is really of little to no concern to the application developer.

The information you require as an application developer is in the Map file.

Posted on March 12, 2018 at 18:11

Nikitha Rakala wrote:

Reference :

/external-link.jspa?url=http%3A%2F%2Ftmdarwen.com%2Fblog%2Fin-depth-analysis-of-an-arm-cortex-m4-program

Which also tells you:

The Map File

When building the project, we've specified in the

https://github.com/tmdarwen/STM32/blob/master/STM32F411/ArmCortexM4Analysis/Makefile

that a map file (out.map) should be generated during the linking step. The map file can be viewed with a text editor and is helpful to understand and confirm some of the conclusions we've come to when analyzing the bin file.

Posted on March 12, 2018 at 22:53

Provide the .BIN, .MAP and whatever supporting material you have, it is hard to make sense of what is going on based on your description.

What does the table you're enumerating describe? Could it be pointers to other things in RAM?

Memory does not require that the 'Content' be in any specific order. What you are showing is the content without an address context.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..