ARM Technical Support Knowledge Articles

DEBUGGING A51 MPL MACROS

Applies to: uVision Debugger

Answer


Information in this article applies to:


QUESTION

I have a assembler modules that use MPL MACROs. In previous versions of C51 (before 6.23) the uVision Debugger did not synchronize with the source code at all. This problem seems to be fixed in Version 6.23. However, I'm still unable to set breakpoints at the MPL macro itself. Is there some trick?

ANSWER

MPL macros are an historic feature of the 8051 assembler. They were initally implemented in the Intel ASM51 Assembler and we have added them to the Keil A51 Assembler. At the time MPL macros were developed, debug tools did not support source-level debugging. Therefore, the concept of the MPL macro processor did not correctly handle problems that arise when you want synchronization between source code and the generated object files.

The Keil A51 Assembler (starting with C51 Version 6.23) implements proper line number synchronisation for assembler files that contain MPL macros. It is possible to set breakpoints on the MPL macro when the first assembler instruction of the macro is in the same line as the %define statement of the MPL macro language. For example:

$MPL

; First MPL macro line does not start with code
%*define (ldxdata1 (Var))

   mov dptr,#%Var
   movx a,@dptr
)

; First MPL macro line contains assembler instructions
%*define (ldxdata2 (Var)) ( mov dptr,#%Var
   movx a,@dptr
)

?XD?mplmac segment xdata
rseg ?XD?mplmac
Var1:   DS 1
Var2:   DS 1

?PR?mplmac SEGMENT CODE
RSEG ?PR?mplmac

   %ldxdata1(Var1)  ; no code at macro begin
                    ; -> no break information at source level
   MOV  R6,A
   %ldxdata2(Var2)  ; code at macro begin
                    ; -> breaks at source level possible
   MOV  R7,A
   ret

   end

CONCLUSION

The uVision debugger supports source-level debugging for code that was initally written for Intel ASM51. However, you must have an assembler instruction in the same line as the MPL %define statement.

Article last edited on: 2004-07-09 00:27:14

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential