/* from https://github.com/ambiot/amb1_sdk/blob/master/project/realtek_amebaz_va0_example/GCC-RELEASE/export-rom_symbol_v01.txt */
INCLUDE "export-rom_symbol_v01.txt"

MEMORY
{
    RAM (rwx) : ORIGIN = (_RAM_START_ADDR - 64), LENGTH = (256K + 64)  /* + header */
}

SECTIONS
{
    _stack_top = ORIGIN(RAM) + LENGTH(RAM) - 0x4000;

    .rom_header : {
        LONG(0x96969999) LONG(0xFC66CC3F)
        LONG(0) 
        . += 28;
        LONG(_image_size)
        LONG(_RAM_START_ADDR)
        . += 16;
    }
    _rom_header_size = SIZEOF(.rom_header);

    .text : {
        . = ALIGN(4);
        . += 20; 
        LONG(_init + 1)
        LONG(0x88167923) /* ROM checks this @ 0x10002018 */
        . = ALIGN(8);
        *(.vectors)
        *(.text* .rodata* .data*)
    }

    .bss : {
        . = ALIGN(4);
        _bss_start = .;
        *(.bss* COMMON)
        _bss_end = .;
    } > RAM

    . = ALIGN(8);
    _end = .;
    _image_size = SIZEOF(.text);
}
