MEMORY
{
  FLASH (rx): ORIGIN = 0x08000000, LENGTH = 512K
  SRAM (rwx): ORIGIN = 0x20000000, LENGTH = 96K
}

SECTIONS
{
  .isr_vector :
  {
    KEEP(*(.isr_vector))
  } >FLASH

  .text :
  {
    . = ALIGN(4);

    *(.text)
    *(.rodata)

    . = ALIGN(4);
    _etext = .;
  } >FLASH

  .preinit_array     :
  {
      PROVIDE_HIDDEN (__preinit_array_start = .);
      KEEP (*(.preinit_array*))
      PROVIDE_HIDDEN (__preinit_array_end = .);
  } >FLASH
  .init_array :
  {
      PROVIDE_HIDDEN (__init_array_start = .);
      KEEP (*(SORT(.init_array.*)))
      KEEP (*(.init_array*))
      PROVIDE_HIDDEN (__init_array_end = .);
  } >FLASH
  .fini_array :
  {
      PROVIDE_HIDDEN (__fini_array_start = .);
      KEEP (*(SORT(.fini_array.*)))
      KEEP (*(.fini_array*))
      PROVIDE_HIDDEN (__fini_array_end = .);
  } >FLASH

  .data :
  {
    . = ALIGN(4);
    _sdata = .;

    *(.data)

    . = ALIGN(4);
    _edata = .;
  } >SRAM AT> FLASH

  _data_size = _edata - _sdata;
  _data_loadaddr = LOADADDR(.data);

  .bss :
  {
    . = ALIGN(4);
    _sbss = .;
    __bss_start__ = _sbss;

    *(.bss)

    . = ALIGN(4);
    _ebss = .;
    __bss_end__ = _ebss;
  } >SRAM

  _bss_size = _ebss - _sbss;
}

ENTRY(reset_handler)
