| |||
| Home > The ARM C micro-library > Building an application with microlib | |||
To build a program using microlib, you must use the command-line
option --library_type=microlib. This option can
be used by the compiler, assembler or linker. Use it with the linker
to override all other options.
Example 11 shows --library_type=microlib being
used by the compiler. Specifying --library_type=microlib when
compiling main.c results in an object file
containing an attribute that asks the linker to use microlib. Compiling extra.c with --library_type=microlib is unnecessary,
because the request to link against microlib exists in the object
file generated by compiling main.c.
Example 11. Compiler option
armcc --library_type=microlib -c main.c armcc -c extra.c armlink -o image.axf main.o extra.o
Example 12 shows this
option being used by the assembler. The request to the linker to
use microlib is made as a result of assembling more.s with --library_type=microlib.
Example 12. Assembler option
armcc -c main.c armcc -c extra.c armasm --library_type=microlib more.s armlink -o image.axf main.o extra.o more.o
Example 13 shows this option being used by the linker. Neither object file contains the attribute requesting that the linker link against microlib, so the linker selects microlib as a result of being explicitly asked to do so on the command line.
Example 13. Linker option
armcc -c main.c armcc -c extra.c armlink --library_type=microlib -o image.axf main.o extra.o