Difference between revisions of "Overlay generator"

From esoterum.org
Jump to: navigation, search
(Makefile settings)
(Makefile settings)
Line 18: Line 18:
 
*Makefile with linker.script.ed
 
*Makefile with linker.script.ed
 
:<code>'''LDFLAGS= -Wl,-T,linker.script -Wl,-Map,spu.map -Wl,--gc-sections'''</code> (-gc-sections is used to dump unused .bss .txt and .data sections in spu.map)
 
:<code>'''LDFLAGS= -Wl,-T,linker.script -Wl,-Map,spu.map -Wl,--gc-sections'''</code> (-gc-sections is used to dump unused .bss .txt and .data sections in spu.map)
 +
 +
=== Auto configuration script for auto overlay ===
 +
*<code>'''compile_config.sh'''</code>: Auto configuration script for auto overlay, recompiles project to create automatically generated </code>'''linker.script'''</code> files based on size constraints given in the script.  The size constraints ("OPTIONS" in the script) describe the size of a buffer that will be added to the code to artificially restrict the size of the local store.  A smaller number means more space will be available in the local store.
 +
*<code>'''compile_config.sh'''</code> requires the following declaration and assigment to be added to a global section such as the file containing "main" in the project:
 +
:'''Declaration: place above main()''''
 +
:<code>/*************************************************************************************/</code>
 +
:<code>/****************** BUFFER TO WASTE SPACE TRYING TO GET LINKER SCRIPT TO WORK ********/</code>
 +
:<code>int waste_of_space_index;</code>
 +
:<code>#define WASTE_OF_SPACE_SIZE 0</code>
 +
:<code>unsigned char waste_of_space[WASTE_OF_SPACE_SIZE];</code>
 +
:<code>/*************************************************************************************/</code>
 +
:<code>/*************************************************************************************/</code>
 +
 +
 +
:'''Assignment''' (ensures the data section isn't dropped by --gc-sections): place within main()
 +
:<code>/*************************************************************************************/</code>
 +
:<code>/****************** BUFFER TO WASTE SPACE TRYING TO GET LINKER SCRIPT TO WORK ********/</code>
 +
:<code>for(waste_of_space_index=0;waste_of_space_index<WASTE_OF_SPACE_SIZE;waste_of_space_index++){</code>
 +
:<code> waste_of_space[waste_of_space_index]=waste_of_space_index;</code>
 +
:<code>}</code>
 +
:<code>/*************************************************************************************/</code>
 +
:<code>/*************************************************************************************/</code>

Revision as of 02:27, 15 November 2009

List of support files

  • function_sizes.nm: Required by overlay_generator, generated from object files using the command line:
nm --size-sort *.o > function_sizes.nm
  • region_sizes_file.dat: Used by script to describe what sizes of scratchpad memory to use, the contents are three space delimited numbers given in bytes: start_size stop_size step_size
  • root_node.configure_overlay_generator: Used by script to describe the root function for the project folder
  • object_filename.cfg: Needed by overlay generator to determine GCCFG of project code, one file is generated for each object file by gcc when the -fdump-tree-cfg switch is given in CFLAGS

List of files generated by overlay_generator

  • common_ancestors.common: Generated by overlay_generator to record common ancestor information so that it need not be recalculated later
  • included_functions.funcs: List of functions included in overlay, generated by overlay_generator
  • graph_[1-8].dot and graph_[1-8].ps: dotty and postscript representations of GCCFG at various stages of construction, graphs following graph_4 each represent an overlay algorithm


Makefile settings

  • Auto overlay Makefile:
MY_CFLAGS += -fdump-tree-cfg -ffunction-sections -Wl,--auto-overlay -Wl,--auto-overlay=linker.script (note that the cfg switch is not required here)
LDFLAGS += -Wl,-Map,spu.map -Wl,--auto-overlay -Wl,--gc-sections (-Map,spu.map switch is not required, -gc-sections is used to dump unused .bss .txt and .data sections in spu.map)
  • Makefile with linker.script.ed
LDFLAGS= -Wl,-T,linker.script -Wl,-Map,spu.map -Wl,--gc-sections (-gc-sections is used to dump unused .bss .txt and .data sections in spu.map)

Auto configuration script for auto overlay

  • compile_config.sh: Auto configuration script for auto overlay, recompiles project to create automatically generated </code>linker.script</code> files based on size constraints given in the script. The size constraints ("OPTIONS" in the script) describe the size of a buffer that will be added to the code to artificially restrict the size of the local store. A smaller number means more space will be available in the local store.
  • compile_config.sh requires the following declaration and assigment to be added to a global section such as the file containing "main" in the project:
Declaration: place above main()'
/*************************************************************************************/
/****************** BUFFER TO WASTE SPACE TRYING TO GET LINKER SCRIPT TO WORK ********/
int waste_of_space_index;
#define WASTE_OF_SPACE_SIZE 0
unsigned char waste_of_space[WASTE_OF_SPACE_SIZE];
/*************************************************************************************/
/*************************************************************************************/


Assignment (ensures the data section isn't dropped by --gc-sections): place within main()
/*************************************************************************************/
/****************** BUFFER TO WASTE SPACE TRYING TO GET LINKER SCRIPT TO WORK ********/
for(waste_of_space_index=0;waste_of_space_index<WASTE_OF_SPACE_SIZE;waste_of_space_index++){
waste_of_space[waste_of_space_index]=waste_of_space_index;
}
/*************************************************************************************/
/*************************************************************************************/