SPRU513Z August 2001 – October 2023 SM320F28335-EP
Mark Function Boundaries
symbol .asmfunc [stack_usage(num)]
.endasmfunc
The .asmfunc and .endasmfunc directives mark function boundaries. These directives are used with the compiler -g option (--symdebug:dwarf) to allow assembly code sections to be debugged in the same manner as C/C++ functions.
You should not use the same directives generated by the compiler (see Appendix A) to accomplish assembly debugging; those directives should be used only by the compiler to generate symbolic debugging information for C/C++ source files.
The symbol is a label that must appear in the label field.
The .asmfunc directive has an optional parameter, stack_usage, which indicates that the function may use up to num bytes.
Consecutive ranges of assembly code that are not enclosed within a pair of .asmfunc and .endasmfunc directives are given a default name in the following format:
$ filename: beginning source line: ending source line$
In this example the assembly source generates debug information for the userfunc section.
1 00000000 .sect ".text"
2 .global userfunc
3 .global _printf
4
5 userfunc: .asmfunc
6 00000000 FE02 ADDB SP,#2
00000002 0000
8 00000003 7640! LCR #_printf
00000004 0000
9 00000005 9A00 MOVB AL,#0
10 00000006 FE82 SUBB SP,#2
11 00000007 0006 LRETR
12 .endasmfunc
13
14 00000000 .sect ".econst"
15 00000000 0048 SL1: .string "Hello World!",10,0
00000001 0065
00000002 006C
00000003 006C
00000004 006F
00000005 0020
00000006 0057
00000007 006F
00000008 0072
00000009 006C
0000000a 0064
0000000b 0021
0000000c 000A
0000000d 0000