Post Go back to editing

Buffers and memory allocation on sam board

Category: Software
Product Number: ADZS-SC589-MINI
Software Version: 3.0.2

Hello,

I have a few questions regarding memory allocation and buffers. Bear in mind I'm new to this processor and to DSP development in general. It is my understanding that if I want to access the external DDR ram on the sam board, then should use the #pragma directive. For example if I want to store a digital delay buffer in ddr ram I would write:

#pragma section("seg_sdram")
float digital_delay_buffer[DIGITAL_DELAY_BUF_SIZE];
#pragma section()
Questions:
- If I want to store in L1 or L2, what is the directive for those? Is there a file... maybe the .ldf where I can find this information? Where can I find the .ldf file and any relevant file I need.
- If I set the buffer size for a delay for example to 2^18 (is it recommended to have buffers of base-2 size?), Max delay time = BUF_SIZE / Sampling rate(48k) = 5.46 seconds, memory usage = 2^18 * 4(because float is 4 bytes per) = 1,048,576 bytes ~1MB. Because of all the space this takes up, it is recommended to use the external ram to store it. But if I have other effects in series with this that don't require a large buffer, should I be using a separate buffer? If so, how can I cascade the audio signal so that it is processed by each effect it goes through.
- Is there any documentation regarding memory allocation on the SHARC processors or even for the sam board specifically?
Parents
  • =

    Hi TeylorW,

    Thanks for reaching out! Please find my responses to your questions below:

    1. Yes, you can use the #pragma section directive to place variables in specific memory regions, such as external DDR RAM, as you have shown. Similarly, you can use the same directive to store data in L1 or L2 memory by specifying the appropriate section names, such as "seg_l1_block0". These section names are defined in the linker description file (.ldf), which controls how memory is allocated in the project. You can refer to the default .ldf for the processor, which can be found in the SHARC/ldf directory of the CCES install.

    2. Since your uses ~1MB, storing it in external SDRAM is recommended. For smaller effects in series, you should use separate, smaller buffers — ideally in L1 or L2 memory. To cascade effects, simply pass the output of one effect as the input to the next in your processing loop.

    3. To verify memory placement, you can generate a map file for your project by going to: Project Properties > C/C++ Build > Settings > CrossCore Baremetal C++ Linker > General and then enabling the "Generate symbol map" option.  This will produce a detailed memory map showing how your variables are allocated across L1, L2, and external memory. For more detailed information, the Linker and Utilities Manual (cces-LinkerUtilities-manual.pdf) from Analog Devices is a great resource on memory sections and the use of #pragma.

    Best, 

    Aradhita

  • I am sharing a document that provides additional details regarding the LDF modification for your reference. Hope it helps with your query.

    PDF

Reply Children
No Data

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.