This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How the microcontroller is differentiating two binary files



Hi,

How the microcontroller is differentiating two binary files(.bin or hex)?

In my one project following is the memory map.

FLASH (RX) : origin = 0x00000000, length = 0x00001000
SRAM (RWX) : origin = 0x20000000, length = 0x00008000

Another project's memory map

FLASH (RX) : origin = 0x00002800, length = 0x0003d800
SRAM (RWX) : origin = 0x20000000, length = 0x00008000

How the controller is treating a binary file? Is there any kind of Header or something?

Thank you for your help.

-Bijo

  • Hi,

    Mainly it is the linker's job - the first instruction is located at the first address specified and then the rest the code follows. In the case of .hex files, the address is contained in each line, after the ":" mark. In the case of the bin file, it is your responsability to instruct the flash loader utility to load it at the precise starting address.

    Petrei

  • Bijo,

    This appears to be a linker file for two different MCUs. Are you just asking for an explanation of these terms? 

    This information just tells the linker which memory location to put specific items. Code, constants, etc go into flash, while variables,stack, etc go into RAM. 

    The MCU itselft does not look at this information. 

    -Jason

  • Jason,

    The examples are both for the same micro controller: the first is for boot loader, the second for the user's application. Both reside in the same flash, but starts at different addresses. 

    Petrei