Skip to content

Commit b9b3925

Browse files
author
Martin Klang
committed
added PLATFORM=OWL1/2/3 makefile option with alternative link files
1 parent 267b96e commit b9b3925

4 files changed

Lines changed: 504 additions & 7 deletions

File tree

Source/owl1.ld

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
/* Entry Point */
2+
ENTRY(Reset_Handler)
3+
4+
/* Generate a link error if heap and stack don't fit into RAM */
5+
_Min_Heap_Size = 0x000; /* required amount of heap */
6+
_Min_Stack_Size = 0x800; /* required amount of stack */
7+
8+
/* Specify the memory areas */
9+
MEMORY
10+
{
11+
CCMHEAP (rw) : ORIGIN = 0x10004000, LENGTH = 32K
12+
PATCHRAM (rwx) : ORIGIN = 0x2000c000, LENGTH = 64K /* total RAM is 112kb */
13+
EXTRAM (rx) : ORIGIN = 0x68000000, LENGTH = 1M
14+
}
15+
16+
/* Define output sections */
17+
SECTIONS
18+
{
19+
/* The startup code goes first into FLASH */
20+
.program_header :
21+
{
22+
. = ALIGN(8);
23+
_startprog = ABSOLUTE(.); /* define a global symbol at program start */
24+
KEEP(*(.program_header)) /* Startup code */
25+
. = ALIGN(8);
26+
} >PATCHRAM /* AT>PATCHFLASH */
27+
28+
/* The program code and other data goes into FLASH */
29+
.text :
30+
{
31+
. = ALIGN(8);
32+
_text_start = .;
33+
*(.text.Reset_Handler)
34+
*(.text.startup)
35+
*(.main*)
36+
*(.text) /* .text sections (code) */
37+
*(.text*) /* .text* sections (code) */
38+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
39+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
40+
*(.glue_7) /* glue arm to thumb code */
41+
*(.glue_7t) /* glue thumb to arm code */
42+
*(.eh_frame)
43+
. = ALIGN(8);
44+
/* These are for static constructors and destructors under ELF */
45+
KEEP (*crtbegin.o(.ctors))
46+
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
47+
KEEP (*(SORT(.ctors.*)))
48+
KEEP (*crtend.o(.ctors))
49+
KEEP (*crtbegin.o(.dtors))
50+
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
51+
KEEP (*(SORT(.dtors.*)))
52+
KEEP (*crtend.o(.dtors))
53+
KEEP (*(.init))
54+
KEEP (*(.fini))
55+
. = ALIGN(8);
56+
_etext = .; /* define a global symbol at end of code */
57+
_text_end = .;
58+
} >PATCHRAM /* AT>PATCHFLASH */
59+
60+
_text_load = LOADADDR (.text);
61+
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >PATCHRAM /* AT>PATCHFLASH */
62+
.ARM : {
63+
__exidx_start = .;
64+
*(.ARM.exidx*)
65+
__exidx_end = .;
66+
} >PATCHRAM /* AT>PATCHFLASH */
67+
68+
.preinit_array :
69+
{
70+
PROVIDE_HIDDEN (__preinit_array_start = .);
71+
KEEP (*(.preinit_array*))
72+
PROVIDE_HIDDEN (__preinit_array_end = .);
73+
} >PATCHRAM /* AT>PATCHFLASH */
74+
.init_array :
75+
{
76+
PROVIDE_HIDDEN (__init_array_start = .);
77+
KEEP (*(SORT(.init_array.*)))
78+
KEEP (*(.init_array*))
79+
PROVIDE_HIDDEN (__init_array_end = .);
80+
} >PATCHRAM /* AT>PATCHFLASH */
81+
.fini_array :
82+
{
83+
PROVIDE_HIDDEN (__fini_array_start = .);
84+
KEEP (*(.fini_array*))
85+
KEEP (*(SORT(.fini_array.*)))
86+
PROVIDE_HIDDEN (__fini_array_end = .);
87+
} >PATCHRAM /* AT>PATCHFLASH */
88+
89+
/* used by the startup to initialize data */
90+
_sidata = .;
91+
92+
/* Initialized data sections goes into RAM, load LMA copy after code */
93+
.data : AT ( _sidata )
94+
{
95+
. = ALIGN(8);
96+
_sdata = .; /* create a global symbol at data start */
97+
*(.data) /* .data sections */
98+
*(.data*) /* .data* sections */
99+
. = ALIGN(8);
100+
_edata = .; /* define a global symbol at data end */
101+
} >PATCHRAM
102+
103+
/* Uninitialized data section */
104+
. = ALIGN(8);
105+
.bss :
106+
{
107+
_endprog = ABSOLUTE(.); /* define a global symbol at program end */
108+
/* This is used by the startup in order to initialize the .bss secion */
109+
_sbss = .; /* define a global symbol at bss start */
110+
__bss_start__ = _sbss;
111+
*(.bss)
112+
*(.bss*)
113+
*(COMMON)
114+
. = ALIGN(8);
115+
_ebss = .; /* define a global symbol at bss end */
116+
__bss_end__ = _ebss;
117+
} >PATCHRAM
118+
119+
.pv (NOLOAD) :
120+
{
121+
. = ALIGN(8);
122+
_programvector = ABSOLUTE(.);
123+
*(.pv)
124+
. = ALIGN(8);
125+
PROVIDE ( _eprogram = . );
126+
PROVIDE ( _stack = . );
127+
} >PATCHRAM
128+
_eram = ORIGIN(PATCHRAM) + 80k; /* Limit to 80k for OwlWare compatiblity */
129+
_estack = ORIGIN(PATCHRAM) + 80k;
130+
131+
.fastheap (NOLOAD) :
132+
{
133+
. = ALIGN(8);
134+
PROVIDE ( _fastheap = . );
135+
. = ALIGN(8);
136+
} >CCMHEAP
137+
_fasteheap = ORIGIN(CCMHEAP) + LENGTH(CCMHEAP);
138+
139+
/* External SRAM, used for heap memory */
140+
.extdata (NOLOAD) :
141+
{
142+
. = ALIGN(8);
143+
*(.extdata)
144+
. = ALIGN(8);
145+
PROVIDE ( _heap = . );
146+
. = . + _Min_Heap_Size;
147+
} >EXTRAM
148+
_eheap = ORIGIN(EXTRAM) + LENGTH(EXTRAM);
149+
150+
151+
/* Remove information from the standard libraries */
152+
/DISCARD/ :
153+
{
154+
libc.a ( * )
155+
libm.a ( * )
156+
libgcc.a ( * )
157+
}
158+
159+
.ARM.attributes 0 : { *(.ARM.attributes) }
160+
}

