HC08: Not allocated variables

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

HC08: Not allocated variables

ソリューションへジャンプ
5,355件の閲覧回数
jdiogon
Contributor I
Hi everybody !

I've some problems while debugging code with CodeWarrior :
some of my variables are indicated as "not allocated", and appear in grey.
Then my code doesn't work.

Is there anybody here who knows how to solve this ?

Thanks a lot in advance.

Message Edited by CrasyCat on 2007-04-13 11:05 AM

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
2,854件の閲覧回数
Nouchi
Senior Contributor II
Hi,

Your variable appears in Grey because it's optimized, so if you don't want optimization only for this variable, you have to declare it as "volatile".


regards,
Emmanuel

元の投稿で解決策を見る

0 件の賞賛
返信
7 返答(返信)
2,854件の閲覧回数
jdiogon
Contributor I
I'm working with a HCS08.

I'm gonna look if I can see registers in the debugger.

Thank you again for all your answers.

PS : Emmanuel : je pense que nous sommes tous deux français...
J'étudie à l'ISIMA à Clermont-Ferrand.
Et toi tu es d'où ? :smileywink:

Message Edited by jdiogon on 2007-01-1908:22 PM

0 件の賞賛
返信
2,855件の閲覧回数
Nouchi
Senior Contributor II
Hi,

Your variable appears in Grey because it's optimized, so if you don't want optimization only for this variable, you have to declare it as "volatile".


regards,
Emmanuel
0 件の賞賛
返信
2,854件の閲覧回数
jdiogon
Contributor I
Thanks.

Is there any solution to avoid this for all code ?
I'd like to be able to access all my variables in the debugger easily.
0 件の賞賛
返信
2,854件の閲覧回数
Stephen
Contributor III
(Without knowing which processor and debugger you are using) does your debugger show you the current contents of the registers and accumulators? Usually "optimisation" just means the C-level instruction is being carried out directly in registers and accumulators.
When I have been faced with debugging in similar circumstances on an HCS12 processor, I have usually found I can still work out what's happening from watching the registers and accumlator. An 8-bit variable is usually put in ACC.B, a 16 bit in ACC.D. A display of the compiled code in assembler also helps.
 
An early career writing everything in assembler is never completely wasted! :smileyhappy:
0 件の賞賛
返信
2,854件の閲覧回数
CrasyCat
Specialist III
Hello
 
  There is no way to disable all optimization in the compiler.
  The compiler will always optimize access to variables with local scope.
 
CrasyCat
2,854件の閲覧回数
Lundin
Senior Contributor IV
"There is no way to disable all optimization in the compiler."

Why not?

- Every other compiler in the known world has this feature, including crappy freeware compilers made by hobbyists.
- It can't be awfully hard to implement it.
- Debugging optimized code is incredible annoying.
0 件の賞賛
返信
2,854件の閲覧回数
jdiogon
Contributor I
Thank you all !
0 件の賞賛
返信