AR# 16633

|

3.1 EDK - There appears to be a bug in the ppc/mb compiler?? (The "volatile" keyword is possibly required in the declaration)

描述

General Description:

A bug appears to be present in the ppc/mb compiler.

解决方案

In some cases, your coding style may affect the compiler results. The "volatile" keyword is an important concept in embedded programming.

Most compilers optimize the code by assuming that a value stays in the memory unless the program changes it. General compilers feature this optimization for better performance. In embedded system applications, this may cause a problem in the shared-data code and I/O access. Make sure that you use the "volatile" keyword in the variable declaration (the "volatile" keyword is part of the C standard.) This keyword specifies to the compiler that the microprocessor must read the value from the memory location (or memory-mapped location) every time it is referenced.

AR# 16633
日期 12/15/2012
状态 Active
Type 综合文章
People Also Viewed