AnsweredAssumed Answered

How to reduce LDR file size

Question asked by Bora on Jun 19, 2009



I managed to boot and run a simple led blink program from SPI EEPROM (Atmel 25256). Moreover, I added a simple SDRAM initialization routine to this program inspired from ADI's example file EE-240.


I noticed that, the SDRAM initialization routine uses a very simple LDF file located under;


EE 240 v4\example\BF533 ASM Blink\init_code\Init_Code_BF533\ADSP-BF533.ldf





SEARCH_DIR( $ADI_DSP\Blackfin\lib )

     PROGRAM          { TYPE(RAM) START(0xFFA00000) END(0xFFA0AFFF) WIDTH(8) } //L1_code
     SDRAM          { TYPE(RAM) START(0x00000000) END(0x07FFFFFF) WIDTH(8) } //SDRAM


             // Align all code sections on 2 byte boundary
             INPUT_SECTIONS( $OBJECTS(program))
          } >PROGRAM
              INPUT_SECTIONS( $OBJECTS(sdram) )
         } >SDRAM

             // The data sections shouldn't be aligned.
             INPUT_SECTIONS( $OBJECTS(stack)) 
          } >PROGRAM


With default LDF file, one must define "main" in the SDRAM initialization routine, and produced DXE file size is big (12 kB). And worst, it does not work!


But, with the simple LDF file mentioned above, "main" is not needed, and DXE file size is below 2 kB, and it works properly. I noticed that since there is no library defined in this simple LDF file, both "main" is not needed and final DXE file is small.


But, there is a problem when I use this simple LDF file with my LED blinking program; it can not be linked (for example, it needs definition of "register_handler")! This is normal because there is no library definition in the simple LDF file.


I used project options and created my own LDF and CRT files. It is compiled without any error. But, I think file size is still big. I have feeling that still tons of redundant codes are still there :-)


Compression is my last resort and I plan to use this feature after shrinking LDR size as much as possible first.


I want to customize my LDF file to add only necessary libraries. And I need minimal start-up CRT code. I use SDRAM, interrupts and DMA. There is no file IO.


Which libraries are necessary for which built-in functions or features?


Do you have a simple example or what you suggest me?


Best regards,