Keil Logo

C51: RELOCATING INTERRUPT VECTOR TABLES


Information in this article applies to:

  • C51 All Versions

QUESTION

How do I relocate the interrupt vector table from address 0x0000 to a different address?

ANSWER

This is a three-step process that involves:

  • Setting the starting address of your program (in the startup file),
  • Setting the offset for interrupt vectors (using a compiler directive),
  • and Setting the address range for program code (using a linker directive).

Assuming that you want to relocate the reset and interrupt vectors and your program to offset 0xC000, proceed as follows.

  1. Copy the startup code (usually STARTUP.A51) into your project. µVision asks if you want to do this each time you begin a project. If it has not already been added to your project, look in the \KEIL\C51\LIB\ folder. Open the startup code source file and locate a line that contains "CSEG AT 0". Change this line to: "CSEG AT 0C000h".
  2. Set the (INTVECTOR) compiler directive to a value of 0xC000. If you use µVision, set the interrupt offset option to 0xC000 (this is located under Options for Target — C51).
  3. Change the starting address for CODE space to 0xC000 using the CODE BL51 Linker Directive or the CLASSES LX51 Linker Directive. If you use µVision, change the code starting address under Options for Target — BL51 Linker to 0xC000.

Save the changes and rebuild your project.

You should now see a gap in your link map of 0xC000 before your first code segment.

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Sunday, June 8, 2008


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.