We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
The startup *.s file is placed in a library project, then the app project link this library. When I compile, error: error: L6236E: No section matches selector - no section to be FIRST/LAST.
but place *.s file in app project, it's OK.
linkfile for keil (*.scf) contain the codes as follow: * (RESET,+FIRST)
And the 'RESET' section is defined in starup file (*.s) of startup libray as follow: AREA RESET, DATA, READONLY
The the linker of KEIL don't find the section 'RESET'
Does it really not find it, or does it simply discard it because it has no symbol dependency requiring it's presence?
A library is a collection of objects, the linker is free to pick and choose which it includes as it navigates the dependency tree. That it doesn't include the object you want suggests that it can get closure without it. When you grasp this, and the appropriateness of dumping everything into a library you might be able to make some progress.
Why should the linker care more about the section RESET than it should about other sections?
A section is just a grouping. As I already indicated in my previous post - it isn't a variable or function.
The day one of your source files not hidden in the library tries to access an exported symbol from that startup file - like maybe Reset_Handler, assuming you have something like
EXPORT Reset_Handler Reset_Handler
then the linker would have a reason to go hunting for an object file that can supply that Reset_Handler reference.
But your area RESET is no more interesting when digging out object files from the library than the area CODE. If it was, then the concept with libraries would fail because the linker would suck in every single object file from the library that happened to mention an area that you want in your program. So all of the CRTL would be included even of the tiniest Hello World!
It's time to stop blaming the tools for doing what they are explicitly designed to do, and start using them as they were intended to be used. You'll get much better progress that way.