MPLAB Project Startup Function
2 posters
Page 1 of 1
MPLAB Project Startup Function
Hello there,
In a MPLAB project, how do I eliminate the startup function from the lib in order to use my own startup code? I tried to delete the Library Search Path from the project build option, which I thought was the way to exclude it, however, the execution still starts from the default startup, and my startup was not invoked. Please advise.
In a MPLAB project, how do I eliminate the startup function from the lib in order to use my own startup code? I tried to delete the Library Search Path from the project build option, which I thought was the way to exclude it, however, the execution still starts from the default startup, and my startup was not invoked. Please advise.
GoldenMaple- Posts : 11
Join date : 2008-08-22
Re: MPLAB Project Startup Function
GoldenMaple,
You were partially right.
If you specify a Library Search Path in the build option, the linker will use the lib that you specified. If you don't specify one, the linker will use the default lib (crt0, crt1 that are located in the MPLAB installation folder) according to the commands in the linker script file such as the following
OUTPUT_ARCH("30F6010A")
EXTERN(__resetPRI)
EXTERN(__resetALT)
to resolve three external symbols
__resetPRI
__resetALT
__reset
Now, if you include one startup code (you may give your file any name but not the same as crt0.s or crt1.s) into your project, and the above three symbols are declared in your file, the linker will use them from your file. For any symbol missed, the linker will use the one in the default lib. In other word, your startup code takes higher priority than the default.
To prove your startup code is used, debug your code from address 0 (you may refer to
Reset to Main() Entry or Zero Address for how) and step through your code from the Program Memory window within MPLAB IDE.
You were partially right.
If you specify a Library Search Path in the build option, the linker will use the lib that you specified. If you don't specify one, the linker will use the default lib (crt0, crt1 that are located in the MPLAB installation folder) according to the commands in the linker script file such as the following
OUTPUT_ARCH("30F6010A")
EXTERN(__resetPRI)
EXTERN(__resetALT)
to resolve three external symbols
__resetPRI
__resetALT
__reset
Now, if you include one startup code (you may give your file any name but not the same as crt0.s or crt1.s) into your project, and the above three symbols are declared in your file, the linker will use them from your file. For any symbol missed, the linker will use the one in the default lib. In other word, your startup code takes higher priority than the default.
To prove your startup code is used, debug your code from address 0 (you may refer to
Reset to Main() Entry or Zero Address for how) and step through your code from the Program Memory window within MPLAB IDE.
lzmind- Posts : 18
Join date : 2008-08-20
Re: MPLAB Project Startup Function
Thank you very much for your very detailed explanation, which I could not find in any documentation. I got my startup code running from reset of the processor.
GoldenMaple- Posts : 11
Join date : 2008-08-22
Similar topics
» Warning message after converting project of v4.5 to v5.0
» Linker error after converting project from v4.5 to v5.0
» Linker error after converting project from v4.5 to v5.0
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|