Configuration

Prior to usage, you must properly configure µC/LIB.

µC/LIB is configurable at compile time via approximately 10 #defines in your application copy of lib_cfg.h. µC/LIB uses #defines when possible because they allow code sections to be scaled at compile time based on enabled features and the configured number of objects. This allows the Read-Only Memory (ROM) and Random-Access Memory (RAM) footprints of µC/LIB to be adjusted based on application requirements.

It is recommended that you begin the configuration process with the default configuration values which in the next sections will be shown in bold.

The sections in this chapter are organized following the order in µC/LIB’s template configuration file, lib_cfg.h.

Lib Mem Configurations

Table - Lib Mem Configuration Constants
ConstantDescriptionPossible values
LIB_MEM_CFG_ARG_CHK_EXT_ENAllows you to control whether you want code to be generated to check arguments for functions that can be called by your application and, for functions which are internal but receive arguments from an API that your application can call. DEF_ENABLED or DEF_DISABLED
LIB_MEM_CFG_OPTIMIZE_ASM_EN

Allows you to enable the substitution of the default Mem_Copy() function implementation with an optimized assembly version, when one is available.

DEF_ENABLED or DEF_DISABLED
LIB_MEM_CFG_DBG_INFO_ENAllows you to enable or disable the debug module that allows you to track memory allocation from the different memory segments.DEF_ENABLED or DEF_DISABLED
LIB_MEM_CFG_HEAP_SIZEAllows you to configure the size of the heap memory segment, in bytes. A size of 0 disables the heap.

0 to 2^(sizeof(CPU_SIZE_T) * 8).

Default value is 1024u.

LIB_MEM_CFG_HEAP_PADDING_ALIGNAllows you to configure the padding alignment to be added at the end of each buffer allocated from the heap. Particularly useful with systems that have cache memory and where you want to avoid having more than one buffer on a given cache line.

LIB_MEM_PADDING_ALIGN_NONE

Any power of 2 values (1, 2, 4, 8, 16, 32, ...).

LIB_MEM_CFG_HEAP_BASE_ADDR
Allows you to specify the base address of the heap memory. Not defining this will cause the heap to be allocated from a standard C buffer.Undefined, 1 to 2^(sizeof(CPU_DATA) * 8).


Lib Str Configurations

Table - Lib Str Configuration Constants
ConstantDescriptionPossible values
LIB_STR_CFG_FP_ENAllows you to enable or disable a function to convert floating point numbers to strings (Str_FmtNbr_32()).DEF_ENABLED or DEF_DISABLED
LIB_STR_CFG_FP_MAX_NBR_DIG_SIG

Allows you to configure the number of significant digits used to calculate and/or displayed in floating point string function(s).

1 to 9.

Default value is LIB_STR_FP_MAX_NBR_DIG_SIG_DFLT