HCS08 Assembler Warning A13003 - Value is truncated to one byte.

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

HCS08 Assembler Warning A13003 - Value is truncated to one byte.

Jump to solution
1,878 Views
admin
Specialist II

I am writing asssembly code for the HCS08SH8 and get the A13003 warning for bytes declared in SECTION RAM  in main.asm and used there and elsewhere. The vars are in zero page but the assembler doesn't seem to know this yet since it doesn't see the .prm file (where the SECTIONs are defined) until link time. I have worked around this by declaring the variables in another file and use xref.b (import reference to an external symbol located on the direct page) where they are used. Now the warnings are gone.

 

The problem with this is now I can't see these variables (data) in the IDE during debug since they appear to be out of the scope of the module I am debugging. Any ideas how to keep the declarations in main.asm and not get the warnings. I can always disable the A13003 warning in "options" but I would rather not do that.

 

Thanks!

Labels (1)
0 Kudos
1 Solution
639 Views
admin
Specialist II

Thank you all for the input! I was able to rid myself of the warning by a combination of suggestions.

 

Use of the SHORT directive for variables in the file where direct addressing is to be used with them.

 

Use of XDEF.B for variables declared in the file where SHORT was used that are to be referenced in other files where direct addressing is to be used.

 

Use of XREF.B for variables declared in the file where SHORT was used and where direct addressing is to be used.

View solution in original post

0 Kudos
9 Replies
639 Views
bigmac
Specialist III

Hello BarryP,

 

In the separate file where the variables are defined, do you XDEF each variable name?

 

Regards,

Mac

 

0 Kudos
639 Views
admin
Specialist II

I placed a dummy subroutine (nop's) in the seperate data file so I can call it during debug. I am able to see all of the globals there in the "data" window of the debugger when I call the dummy sub. This is painful, however...

0 Kudos
639 Views
bigmac
Specialist III

Hello Barry P,

 

I am guessing here, but something else to try would be to INCLUDE the variable file ahead of the code where the variables are used.  However, you would need to add directives to the variable file to prevent multiple inclusions,

  IFNDEF  MY_VARIABLES

  DEFINE  MY_VARIABLES

 

; Define variables here

 

  ENDIF

0 Kudos
639 Views
admin
Specialist II

It appears that "DEFINE" isn't a directive in the HCS08 assembler. I was able to accomplish this with:

 

IFNDEF  MY_VARIABLES

 

; Define variables here

 

  ENDIF

 

It appears to be working but I get the same warning, A13003.

 

Thanks for the advice anyway.

 

Any other options would be appreciated.

 

Barry

0 Kudos
639 Views
bigmac
Specialist III

Hello Barry,

 

Sorry about my confusion.  The conditional assembly within the include should be:

 

  IFNDEF  MY_VARIABLES

MY_VARIABLES:

 

; Define variables here

 

  ENDIF

 

If you did not already use the SHORT qualifier, as suggested by Compiler Guru, I suspect this will solve the warning message issue.

 

Regards,

Mac

 

0 Kudos
640 Views
admin
Specialist II

Thank you all for the input! I was able to rid myself of the warning by a combination of suggestions.

 

Use of the SHORT directive for variables in the file where direct addressing is to be used with them.

 

Use of XDEF.B for variables declared in the file where SHORT was used that are to be referenced in other files where direct addressing is to be used.

 

Use of XREF.B for variables declared in the file where SHORT was used and where direct addressing is to be used.

0 Kudos
639 Views
peg
Senior Contributor IV

Hello,

 

https://community.freescale.com/message/10929#10929 deals with the two main reasons for this warning.

See if it helps you.

 

0 Kudos
639 Views
CompilerGuru
NXP Employee
NXP Employee

As mentioned in thread Peg linked to relocatable sections which are intended to be allocated in the zero page should use the SHORT qualifier.

E.g.

MySectionName: Section SHORT

MyName: DS.B 1

 

Daniel

0 Kudos
639 Views
admin
Specialist II
Yes, I do.
0 Kudos