This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to exclude some sections of code while creating a binary file for multiple load regions in keil

i have written a program for STR912FAW44 which boots from bank1. In this, i am using the standard STR91x.CFG file given in example programs of the keil for chip select mapping to boot it from bank1. This program is working perfectly fine if i am downloading the hex file in flash memory.
But my requirement is to generate the binary file for this program. When I try to generate binary file using fromelf command, three different binary files corresponding to three different sections/regions is generated. Out of these, one is corresponding to my application at address 0x0, other two correspond to the address 0x510000 and 0x520000 which is specified in STR91x.CFG file.
I have used the option --binCombined of fromelf command to generate a single binary file. but the size of the file is very large,because as per the command details it will pad the unused area between different sections with 0xFF. Can anybody help me tell how some sections can be excluded while creating a single binary file for multiple load regions/sections.

Parents
  • Since bin files doesn't contain load address information, you can't create a small bin file.

    You either need to have one bin file per load region. Or a combined bin file that has padding to fill the gap between each individual region. That's how bin files works.

    So maybe time to take one step back. You claim "But my requirement is to generate the binary file for this program."

    Who set up that requirement? And why?

    The hex format works well for factory programming.

    And if you instead wants to distribute a packaged file for use with a boot loader, then I suggest that you write your own boot loader (possibly a secondary boot loader on top of one you already have) where you add support for some more appropriate file format - one that can handle the gaps and that also contains some form of check-summing to validate that the user feeds correct and complete data.

    So invent something that has: * File header - to validate the file is intended for that specific product. * One or more blocks - with offset, size, data, checksum. * File epilogue - report full file processed + checksum to validate full flashing.

Reply
  • Since bin files doesn't contain load address information, you can't create a small bin file.

    You either need to have one bin file per load region. Or a combined bin file that has padding to fill the gap between each individual region. That's how bin files works.

    So maybe time to take one step back. You claim "But my requirement is to generate the binary file for this program."

    Who set up that requirement? And why?

    The hex format works well for factory programming.

    And if you instead wants to distribute a packaged file for use with a boot loader, then I suggest that you write your own boot loader (possibly a secondary boot loader on top of one you already have) where you add support for some more appropriate file format - one that can handle the gaps and that also contains some form of check-summing to validate that the user feeds correct and complete data.

    So invent something that has: * File header - to validate the file is intended for that specific product. * One or more blocks - with offset, size, data, checksum. * File epilogue - report full file processed + checksum to validate full flashing.

Children