Embedded Studio Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

MPLAB Project Startup Function

2 posters

Go down

MPLAB Project Startup Function Empty MPLAB Project Startup Function

Post  GoldenMaple Wed Nov 26, 2008 12:08 am

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.

GoldenMaple

Posts : 11
Join date : 2008-08-22

Back to top Go down

MPLAB Project Startup Function Empty Re: MPLAB Project Startup Function

Post  lzmind Wed Nov 26, 2008 11:17 am

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.

lzmind

Posts : 18
Join date : 2008-08-20

Back to top Go down

MPLAB Project Startup Function Empty Re: MPLAB Project Startup Function

Post  GoldenMaple Wed Nov 26, 2008 9:22 pm

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

Back to top Go down

MPLAB Project Startup Function Empty Re: MPLAB Project Startup Function

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum