Why do I get Error L6218E?

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.