Keil Logo

C51: RELOCATING PROGRAM CODE IN C


Information in this article applies to:

  • C51 All Versions

QUESTION

I have a C51 development software for windows. I want to relocate the program code to an address other than 0000h. How do I do that in C source code? I tried to set the linker code segment address to 8000h, but it did not work.

ANSWER

There are several steps involved in this.

  1. If you haven't already, copy \C51\LIB\STARTUP.A51 into your working directory, and add it to your project as the last file.
  2. In STARTUP.A51 change the CSEG AT 0000H line to be: CSEG AT 8000H
  3. Open the µVision "Options for Target..." window. Select the "Target" tab. Set your Eprom, Start to 0x8000.
  4. On the C51 tab, set "Interrupt vectors at address" to 0x8000.

The next time you build your project, all of your source code will be located at 8000h and above.

SEE ALSO

FORUM THREADS

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

Last Reviewed: Monday, August 21, 2006


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.