Atmel CAVR-4 사용자 설명서
![Atmel](https://files.manualsbrain.com/attachments/0369829915bda09f9c2e00fb805a7753579683b5/common/fit/150/50/8d2bf08978ec3e5bc63f4343ac5e91ce8d0e40045619fa520d910d64af8f/brand_logo.png)
CAVR-4
Part1. Using the compiler
93
Assembler language
interface
interface
When you develop an application for an embedded system, there may be
situations where you will find it necessary to write parts of the code in
assembler, for example, when using mechanisms in the AVR microcontroller
that require precise timing and special instruction sequences.
This chapter describes the available methods for this, as well as some C
alternatives, with their pros and cons. It also describes how to write functions
in assembler language that work together with an application written in C or
C++.
Finally, the chapter covers how you can implement support for call frame
information in your assembler routines for use in the C-SPY Call Stack
window.
Mixing C and assembler
The AVR IAR C/C++ Compiler provides several ways to mix C or C++ and assembler:
●
Modules written entirely in assembler
●
Intrinsic functions (the C alternative)
●
Inline assembler.
It might be tempting to use simple inline assembler. However, you should carefully
choose which method to use.
choose which method to use.
INTRINSIC FUNCTIONS
The compiler provides a small number of predefined functions that allow direct access
to low-level processor operations without having to use the assembler language. These
functions are known as intrinsic functions. They can be very useful in, for example,
time-critical routines.
to low-level processor operations without having to use the assembler language. These
functions are known as intrinsic functions. They can be very useful in, for example,
time-critical routines.
An intrinsic function looks like a normal function call, but it is really a built-in function
that the compiler recognizes. The intrinsic functions compile into inline code, either as
a single instruction, or as a short sequence of instructions.
that the compiler recognizes. The intrinsic functions compile into inline code, either as
a single instruction, or as a short sequence of instructions.