Source/owl2.ld

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
/* Entry Point */
2+
ENTRY(Reset_Handler)
3+
4+
/* Generate a link error if heap and stack don't fit into RAM */
5+
_Min_Heap_Size = 0x000; /* required amount of heap */
6+
7+
/* Specify the memory areas */
8+
MEMORY
9+
{
10+
CCMHEAP (rw) : ORIGIN = 0x10004000, LENGTH = 32K
11+
PATCHRAM (rwx) : ORIGIN = 0x2000c000, LENGTH = 144K /* total RAM is 192kb */
12+
EXTRAM (rx) : ORIGIN = 0x68000000, LENGTH = 8M
13+
}
14+
15+
/* Define output sections */
16+
SECTIONS
17+
{
18+
/* The startup code goes first into PATCHRAM */
19+
.program_header :
20+
{
21+
. = ALIGN(8);
22+
_startprog = ABSOLUTE(.); /* define a global symbol at program start */
23+
KEEP(*(.program_header)) /* Startup code */
24+
. = ALIGN(8);
25+
} >PATCHRAM /* AT>PATCHFLASH */
26+
27+
/* The program code and other data goes into PATCHRAM */
28+
.text :
29+
{
30+
. = ALIGN(8);
31+
_text_start = .;
32+
*(.text.Reset_Handler)
33+
*(.text.startup)
34+
*(.main*)
35+
*(.text) /* .text sections (code) */
36+
*(.text*) /* .text* sections (code) */
37+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
38+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
39+
*(.glue_7) /* glue arm to thumb code */
40+
*(.glue_7t) /* glue thumb to arm code */
41+
*(.eh_frame)
42+
. = ALIGN(8);
43+
/* These are for static constructors and destructors under ELF */
44+
KEEP (*crtbegin.o(.ctors))
45+
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
46+
KEEP (*(SORT(.ctors.*)))
47+
KEEP (*crtend.o(.ctors))
48+
KEEP (*crtbegin.o(.dtors))
49+
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
50+
KEEP (*(SORT(.dtors.*)))
51+
KEEP (*crtend.o(.dtors))
52+
KEEP (*(.init))
53+
KEEP (*(.fini))
54+
. = ALIGN(8);
55+
_etext = .; /* define a global symbol at end of code */
56+
_text_end = .;
57+
} >PATCHRAM
58+
59+
_text_load = LOADADDR (.text);
60+
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >PATCHRAM
61+
.ARM : {
62+
__exidx_start = .;
63+
*(.ARM.exidx*)
64+
__exidx_end = .;
65+
} >PATCHRAM
66+
67+
.preinit_array :
68+
{
69+
PROVIDE_HIDDEN (__preinit_array_start = .);
70+
KEEP (*(.preinit_array*))
71+
PROVIDE_HIDDEN (__preinit_array_end = .);
72+
} >PATCHRAM
73+
.init_array :
74+
{
75+
PROVIDE_HIDDEN (__init_array_start = .);
76+
KEEP (*(SORT(.init_array.*)))
77+
KEEP (*(.init_array*))
78+
PROVIDE_HIDDEN (__init_array_end = .);
79+
} >PATCHRAM
80+
.fini_array :
81+
{
82+
PROVIDE_HIDDEN (__fini_array_start = .);
83+
KEEP (*(.fini_array*))
84+
KEEP (*(SORT(.fini_array.*)))
85+
PROVIDE_HIDDEN (__fini_array_end = .);
86+
} >PATCHRAM
87+
88+
/* used by the startup to initialize data */
89+
_sidata = .;
90+
91+
/* Initialized data sections goes into RAM, load LMA copy after code */
92+
.data : AT ( _sidata )
93+
{
94+
. = ALIGN(8);
95+
_sdata = .; /* create a global symbol at data start */
96+
*(.data) /* .data sections */
97+
*(.data*) /* .data* sections */
98+
. = ALIGN(8);
99+
_edata = .; /* define a global symbol at data end */
100+
} >PATCHRAM
101+
102+
/* Uninitialized data section */
103+
. = ALIGN(8);
104+
.bss :
105+
{
106+
_endprog = ABSOLUTE(.); /* define a global symbol at program end */
107+
/* This is used by the startup in order to initialize the .bss secion */
108+
_sbss = .; /* define a global symbol at bss start */
109+
__bss_start__ = _sbss;
110+
*(.bss)
111+
*(.bss*)
112+
*(COMMON)
113+
. = ALIGN(8);
114+
_ebss = .; /* define a global symbol at bss end */
115+
__bss_end__ = _ebss;
116+
} >PATCHRAM
117+
118+
.pv (NOLOAD) :
119+
{
120+
. = ALIGN(8);
121+
_programvector = ABSOLUTE(.);
122+
*(.pv)
123+
. = ALIGN(8);
124+
PROVIDE ( _eprogram = . );
125+
PROVIDE ( _stack = . );
126+
} >PATCHRAM
127+
_eram = ORIGIN(PATCHRAM) + 80k; /* Limit to 80k for OwlWare compatiblity */
128+
_estack = ORIGIN(PATCHRAM) + 80k;
129+
130+
.fastheap (NOLOAD) :
131+
{
132+
. = ALIGN(8);
133+
PROVIDE ( _fastheap = . );
134+
. = ALIGN(8);
135+
} >CCMHEAP
136+
_fasteheap = ORIGIN(CCMHEAP) + LENGTH(CCMHEAP);
137+
138+
/* External SRAM, used for heap memory */
139+
.extdata (NOLOAD) :
140+
{
141+
. = ALIGN(8);
142+
*(.extdata)
143+
. = ALIGN(8);
144+
PROVIDE ( _heap = . );
145+
. = . + _Min_Heap_Size;
146+
} >EXTRAM
147+
_eheap = ORIGIN(EXTRAM) + LENGTH(EXTRAM);
148+
149+
150+
/* Remove information from the standard libraries */
151+
/DISCARD/ :
152+
{
153+
libc.a ( * )
154+
libm.a ( * )
155+
libgcc.a ( * )
156+
}
157+
158+
.ARM.attributes 0 : { *(.ARM.attributes) }
159+
}

0 commit comments

Comments
 (0)