This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

A51: Error A20: INVALID SIMPLE RELOCATABLE EXPRESSION

I have:
1. ext_port.a51 file, that contains some variables.
2. ext_port.inc file, that contains some macros, that use variables from ext_port.a51.
3. some files, that use macros from ext_port.inc.

In my case I want use EQU to use this variables, but this variables is external and I take error A20.

I tried include all this in one file(#include or $include), but in this case debug information is lost.
*********************************************

ext_port.a51


?PR?EXT_PORT	SEGMENT DATA

	RSEG ?PR?EXT_PORT
	public P5Buf
	public P6Buf
P5Buf: DS 1
P6Buf: DS 1


ext_port.inc

#ifndef _EXT_PORT_INC
#define _EXT_PORT_INC

#include "set.inc"

#define P7A_ADDR 	f_ad0512
#define P7B_ADDR 	F_DAT512
#define P7C_ADDR 	f_ad1512
#define P7CTL_ADDR 	f_ctl512

#define _P0				0x00
#define _P1				0x10
#define _P2				0x20
#define _P3				0x30
#define _P4				0x40
#define _P5				0x50
#define _P6				0x60
#define _P7A			0x70
#define _P7B			0x71
#define _P7C			0x72
#define _P7CTL			0x73

P_0x00 		EQU	P0
P_0x10 		EQU	P1
P_0x20 		EQU	P2
P_0x30 		EQU	P3
P_0x40 		EQU	P4

P_0x50_ADDR	EQU	P5_HIGH_ADDR
P_0x60_ADDR	EQU	P6_HIGH_ADDR

P_0x70_ADDR	EQU	P7A_ADDR
P_0x71_ADDR	EQU	P7B_ADDR
P_0x72_ADDR	EQU	P7C_ADDR
P_0x73_ADDR	EQU	P7CTL_ADDR

;----------------------------------------------------------------------------

        extrn DATA (P5Buf)
        extrn DATA (P6Buf)
P_0x50_Buf 	EQU	P5Buf
P_0x60_Buf 	EQU	P6Buf

;----------------------------------------------------------------------------
;	xxx_m - state format is mask
;	xxx_c - state is constant
;	xxx_sb - state is variable.bit
;----------------------------------------------------------------------------

#define PORTS_ExSpec	_P7A, _P7B, _P7C
#define PORTS_Ex		_P5, _P6
#define PORTS_x			_P0, _P1, _P2, _P3, _P4


_PXXX_CALL macro p, pl, fc, ft, prm
		irp px, <pl>
			if p == px
				fc&ft prm
			endif
		endm
	endm

;----------------------------------------------------------------------------

Px_set_c macro p, b, s
		if s
			setb p.b
		else
			clr p.b
		endif
	endm

Px_c macro p, b, s
		Px_set_c P_&p, b, s
	endm

PxEx_select_set_c_m macro paddr, pbuf
		mov DPTR, #paddr
		if s
			orl pbuf, #bm
		else
			anl pbuf, #NOT bm
		endif
	endm

PxEx_c_m macro p, bm, s
		PxEx_select_set_c_m P_&p&_ADDR, P_&p&_Buf, bm, s
		mov A, pbuf
		movx @DPTR, A
	endm

PxEx_c macro p, b, s
	PxEx_c_m p, (1 SHL b), s
	endm

Px_OUT_BIT_c macro p, b, s
		_PXXX_CALL p, <PORTS_x>, Px, _c, <p, b, s>
		_PXXX_CALL p, <PORTS_Ex>, PxEx, _c, <p, b, s>
	endm

;----------------------------------------------------------------------------

Px_set_sb macro p, b, vp, vb
		mov A, vp
		mov C, ACC.vb
		mov p.b, C
	endm

Px_sb macro p, b, vp, vb
		Px_set_sb P_&p, b, vp, vb
	endm

PxEx_out_C macro paddr, pbuf, b
		mov DPTR, #paddr
		mov A, pbuf
		mov ACC.b, C
		mov pbuf, A
		movx @DPTR, A
	endm

PxEx_sb macro p, b, vp, vb
		mov A, vp
		mov C, ACC.vb
		PxEx_out_C P_&p&_ADDR, P_&p&_Buf, b
	endm

Px_OUT_BIT_sb macro p, b, vp, vb
		_PXXX_CALL p, <PORTS_x>, Px, _sb, <p, b, vp, vb>
		_PXXX_CALL p, <PORTS_Ex>, PxEx, _sb, <p, b, vp, vb>
	endm

;----------------------------------------------------------------------------

Px_OUT_ macro p, v
		mov P_&p, v
	endm

PxEx_OUT_ macro p, v
		mov DPTR, #P_&p&_ADDR
		mov A, v
		mov P_&p&_Buf, A
		movx @DPTR, A
	endm

PxExSpec_OUT_ macro p, v
		mov DPTR, #P_&p&_ADDR
		mov A, v
		movx @DPTR, A
	endm

Px_OUT macro p, v
		_PXXX_CALL p, <PORTS_x>, Px_OUT, _, <p, v>
		_PXXX_CALL p, <PORTS_Ex>, PxEx_OUT, _, <p, v>
		_PXXX_CALL p, <PORTS_ExSpec>, PxExSpec_OUT, _, <p, v>
	endm

;----------------------------------------------------------------------------

#endif

1.a51
#include "ex_port.inc"

Px_OUT _P5, #0

2.a51
#include "ex_port.inc"

Px_OUT _P5, #1