|
|
|
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 relocating your C51 program to start an 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 uVision...
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 uVision2...
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 uVision...
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 uVision2...
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.
Last Reviewed: 2/23/2000
Copyright © 2000
Keil Software, Inc. All rights reserved.
|
|