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:
- Change the startup code to begin at the target reset vector. // 更改cseg 改代码段
- Locate the interrupt vectors at their new location. //改中断向量
- Specify the code area for the linker. // 改链接器
The following instructions assume you want to relocate your program to 8000h.
To change the startup code...
- Copy the STARTUP.A51 file from the \C51\LIB directory to your project directory.
- Search for CSEG AT 0000h and change it to CSEG AT 8000h.
- Add the startup code to your project.
To locate the interrupt vectors...
In µVision Version 2...
- Select Options for Target from the Project menu.
- Select the C51 tab.
- Check the Interrupt vectors at address checkbox.
- Change the offset to 0x8000.
To specify the code area for the linker...
In µVision Version 2...
- Select Options for Target from the Project menu.
- Select the Target tab.
- Change the EPROM starting address to 0x8000.
Or, if you don't use the memory layout dialog...
- Select Options for Target from the Project menu.
- Select the L51 Locate tab.
- Uncheck the Use Memory Layout from Target Dialog checkbox.
- 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.
1229

被折叠的 条评论
为什么被折叠?



