Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 24 additions & 42 deletions soc/xtensa/intel_adsp/cavs_v20/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@ PROVIDE(_MemErrorHandler = 0x00000000);
* data (e.g. stacks) or shared data that is managed with explicit
* cache flush/invalidate operations.
*
* The UNCACHED_RAM_OFFSET will be used before to move the address
* pointer forward or backward so code and data land in correct
* region. Remember to align the memory, and be sure to also emit the
* These macros will set up a segment start address correctly,
* including alignment to a cache line. Be sure to also emit the
* section to ">ram :ram_phdr" or ">ucram :ucram_phdr" as
* appropriate. (Forgetting the correct PHDR will actually work, as
* the output tooling ignores it, but it will cause the linker to emit
* 512MB of unused data into the output file!)
*
* (Note clumsy syntax because XCC doesn't understand the "~" operator)
*/
#define UNCACHED_RAM_OFFSET 0x20000000
#define SEGSTART_CACHED (ALIGN(64) | 0x20000000)
#define SEGSTART_UNCACHED (ALIGN(64) & 0xdfffffff) /* == ~0x20000000 */

MEMORY
{
Expand Down Expand Up @@ -115,7 +116,7 @@ MEMORY
org = RAM_BASE,
len = RAM_SIZE
ucram :
org = RAM_BASE - UNCACHED_RAM_OFFSET,
org = RAM_BASE - 0x20000000,
len = RAM_SIZE
#ifdef CONFIG_GEN_ISR_TABLES
IDT_LIST :
Expand Down Expand Up @@ -420,20 +421,13 @@ SECTIONS
KEEP (*(.fw_ready_metadata))
} >ram :ram_phdr

/*
* Address pointer here is at cached ram.
* So need to go into uncached memory region, hence
* the subtraction.
*/
segstart_uncached_noinit = ALIGN(64) - UNCACHED_RAM_OFFSET;

.noinit segstart_uncached_noinit : ALIGN(64)
.noinit SEGSTART_UNCACHED : ALIGN(4)
{
*(.noinit)
*(.noinit.*)
} >ucram :ucram_phdr

.data : ALIGN(4)
.data SEGSTART_UNCACHED : ALIGN(4)
{
_data_start = ABSOLUTE(.);
*(.data)
Expand All @@ -454,52 +448,40 @@ SECTIONS
. = ALIGN(4096);
} >ucram :ucram_phdr

/* Going back into cached memory region. */
segstart_cached_lit4 = ALIGN(64) + UNCACHED_RAM_OFFSET;

.lit4 segstart_cached_lit4 : ALIGN(64)
.lit4 SEGSTART_CACHED : ALIGN(4)
{
_lit4_start = ABSOLUTE(.);
*(*.lit4)
*(.lit4.*)
*(.gnu.linkonce.lit4.*)
_lit4_end = ABSOLUTE(.);
} >ram :ram_phdr
.cached :
{
*(.cached .cached.*)
} >ram :ram_phdr

/* These values need to change in our scheme, where the common-ram
* sections need to be linked in safe/uncached memory but common-rom
* wants to use the cache
*/

. = SEGSTART_UNCACHED;

#undef RAMABLE_REGION
#undef ROMABLE_REGION
#define RAMABLE_REGION ucram :ucram_phdr
#define ROMABLE_REGION ucram :ucram_phdr
#include <linker/common-ram.ld>

/* Going back into cached memory region. */
segstart_cached_cached = ALIGN(64) + UNCACHED_RAM_OFFSET;

/* This section is cached. By default it contains only declared
* thread stacks, but applications can put symbols here too.
*/
.cached segstart_cached_cached :
{
*(.cached .cached.*)
} >ram :ram_phdr

/* Going back into un-cached memory region. */
segstart_uncached_tm_clone_table = ALIGN(64) - UNCACHED_RAM_OFFSET;

.tm_clone_table segstart_uncached_tm_clone_table :
.tm_clone_table :
{
*(.tm_clone_table)
} >ram :ram_phdr

. = ALIGN(4096);

.bss ALIGN(64) (NOLOAD) :
.bss (NOLOAD) : ALIGN(4096)
{
. = ALIGN(4096);
_bss_start = ABSOLUTE(.);
*(.dynsbss)
*(.sbss)
Expand All @@ -518,16 +500,15 @@ SECTIONS
_bss_end = ABSOLUTE(.);
} >ucram :ucram_phdr

_end = ALIGN(64);
. = SEGSTART_UNCACHED;
_end = ALIGN(8);
PROVIDE(end = ALIGN(8));

/* Re-adjust to the upper mapping for the final symbols below */
segstart_cached_stack = _end + UNCACHED_RAM_OFFSET;
. = segstart_cached_stack;
. = SEGSTART_CACHED;
__stack = L2_SRAM_BASE + L2_SRAM_SIZE;

segstart_uncached_lpbuf = ALIGN(4) - UNCACHED_RAM_OFFSET;
. = segstart_uncached_lpbuf;
. = SEGSTART_UNCACHED;

/* dma buffers */
.lpbuf (NOLOAD): ALIGN(4)
Expand All @@ -538,7 +519,8 @@ SECTIONS
} >LP_SRAM_REGION

. = L2_SRAM_BASE + L2_SRAM_SIZE;
_heap_sentry = . - UNCACHED_RAM_OFFSET;
. = SEGSTART_UNCACHED;
_heap_sentry = .;

.comment 0 : { *(.comment) }
.debug 0 : { *(.debug) }
Expand Down