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.
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.
I would suggest getting Keil to generate .HEX data and then processing that into the form you want. You could do it directly from the .AXF/ELF but that requires more skill.
You could presumably take the .BINs you are creating now, and use basic file access functions fopen,fseek,fread,fwrite,fclose, etc to create the binary blob in the manner you need. Basic competence in C should be sufficient to do this.
The COPY command can consolidate files in a pretty simplistic way, ie
COPY /B A.BIN+B.BIN+C.BIN BIG.BIN
I'm more in Per's camp here, I'd just build a packaged binary, with sizing, placement, and integrity considered.
Thanx for your response Pier.. Actually I have already developed a customised bootloader for STR912FAW44 which is resident in Bank1 of flash memory. Using this, I am able to successfully download the application in .Hex format in Bank0. This configuration is working perfectly. Now, I have to develop the bootloader resident in Bank0 , using which, i can download the application in .bin format in Bank1. As with the developed bootloader, i am able to download the application in the bank1 but my problem is that control is not shifting to the application and it does not execute. So to rule out my customised bootloader problem, i was using the UART based bootloader given by keil. I converted it to be resident in bank0 and accordingly changed the blinky application to execute it from bank1. In this process, chip select mapping option has to be enabled in STR91x.cfg file in blinky application. Because of which,three different binary files are generated and i am not able to download all of them using standard bootloader. pls help me.. what can be the reason that application is not executing even after successful download in my cutomised bootloader??