| ARM Technical Support Knowledge Articles | |
Applies to: C51 C Compiler
Information in this article applies to:
How do I redirect my interrupts for an application that includes EPROM (starting at 0x0000) and FLASH (starting at 0x2000)?
You must have a program in the EPROM and another program in the FLASH memory to accomplish this. The EPROM assumably contains a loader that contains a simple assembly program that has its reset vector at 0 and its interrupts located in memory with the standard offsets; 3H, 0BH .... Here is a code snipet to demonstrate the program:
OFFSET EQU 2000H
CSEG AT 0003H
LJMP OFFSET + 0003h
CSEG AT 000BH
LJMP OFFSET + 000BH
; .
; .
; .
;For each interrupt that is contained in both the Flash
;program and the loader, such as the serial
;interrupt you must have code to test which interrupt is
;currently being used. In the following
;snipet we will use the user defined bit in the
;PSW for the flag which must be set by the loader
;and reset by the flash program. If you have more
;than one interrupt that is shared then you will
;need a different messaging system.
CSEG AT 0023H ;The reset vectors are located
;in the loader in ROM
LJMP SIO_ISR ;The serial interrupt is being
;used as an example
INTR_HNDLR SEGMENT CODE
RSEG INTR_HNDLR ;The following segment is
;relocatable
SIO_ISR:
PUSH PSW ;Save the world
JNB PSW.1, PROG_JMP ;Loader serial interrupt or
;flash program interrupt
POP PSW ;Set the world right for the
;loader interrupt handler
LJMP LOADER_SIO_ISR ;Go handle the interrupt for
;the loader
PROG_JMP: ;
POP PSW ;Set the world right from the
;flash program interrupt handler
LJMP OFFSET + 0023H ;Go handle the interrupt for the
;flash program
The flash located program has the same reset and interrupt vectors but the offset has been changed from 0 to 2000H using the IV(2000H) directive in the compiler.
Article last edited on: 2006-11-18 21:26:23
Did you find this article helpful? Yes No
How can we improve this article?