tracesrv/tracecompiler/tracecompiler/readme.txt
author hgs
Fri, 08 Oct 2010 14:56:39 +0300
changeset 56 aa2539c91954
parent 41 tracefw/tracecompiler/tracecompiler/readme.txt@838cdffd57ce
permissions -rw-r--r--
201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41
hgs
parents:
diff changeset
     1
------------TraceCompiler------------
hgs
parents:
diff changeset
     2
hgs
parents:
diff changeset
     3
hgs
parents:
diff changeset
     4
hgs
parents:
diff changeset
     5
----What is TraceCompiler?----
hgs
parents:
diff changeset
     6
hgs
parents:
diff changeset
     7
TraceCompiler will find OST (Open System Trace) traces from source files and generate needed headers and decode files for them
hgs
parents:
diff changeset
     8
during component compilation time.
hgs
parents:
diff changeset
     9
hgs
parents:
diff changeset
    10
hgs
parents:
diff changeset
    11
hgs
parents:
diff changeset
    12
----What are OST traces?----
hgs
parents:
diff changeset
    13
hgs
parents:
diff changeset
    14
Open System Trace traces. Macros can be found from the header OpenSystemTrace.h. OST is a binary tracing concept for good performance
hgs
parents:
diff changeset
    15
and run-time activation of traces.
hgs
parents:
diff changeset
    16
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
hgs
parents:
diff changeset
    19
----How to set up TraceCompiler?----
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
Remove comments before exports from group folder bld.inf
hgs
parents:
diff changeset
    22
When compiled from the group folder, will export itself to /epoc32/tools folder.
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
Usually TraceCompiler is already integrated to Symbian build system, so there is no need to run TraceCompiler separately. Symbian build system calls 
hgs
parents:
diff changeset
    25
TraceCompiler automatically during component compilation. 
hgs
parents:
diff changeset
    26
hgs
parents:
diff changeset
    27
If TraceCompiler is not integrated to build system but is needed to be run automatically when building a component
hgs
parents:
diff changeset
    28
abld.pl in /epoc32/tools/ needs to be changed to call tracecompiler.pl file. Note that the change might already be there.
hgs
parents:
diff changeset
    29
hgs
parents:
diff changeset
    30
Change is done after a line like this:
hgs
parents:
diff changeset
    31
  "foreach $LoopBld (@Blds) {"
hgs
parents:
diff changeset
    32
			
hgs
parents:
diff changeset
    33
And the change is this: (First line is comment)
hgs
parents:
diff changeset
    34
hgs
parents:
diff changeset
    35
	# Add the TraceCompiler once to the Calls array when TARGET is called
hgs
parents:
diff changeset
    36
	$Command eq "TARGET" and not scalar grep(/tracecompiler\.pl/,@Calls) and push @Calls, "perl /epoc32/tools/tracecompiler.pl $Plat $Program";
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
hgs
parents:
diff changeset
    39
		
hgs
parents:
diff changeset
    40
----How to use TraceCompiler?----
hgs
parents:
diff changeset
    41
hgs
parents:
diff changeset
    42
Usually TraceCompiler is already integrated to Symbian build system, so there is no need to run TraceCompiler separately. Symbian build system calls 
hgs
parents:
diff changeset
    43
TraceCompiler automatically during component compilation. 
hgs
parents:
diff changeset
    44
hgs
parents:
diff changeset
    45
If there is need to run TraceCompiler manually, it can be done following way:
hgs
parents:
diff changeset
    46
hgs
parents:
diff changeset
    47
   perl /epoc32/tools/tracecompiler.pl <platform> [program]
hgs
parents:
diff changeset
    48
hgs
parents:
diff changeset
    49
   For example: perl /epoc32/tools/tracecompiler.pl armv5
hgs
parents:
diff changeset
    50
		
hgs
parents:
diff changeset
    51
hgs
parents:
diff changeset
    52
hgs
parents:
diff changeset
    53
----How to actually get the traces?----
hgs
parents:
diff changeset
    54
Open System Trace macros use Symbian BTrace framework to forward the traces. To get these traces, you must implement a trace handler which will
hgs
parents:
diff changeset
    55
register itself to the Symbian BTrace using command BTrace::SetHandler( MyHandler ). Then it's up to you what to do with the traces.
hgs
parents:
diff changeset
    56
hgs
parents:
diff changeset
    57
hgs
parents:
diff changeset
    58
hgs
parents:
diff changeset
    59
----What is happening in TraceCompiler?----
hgs
parents:
diff changeset
    60
hgs
parents:
diff changeset
    61
1. tracecompiler.pl first runs a Java check to ensure that Java 1.5 or newer is found from the system. If this fails, tracecompiler.pl will exit.
hgs
parents:
diff changeset
    62
	 
hgs
parents:
diff changeset
    63
   If Java check is OK, tracecompiler.pl opens a "abld.bat" file which is generated by command "bldmake bldfiles". From that file, a path to
hgs
parents:
diff changeset
    64
   MAKEFILE generated by "bldmake bldfiles" is searched. This MAKEFILE is then opened and is parsed for a list of project MMP files. These MMP
hgs
parents:
diff changeset
    65
   files are then forwarded to the tracecompiler_parse_mmp.pl script.
hgs
parents:
diff changeset
    66
	 
hgs
parents:
diff changeset
    67
2. tracecompiler_parse_mmp.pl gets a MMP file as a parameter. It parses the MMP file for UID of the component and paths to all the source files.
hgs
parents:
diff changeset
    68
	 NOTE that MACROS are NOT supported! If UID cannot be found from the MMP file, tracecompiler_parse_mmp.pl will exit. If UID is found,
hgs
parents:
diff changeset
    69
	 TraceCompiler Java application is started and the component UID is given to it as a parameter. After it's started, component name, the path
hgs
parents:
diff changeset
    70
	 to the MMP file of the component and a list of source paths are send to STDOUT of TraceCompiler Java application. When all source paths are
hgs
parents:
diff changeset
    71
	 send, tracecompiler_parse_mmp.pl sends end tag "*ENDOFSOURCEFILES*" to TraceCompiler so it knows all the sources are then sent.
hgs
parents:
diff changeset
    72
	 
hgs
parents:
diff changeset
    73
3. TraceCompiler Java application listens to STDIN for component name, MMP file path and the paths to the source files. When it receives
hgs
parents:
diff changeset
    74
   "*ENDOFSOURCEFILES*" tag, it starts processing the source files. It finds all OST traces from the source files and generates needed headers
hgs
parents:
diff changeset
    75
   for the application to compile properly. It also generates autogen header and Symbian Dictionary file from the traces.