> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs-staging.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ADSP Memory Management for Custom Voice Wake-Up Engines and Concurrent VAs

> Configure and validate ADSP island TCM memory when Qualcomm SVA and a custom voice activation engine run in the same ADSP image.

## Overview

This application note describes how to configure and validate ADSP island TCM memory when Qualcomm SVA (Sound Trigger Engine) and a custom voice activation or hotword engine are integrated in the same ADSP image. It addresses two related failure modes:

* Build-time out-of-memory (OOM) failures while creating the ADSP image.
* Runtime TCM allocation failures or ADSP panics when SVA and the custom engine are active concurrently.

The recommendations focus on island placement, shared-pool sizing, configuration review, and end-to-end validation. The example sizes in this note are configuration-specific and must not be treated as universal defaults.

## Scope

This note is intended for engineers who integrate, configure, build, and validate concurrent voice wake-up engines on all Qualcomm ADSP-based platforms. Readers should be familiar with ADSP image generation, island-memory placement, `pp_libs_cfg.json`, `cust_config.xml`, and ADSP runtime-log analysis.

## ADSP island TCM memory architecture

The relevant island TCM is partitioned into two logical pools. Both pools use the same fixed physical island TCM budget; therefore, increasing one pool requires reducing the other.

<Frame>
  <img src="https://mintcdn.com/qualcomm-staging/IpOQZ3a456y-ntjm/Addendum-docs/Audio/media/ADSP_island_TCM_memory_architecture.png?fit=max&auto=format&n=IpOQZ3a456y-ntjm&q=85&s=56226462bfa6b296fbf2bd6bb2d62659" width="1009" height="393" data-path="Addendum-docs/Audio/media/ADSP_island_TCM_memory_architecture.png" />
</Frame>

Hierarchy of ADSP Island TCM, which branches into QURTOS\_VA\_ISLAND\_POOL and TCM\_PHYSPOOL, leading to the SVA/Sound Trigger Engine and the Custom VA Engine respectively, for concurrent voice-engine operation.

| Memory pool             | Purpose                                                            | Example size       |
| ----------------------- | ------------------------------------------------------------------ | ------------------ |
| `QURTOS_VA_ISLAND_POOL` | Voice Activation island heap used by the Sound Trigger Engine.     | 512 KB (`0x80000`) |
| `TCM_PHYSPOOL`          | Tightly Coupled Memory pool used by the custom hotword DSP module. | 256 KB (`0x40000`) |

<Note>
  The total island TCM available is fixed by the hardware and software configuration. Evaluate pool sizes, module placement, and model footprints together.
</Note>

## Build-time OOM during custom VA integration

### Symptom

Adding the custom voice activation module can fail during ADSP image creation with an error similar to:

```text theme={null}
Exception: !!!OOM!!!, Unable to fit 0x34 in QURTOS_VA_ISLAND_POOL
```

In the documented configuration, only approximately 16 KB remained in `QURTOS_VA_ISLAND_POOL`, while the custom engine required approximately 37,000 bytes for the small model and 46,080 bytes for the large model.

### Root cause

Modules that were not required by the target configuration were still placed in island memory. Their reserved space reduced the headroom available for the custom hotword module.

### Resolution

Review `pp_libs_cfg.json` and set `island: False` for unused modules. The documented example includes:

* `voice_wakeup_v2_module`, when Qualcomm voice activation is not used in that configuration.
* `stage1_pdk_module`, when it is not required by the target configuration.

After removing unnecessary island placement, the documented configuration increased available VA island space from approximately 16 KB to 28 KB. Move additional unused modules out of island memory if you need more headroom.

Example concept in `pp_libs_cfg.json`:

```json theme={null}
"<unused_module>": { "island": false }
```

<Warning>
  Do not move a module out of island memory solely to follow this example. Confirm that the module is unused, or that its non-island placement is supported by the target configuration.
</Warning>

## Runtime failure with concurrent voice activations

### Symptom

When SVA is enabled first and the custom keyword engine is enabled afterward, the ADSP may report a TCM allocation failure such as:

```text theme={null}
ADSP: posal_tcm_island_heap_mgr_malloc: failure occurred - no TCM memory of size 46095 bytes available
```

