Can't watch variables in the data window (sorry, NOOB here)

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

Can't watch variables in the data window (sorry, NOOB here)

3,824 次查看
Scoobydoo
Contributor I
Hello,
 
I am working on a new project using the 9S08AC128. I have been using the P&E IDE for some time now. I write in Assembly, however, being self-taught, Ieaves me with little doubt that I am not doing this correctly.
 
I am not "declaring" any variables, but using the EQU statement. (TEMP  EQU  $0081) This has never stopped me from being able to watch the variables in the P&E IDE, but when I try to add the variable in the CW debugger, it tells me that it is an "undefined expression (unknown identifier). Can someone please tell me the correct way to declare the variable, so I can watch it in the CW debugger? Many Thanks....
标签 (1)
标记 (1)
0 项奖励
回复
6 回复数

1,825 次查看
Scoobydoo
Contributor I
Thank you, Can you provide me with an example of how to properly use the Xdef command? Is it necessary to use this command for each variable that I wish to watch in the debugger? Or can it be issued in a way to cover all the variables?
0 项奖励
回复

1,825 次查看
CrasyCat
Specialist III
Hello
 
EQU defined symbols are like ANSI C macros.
The macro assembler will replace each occurrence of the symbol by its vale in the generated code.
So the linker/debugger does not know about those symbols.
 
If you want to be able to see those symbols in the debugger you need to tell the macro assembler they should be visible outside of the module.
 
This is done using the assembly directive XDEF.
 
CrasyCat
0 项奖励
回复

1,825 次查看
Scoobydoo
Contributor I
Thank you, Can you provide me with an example of how to properly use the Xdef command? Is it necessary to use this command for each variable that I wish to watch in the debugger? Or can it be issued in a way to cover all the variables?
0 项奖励
回复

1,825 次查看
CrasyCat
Specialist III
Hello
 
Please refer to {Install}\Help\PDF\Assembler_HC08.pdf chapter "Assembler Directives" section "detailed descriptions of all assembler directives " -> "XDEF - External Symbol Definition"  (page 323 in manual delivered with CodeWarrior MCU V6.2).
 
You can also look at how XDEF is used in {Install}\(CodeWarrior_Examples)\HCS08\Assembly Examples\AC Demos\AC8 Demo\Sources\main.asm
 
And yes you need to specify each symbol you want to see in the debugger in a XDEF directive.
Other solution would be to define real variable using directive DS.
 
I hope this helps.
 
CrasyCat
0 项奖励
回复

1,825 次查看
bigmac
Specialist III
Hello,

Keep in mind that the use of XDEF and XREF directives does imply that the project uses relocatable assembly code - these directives do not apply to absolute assembly code.  Since you have previously used P&E assembler, it is possible that your previous projects have actually been absolute assembly (with the use of a single .asm file, plus optional include files, and with ORG directives).

With CW you may choose to use either project type.  As the previous post has suggested, the use of the DS directive should work for either case.

  ORG  Z_RAMStart
TEMP   DS  1  ; Temporary byte variable
BVAR1  DS  1  ; Byte variable
WVAR1  DS  2  ; Word variable

  ORG  ROMStart ; Start of code
...
...

Also keep in mind that you will need to take into account quite a few other differences between CW and P&E assembly formats.

Regards,
Mac



0 项奖励
回复

1,825 次查看
Scoobydoo
Contributor I
Hi,
 
Yes, I did choose "absolute assembly" as the type. I will experiment with that. You guys ROCK!!!  Thanks so much! :smileyhappy:
0 项奖励
回复