rename main function in startup

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

rename main function in startup

492 Views
darnaiadam
Contributor III

Hi,

I want to rename the main function mentioned in my question, but I can't find out, how should I do it. If I change the name in the "startup_<device_name>.S" based on the function I created in my main.c source, the compiler returns an error message:

"...crt0.o: In function `_start':
(.text+0x4a): undefined reference to `main'"

There is two problems with the crt0.o:

   - this file is part of a prebuilt library

   - crt0.o is a part of the compiler

I implemented a line in linker script, as follows:

main = created_main;

With this change I could compile my code, and it works perfectly.

What is the best way instead of this solution to make it working? Thanks!

0 Kudos
Reply
1 Reply

334 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Darnai Adam,

According to the statement, I've learned that you want to rename the main function in the main.c file.

And I wan wondering if you can upload your demo, as the different IDE has its particular startup files.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply