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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Assembler languageinterfaceWhen you develop an application for an embedded system, there may besituations where you will find it necessary to write parts of the code inassembler, for example when using mechanisms in the <strong>MSP430</strong>microcontroller that require precise timing and special instruction sequences.This chapter describes the available methods for this, as well as some Calternatives, with their advantages and disadvantages. It also describes how towrite functions in assembler language that work together with an applicationwritten in C or <strong>C++</strong>.Finally, the chapter covers how functions are called for the different cores, thedifferent memory access methods corresponding to the supported memorytypes, and how you can implement support for call frame information in yourassembler routines for use in the C-SPY® Call Stack window.Mixing C and assemblerThe <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong> provides several ways to mix C or <strong>C++</strong> andassembler:● Modules written entirely in assembler● Intrinsic functions (the C alternative)● Inline assembler.It might be tempting to use simple inline assembler. However, you should carefullychoose which method to use.INTRINSIC FUNCTIONSThe compiler provides a small number of predefined functions that allow direct accessto low-level processor operations without having to use the assembler language. Thesefunctions are known as intrinsic functions. They can be very useful in, for example,time-critical routines.Part 1. Using the compiler 83

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

Saved successfully!

Ooh no, something went wrong!