221KB

The following document contains information on Cypress products.
Colophon
The products described in this document are designed, developed and manufactured as contemplated for general use,
including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not
designed, developed and manufactured as contemplated (1) for any use that includes fatal risks or dangers that, unless
extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury,
severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control,
mass transport control, medical life support system, missile launch control in weapon system), or (2) for any use where
chance of failure is intolerable (i.e., submersible repeater and artificial satellite). Please note that Spansion will not be liable
to you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products.
Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such
failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and
prevention of over-current levels and other abnormal operating conditions. If any products described in this document
represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law
of Japan, the US Export Administration Regulations or the applicable laws of any other country, the prior authorization by the
respective government entity will be required for export of those products.
Trademarks and Notice
The contents of this document are subject to change without notice. This document may contain information on a Spansion
product under development by Spansion. Spansion reserves the right to change or discontinue work on any product without
notice. The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy,
completeness, operability, fitness for particular purpose, merchantability, non-infringement of third-party rights, or any other
warranty, express, implied, or statutory. Spansion assumes no liability for any damages of any kind arising out of the use of
the information in this document.
®
®
®
TM
Copyright © 2013 Spansion Inc. All rights reserved. Spansion , the Spansion logo, MirrorBit , MirrorBit Eclipse ,
TM
ORNAND and combinations thereof, are trademarks and registered trademarks of Spansion LLC in the United States and
other countries. Other names used are for informational purposes only and may be trademarks of their respective owners.
Fujitsu Microelectronics Europe
Application Note
MCU-AN-390075-E-V10
F²MC-16LX FAMILY
16-BIT MICROCONTROLLER
MB90XXX
RELOCATED INTERRUPT
VECTOR TABLE
APPLICATION NOTE
Interrupt Jump Table
Revision History
Revision History
Date
2002-10-21
Issue
st
M. Willam; 1 version
This document contains 10 pages.
MCU-AN-390075-E-V10
-2-
© Fujitsu Microelectronics Europe GmbH
Interrupt Jump Table
Warranty and Disclaimer
Warranty and Disclaimer
To the maximum extent permitted by applicable law, Fujitsu Microelectronics Europe GmbH restricts
its warranties and its liability for all products delivered free of charge (eg. software include or
header files, application examples, target boards, evaluation boards, engineering samples of IC’s
etc.), its performance and any consequential damages, on the use of the Product in accordance with
(i) the terms of the License Agreement and the Sale and Purchase Agreement under which
agreements the Product has been delivered, (ii) the technical descriptions and (iii) all accompanying
written materials. In addition, to the maximum extent permitted by applicable law, Fujitsu
Microelectronics Europe GmbH disclaims all warranties and liabilities for the performance of the
Product and any consequential damages in cases of unauthorised decompiling and/or reverse
engineering and/or disassembling. Note, all these products are intended and must only be used
in an evaluation laboratory environment.
1.
Fujitsu Microelectronics Europe GmbH warrants that the Product will perform substantially in
accordance with the accompanying written materials for a period of 90 days form the date of
receipt by the customer. Concerning the hardware components of the Product, Fujitsu
Microelectronics Europe GmbH warrants that the Product will be free from defects in material
and workmanship under use and service as specified in the accompanying written materials
for a duration of 1 year from the date of receipt by the customer.
2.
Should a Product turn out to be defect, Fujitsu Microelectronics Europe GmbH´s entire liability
and the customer´s exclusive remedy shall be, at Fujitsu Microelectronics Europe GmbH´s
sole discretion, either return of the purchase price and the license fee, or replacement of the
Product or parts thereof, if the Product is returned to Fujitsu Microelectronics Europe GmbH in
original packing and without further defects resulting from the customer´s use or the transport.
However, this warranty is excluded if the defect has resulted from an accident not attributable
to Fujitsu Microelectronics Europe GmbH, or abuse or misapplication attributable to the
customer or any other third party not relating to Fujitsu Microelectronics Europe GmbH.
3.
To the maximum extent permitted by applicable law Fujitsu Microelectronics Europe GmbH
disclaims all other warranties, whether expressed or implied, in particular, but not limited to,
warranties of merchantability and fitness for a particular purpose for which the Product is not
designated.
4.
To the maximum extent permitted by applicable law, Fujitsu Microelectronics Europe GmbH´s
and its suppliers´ liability is restricted to intention and gross negligence.
NO LIABILITY FOR CONSEQUENTIAL DAMAGES
To the maximum extent permitted by applicable law, in no event shall Fujitsu
Microelectronics Europe GmbH and its suppliers be liable for any damages whatsoever
(including but without limitation, consequential and/or indirect damages for personal
injury, assets of substantial value, loss of profits, interruption of business operation,
loss of information, or any other monetary or pecuniary loss) arising from the use of
the Product.
Should one of the above stipulations be or become invalid and/or unenforceable, the remaining
stipulations shall stay in full effect
© Fujitsu Microelectronics Europe GmbH
-3-
MCU-AN-390075-E-V10
Interrupt Jump Table
Contents
Contents
REVISION HISTORY ............................................................................................................ 2
WARRANTY AND DISCLAIMER ......................................................................................... 3
CONTENTS .......................................................................................................................... 4
0 INTRODUCTION.............................................................................................................. 5
1 THE INTERRUPT TABLE ................................................................................................ 6
1.1
Location .................................................................................................................. 6
1.2
Normal Reference ................................................................................................... 7
2 SECOND TABLE - WORKAROUND ............................................................................... 8
2.1
Relocated Reference............................................................................................... 8
2.2
Interrupt Flow .......................................................................................................... 9
2.3
Code Flow ............................................................................................................. 10
MCU-AN-390075-E-V10
-4-
© Fujitsu Microelectronics Europe GmbH
Interrupt Jump Table
Introduction
0 Introduction
This document describes how to use a customized Interrupt Vector Jump Table.
© Fujitsu Microelectronics Europe GmbH
-5-
MCU-AN-390075-E-V10
Interrupt Jump Table
Chapter 1 The Interrupt Table
1 The Interrupt Table
DESCRIPTION OF THE INTERRUPT VECTOR TABLE
1.1
Location
The interrupt vector table is located fix in the Bank FFH. There is no way for the user to move
it to another memory location.
Below is a list of the interrupt vector address locations:
Vector
Interrupt
Vector
Hardware
Interrupt
Interrupt
Control Reg.
Address L
Address M
Address H
INT0
None
-
FFFFFCH
FFFFFDH
FFFFFEH
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
INT7
None
-
FFFFE0H
FFFFE1H
FFFFE2H
INT8
Reset
-
FFFFDCH
FFFFDDH
FFFFDEH
INT9
INT9 Instruction
-
FFFFD8H
FFFFD9H
FFFFDAH
INT10
Exception
-
FFFFD4H
FFFFD5H
FFFFD6H
INT11
(device specific)
FFFFD0H
FFFFD2H
FFFFD3H
INT12
(device specific)
FFFFCCH
FFFCDH
FFFFCEH
…
…
…
…
…
INT254
(device specific)
FFFC04H
FFFC05H
FFFC06H
INT255
(device specific)
FFFC00H
FFFC01H
FFFC02H
ICR00
…
ICR122
Note, that a device can have theoretical 255 interrupts, but in the most devices the number
of interrupts is less than 45.
MCU-AN-390075-E-V10
-6-
© Fujitsu Microelectronics Europe GmbH
Interrupt Jump Table
Chapter 1 The Interrupt Table
1.2
Normal Reference
An example of he usual interrupt vector reference without relocation is shown below. This
has to be done in the file “vectors.c”.
. . .
/* Prototypes
*/
__interrupt
void
IRQ_Handler1(void);
__interrupt
void
IRQ_Handler2(void);
__interrupt
void
IRQ_Handler3(void);
. . .
/* Vector definition
*/
#pragma intvect IRQ_Handler1 9
#pragma intvect IRQ_Handler2 10
#pragma intvect IRQ_Handler3 11
. . .
usual “vectors.c”
The following illustration shows the corresponding Interrupt handler routines. In this example
they can be found in the main program “main.c”.
. . .
/* End of void main(void)
*/
}
__interrupt void IRQ_Handler1(void)
{
. . .
/* Code here
*/
}
__interrupt void IRQ_Handler2(void)
{
. . .
/* Code here
*/
}
__interrupt void IRQ_Handler3(void)
{
. . .
/* Code here
*/
}
“main.c“
© Fujitsu Microelectronics Europe GmbH
-7-
MCU-AN-390075-E-V10
Interrupt Jump Table
Chapter 2 Second Table - Workaround
2 Second Table - Workaround
USING A SECOND TABLE
2.1
Relocated Reference
It is possible to use a second so-called “Jump-Table”, which is then independent from the
hard-wired table.
This table then has to be like in the following example in a separate assembly file:
.PROGRAM NEWVECT
.TITLE
"ALTERNATIVE IRQ VECTOR TABLE"
.SECTION NEWINTVECT, CONST, LOCATE=H'FF8000 ; depends on MCU type
.IMPORT
_IRQ_Handler1
.IMPORT
_IRQ_Handler2
.IMPORT
_IRQ_Handler3
.EXPORT
_Vector1
.EXPORT
_Vector2
.EXPORT
_Vector3
_Vector1:
JMPP
_IRQ_Handler1
_Vector2:
JMPP
_IRQ_Handler2
_Vector3:
JMPP
_IRQ_Handler3
. . .
. . .
. . .
.END
”newvect.asm”
“_IRQ_Handlern” is the basic interrupt handler function (ISR), which is normally referenced
in “vectors.c” without relocation.
Depending on the Code segment in which this table and the interrupt service routine are
located, you have to be careful using the “JMP” (16-Bit-Addressing) or the “JMPP” (24-BitAddressing) instruction.
Note, that “JMPP” will always work.
The next step is to reference to these Jump-Locations in the “vectors.c” file:
MCU-AN-390075-E-V10
-8-
© Fujitsu Microelectronics Europe GmbH
Interrupt Jump Table
Chapter 2 Second Table - Workaround
. . .
/* Prototypes
*/
__interrupt
void
Vector1(void);
__interrupt
void
Vector2(void);
__interrupt
void
Vector3(void);
. . .
/* Vector definition
*/
#pragma intvect Vector1 9
#pragma intvect Vector2 10
#pragma intvect Vector3 11
. . .
“vectors.c”
The file in which the Interrupt routines are coded (“Main.c”) remains unaffected.
2.2
Interrupt Flow
Now the instruction flow is like in the following illustration.
Interrupt occurs
Save Registers
no
IRQ
11 ?
Check if RESET,
EI2OS, INT9, …
yes
Fetch address of
corresponding vector
Workaround
Vector Table FFxxxxH
st
1 jump
PC: Corresponding
instruction of Interrupt
Vector Jump Table
2
nd
New Vector Jump
Table
jump
Interrupt Service
Routine
Jump to Interrupt
Handler Function (ISR)
© Fujitsu Microelectronics Europe GmbH
-9-
MCU-AN-390075-E-V10
Interrupt Jump Table
Chapter 2 Second Table - Workaround
2.3
Code Flow
The following graphic illustrates the program code flow for the Jump Table Workaround:
“Vectors.c”
“Main.c”
Vectoraddressm-2
Instructionn
Instructionn+1
Instructionn+2
Vectoraddressm-1
IRQm
CPU
Tasks
Instructionn+3
get
Vectoraddressm
Addr.
Vectoraddressm+1
Vectoraddressm+2
Instructionn+4
Instructionn+5
Jump to
Vectoraddr.
Return from
Interrupt
“Newvect.asm”
Vectoraddr m-2
JMP ISRm-2
Vectoraddr m-1
JMP ISRm-1
Vectoraddrm
JMP ISRm
Vectoraddrm+1
JMP ISRm+1
Vectoraddrm+2
JMP ISRm+2
Interrupt Handler Routine
ISRm-Instruction1
Jump to
ISR
ISRm-Instruction2
ISRm-Instruction3
...
ISRm-Instructioni
RETI
MCU-AN-390075-E-V10
- 10 -
© Fujitsu Microelectronics Europe GmbH
Similar pages