keil c51 locating program start address 如何修改 keil c51 程式編譯的起始位址

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 are 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://www.keil.com/support/docs/189.htm

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com 標誌

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google photo

您的留言將使用 Google 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 /  變更 )

連結到 %s