SLAU132V October 2004 – February 2020
The linker looks for run-time-support libraries primarily through the MSP430_C_DIR environment variable. Typically, one of the pathnames in MSP430_C_DIR is your install directory/lib, which contains all of the pre-built libraries, as well as the index library libc.a. The linker looks in MSP430_C_DIR to find a library that is the best match for the build attributes of the application. The build attributes are set indirectly according to the command-line options used to build the application. Build attributes include things like CPU revision. If the library name is explicitly specified (e.g. -library=rts430_eabi.lib), run-time support looks for that library exactly. If the library name is not specified, the linker uses the index library libc.a to pick an appropriate library. If the library is specified by path (e.g. –library=/foo/rts430_eabi.lib), it is assumed the library already exists and it will not be built automatically.
The index library describes a set of libraries with different build attributes. The linker will compare the build attributes for each potential library with the build attributes of the application and will pick the best fit. For details on the index library, see the archiver chapter in the MSP430 Assembly Language Tools User's Guide.
Now that the linker has decided which library to use, it checks whether the run-time-support library is present in MSP430_C_DIR . The library must be in exactly the same directory as the index library libc.a. If the library is not present, the linker invokes mklib to build it. This happens when the library is missing, regardless of whether the user specified the name of the library directly or allowed the linker to pick the best library from the index library.
The mklib program builds the requested library and places it in 'lib' directory part of MSP430_C_DIR in the same directory as the index library, so it is available for subsequent compilations.
Things to watch out for: