To get a sense of the cost of using the library consider the code in
Figure 2.1 which configures PC8 and PC9 as outputs (to drive LEDs) and
PA0 as an input (to read the push button). 3. Similar library based code
is presented as an exercise in Chapter 4. In Table 2.1 I compare the space
requirements of two versions of this program with and without the use of the
standard peripheral library. The first column (text) provides the size of “text
segment” (code and data initializers), the data allocated in ram at startup is
the sum of data (initialized data) and bss (zeroed data). The total memory
requirements are provided in column text. The .elf files are the complete
binaries. Excluding 256 bytes of preallocated runtime stack (bss), the library
version is nearly 3 times as large. Unlike the original which did minimum
system initialization, I included two common startup files for both versions.
Also, the standard peripheral library has extensive parameter checking which
I disabled for this comparison.