as: MSP430 Profiling Capability
1
1 9.29.6 Profiling Capability
1 ---------------------------
1
1 It is a performance hit to use gcc's profiling approach for this tiny
1 target. Even more - jtag hardware facility does not perform any
1 profiling functions. However we've got gdb's built-in simulator where
1 we can do anything.
1
1 We define new section '.profiler' which holds all profiling
1 information. We define new pseudo operation '.profiler' which will
1 instruct assembler to add new profile entry to the object file. Profile
1 should take place at the present address.
1
1 Pseudo operation format:
1
1 '.profiler flags,function_to_profile [, cycle_corrector, extra]'
1
1 where:
1
1 'flags' is a combination of the following characters:
1
1 's'
1 function entry
1 'x'
1 function exit
1 'i'
1 function is in init section
1 'f'
1 function is in fini section
1 'l'
1 library call
1 'c'
1 libc standard call
1 'd'
1 stack value demand
1 'I'
1 interrupt service routine
1 'P'
1 prologue start
1 'p'
1 prologue end
1 'E'
1 epilogue start
1 'e'
1 epilogue end
1 'j'
1 long jump / sjlj unwind
1 'a'
1 an arbitrary code fragment
1 't'
1 extra parameter saved (a constant value like frame size)
1
1 'function_to_profile'
1 a function address
1 'cycle_corrector'
1 a value which should be added to the cycle counter, zero if
1 omitted.
1 'extra'
1 any extra parameter, zero if omitted.
1
1 For example:
1 .global fxx
1 .type fxx,@function
1 fxx:
1 .LFrameOffset_fxx=0x08
1 .profiler "scdP", fxx ; function entry.
1 ; we also demand stack value to be saved
1 push r11
1 push r10
1 push r9
1 push r8
1 .profiler "cdpt",fxx,0, .LFrameOffset_fxx ; check stack value at this point
1 ; (this is a prologue end)
1 ; note, that spare var filled with
1 ; the farme size
1 mov r15,r8
1 ...
1 .profiler cdE,fxx ; check stack
1 pop r8
1 pop r9
1 pop r10
1 pop r11
1 .profiler xcde,fxx,3 ; exit adds 3 to the cycle counter
1 ret ; cause 'ret' insn takes 3 cycles
1