summaryrefslogtreecommitdiffstats
path: root/rbutil/mks5lboot/dualboot/dualboot.lds
blob: cb92e2a28664e2d72fec8b5cd391a281f785d9d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#define ASM
#include "config.h"
#include "cpu.h"
#include "mks5lboot.h"

ENTRY(_start)
OUTPUT_FORMAT(elf32-littlearm)
OUTPUT_ARCH(arm)

#define BIN_ORIG    DFU_LOADADDR + BIN_OFFSET
#define BIN_SIZE    MAX_PAYLOAD

MEMORY
{
    IRAM : ORIGIN = BIN_ORIG, LENGTH = BIN_SIZE
}

SECTIONS
{
    .text : {
        *(.init.text*)
        *(.text*)
        *(.icode*)
        . = ALIGN(4);
    } > IRAM

    /* include initialized BSS (if any) into DFU image */
    .bss : {
        *(.bss*)
        *(.ibss*)
        *(COMMON)
        . = ALIGN(4);
    } > IRAM

#if 1
    /* reuse pwnage as stack, 0x30c bytes available */
    _exception_stack = BIN_ORIG;
    _supervisor_stack = _exception_stack;
#else
    /* include stack into DFU image */
    .stack : {
       . += 0x400;
       _supervisor_stack = .;
       . += 0x200;
       _exception_stack = .;
    } > IRAM
#endif

    .data : {
        *(.data*)
        *(.rodata*)
        *(.idata*)
        *(.irodata*)
        /* place bootloader IM3 header at the end, mkdfu
           will concatenate the bootloader binary here */
        . = ALIGN(16);
        *(.im3info.data*)
    } > IRAM
}