AnsweredAssumed Answered

rename main function in startup

Question asked by Darnai Adam on Oct 28, 2016
Latest reply on Oct 30, 2016 by jeremyzhou

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!

Outcomes