Difference between revisions of "Overlay generator"
From esoterum.org
(→Auto configuration script for spu-gcc auto overlay) |
|||
(9 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
=== List of files generated by overlay_generator === | === List of files generated by overlay_generator === | ||
+ | *<code>'''interference_costs.interference'''</code>: Generated by overlay_generator to record interference information so that it need not be recalculated later | ||
*<code>'''common_ancestors.common'''</code>: Generated by overlay_generator to record common ancestor information so that it need not be recalculated later | *<code>'''common_ancestors.common'''</code>: Generated by overlay_generator to record common ancestor information so that it need not be recalculated later | ||
*<code>'''included_functions.funcs'''</code>: List of functions included in overlay, generated by overlay_generator | *<code>'''included_functions.funcs'''</code>: List of functions included in overlay, generated by overlay_generator | ||
− | *<code>'''graph_[1-8].dot'''</code> and <code>'''graph_[1-8].ps'''</code>: dotty and postscript representations of GCCFG at various stages of construction, graphs | + | *<code>'''graph_[1-8].dot'''</code> and <code>'''graph_[1-8].ps'''</code>: 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: | ||
+ | :<code>'''MY_CFLAGS += -fdump-tree-cfg -ffunction-sections -Wl,--auto-overlay -Wl,--auto-overlay=linker.script'''</code> (note that the cfg switch is not required here) | ||
+ | :<code>'''LDFLAGS += -Wl,-Map,spu.map -Wl,--auto-overlay -Wl,--gc-sections'''</code> (-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 | ||
+ | :<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) | ||
+ | |||
+ | === Add timing code to project === | ||
+ | *<code>'''timing.h'''</code>: Add [http://www.esoterum.com/temp/timing.h timing.h] to main source file | ||
+ | *Add code to start and stop timer, i.e. at start and end of main(). STOP_TIMER will also print the elapsed time. | ||
+ | :'''Start timer''': | ||
+ | :<code>/***** add timing statements ************/</code> | ||
+ | :<code>START_TIMER</code> | ||
+ | :<code>/****************************************/</code> | ||
+ | |||
+ | |||
+ | :'''Stop timer''': | ||
+ | :<code>/*MAB 10 NOV 09 : add timing statements */</code> | ||
+ | :<code>STOP_TIMER</code> | ||
+ | :<code>/****************************************/</code> | ||
+ | |||
+ | === Auto configuration script for spu-gcc 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> |
Latest revision as of 13:00, 31 August 2010
Contents
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_sizeroot_node.configure_overlay_generator
: Used by script to describe the root function for the project folderobject_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 inCFLAGS
List of files generated by overlay_generator
interference_costs.interference
: Generated by overlay_generator to record interference information so that it need not be recalculated latercommon_ancestors.common
: Generated by overlay_generator to record common ancestor information so that it need not be recalculated laterincluded_functions.funcs
: List of functions included in overlay, generated by overlay_generatorgraph_[1-8].dot
andgraph_[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)
Add timing code to project
timing.h
: Add timing.h to main source file- Add code to start and stop timer, i.e. at start and end of main(). STOP_TIMER will also print the elapsed time.
- Start timer:
/***** add timing statements ************/
START_TIMER
/****************************************/
- Stop timer:
/*MAB 10 NOV 09 : add timing statements */
STOP_TIMER
/****************************************/
Auto configuration script for spu-gcc auto overlay
compile_config.sh
: Auto configuration script for auto overlay, recompiles project to create automatically generatedlinker.script
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;
}
/*************************************************************************************/
/*************************************************************************************/