Documentation for get_rom_symbols.pl |
get_rom_symbols.pl
Perl script that reads in an XML file representation of a linker map file and spits out many .asm files as follows: -
/* This file is *auto-generated*. Mods risk being overwritten */
.global _memset
_memset .set 0x3e600
The end output is a list of all the symbols and their addresses to which they got ROM'ed.
This would typically be run in the context of a batch file / shell-script doing e.g. (first ensure cgtools\bin is in your path!) del *tmp*.asm del *tmp*.obj
perl c:\temp\cg_xml\map\get_rom_symbols.pl ..\rom_image\rom_rts.xml -s=.rom_rts
cl6x -g -mv6400 *.asm
ar6x r rom_rts_symbols.lib *.obj
del *tmp*.asm
del *tmp*.obj
Why do we put each in a separate .asm file? Because then we can patch on a per function basis i.e. we simply explicitly link the patched RAM version before linkage of the ROM symbols lib. Each asm file is built and archived into a library thus enabling standard linker -priority switch selection mechanisms.
Wildcards on section names can be specified by using the -e option e.g. -e=.bios.* will pick up all of .bios, fbios, .bios_abc, .bios:abc We separate this from -s because -s is an exact string match e.g. -s=.bios will *only* pick up .bios whereas -e=.bios would pick up .bios and fbios.
We also support absolute symbols - what does this mean? BIOS 5.x for example has several absolute symbols which are symbols in the sym-table with a constant value like PIP_A_TABLEN yet they do not take up any target memory, nor are they part of any section. We need to 'bring these forward' in same fashion as the functions in sections. We use a different cmd line option (-a) to do this. The script user has to pass in the name of the absolute symbols to generate files with .set directives.
NOTE : this script generates A LOT of files! These are temporary since we can kill the .asm and their .obj's after we archive the objects into a lib. But we dont do the 'cleanup' in this script because we wish to avoid shell [delete, rename etc] commands inside this script which would tie the script to a particular environment [windows, linux etc] You probably want to run this script from an empty directory
Note that the i/p XML version of map file can be obtained via linker option --xml_link_info=<file>
get_rom_symbols.pl link_xml_file -s=.rom_sect1 -s=.rom_sect2 -e=.sect.* -a=sym1
--cg_xml_version : Print out the version of the cg_xml package in use
This script was written using Perl version 5.8.3. It may not work with earlier revisions of Perl.
Documentation for get_rom_symbols.pl |