EasyManuals Logo

Texas Instruments CC2540DK-MINI Software Developers Guide

Texas Instruments CC2540DK-MINI
162 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #18 background image
Heap Manager
www.ti.com
18
SWRU271H–October 2010–Revised April 2019
Submit Documentation Feedback
Copyright © 2010–2019, Texas Instruments Incorporated
The Operating System Abstraction Layer (OSAL)
In the SimpleBLEPeripheral application, the event processing function is called
SimpleBLEPeripheral_ProcessEvent() to handle all active events associated with the task. After
processing, the events must be cleared to prevent duplicate processing of the same event. The
SimpleBLEPeripheral_ProcessEvent() application function shows that after the START_DEVICE_EVT
event occurs it returns the 16-bit events variable with the SBP_START_DEVICE_EVT flag cleared.
Any layer of the software can set an OSAL event for any layer. Use the osal_set_event() function
(prototype in OSAL.h) to immediately schedule a new OSAL event. With this function, you specify the task
ID (of the task that will process the event) and the event flag as parameters.
An alternate method to set an OSAL event for any layer is to use the osal_start_timerEx() function
(prototype in OSAL_Timers.h). This function operates similarly to the osal_set_event() function. You select
the task ID of the task that will process the event and the event flag as parameters. The
osal_start_timerEx() function has a third parameter that you must use to input a time-out value in
milliseconds. This timeout parameter causes the OSAL to set a timer and set the specified event when the
timer expires.
3.4 Heap Manager
Th eOSAL provides basic memory management functions. The osal_mem_alloc() function can allocate
memory similarly to the standard C malloc function. The OSAL function takes a single parameter
specifying the number of bytes to allocate and returns a void pointer if successful. If memory is
unavailable, a NULL pointer is returned.
The osal_mem_free() function frees memory allocated using osal_mem_alloc() similarly to the standard C
free function.
The INT_HEAP_LEN preprocessor symbol reserves memory for dynamic allocation.
To profile dynamic memory usage, do the following:
1. Set the preprocessor symbol as OSALMEM_METRICS=TRUE in the project options.
2. Exercise the system in stress conditions that replicate the worst-case expected system load. (This may
involve having the maximum connected clients with maximum throughput while the application is
operating at maximum capacity.)
3. If configured, enable Pairing/Bonding.
4. Perform the test with encryption enabled.
5. Review the value of the variable memMax in OSAL_Memory.c to see the maximum amount of memory
allocated.
6. Use this value as a guideline for lowering INT_HEAP_LEN.
Because the Bluetooth Low Energy stack also uses the heap, you must test it with both components in the
maximum-expected operating conditions.

Table of Contents

Other manuals for Texas Instruments CC2540DK-MINI

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments CC2540DK-MINI and is the answer not in the manual?

Texas Instruments CC2540DK-MINI Specifications

General IconGeneral
BrandTexas Instruments
ModelCC2540DK-MINI
CategoryMicrocontrollers
LanguageEnglish

Related product manuals