-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhifive1-revb.lscript
76 lines (61 loc) · 1.37 KB
/
hifive1-revb.lscript
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/****************************************************************************
*
* Copyright (C) 2022 bsvtgc@gmail.com. All rights reserved.
* Author: Vincent <bsvtgc@gmail.com>
*
****************************************************************************/
/* Comments here */
OUTPUT_ARCH("riscv")
/* Entry point */
ENTRY(_start)
/* Memory Layout */
MEMORY
{
ram : ORIGIN = 0x80000000, LENGTH = 0x4000
}
/* SECTIONS Commmand
SECTIONS { ...
secname : {
contents
}
... }
In above, secname is the output section name, content is the
content that goes into the section. The output section
would be created only if there is any content.
SECTIONS
{
. = 0x10000;
.text : { *(.text) }
. = 0x8000000;
.data : { *(.data) }
.bss : { *(.bss) }
_etext = .;
}
You write the `SECTIONS' command as the keyword `SECTIONS',
followed by a series of symbol assignments and output section descriptions enclosed in curly braces.
The symbol `_etext' will be defined as the address following the last `.bss' input section
*/
SECTIONS
{
.mtvec_base : /* start address is 0x80000000 */
{
KEEP(*(.entry))
}
> ram
. = ALIGN(4);
.code :
{
*(.code*)
*(.text*)
}
> ram
. = ALIGN(4);
.data :
{
*(.data*)
}
> ram
. = ALIGN(4);
/* Set Stack after code & data */
_stack_start = .;
}