C51: SETTING PROGRAM START ADDRESS

QUESTION

How do I start my C51 program at an address other than 0000h?

ANSWER

There are three steps to relocate your C51 program to start at a different offset. Specifically, you must do the following:

  1. Change the startup code to begin at the target reset vector.
  2. Locate the interrupt vectors at their new location.
  3. Specify the code area for the linker.

The following instructions assume you want to relocate your program to 8000h.

To change the startup code...

  1. Copy the STARTUP.A51 file from the \C51\LIB directory to your project directory.
  2. Search for CSEG AT 0000h and change it to CSEG AT 8000h.
  3. Add the startup code to your project.

To locate the interrupt vectors...

In µVision...

  1. Select the C51 Compiler command from the Options menu.
  2. Select the Object tab.
  3. Change the Offset for the interrupt vectors to 0x8000.

In µVision Version 2...

  1. Select Options for Target from the Project menu.
  2. Select the C51 tab.
  3. Check the Interrupt vectors at address checkbox.
  4. Change the offset to 0x8000.

To specify the code area for the linker...

In µVision Version 1...

  1. Select the BL51 Code Banking Linker command from the Options menu.
  2. Select the Size/Location tab.
  3. Change the Code segment location to 8000 (note that 0x and H a​​re not required here).

In µVision Version 2...

  1. Select Options for Target from the Project menu.
  2. Select the Target tab.
  3. Change the EPROM starting address to 0x8000.

Or, if you don't use the memory layout dialog...

  1. Select Options for Target from the Project menu.
  2. Select the L51 Locate tab.
  3. Uncheck the Use Memory Layout from Target Dialog checkbox.
  4. Enter the base address of 0x8000 for the Code space.

Finally

Rebuild your program and check the M51 map file to make sure your program begins at the appropriate address.

 

文章出處: http://blog.csdn.net/phenixyf/article/details/8552257

 

創作者介紹

Chi Learning

Chi Learning 發表在 痞客邦 PIXNET 留言(0) 人氣()