Why do I get Error L6218E?

ADL, A&D memory, Flash objects, multi-tasking, file system, DOTA.

Why do I get Error L6218E?

Postby FAQ_Poster » Fri Oct 26, 2012 1:04 pm

You may see this error L6218E which refers to Undefined symbol main (referred from kernel.o) when linking your application with RealView Development Suite (RVDS) 3.X.

The linker is reporting that your application does not include a [main()] function. The error is generated due to changes in the RVCT library code. In RVCT 3.0, a new mechanism has been introduced to select from a number of __user_initial_stackheap() functions in the libraries depending on the layout of your scatter file.
Details of how to use this new feature are given in section 5.1.2 of the RVCT 3.0 Linker and Utilities Guide.

Due to the way in which these new functions are implemented, they refer
to the __rt_exit() function. This is contained in kernel.o, which also contains the __rt_lib_init() function.
As the __rt_lib_init() function calls main(), this results in an undefined symbol error when main() is not present.

The behaviour of calling main() at startup is defined in the ISO C standard.
As there is no [main()] function as the entry point of application C code , you should be prepared to make allowances for the specific behaviour of the tools.
In the case of RVCT 3.0, the simplest solution is to implement an empty, dummy main() function or a dummy implementation of __rt_exit(). If one of these stubs is contained in a separate source file, it will usually be removed by the linker's normal unused section elimination process so there will be no overhead in the final linked image.
User avatar
Posts: 254
Joined: Thu Oct 25, 2012 7:10 am
Has thanked: 0 time
Have thanks: 5 times

Topic Tags

scatter file, undefined symbol main, RVCT, L6218E, error, RVDS, library

Return to Operating System FAQ

Who is online

Users browsing this forum: No registered users and 1 guest