Skip to content
This repository was archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Use region aliases in the linker script
Browse files Browse the repository at this point in the history
  • Loading branch information
Disasm committed Apr 1, 2019
1 parent d7743c8 commit e233d73
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions link.x
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/* NOTE: Adapted from cortex-m/link.x */
INCLUDE memory.x

PROVIDE(_stack_start = ORIGIN(RAM) + LENGTH(RAM));
PROVIDE(_stack_start = ORIGIN(REGION_STACK) + LENGTH(REGION_STACK));

PROVIDE(trap_handler = default_trap_handler);

Expand All @@ -12,19 +9,19 @@ PROVIDE(__pre_init = default_pre_init);

PHDRS
{
flash PT_LOAD;
ram_init PT_LOAD;
ram PT_NULL;
load PT_LOAD;
ram_load PT_LOAD;
virtual PT_NULL;
}

SECTIONS
{
PROVIDE(_stext = ORIGIN(FLASH));
PROVIDE(_stext = ORIGIN(REGION_TEXT));

.text.dummy ORIGIN(FLASH) :
.text.dummy ORIGIN(REGION_TEXT) :
{
/* This section is intended to make _stext address work */
} > FLASH :ram
} > REGION_TEXT :virtual

.text ALIGN(_stext,4) :
{
Expand All @@ -37,12 +34,12 @@ SECTIONS
KEEP(*(.trap.rust));

*(.text .text.*);
} > FLASH :flash
} > REGION_TEXT :load

.rodata ALIGN(4) :
{
*(.rodata .rodata.*);
} > FLASH :flash
} > REGION_RODATA :load

.data ALIGN(4) :
{
Expand All @@ -53,15 +50,15 @@ SECTIONS
*(.data .data.*);
. = ALIGN(4);
_edata = .;
} > RAM AT > FLASH :ram_init
} > REGION_DATA AT > REGION_RODATA :ram_load

.bss :
{
_sbss = .;
*(.bss .bss.*);
. = ALIGN(4);
_ebss = .;
} > RAM :ram
} > REGION_BSS :virtual

PROVIDE(_heap_size = 0);

Expand All @@ -72,15 +69,15 @@ SECTIONS
. += _heap_size;
. = ALIGN(4);
_eheap = .;
} > RAM :ram
} > REGION_HEAP :virtual

/* fictitious region that represents the memory available for the stack */
.stack (INFO) :
{
_estack = .;
. = _stack_start;
_sstack = .;
} > RAM :ram
} > REGION_STACK :virtual

/* fake output .got section */
/* Dynamic relocations are unsupported. This section is only used to detect
Expand Down

0 comments on commit e233d73

Please sign in to comment.