ARM Technical Support Knowledge Articles

RELOCATING INTERRUPT BASE ADDRESS

Applies to: RTX51 Real-time Kernel

Answer

QUESTION

Is it possible to relocate RTX-51's interrupt vector base address?

ANSWER

Yes. There are only a few steps you must take to move the interrupt vectors.

  1. Change the startup code to begin at the target reset vector.
  2. Locate the interrupt vectors at their new location using C51.
  3. Specify the code area for the linker.
  4. Modify the RTXSETUP.DCL to know where to put the interrupt vector table.
  5. 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.

  1. 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.
  2. 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.
  3. 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.
  4. Modify RTXSETUP.DCL so that the interrupt base address is 0x1000. Search for ?RTX_INTBASE EQU 0 and change it to ?RTX_INTBASE EQU 1000h.
  5. 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 0x0000
ASM LJMP 0x1000

ASM 0x0003
ASM LJMP 0x1003

ASM 0x000B
ASM LJMP 0x100B

ASM 0x0013
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 table.

SEE ALSO

Article last edited on: 2005-07-09 11:34:06

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential