AN2345 Freescale Semiconductor / Motorola, AN2345 Datasheet - Page 15

no-image

AN2345

Manufacturer Part Number
AN2345
Description
Real-Time Memory Manager for StarCore DSPs
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
4
4.1 Initial Configuration
4.2 Project Set-up
Building Your Application with VSMM
This section describes the steps necessary to include the VSMM functionality within your application,
and it concludes with examples. For additional details on the VSMM, refer to the VSMM Reference
Manual [5].
The first step to perform when using the VSMM is to gain an understanding of your application and its
memory requirements so that your application uses the available memory most efficiently. Section 3.3,
VSMM Configuration ‘C’ Source File, on page 12 describes the configurable VSMM parameters and the
files requiring modifications based on your criteria. Edit these files carefully and save them when done.
The minimum recommended modifications are to set the maximum number of partitions or heaps that
your system requires, keeping in mind that the VSMM requires at least two heaps and each heap requires
a minimum of two memory blocks.
Perform the following steps:
1. Set the maximum number of heaps by editing the VSMM_MAX_MEM_PART #define constant in the
2. In VSMM_cfg.h, specify the critical method for entering and exiting critical sections. Edit the
3. Edit the VSMM_cfg.c configuration source file if you want to change the current VSMM argument
Your application must include the VSMM master include header file, VSMM_Includes.h. This
master header file contains all VSMM header files required to build your application with the VSMM
library. The order of the #includes within this file is important, so do not edit this file. Like all header
files, this file contains a mechanism to prevent multiple inclusions.
Ensure that the OSEck bspspinlock.h header file is included in your module containing this code
snippet.
VSMM_cfg.h header file.
Recall that the memory control block associated with each heap requires 24-bytes of memory.
VSMM_CRTICAL_METHOD #define constant appropriately.
Of course, you can add your own critical methods and/or enable the OSE_RTOS #define constant to
use the OSEck RTOS critical method macros or spin-lock. To use the OSEck RTOS critical method
macros/spin-locks, edit the OSE_RTOS #define constant to a value of 1 or 0 if you do not wish to use
these macros. Refer to Section 7, Building VSMM Examples 1–3, on page 26 for a source listing of
VSMM_cfg.h.
verification mode.
To enable VSMM argument verification, edit the gucVSMM_ARG_CHK_EN global variable to a
value of 1; to disable argument verification clear this variable to 0. Do not modify this global variable
at run time since a mutex is not assigned to it. You may also add your own critical methods within this
module or modify those that are here. Refer to Section 7, Building VSMM Examples 1–3, on page 26
for a source listing of VSMM_cfg.c.
#if
#endif
Freescale Semiconductor, Inc.
For More Information On This Product,
// allocate a spinlock for critical method & release same
bsp_spinlock_release((gpusiCMSpinLock = bsp_spinlock_alloc()));
((VSMM_CRITICAL_METHOD == 4) && (OSE_RTOS > 0))
Go to: www.freescale.com
Building Your Application with VSMM
15

Related parts for AN2345