Техническая Спецификация для Atmel Evaluation Board using the SAM7SE Microcontroller AT91SAM7SE-EK AT91SAM7SE-EK

Модели
AT91SAM7SE-EK
Скачать
Страница из 24
3
6295A–ATARM–27-Mar-07
Application Note
The Getting Started example software can be compiled and loaded on the internal Flash and the
external SDRAM.
3.1.3.2
Buttons
The AT91SAM7SE Evaluation Kit features two pushbuttons, connected to pins PB22 and PB25.
When pressed, they force a logical low level on the corresponding PIO line.
The Getting Started example uses both buttons (PB22 and PB27).
3.1.3.3
LEDs
There are two general-purpose green LEDs on the AT91SAM7SE-EK, as well as a software-
controllable yellow power LED; they are wired to pins PA1, PA2 and PA0, respectively. Setting a
logical low level on these PIO lines turns the corresponding LED on.
The example application uses the two green LEDs (PA1 and PA2).
3.1.3.4
Debug Unit
On the AT91SAM7SE, the Debug Unit uses pins PA9 and PA10 for the DRXD and DTXD sig-
nals, respectively.
3.2
Implementation
As stated previously, the example defined above requires the use of several peripherals. It must
also provide the necessary code for starting up the microcontroller. Both aspects are described
in detail in this section, with commented source code when appropriate.
3.2.1
C-Startup
Most of the code of an embedded application is written in C. This makes the program easier to
understand, more portable and modular. However, using the C language requires the initializa-
tion of several components. These initialization procedures must be performed using assembly
language, and are grouped into a file referred to as C-startup. The C-startup code must:
• Provide exception vectors
• Initialize critical peripherals
• Initialize stacks
• Initialize memory segments
These steps are described in the following paragraphs. More information about startup code can
be found in the AT91 Assembler Code Startup Sequence for C Code Applications Software
application note (literature no. 2644), available on 
3.2.1.1
Exception Vectors
When an exception occurs (e.g., data abort, undefined instruction, IRQ, etc.), the core instantly
jumps to one of the 8 instructions located between addresses 0x00 and 0x1C.
If the program does not need to handle an exception, then the corresponding instruction can
simply be set to an infinite loop, i.e. a branch to the same address. For vectors which are to be
handled, a branch instruction to a function must be provided. Since address 0x00 is used after a
Reset, the associated branch must always jump to the beginning of the code.
In this example, the only relevant vector is the one for IRQs (excluding the Reset vector). It must
simply branch to the IRQ handler, which is described in 
The code for all eight vectors looks like this: