如何从其他地址启动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.   // 更改cseg 改代码段
  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 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 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.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值