This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Undefined reference to __main

Hi,

I am trying to port an existing startup code (which compiles fine using arm compiler 6.18) to compile with GNU toolchain for arm (arm-none-eabi).

The startup code includes a jump to __main which doesnt exist in my codebase presumably because its part of some sort of C runtime library.

But when I try and compile it with gcc cross-compiler, it complains about "undefined reference __main".

How do I resolve this pls?

Thanks

Sarah

Parents
  • Ignore my comment on undefining the symbols. Thinking it through I don't think that would help. I just meant to comment them out, but the startup code would still be looking for them.

    Does your ld script define all the .bss regions? This would be the catch-all for anything else remaining. If there is nothing remaining, still defining them as regions in your ld script should allow the init code to proceed.

Reply
  • Ignore my comment on undefining the symbols. Thinking it through I don't think that would help. I just meant to comment them out, but the startup code would still be looking for them.

    Does your ld script define all the .bss regions? This would be the catch-all for anything else remaining. If there is nothing remaining, still defining them as regions in your ld script should allow the init code to proceed.

Children