Configuration
This is the default configuration of the middleware.
When any of the settings shall be modified, it shall be done in dedicated application config lwmem_opts.h file.
Note
Check Getting started for guidelines on how to create and use configuration file.
- group LWMEM_OPT
LwMEM options.
Defines
-
LWMEM_CFG_OS
Enables
1or disables0operating system support in the library.Note
When
LWMEM_CFG_OSis enabled, user must implement functions in System functions group.
-
LWMEM_CFG_OS_MUTEX_HANDLE
Mutex handle type.
Note
This value must be set in case LWMEM_CFG_OS is set to
1. If data type is not known to compiler, include header file with definition before you define handle type
-
LWMEM_CFG_ALIGN_NUM
Number of bits to align memory address and memory size.
Some CPUs do not offer unaligned memory access (Cortex-M0 as an example) therefore it is important to have alignment of data addresses and potentialy length of data
Note
This value must be a power of
2for number of bytes. Usually alignment of4bytes fits to all processors.
-
LWMEM_CFG_FULL
Enables
1or disables0full memory management support.When enabled (default config), library supports allocation, reallocation and freeing of the memory.
Memory [c]allocation
Memory reallocation
Memory allocation in user defined memory regions
Memory freeing
When disabled, library only supports allocation and does not provide any other service.
Its purpose is for memory allocation at the start of firmware initialization only
Note
When disabled, statistics functionaltiy is not available and only one region is supported (for now, may be updated later). API to allocate memory remains the same as for full configuration.
-
LWMEM_CFG_CLEAN_MEMORY
Enables
1or disables0memory cleanup on free operation (or realloc).It resets unused memory to
0x00and prevents other applications seeing old data. It is disabled by default since it has performance penalties.
-
LWMEM_CFG_ENABLE_STATS
Enables
1or disables0statistics in the library.
-
LWMEM_MEMSET(dst, val, len)
Memory set function.
Note
Function footprint is the same as memset
-
LWMEM_MEMCPY(dst, src, len)
Memory copy function.
Note
Function footprint is the same as memcpy
-
LWMEM_MEMMOVE(dst, src, len)
Memory move function.
Note
Function footprint is the same as memmove
-
LWMEM_CFG_OS