Skip to content

Commit 79f12e7

Browse files
committed
Add a new Cortex-M3 template
1 parent d856a2f commit 79f12e7

File tree

7 files changed

+642
-0
lines changed

7 files changed

+642
-0
lines changed

ilg.gnuarmeclipse.managedbuild.cross/plugin.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3920,6 +3920,12 @@
39203920
location="$nl$/templates/projecttemplates/HelloWorld_C_Project/template.xml"
39213921
projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
39223922
</template>
3923+
<template
3924+
filterPattern=".*gcc"
3925+
id="ilg.gnuarmeclipse.managedbuild.cross.templates.HelloARMWorld_CM3_C_Project"
3926+
location="$nl$/templates/projecttemplates/HelloWorld_CM3_C_Project/template.xml"
3927+
projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
3928+
</template>
39233929
</extension>
39243930
<extension
39253931
point="org.eclipse.cdt.core.LanguageSettingsProvider">
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* Memory layout for STM32F103[CRTV]B */
2+
3+
MEMORY
4+
{
5+
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 128K
6+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
7+
}
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
/* Based on the linker script from CMSIS for GCC for ARM Embedded Processors.
2+
* Should be included after memory layout script.
3+
*/
4+
5+
/* Library configurations */
6+
GROUP(libgcc.a libc.a libm.a)
7+
8+
/* Linker script to place sections and symbol values. Should be used together
9+
* with other linker script that defines memory regions FLASH and RAM.
10+
* It references following symbols, which must be defined in code:
11+
* Reset_Handler : Entry of reset handler
12+
*
13+
* It defines following symbols, which code can use without definition:
14+
* __exidx_start
15+
* __exidx_end
16+
* __etext
17+
* __data_start__
18+
* __preinit_array_start
19+
* __preinit_array_end
20+
* __init_array_start
21+
* __init_array_end
22+
* __fini_array_start
23+
* __fini_array_end
24+
* __data_end__
25+
* __bss_start__
26+
* __bss_end__
27+
* __end__
28+
* end
29+
* __HeapLimit
30+
* __StackLimit
31+
* __StackTop
32+
* __stack
33+
*/
34+
35+
/* Used in QEMU, the embedded images entry point is in the interrupts table */
36+
ENTRY(Reset_Handler)
37+
38+
SECTIONS
39+
{
40+
.text :
41+
{
42+
KEEP(*(.core_isr_vectors))
43+
KEEP(*(.family_isr_vectors))
44+
KEEP(*(.device_isr_vectors))
45+
KEEP(*(.isr_vector))
46+
*(.text*)
47+
48+
KEEP(*(.init))
49+
KEEP(*(.fini))
50+
51+
/* .ctors */
52+
*crtbegin.o(.ctors)
53+
*crtbegin?.o(.ctors)
54+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
55+
*(SORT(.ctors.*))
56+
*(.ctors)
57+
58+
/* .dtors */
59+
*crtbegin.o(.dtors)
60+
*crtbegin?.o(.dtors)
61+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
62+
*(SORT(.dtors.*))
63+
*(.dtors)
64+
65+
. = ALIGN(4);
66+
/* preinit data */
67+
PROVIDE_HIDDEN (__preinit_array_start = .);
68+
KEEP(*(.preinit_array))
69+
PROVIDE_HIDDEN (__preinit_array_end = .);
70+
71+
. = ALIGN(4);
72+
/* init data */
73+
PROVIDE_HIDDEN (__init_array_start = .);
74+
KEEP(*(SORT(.init_array.*)))
75+
KEEP(*(.init_array))
76+
PROVIDE_HIDDEN (__init_array_end = .);
77+
78+
79+
. = ALIGN(4);
80+
/* finit data */
81+
PROVIDE_HIDDEN (__fini_array_start = .);
82+
KEEP(*(SORT(.fini_array.*)))
83+
KEEP(*(.fini_array))
84+
PROVIDE_HIDDEN (__fini_array_end = .);
85+
86+
*(.rodata*)
87+
88+
KEEP(*(.eh_frame*))
89+
} > FLASH
90+
91+
.ARM.extab :
92+
{
93+
*(.ARM.extab* .gnu.linkonce.armextab.*)
94+
} > FLASH
95+
96+
__exidx_start = .;
97+
.ARM.exidx :
98+
{
99+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
100+
} > FLASH
101+
__exidx_end = .;
102+
103+
__etext = .;
104+
105+
/* The initialised data section is stored immediately
106+
at the end of the text section */
107+
.data : AT (__etext)
108+
{
109+
__data_start__ = .;
110+
*(vtable)
111+
*(.data*)
112+
113+
. = ALIGN(4);
114+
/* init_array/fini_array moved to flash, align preserved */
115+
116+
KEEP(*(.jcr*))
117+
. = ALIGN(4);
118+
/* All data end */
119+
__data_end__ = .;
120+
121+
} > RAM
122+
123+
.bss :
124+
{
125+
. = ALIGN(4);
126+
__bss_start__ = .;
127+
*(.bss*)
128+
*(COMMON)
129+
. = ALIGN(4);
130+
__bss_end__ = .;
131+
} > RAM
132+
133+
.heap (COPY):
134+
{
135+
__end__ = .;
136+
end = __end__;
137+
*(.heap*)
138+
__HeapLimit = .;
139+
} > RAM
140+
141+
/* .stack_dummy section doesn't contains any symbols. It is only
142+
* used for linker to calculate size of stack sections, and assign
143+
* values to stack symbols later */
144+
.stack_dummy (COPY):
145+
{
146+
*(.stack*)
147+
} > RAM
148+
149+
/* Set stack top to end of RAM, and stack limit move down by
150+
* size of stack_dummy section */
151+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
152+
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
153+
PROVIDE(__stack = __StackTop);
154+
155+
/* Check if data + heap + stack exceeds RAM limit */
156+
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
157+
158+
159+
/* The following is from F4 linker scripts */
160+
161+
/* after that it's only debugging information. */
162+
163+
/* remove the debugging information from the standard libraries */
164+
DISCARD :
165+
{
166+
libc.a ( * )
167+
libm.a ( * )
168+
libgcc.a ( * )
169+
}
170+
171+
172+
/* Stabs debugging sections. */
173+
.stab 0 : { *(.stab) }
174+
.stabstr 0 : { *(.stabstr) }
175+
.stab.excl 0 : { *(.stab.excl) }
176+
.stab.exclstr 0 : { *(.stab.exclstr) }
177+
.stab.index 0 : { *(.stab.index) }
178+
.stab.indexstr 0 : { *(.stab.indexstr) }
179+
.comment 0 : { *(.comment) }
180+
/* DWARF debug sections.
181+
Symbols in the DWARF debugging sections are relative to the beginning
182+
of the section so we begin them at 0. */
183+
/* DWARF 1 */
184+
.debug 0 : { *(.debug) }
185+
.line 0 : { *(.line) }
186+
/* GNU DWARF 1 extensions */
187+
.debug_srcinfo 0 : { *(.debug_srcinfo) }
188+
.debug_sfnames 0 : { *(.debug_sfnames) }
189+
/* DWARF 1.1 and DWARF 2 */
190+
.debug_aranges 0 : { *(.debug_aranges) }
191+
.debug_pubnames 0 : { *(.debug_pubnames) }
192+
/* DWARF 2 */
193+
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
194+
.debug_abbrev 0 : { *(.debug_abbrev) }
195+
.debug_line 0 : { *(.debug_line) }
196+
.debug_frame 0 : { *(.debug_frame) }
197+
.debug_str 0 : { *(.debug_str) }
198+
.debug_loc 0 : { *(.debug_loc) }
199+
.debug_macinfo 0 : { *(.debug_macinfo) }
200+
/* SGI/MIPS DWARF 2 extensions */
201+
.debug_weaknames 0 : { *(.debug_weaknames) }
202+
.debug_funcnames 0 : { *(.debug_funcnames) }
203+
.debug_typenames 0 : { *(.debug_typenames) }
204+
.debug_varnames 0 : { *(.debug_varnames) }
205+
206+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
============================================================================
3+
Name : $(baseName).c
4+
Author : $(author)
5+
Version :
6+
Copyright : $(copyright)
7+
Description : Hello World in C
8+
============================================================================
9+
*/
10+
11+
#include <stdio.h>
12+
13+
/*
14+
15+
Print a greeting message on standard output and exit.
16+
17+
On embedded platforms this might require semi-hosting or similar.
18+
19+
For example, for toolchains derived from GNU Tools for Embedded,
20+
to enable semi-hosting, the following should be added to the linker:
21+
22+
--specs=rdimon.specs -Wl,--start-group -lgcc -lc -lc -lm -lrdimon -Wl,--end-group
23+
24+
*/
25+
26+
void
27+
SystemInit()
28+
{
29+
// add your system hardware initialisations here
30+
}
31+
32+
33+
int
34+
main(void)
35+
{
36+
printf("$(messagearm)");
37+
return 0;
38+
}

0 commit comments

Comments
 (0)