uC-LIB Portable Library Functions
µC/LIB consists of library functions meant to be highly portable and not tied to any specific compiler. This facilitates third-party certification of Micriµm products. µC/OS-III does not use any µC/LIB functions, however µC/OS-III and µC/CPU assumes the presence of lib_def.h
for such definitions as: DEF_YES
, DEF_NO
, DEF_TRUE
, DEF_FALSE
, DEF_ON
, DEF_OFF
and more.
\Micrium \Software \uC-LIB \lib_ascii.c \lib_ascii.h \lib_def.h \lib_math.c \lib_math.h \lib_mem.c \lib_mem.h \lib_str.c \lib_str.h \Cfg\Template \lib_cfg.h \Ports \<architecture> \<compiler> \lib_mem_a.asm
\Micrium
Contains all software components and projects provided by Micrium.
\Software
This sub-directory contains all software components and projects.
\uC-LIB
This is the main µC/LIB directory.
lib_ascii.c
and lib_ascii.h
contain source code to replace some standard library functions such as tolower()
, toupper()
, isalpha()
, isdigit()
, etc. with µC/LIB equivalent functions ASCII_ToLower()
, ASCII_ToUpper()
, ASCII_IsAlpha()
, and ASCII_IsDig()
, respectively.
lib_def.h
defines constants for many common values such as TRUE/FALSE
, YES/NO
, ENABLED/DISABLED
; as well as for integer, octet, and bit values. However, all #define
in this file starts with DEF_
so those constants are actually called DEF_TRUE/DEF_FALSE
, DEF_YES/DEF_NO
, DEF_ENABLED/DEF_DISABLED
, etc. This file also contains macros for common mathematical operations like min()
, max()
, abs()
, bit_set()
, bit_clr()
, etc. with DEF_MIN()
, DEF_MAX()
, DEF_ABS()
, DEF_BIT_SET()
, DEF_BIT_CLR()
, respectively.
lib_math.c
and lib_math.h
contain source code to replace some standard library functions such as rand()
, srand()
, etc. with µC/LIB equivalent functions Math_Rand()
, Math_SetSeed()
, respectively.
lib_mem.c
and lib_mem.h
contain source code to replace some standard library functions such as memclr()
, memset()
, memcpy()
, memcmp()
, etc. with µC/LIB equivalent functions Mem_Clr()
, Mem_Set()
, Mem_Copy()
, Mem_Cmp()
, respectively.
lib_str.c
and lib_str.h
contain source code to replace some standard library functions such as strlen()
, strcpy()
, strcmp()
, memcmp()
, etc. with µC/LIB equivalent functions Str_Lenr()
, Str_Copy()
, Str_Cmp()
, respectively.
\Cfg\Template
This directory contains a configuration template file (lib_cfg.h
) that should be copied to the application directory to configure the µC/LIB module based on application requirements.
lib_cfg.h
determines whether to enable assembly language optimization (assuming there is an assembly language file for the processor, i.e., lib_mem_a.asm
) and a few other #defines
.
\Ports\Architecture\Compiler
This directory contains optimized assembly language files specific to the CPU architecture to replace C functions with much faster assembly language implementations. The presence of this folder depends on whether such assembly language functions were implemented by the port developer of the µC/LIB module.
lib_mem_a.asm
contains optimized versions of the lib_mem.c
functions.