Relocatable Assembly Problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Relocatable Assembly Problem

2,611 Views
mylim
Contributor IV
Hi, I'm trying to set a self defined flag in my extended file but I can't read/write the status of the flag in my main.asm file.
My flag is define in the relocatable file .asm & export it in .inc file.
I include the .inc file in my main.asm.
I've attached the 3 files for your reference.
I use DS 1 byte for TPM1SR & TMRF as constant EQU $00.
I tried BSET TMRF,TPM1SR in S08_TPM1_tmr.asm
then I did a BRSET condition in MAIN_.asm I could get the condition set in S08_TPM1_tmr.asm.

Please advise. Thanks.

Regards,
MY

Message Edited by mingyee on 2008-11-23 02:20 PM
Labels (1)
0 Kudos
7 Replies

354 Views
Ake
Contributor II
Hi,
You have in your code the variable
TPMSR      ds     1
this name is used by the procedure MCUinit() that you are calling.
 
So change the name to
TPMSRA      ds     1
and at the following
chkled      brset  TRMF1,TPMSRA,chkled1
            bra    chkledz
chkled1      bclr   TRMF1,TPMSRA 
and the code assembles correctly. 
 
Regards,
Ake
 
0 Kudos

354 Views
mylim
Contributor IV
Hi Ake,
Thanks for your response.
Actually, I'm intending to use the TPM1SR globally, shared among the MAIN_.asm & S08_TPM1_tmr.asm.
Please advise.

Regards,
MY
0 Kudos

354 Views
bigmac
Specialist III
Hello MY,

You do not say which MCU type you are using, but is is possible that the register TPM1SR may already be defined by the file derivative.inc (or the .inc file that it includes).  If you need a RAM register to handle flags of your own creation, it will require to have a different name, as suggested by Ake.

Regards,
Mac



Message Edited by bigmac on 2008-11-25 02:20 AM
0 Kudos

354 Views
mylim
Contributor IV

Hi guys, i guess i posted the wrong MAIN_.asm file as i was trying to declare
TMRF equ 1
TPM1SC ds 1
in MAIN_.asm after failing to write into TPM1SC which i declared in S08_TPM1_tmr.asm
& I've checked thru TMP1SC has not been used in any other files.
Please find the project files as attached.
I'm using AW60 MCU.
Thanks.

REgards,
MY

 

AW60_RP4880v3_0.zip

Message Edited by t.dowe on 2009-10-27 12:00 PM
0 Kudos

354 Views
bigmac
Specialist III
Hello MY,

You will see that the derivative.inc file includes the CW file MC9S08AW60.inc.  This latter file already defines the symbol TPM1SC as a hardware register, the status and control register for TPM1.  You cannot use the same name for a RAM register, where both definitions are visible to a particular file.

It is best to keep well clear of the standard register names for the MCU to avoid such conflicts.

Regards,
Mac

0 Kudos

354 Views
mylim
Contributor IV
Hi Bigmac,
My mistake, actually i'm declaring it as TPM1SR instead of TPM1SC.
**bleep**.. I must be so blur that I'm almost blind.
Sorry for the confusion.
Thanks.

Regards,
MY
0 Kudos

354 Views
bigmac
Specialist III
Hello MY,

The following seems to explain the reason for your previous problem -

Near the top of the MAIN_.asm file you have included the file S08_TPM1_tmr.inc.  This latter file provides a conditional XREF to the label TPM1SR, to indicated that the definition for the label will be found elswhere (not within the current MAIN_.asm file).  If you then define the label as a zero page variable, this represents the conflict that you have observed.

If you wish to define the variable within MAIN_.asm,. but still provide the conditional XREF within S08_TPM1_tmr.inc (for use by other files), perhaps XDEF the label prior to the INCLUDE directive.

File: MAIN_.asm:

  XDEF  TPM1SR
  INCLUDE "S08_TPM1_tmr.inc"
  ...
 
  MY_ZEROPAGE: SECTION SHORT
TPM1SR   ds  1

  ...

File: S08_TPM1_tmr.inc:

  IFNDEF TPM1SR
  XREF   TPM1SR
  ENDIF

  ...

Regards,
Mac

0 Kudos