Article Map specific source file to L2 Memory in SC83x

Question:
How can a bundle of specifically named source files be mapped to a designated section in L2 memory, and how can this be modified in a *.ld linker script?
Answer: 
Mapping a group of source files requires directing the corresponding object files (*.o) into the L2_SRAM region.
This can be achieved by adding a custom section definition in the ADSP-SC83x-2MB.ld linker script, as shown below:
.a2bstack_text :
  {
    KEEP(*a2bstack*.o(.text .text.*))
  } > L2_SRAM
Here is the explanation on how it works:
KEEP() → Ensures the linker doesn’t discard those sections during garbage collection.
*a2bstack*.o → Matches all object files with names containing a2bstack.
(.text .text.*) → Collects both the base .text and any sub‑sections (like .text.startup) and map into it.
L2_SRAM → Places the collected code into the L2_SRAM memory region defined in your MEMORY block.
Note: It is recommended to place this custom section definition at the beginning of the SECTIONS { … } block, because the linker assigns input sections to the first matching output section.
We can verify the mappings using the generated *.map file.
Herewith, we have attached the project and mappings screenshot for reference.

Before You Switch


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