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

     1  /* Linker script for the ESP8266 */
     2  
     3  MEMORY
     4  {
     5      /* Data RAM. Allows byte access. */
     6      DRAM  (rw) : ORIGIN = 0x3FFE8000, LENGTH = 80K
     7      /* Instruction RAM. */
     8      IRAM  (x)  : ORIGIN = 0x40100000, LENGTH = 32K
     9  }
    10  
    11  /* The entry point. It is set in the image flashed to the chip, so must be
    12   * defined.
    13   */
    14  ENTRY(main)
    15  
    16  SECTIONS
    17  {
    18      /* Mutable global variables.
    19       */
    20      .data : ALIGN(4)
    21      {
    22          _sdata = ABSOLUTE(.);
    23          *(.data)
    24          *(.data.*)
    25      } >DRAM
    26  
    27      /* Constant global variables.
    28       * Note that they still need to be loaded in RAM because the ESP8266 doesn't
    29       * allow byte access to flash.
    30       */
    31      .rodata : ALIGN(4)
    32      {
    33          *(.rodata)
    34          *(.rodata.*)
    35      } >DRAM
    36  
    37      /* Global variables that are mutable and zero-initialized.
    38       */
    39      .bss (NOLOAD) : ALIGN(4)
    40      {
    41          . = ALIGN (4);
    42          _sbss = ABSOLUTE(.);
    43          *(.bss)
    44          *(.bss.*)
    45          . = ALIGN (4);
    46          _ebss = ABSOLUTE(.);
    47      } >DRAM
    48  
    49      /* Constant literals and code. Loaded into IRAM for now. Eventually, most
    50       * code should be executed directly from flash.
    51       * Note that literals must be before code for the l32r instruction to work.
    52       */
    53      .text : ALIGN(4)
    54      {
    55          *(.literal .text)
    56          *(.literal.* .text.*)
    57      } >IRAM
    58  }
    59  
    60  _globals_start = _sdata;
    61  _globals_end = _ebss;
    62  _heap_start = _ebss;
    63  _heap_end = ORIGIN(DRAM) + LENGTH(DRAM);
    64  
    65  /* It appears that the stack is set to 0x3ffffff0 when main is called.
    66   * Be conservative and scan all the way up to the end of the RAM.
    67   */
    68  _stack_top = 0x40000000;
    69  
    70  /* Functions normally provided by a libc.
    71   * Source:
    72   * https://github.com/espressif/ESP8266_NONOS_SDK/blob/master/ld/eagle.rom.addr.v6.ld
    73   */
    74  memcpy  = 0x4000df48;
    75  memmove = 0x4000e04c;
    76  memset  = 0x4000e190;
    77  
    78  /* Compiler runtime functions provided by the ROM.
    79   * Source:
    80   * https://github.com/espressif/ESP8266_NONOS_SDK/blob/master/ld/eagle.rom.addr.v6.ld
    81   */
    82  __adddf3      = 0x4000c538;
    83  __addsf3      = 0x4000c180;
    84  __divdf3      = 0x4000cb94;
    85  __divdi3      = 0x4000ce60;
    86  __divsi3      = 0x4000dc88;
    87  __extendsfdf2 = 0x4000cdfc;
    88  __fixdfsi     = 0x4000ccb8;
    89  __fixunsdfsi  = 0x4000cd00;
    90  __fixunssfsi  = 0x4000c4c4;
    91  __floatsidf   = 0x4000e2f0;
    92  __floatsisf   = 0x4000e2ac;
    93  __floatunsidf = 0x4000e2e8;
    94  __floatunsisf = 0x4000e2a4;
    95  __muldf3      = 0x4000c8f0;
    96  __muldi3      = 0x40000650;
    97  __mulsf3      = 0x4000c3dc;
    98  __subdf3      = 0x4000c688;
    99  __subsf3      = 0x4000c268;
   100  __truncdfsf2  = 0x4000cd5c;
   101  __udivdi3     = 0x4000d310;
   102  __udivsi3     = 0x4000e21c;
   103  __umoddi3     = 0x4000d770;
   104  __umodsi3     = 0x4000e268;
   105  __umulsidi3   = 0x4000dcf0;
   106  
   107  /* Proprietary ROM function needed for proper clock configuration.
   108   */
   109  rom_i2c_writeReg = 0x400072d8;