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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
3,054 次查看
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!

标签 (1)
0 项奖励
回复
1 解答
1,815 次查看
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 项奖励
回复
9 回复数
1,815 次查看
bigmac
Specialist III

Hello BarryP,

 

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

 

Regards,

Mac

 

0 项奖励
回复
1,815 次查看
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 项奖励
回复
1,815 次查看
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 项奖励
回复
1,815 次查看
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 项奖励
回复
1,815 次查看
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 项奖励
回复
1,816 次查看
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 项奖励
回复
1,815 次查看
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 项奖励
回复
1,815 次查看
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 项奖励
回复
1,815 次查看
admin
Specialist II
Yes, I do.
0 项奖励
回复