|
|||||||||||
Technical Support Support Resources
Product Information |
C51: Adding to the Startup CodeInformation in this article applies to:
QUESTIONHow do I add code to the startup routines so that it executes before the main C function? ANSWERThe startup code is very easy to modify. First, you must copy the proper startup code into your project folder and add it to your project. Then, you must add your code to the correct place in the startup code. The following listings show excerpts from the startup code.
This is the RESET vector. On the 8051, the reset vector is located at address 0000h (unless it has been moved to work with a target monitor or boot loader). Note that the reset vector is simply an LJMP to the startup code. The reset vector MUST be an LJMP because the first interrupt vector is located at address 0003h.
The next lines of code define a relocatable segment (named ?C_C51STARTUP) and a label (STARTUP1). Note that this is the label that the reset vector jumps to. Your initialization code should typically go immediately after this label. SEE ALSOLast Reviewed: Thursday, February 25, 2021 | ||||||||||
|
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.