github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/targets/gameboy-advance.ld (about)

     1  OUTPUT_ARCH(arm)
     2  ENTRY(_start)
     3  
     4  /* Note: iwram is reduced by 96 bytes because the last part of that RAM
     5   * (starting at 0x03007FA0) is used for interrupt handling.
     6   */
     7  MEMORY {
     8      ewram   : ORIGIN = 0x02000000, LENGTH = 256K   /* on-board work RAM (2 wait states) */
     9      iwram   : ORIGIN = 0x03000000, LENGTH = 32K-96 /* in-chip work RAM (faster) */
    10      rom     : ORIGIN = 0x08000000, LENGTH = 32M    /* flash ROM */
    11  }
    12  
    13  __stack_size_irq = 1K;
    14  __stack_size_usr = 2K;
    15  
    16  SECTIONS
    17  {
    18      .text :
    19      {
    20          KEEP (*(.init))
    21          *(.text)
    22          *(.text.*)
    23          . = ALIGN(4);
    24      } >rom
    25  
    26      .rodata :
    27      {
    28          . = ALIGN(4);
    29          *(.rodata)
    30          *(.rodata.*)
    31          . = ALIGN(4);
    32      } >rom
    33  
    34      /* Put the stack at the bottom of RAM, so that the application will
    35       * crash on stack overflow instead of silently corrupting memory.
    36       * See: http://blog.japaric.io/stack-overflow-protection/ */
    37      .stack (NOLOAD) :
    38      {
    39          . = ALIGN(4);
    40          _stack_top_irq = .;
    41          . += __stack_size_irq;
    42          _stack_top = .;
    43          . += __stack_size_usr;
    44      } >iwram
    45  
    46      /* Start address (in flash) of .data, used by startup code. */
    47      _sidata = LOADADDR(.data);
    48  
    49      /* Globals with initial value */
    50      .data :
    51      {
    52          . = ALIGN(4);
    53          _sdata = .;        /* used by startup code */
    54          *(.data)
    55          *(.data.*)
    56          *(.iwram .iwram.*)
    57          . = ALIGN(4);
    58          _edata = .;        /* used by startup code */
    59      } >iwram AT>rom
    60  
    61      /* Zero-initialized globals  */
    62      .bss :
    63      {
    64          . = ALIGN(4);
    65          _sbss = .;         /* used by startup code */
    66          *(.bss)
    67          *(.bss.*)
    68          *(COMMON)
    69          . = ALIGN(4);
    70          _ebss = .;         /* used by startup code */
    71      } >iwram
    72  
    73      /DISCARD/ :
    74      {
    75          *(.ARM.exidx)      /* causes 'no memory region specified' error in lld */
    76          *(.ARM.exidx.*)    /* causes spurious 'undefined reference' errors */
    77      }
    78  }
    79  
    80  /* For the memory allocator. */
    81  _heap_start = ORIGIN(ewram);
    82  _heap_end = ORIGIN(ewram) + LENGTH(ewram);
    83  _globals_start = _sdata;
    84  _globals_end = _ebss;