当前位置:网站首页>Keil debug view variable prompt not in scope
Keil debug view variable prompt not in scope
2022-06-25 06:42:00 【A little big:)】
Screenshot of the problem :
There was a warning when compiling :…\src\user_main.c(155): warning: #550-D: variable “crc_buffer” was set but never used
I started by changing the variable type , from uint32_t Changed to uint8_t,uint16_t,uint64_t No way to find out , I wonder if it has been optimized , Then the optimization level is changed, as shown in the figure below , from Level 3 Changed to Level 0 I can't find it .

But I still want to be optimized , But I didn't think of a way .
I solved the warning , This variable is used , Even if this variable is used in the wrong way , But I can see the value , Here's the picture .
I consulted my master who is now in the company ( Miss Zhao ), Then he prompted me to use volatile, Then I found that I could see the value , Then he let me change to static, I found that it can also , Then I was prompted to think about the area where my parameter variables were placed ( Stack ), Let me think for myself .
My thoughts ( If you make a mistake, please correct it ):
Compiler optimization , Command variables in the optimization stack , If you don't optimize variables in the stack , So it's like I declared many variables but didn't use them , It can easily lead to stack overflow problems . Add volatile The keyword is to prevent the compiler from optimizing this variable in the stack , Use static This variable is not stored on the stack , It is stored in the static variable area ( Pile up ), Then it will not be optimized .
After the above thought , I just thought if that was the case , If I change a variable into a global variable, there is no problem , The fact is that there is no problem .
I changed the optimization level again , from Level 0 Changed to not use (default), And the variables are still on the stack ( local variable ) in , Discover or not in scope
I will read many articles to solve this problem , Is to write and change the optimization level , But it was not written on the dot , Why change the optimization level ? Are there other ways to prevent optimization ?
After this, I also know a little about compiler optimization .
边栏推荐
- Zhinai's database
- [ACNOI2022]王校长的构造
- 爱情️终结者
- Aviator an expression evaluation engine
- Derivation of sin (a+b) =sina*cosb+sinb*cosa
- Kubernetes cluster dashboard & kuboard installation demo
- レレ / 蕾蕾
- [轻松学会shell编程]-5、计划任务
- How to record a database [closed] - how to document a database [closed]
- Is it safe to open a stock account on the Internet in Beijing?
猜你喜欢

有能力的人从不抱怨大环境!

Understand what MTU is

Derivation of COS (a-b) =cosa*cosb+sina*sinb

What is the real future of hardware engineers?

Zero foundation wants to learn web security, how to get started?

DataX tutorial (10) - hot plug principle of dataX plug-in
![[core content and derivation] the mystery of human memory system may be just like this](/img/7c/98f27bb55a1a3b74c0ed8fd7fd2cc5.jpg)
[core content and derivation] the mystery of human memory system may be just like this

Exercise: completion

爱情️终结者

SAP QM executes the transaction code qp01, and the system reports an error -material type food is not defined for task list type Q-
随机推荐
joda.time获取日期总结
Arm register (cortex-a), coprocessor and pipeline
爱情️终结者
[short time average zero crossing rate] short time average zero crossing rate of speech signal based on MATLAB [including Matlab source code 1721]
sin(a+b)=sina*cosb+sinb*cosa的推导过程
Preliminary practice of niuke.com (summary)
ACWING/2004. 错字
Self adjustment process of MySQL index tree when adding data
DataX tutorial (09) - how does dataX achieve speed limit?
How two hosts in different network segments directly connected communicate
[200 opencv routines of youcans] 104 Motion blur degradation model
Which of the top ten securities companies has the lowest Commission and is the most safe and reliable? Do you know anything
The five minute demonstration "teaches" actors to speak foreign languages and can seamlessly switch languages. This AI dubbing company has just received a round a financing of 20million US dollars
How to configure log4j to only keep log files for the last seven days?
Derivation of COS (a+b) =cosa*cosb-sina*sinb
Power representation in go language
Explain @builder usage
Exercise: completion
Large funds support ecological construction, and Plato farm builds a real meta universe with Dao as its governance
After unplugging the network cable, does the original TCP connection still exist?