RELOCATING INTERRUPT BASE ADDRESS
Applies to: RTX51 Real-time Kernel
Is it possible to relocate RTX-51's interrupt vector base
Yes. There are only a few steps you must take to move the
Change the startup code to begin at the target reset
Locate the interrupt vectors at their new location using
- Specify the code area for the linker.
Modify the RTXSETUP.DCL to know where to put the interrupt
- Specify the RTX interrupt vector location to the linker.
The following example assumes that you wish to relocate the
interrupt table to 0x1000 where the reset vector is at 0x1000 and
interrupts are at 0x1003, 0x100B, 0x1013, and so on.
To change the startup code, copy the STARTUP.A51 file from the
C51LIB directory to your project directory. Search for CSEG AT
0000h and change it to CSEG AT 1000h.
To locate the interrupt vectors, in uVision, select the C51
Compiler command from the Options menu and select the Object tab.
Change the Offset for the interrupt vectors to 0x1000. If you don't
use uVision, add IV (0x1000) to your C51 command line.
To specify the code area for the linker, in uVision, select the
BL51 Code Banking Linker command from the Options menu and select
the Size/Location tab. Change the Code segment location to 1000
(note that 0x and H are not required here). If you don't use
uVision, add CODE (0x1000) to your BL51 command line.
Modify RTXSETUP.DCL so that the interrupt base address is
0x1000. Search for ?RTX_INTBASE EQU 0 and change it to ?RTX_INTBASE
In the BL51 Linker Options dialog box, select the Additional
tab and add RTXINTBASE(1000h) to the first available line. This
linnker command relocates the RTX51 interrupt table to 1000h. The
address you specify must be the same as for the ?RTX_INTBASE
declaration in RTXSETUP.DCL. Note that you may abbreviate the
linker option as RI(1000h).
Rebuild your program and look at the M51 map file to make sure
your program begins at the appropriate address.
Note that if you attempt to run your program with dScope, it will
not run. This is because dScope jumps to the REAL interrupt vectors
(0000h, 0003h, 000Bh, 0013h, and so on). You can get around this
problem by using the dScope assembler to add LJMPs at the real
interrupt vectors to the relocated interrupts. For example:
ASM LJMP 0x1000
ASM LJMP 0x1003
ASM LJMP 0x100B
ASM LJMP 0x1013
You could also create a small assembly program that redirects the
interupt vectors to their new locate. Either way, the real interrupt
vectors must redirect the interrupt to your new interrupt vector
Article last edited on: 2005-07-09 11:34:06
Rate this article
Disagree? Move your mouse over the bar and click