embtextf  20130407
Embedded System Text Formatting
 All Files Functions Typedefs Macros Pages
Installation and Use

Table of Contents

embtextf uses the GNU Build System to simplify configuration, compilation, library building, and installation. The general process is:

./configure --host=target --prefix=install-path
make
make install

Most users of embtextf will want to cross-compile it for an embedded system, which is indicated by using the –host flag to configure to tell it to cross-compile. Be aware that with most versions of autoconf released since the year 2000 you will get the following message:

configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used

There is nothing wrong here except the expectations of the maintainers and most users of autoconf. You don't want to set the –build type, you do want to cross-compile, and you did exactly what you were supposed to do. Ignore the warning.

You can run:

./configure --help

to see what the various options mean and how you can influence the configuration and compilation process. In particular, there are options to disable features such as support for long long types. See <embtextf/config.h> for descriptions of features that can be enabled or disabled based on specific needs.

Configuration Options

By default, all features of embtextf are enabled, but in some cases the features may be unnecessary and support for them might increase the size of the library. As an example, the following turns off embtextf_vuprintf() support for 64-bit values (EMBTEXTF_ENABLE_VUPRINTF_LONGLONG) and format precision (EMBTEXTF_ENABLE_VUPRINTF_PRECISION) on the MSP430, resulting in a significantly smaller library:

./configure \
--host=msp430 --prefix=/usr/local/mspgcc \
--disable-vuprintf-longlong \
--disable-vuprintf-precision

Installation for Specific Platforms

Installation using mspgcc

The following can be used to produce an embtextf installation suitable for use with Texas Instruments MSP430 devices when using the mspgcc GNU-based toolchain:

./configure \
--host=msp430 --prefix=/usr/local/mspgcc

Because autoconf does not nicely support multilibs, if you want to control the memory model or take advantage of CPU/MPY capabilities of the target chip you'll need to do that through TARGET_CFLAGS:

./configure \
--host=msp430 --prefix=/usr/local/mspgccx \
TARGET_CFLAGS='-mcpu=430x -mmemory-model=medium'

Memory model information for an object file can be displayed using msp430-readelf with the -A flag:

llc% msp430-readelf -A /usr/local/mspgccx/lib/libembtextf.a
File: /tmp/msp430x/lib/libembtextf.a(vuprintf.o)
Attribute Section: gnu
File Attributes
  Tag_GNU_MSP430_CPUX_TARGET: c20,sr20

Installation for Energy Micro Devices

The following can be used to produce an embtextf installation suitable for use with Energy Micro and probably other Cortex-M3 devices when using the CodeSourcery toolchain:

./configure \
--host=arm-none-eabi --prefix=/usr/local/efm32 \
TARGET_CFLAGS='-mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd'

Installation using Code Composer Studio

The following can be used to produce an embtextf installation built with the Texas Instruments Code Composer Studio compiler toolchain:

./configure \
CCS_INSTALL_ROOT=/usr/local/ccs-5.2.1/ccsv5 \
--with-ccs-target=msp430 \
--prefix=/usr/local/ccs-msp430

The –with-ccs-target option should specify the target platform, such as msp430 or tms470. The installation root of the TI compiler toolchain should be specified in the CCS_INSTALL_ROOT environment variable or on the configure command line.

pkg-config support from embtextf

embtextf constructs and installs a pkg-config file that can be used to obtain the flags necessary to build applications to link with an installed embtextf system. Use the tool this way:

PKG_CONFIG_PATH=/usr/local/efm32/lib/pkgconfig pkg-config --cflags --libs embtextf

which will produce output like:

-mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -g -O2 -Os -I/usr/local/efm32/include  -L/usr/local/efm32/lib -lembtextf

pkg-config assumes you combine CPPFLAGS into CFLAGS (and LDFLAGS into LIBS), so though you can obtain the include path using –cflags-only-I there is no general way to extract only the specific pieces that belong in CFLAGS and LDFLAGS.

pkg-config also does not have a concept of optional libraries within a package, so for simplicity -lembtextf-libc is excluded from LIBS and must be added if the libc wrappers enabled by EMBTEXTF_PROVIDE_LIBC are desired.