1//
2// This is the linker script example (SRV3-style).
3// (c) Synopsys, 2013
4//
5//
6
7//number of exceptions and interrupts
8NUMBER_OF_EXCEPTIONS = 16;//it is fixed (16)
9NUMBER_OF_INTERRUPTS = 5;//depends on HW configuration
10
11//define Interrupt Vector Table size
12IVT_SIZE_ITEMS = (NUMBER_OF_EXCEPTIONS + NUMBER_OF_INTERRUPTS);//the total IVT size (in "items")
13IVT_SIZE_BYTES = IVT_SIZE_ITEMS * 4;//in bytes
14
15//define ICCM and DCCM locations
16MEMORY {
17    ICCM:      ORIGIN = 0x00000000, LENGTH = 128K
18    DCCM:      ORIGIN = 0x80000000, LENGTH = 128K
19}
20
21//define sections and groups
22SECTIONS {
23    GROUP: {
24        .ivt  (TEXT) :  # Interrupt table
25        {
26            ___ivt1 = .;
27            * (.ivt)
28            ___ivt2 = .;
29            // Make the IVT at least IVT_SIZE_BYTES
30            . += (___ivt2 - ___ivt1 < IVT_SIZE_BYTES) ? (IVT_SIZE_BYTES - (___ivt2 - ___ivt1)) : 0;
31        }
32        .ivh  (TEXT) :  // Interrupt handlers
33
34        //TEXT sections
35        .text? : { *('.text$crt*') }
36        * (TEXT): {}
37        //Literals
38        * (LIT): {}
39    } > ICCM
40
41    GROUP: {
42        //data sections
43        .sdata?: {}
44        .sbss?: {}
45        *(DATA): {}
46        *(BSS): {}
47        //stack
48        .stack_top: {}
49        .stack ALIGN(4) SIZE(DEFINED _STACKSIZE?_STACKSIZE:4096): {}
50        .stack_base: {}
51        //heap (empty)
52        .heap? ALIGN(4) SIZE(DEFINED _HEAPSIZE?_HEAPSIZE:0): {}
53        .free_memory: {}
54        } > DCCM
55     }
56