Skip to content

Commit 62604b4

Browse files
authored
Merge pull request #1880 from zgoda/generic_bluepill
Support for Blue Pill
2 parents ef1557d + 2731bc7 commit 62604b4

File tree

20 files changed

+13599
-0
lines changed

20 files changed

+13599
-0
lines changed

hal/targets.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,5 +1696,14 @@
16961696
"progen_target": "samg55j19",
16971697
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH"],
16981698
"default_build": "standard"
1699+
},
1700+
"BLUEPILL_F103C8": {
1701+
"core": "Cortex-M3",
1702+
"default_toolchain": "GCC_ARM",
1703+
"extra_labels": ["STM", "STM32F1", "STM32F103C8"],
1704+
"supported_toolchains": ["GCC_ARM"],
1705+
"inherits": ["Target"],
1706+
"progen": {"target": "bluepill-f103c8"},
1707+
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"]
16991708
}
17001709
}
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
/* Linker script to configure memory regions. */
2+
MEMORY
3+
{
4+
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K
5+
RAM (rwx) : ORIGIN = 0x200000EC, LENGTH = 20K - 0xEC
6+
}
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+
* _estack
34+
*/
35+
ENTRY(Reset_Handler)
36+
37+
SECTIONS
38+
{
39+
.text :
40+
{
41+
KEEP(*(.isr_vector))
42+
*(.text*)
43+
KEEP(*(.init))
44+
KEEP(*(.fini))
45+
46+
/* .ctors */
47+
*crtbegin.o(.ctors)
48+
*crtbegin?.o(.ctors)
49+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
50+
*(SORT(.ctors.*))
51+
*(.ctors)
52+
53+
/* .dtors */
54+
*crtbegin.o(.dtors)
55+
*crtbegin?.o(.dtors)
56+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
57+
*(SORT(.dtors.*))
58+
*(.dtors)
59+
60+
*(.rodata*)
61+
62+
KEEP(*(.eh_frame*))
63+
} > FLASH
64+
65+
.ARM.extab :
66+
{
67+
*(.ARM.extab* .gnu.linkonce.armextab.*)
68+
} > FLASH
69+
70+
__exidx_start = .;
71+
.ARM.exidx :
72+
{
73+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
74+
} > FLASH
75+
__exidx_end = .;
76+
77+
__etext = .;
78+
_sidata = .;
79+
80+
.data : AT (__etext)
81+
{
82+
__data_start__ = .;
83+
_sdata = .;
84+
*(vtable)
85+
*(.data*)
86+
87+
. = ALIGN(4);
88+
/* preinit data */
89+
PROVIDE_HIDDEN (__preinit_array_start = .);
90+
KEEP(*(.preinit_array))
91+
PROVIDE_HIDDEN (__preinit_array_end = .);
92+
93+
. = ALIGN(4);
94+
/* init data */
95+
PROVIDE_HIDDEN (__init_array_start = .);
96+
KEEP(*(SORT(.init_array.*)))
97+
KEEP(*(.init_array))
98+
PROVIDE_HIDDEN (__init_array_end = .);
99+
100+
101+
. = ALIGN(4);
102+
/* finit data */
103+
PROVIDE_HIDDEN (__fini_array_start = .);
104+
KEEP(*(SORT(.fini_array.*)))
105+
KEEP(*(.fini_array))
106+
PROVIDE_HIDDEN (__fini_array_end = .);
107+
108+
KEEP(*(.jcr*))
109+
. = ALIGN(4);
110+
/* All data end */
111+
__data_end__ = .;
112+
_edata = .;
113+
114+
} > RAM
115+
116+
.bss :
117+
{
118+
. = ALIGN(4);
119+
__bss_start__ = .;
120+
_sbss = .;
121+
*(.bss*)
122+
*(COMMON)
123+
. = ALIGN(4);
124+
__bss_end__ = .;
125+
_ebss = .;
126+
} > RAM
127+
128+
.heap (COPY):
129+
{
130+
__end__ = .;
131+
end = __end__;
132+
*(.heap*)
133+
__HeapLimit = .;
134+
} > RAM
135+
136+
/* .stack_dummy section doesn't contains any symbols. It is only
137+
* used for linker to calculate size of stack sections, and assign
138+
* values to stack symbols later */
139+
.stack_dummy (COPY):
140+
{
141+
*(.stack*)
142+
} > RAM
143+
144+
/* Set stack top to end of RAM, and stack limit move down by
145+
* size of stack_dummy section */
146+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
147+
_estack = __StackTop;
148+
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
149+
PROVIDE(__stack = __StackTop);
150+
151+
/* Check if data + heap + stack exceeds RAM limit */
152+
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
153+
}
154+

0 commit comments

Comments
 (0)