よくある質問

よくある質問

Why is the observed variable displayed as “not in scope” in Debug mode under the Keil development environment?  日付:2015-11-02

When interrupted in Debug mode, the user wants to check the variable value but see ”not in scope” on the Watch window, as shown below:

This is because the compiler would put variables into R1 registers after optimization, but the Watch window could only get the value from the internal memory. Therefore, “not in scope” will be displayed.

 

There are three solutions:

  1. Set the variable as a global variable.
  2. Set the variable as volatile.
  3. Set ”Optimization“ of ”C/C++” in the ”Options for Target…” as ”Level 0 (-O0)”, as shown below:

製品: マイクロコントローラ ,Arm Cortex-M0 MCU ,M051 ベースシリーズ ,M0518シリーズ ,M0519シリーズ ,ミニ 51 ベースシリーズ ,ナノ 100/102 ベースシリーズ ,ナノ 110/112 LCD シリーズ ,ナノ 120 USB シリーズ ,ナノ 130 アドバンストシリーズ ,NUC029 シリーズ ,NUC100/200 アドバンストシリーズ ,NUC120/122/123/220 USB シリーズ ,NUC130/230 CAN シリーズ ,NUC131/NUC1311 CAN シリーズ ,NUC140/240 コネクティビティシリーズ ,Arm Cortex-M4 MCU ,M451 Base シリーズ ,M451M シリーズ ,M452 USB シリーズ ,M453 CAN シリーズ ,NUC442/472 シリーズ ,NUC505 シリーズ
アプリケーション:
機能: Software and Tools,Development-Environment,Keil
This website uses cookies to ensure you get the best experience on our website. Learn more
OK