よくある質問

Häufig gestellte Fragen

Why is the observed variable displayed as “not in scope” in Debug mode under the Keil development environment?  Datum: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:

Produkte: Mikrocontroller ,Arm Cortex-M0-MCUs ,M051-Base-Serie ,M0518-Serie ,M0519-Serie ,Mini51-Base-Serie ,Nano100/102-Base-Serie ,Nano110/112-LCD-Serie ,Nano120-USB-Serie ,Nano130-Advanced-Serie ,NUC029-Serie ,NUC100/200-Advanced-Serie ,NUC120/122/123/220-USB-Serie ,NUC130/230-CAN-Serie ,NUC131-NUC1311-CAN-Serie ,NUC140/240-Konnektivität-Serie ,Arm Cortex-M4-MCUs ,M451-Base-Serie ,M451M-Serie ,M452-USB-Serie ,M453-CAN-Serie ,NUC442/472-Serie ,NUC505-Serie
Applikationen:
Funktion: Software and Tools,Development-Environment,Keil
This website uses cookies to ensure you get the best experience on our website. Learn more
OK