11.07.2015 Views

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Data representation●●Trigger access; as for a memory-mapped SFR where the fact that an access occurshas an effectModified access; where the contents of the object can change in ways not known tothe compiler.Definition of access to volatile objectsThe ISO/ANSI standard defines an abstract machine, which governs the behavior ofaccesses to volatile declared objects. In general and in accordance to the abstractmachine, the compiler:● Considers each read and write access to an object that has been declared volatileas an access● The unit for the access is either the entire object or, for accesses to an element in acomposite object—such as an array, struct, class, or union—the element. Forexample:char volatile a;a = 5; /* A write access */a += 6; /* First a read then a write access */● An access to a bitfield is treated as an access to the underlaying type.However, these rules are not detailed enough to handle the hardware-relatedrequirements. The rules specific to the <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong> are describedbelow.Rules for accessesIn the <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong>, accesses to volatile declared objects aresubject to the following rules:● All accesses are preserved● All accesses are complete, that is, the whole object is accessed● All accesses are performed in the same order as given in the abstract machine● All accesses are atomic, that is, they cannot be interrupted.The <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong> adheres to these rules for all 8-bit and 16-bitmemory accesses. For <strong>MSP430</strong>X also for all 20-bit memory accesses.For larger types, all accesses are preserved but it is not guaranteed that all parts of theobject is accessed.DECLARING OBJECTS CONSTThe const type qualifier is used for indicating that a data object, accessed directly orvia a pointer, is non-writable. A pointer to const declared data can point to bothPart 2. <strong>Compiler</strong> <strong>reference</strong>177

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!