### Root cause

The documented configuration used `TCM_PHYSPOOL = 0x40000` (256 KB). This was insufficient for the custom engine's approximately 46 KB runtime allocation after SVA had already consumed part of the shared island TCM budget. The issue appears only in the concurrent-use case, because the combined peak demand exceeds the available partition.

### Example pool rebalancing

| Pool                    | Original           | Example fixed size | Change |
| ----------------------- | ------------------ | ------------------ | ------ |
| `QURTOS_VA_ISLAND_POOL` | `0x80000` (512 KB) | `0x70000` (448 KB) | -64 KB |
| `TCM_PHYSPOOL`          | `0x40000` (256 KB) | `0x50000` (320 KB) | +64 KB |

The 64 KB transfer is an example validated for the documented configuration. Reevaluate it if the platform, ADSP image, SVA configuration, custom engine, model, or module placement changes.

Reducing `QURTOS_VA_ISLAND_POOL` provides additional memory for `TCM_PHYSPOOL`, but reduces the memory available to SVA and other VA-island users. If the remaining pool is insufficient, or lacks a suitably sized aligned free block, SVA initialization, runtime allocation, dynamic mapping, or concurrent voice operation may fail.

This change is configuration-specific. Validate it through build checks, pool-usage analysis, and SVA/custom VA concurrent testing before production use.

## Memory sizing method

Use the following procedure before finalizing pool sizes:

1. Measure the island and TCM footprint of each voice wake-up engine, including the small and large custom models.
2. Identify the worst-case simultaneous activation scenario.
3. Account for fixed platform reservations and any modules placed in island memory.
4. Allocate `QURTOS_VA_ISLAND_POOL` and `TCM_PHYSPOOL` so the combined peak demand fits within the fixed physical island TCM budget.
5. Retain practical headroom for allocator overhead and configuration growth.

At minimum, the sizing decision should cover SVA-only, custom-engine-only, and SVA-plus-custom-engine operation.

## Configuration files

| File               | Purpose                                                                                                                        |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
| `pp_libs_cfg.json` | Controls island placement of ADSP modules. Use `island: False` for modules confirmed to be unused in the target configuration. |
| `cust_config.xml`  | Contains customer-specific ADSP configuration, including the pool settings or related platform customization as applicable.    |

Record the exact branch, platform, configuration revision, and model revision used when validating a pool-size change.

## Validation

| Step | Validation action                                                                                             |
| ---- | ------------------------------------------------------------------------------------------------------------- |
| 1    | Audit `pp_libs_cfg.json` and identify modules that are not used by the target configuration.                  |
| 2    | Confirm island placement for each required module and move only approved unused modules out of island memory. |
| 3    | Measure small- and large-model memory footprints for every voice wake-up engine.                              |
| 4    | Calculate peak demand for the worst-case concurrent scenario.                                                 |
| 5    | Size `QURTOS_VA_ISLAND_POOL` and `TCM_PHYSPOOL` to meet that demand within the fixed island TCM budget.       |
| 6    | Build the ADSP image and confirm that no OOM error occurs.                                                    |
| 7    | Run SVA-only, custom-engine-only, and concurrent SVA-plus-custom-engine tests.                                |
| 8    | Repeat validation with the largest supported model and monitor runtime logs for TCM allocation failures.      |

## Summary

| Issue                                     | Typical cause                                                                     | Recommended action                                                                  |
| ----------------------------------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| Build-time OOM in `QURTOS_VA_ISLAND_POOL` | Unused modules consuming island memory.                                           | Audit `pp_libs_cfg.json` and set `island: False` only for unused, approved modules. |
| Runtime TCM allocation failure            | `TCM_PHYSPOOL` is too small for the custom engine during concurrent operation.    | Rebalance the shared island TCM pools based on measured peak demand.                |
| Configuration regression after changes    | Pool or module placement values copied across incompatible platforms or releases. | Revalidate against the target platform, branch, image, and model revisions.         |

Size the shared island TCM partition for the worst-case concurrent voice wake-up workload, remove unnecessary island placement, and complete build plus runtime validation before production deployment.
