2018-03-04 07:01 PM
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?
Thanks for your support!
Nikitha
2018-03-05 01:09 AM
Use the Map file (linker listing) to see how memory has been used
2018-03-10 05:44 AM
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.
2018-03-10 05:49 AM
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?
2018-03-12 07:23 AM
I'm not sure where i'm going wrong. Please correct me..
My expectation of how the binary file should be :
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.
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.
2018-03-12 07:29 AM
That makes no sense!
Correct - unless the BIN file is the ONLY artifact the O.P. has.
And what could that mean ?
2018-03-12 10:59 AM
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.
2018-03-12 11:11 AM
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.2018-03-12 03:53 PM
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.