Skip to content

Commit b76571c

Browse files
mcer12ABOSTM
authored andcommitted
[variant] Add Generic F100Cx
Supersed stm32duino#1208 Signed-off-by: Martin Cerný <[email protected]> Co-authored-by: Alexandre Bourdiol <[email protected]>
1 parent af98645 commit b76571c

File tree

6 files changed

+442
-4
lines changed

6 files changed

+442
-4
lines changed

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
178178

179179
| Status | Device(s) | Name | Release | Notes |
180180
| :----: | :-------: | ---- | :-----: | :---- |
181+
| :yellow_heart: | STM32F100C4<br>STM32F100C6 | Generic Board | **2.0.0** | |
182+
| :yellow_heart: | STM32F100C8<br>STM32F100CB | Generic Board | **2.0.0** | |
181183
| :green_heart: | STM32F103C6<br>STM32F103C8<br>STM32F103CB | [Blue Pill](https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill) | *1.2.0* | USB CDC support since *1.5.0*<br> Maple bootloaders support since *1.6.0* |
182184
| :green_heart: | STM32F103C8<br>STM32F103CB | [Black Pill](https://stm32-base.org/boards/STM32F103C8T6-Black-Pill) | *1.5.0* | |
183185
| :green_heart: | STM32F103C4<br>STM32F103C6<br>STM32F103C8<br>STM32F103CB | Generic Board | *1.9.0* | |

Diff for: boards.txt

+32
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,38 @@ GenF1.menu.pnum.BLUEBUTTON_F103RET.build.product_line=STM32F103xE
12561256
GenF1.menu.pnum.BLUEBUTTON_F103RET.build.variant=STM32F1xx/F103R(C-D-E)T
12571257
GenF1.menu.pnum.BLUEBUTTON_F103RET.build.variant_h=variant_{build.board}.h
12581258

1259+
# Generic F100C4Tx
1260+
GenF1.menu.pnum.GENERIC_F100C4TX=Generic F100C4Tx
1261+
GenF1.menu.pnum.GENERIC_F100C4TX.upload.maximum_size=16384
1262+
GenF1.menu.pnum.GENERIC_F100C4TX.upload.maximum_data_size=4096
1263+
GenF1.menu.pnum.GENERIC_F100C4TX.build.board=GENERIC_F100C4TX
1264+
GenF1.menu.pnum.GENERIC_F100C4TX.build.product_line=STM32F100xB
1265+
GenF1.menu.pnum.GENERIC_F100C4TX.build.variant=STM32F1xx/F100C(4-6)T
1266+
1267+
# Generic F100C6Tx
1268+
GenF1.menu.pnum.GENERIC_F100C6TX=Generic F100C6Tx
1269+
GenF1.menu.pnum.GENERIC_F100C6TX.upload.maximum_size=32768
1270+
GenF1.menu.pnum.GENERIC_F100C6TX.upload.maximum_data_size=4096
1271+
GenF1.menu.pnum.GENERIC_F100C6TX.build.board=GENERIC_F100C6TX
1272+
GenF1.menu.pnum.GENERIC_F100C6TX.build.product_line=STM32F100xB
1273+
GenF1.menu.pnum.GENERIC_F100C6TX.build.variant=STM32F1xx/F100C(4-6)T
1274+
1275+
# Generic F100C8Tx
1276+
GenF1.menu.pnum.GENERIC_F100C8TX=Generic F100C8Tx
1277+
GenF1.menu.pnum.GENERIC_F100C8TX.upload.maximum_size=65536
1278+
GenF1.menu.pnum.GENERIC_F100C8TX.upload.maximum_data_size=8192
1279+
GenF1.menu.pnum.GENERIC_F100C8TX.build.board=GENERIC_F100C8TX
1280+
GenF1.menu.pnum.GENERIC_F100C8TX.build.product_line=STM32F100xB
1281+
GenF1.menu.pnum.GENERIC_F100C8TX.build.variant=STM32F1xx/F100C(8-B)T
1282+
1283+
# Generic F100CBTx
1284+
GenF1.menu.pnum.GENERIC_F100CBTX=Generic F100CBTx
1285+
GenF1.menu.pnum.GENERIC_F100CBTX.upload.maximum_size=131072
1286+
GenF1.menu.pnum.GENERIC_F100CBTX.upload.maximum_data_size=8192
1287+
GenF1.menu.pnum.GENERIC_F100CBTX.build.board=GENERIC_F100CBTX
1288+
GenF1.menu.pnum.GENERIC_F100CBTX.build.product_line=STM32F100xB
1289+
GenF1.menu.pnum.GENERIC_F100CBTX.build.variant=STM32F1xx/F100C(8-B)T
1290+
12591291
# Generic F100R8Tx
12601292
GenF1.menu.pnum.GENERIC_F100R8TX=Generic F100R8Tx
12611293
GenF1.menu.pnum.GENERIC_F100R8TX.upload.maximum_size=65536

Diff for: variants/STM32F1xx/F100C(4-6)T/generic_clock.c

+27-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,33 @@
2020
*/
2121
WEAK void SystemClock_Config(void)
2222
{
23-
/* SystemClock_Config can be generated by STM32CubeMX */
24-
#warning "SystemClock_Config() is empty. Default clock at reset is used."
23+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
24+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
25+
26+
/** Initializes the RCC Oscillators according to the specified parameters
27+
* in the RCC_OscInitTypeDef structure.
28+
*/
29+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
30+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
31+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
32+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
33+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
34+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;
35+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
36+
Error_Handler();
37+
}
38+
/** Initializes the CPU, AHB and APB buses clocks
39+
*/
40+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
41+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
42+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
43+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
44+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
45+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
46+
47+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) {
48+
Error_Handler();
49+
}
2550
}
2651

2752
#endif /* ARDUINO_GENERIC_* */

Diff for: variants/STM32F1xx/F100C(4-6)T/ldscript.ld

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
/**
2+
******************************************************************************
3+
* @file LinkerScript.ld
4+
* @author Auto-generated by STM32CubeIDE
5+
* @brief Linker script for STM32F100C4Tx Device from STM32F1 series
6+
* 16Kbytes FLASH
7+
* 4Kbytes RAM
8+
*
9+
* Set heap size, stack size and stack location according
10+
* to application requirements.
11+
*
12+
* Set memory bank area and size if external memory is used
13+
******************************************************************************
14+
* @attention
15+
*
16+
* <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
17+
* All rights reserved.</center></h2>
18+
*
19+
* This software component is licensed by ST under BSD 3-Clause license,
20+
* the "License"; You may not use this file except in compliance with the
21+
* License. You may obtain a copy of the License at:
22+
* opensource.org/licenses/BSD-3-Clause
23+
*
24+
******************************************************************************
25+
*/
26+
27+
/* Entry Point */
28+
ENTRY(Reset_Handler)
29+
30+
/* Highest address of the user mode stack */
31+
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
32+
33+
_Min_Heap_Size = 0x200; /* required amount of heap */
34+
_Min_Stack_Size = 0x400; /* required amount of stack */
35+
36+
/* Memories definition */
37+
MEMORY
38+
{
39+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE
40+
FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET
41+
}
42+
43+
/* Sections */
44+
SECTIONS
45+
{
46+
/* The startup code into "FLASH" Rom type memory */
47+
.isr_vector :
48+
{
49+
. = ALIGN(4);
50+
KEEP(*(.isr_vector)) /* Startup code */
51+
. = ALIGN(4);
52+
} >FLASH
53+
54+
/* The program code and other data into "FLASH" Rom type memory */
55+
.text :
56+
{
57+
. = ALIGN(4);
58+
*(.text) /* .text sections (code) */
59+
*(.text*) /* .text* sections (code) */
60+
*(.glue_7) /* glue arm to thumb code */
61+
*(.glue_7t) /* glue thumb to arm code */
62+
*(.eh_frame)
63+
64+
KEEP (*(.init))
65+
KEEP (*(.fini))
66+
67+
. = ALIGN(4);
68+
_etext = .; /* define a global symbols at end of code */
69+
} >FLASH
70+
71+
/* Constant data into "FLASH" Rom type memory */
72+
.rodata :
73+
{
74+
. = ALIGN(4);
75+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
76+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
77+
. = ALIGN(4);
78+
} >FLASH
79+
80+
.ARM.extab : {
81+
. = ALIGN(4);
82+
*(.ARM.extab* .gnu.linkonce.armextab.*)
83+
. = ALIGN(4);
84+
} >FLASH
85+
86+
.ARM : {
87+
. = ALIGN(4);
88+
__exidx_start = .;
89+
*(.ARM.exidx*)
90+
__exidx_end = .;
91+
. = ALIGN(4);
92+
} >FLASH
93+
94+
.preinit_array :
95+
{
96+
. = ALIGN(4);
97+
PROVIDE_HIDDEN (__preinit_array_start = .);
98+
KEEP (*(.preinit_array*))
99+
PROVIDE_HIDDEN (__preinit_array_end = .);
100+
. = ALIGN(4);
101+
} >FLASH
102+
103+
.init_array :
104+
{
105+
. = ALIGN(4);
106+
PROVIDE_HIDDEN (__init_array_start = .);
107+
KEEP (*(SORT(.init_array.*)))
108+
KEEP (*(.init_array*))
109+
PROVIDE_HIDDEN (__init_array_end = .);
110+
. = ALIGN(4);
111+
} >FLASH
112+
113+
.fini_array :
114+
{
115+
. = ALIGN(4);
116+
PROVIDE_HIDDEN (__fini_array_start = .);
117+
KEEP (*(SORT(.fini_array.*)))
118+
KEEP (*(.fini_array*))
119+
PROVIDE_HIDDEN (__fini_array_end = .);
120+
. = ALIGN(4);
121+
} >FLASH
122+
123+
/* Used by the startup to initialize data */
124+
_sidata = LOADADDR(.data);
125+
126+
/* Initialized data sections into "RAM" Ram type memory */
127+
.data :
128+
{
129+
. = ALIGN(4);
130+
_sdata = .; /* create a global symbol at data start */
131+
*(.data) /* .data sections */
132+
*(.data*) /* .data* sections */
133+
*(.RamFunc) /* .RamFunc sections */
134+
*(.RamFunc*) /* .RamFunc* sections */
135+
136+
. = ALIGN(4);
137+
_edata = .; /* define a global symbol at data end */
138+
139+
} >RAM AT> FLASH
140+
141+
/* Uninitialized data section into "RAM" Ram type memory */
142+
. = ALIGN(4);
143+
.bss :
144+
{
145+
/* This is used by the startup in order to initialize the .bss section */
146+
_sbss = .; /* define a global symbol at bss start */
147+
__bss_start__ = _sbss;
148+
*(.bss)
149+
*(.bss*)
150+
*(COMMON)
151+
152+
. = ALIGN(4);
153+
_ebss = .; /* define a global symbol at bss end */
154+
__bss_end__ = _ebss;
155+
} >RAM
156+
157+
/* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
158+
._user_heap_stack :
159+
{
160+
. = ALIGN(8);
161+
PROVIDE ( end = . );
162+
PROVIDE ( _end = . );
163+
. = . + _Min_Heap_Size;
164+
. = . + _Min_Stack_Size;
165+
. = ALIGN(8);
166+
} >RAM
167+
168+
/* Remove information from the compiler libraries */
169+
/DISCARD/ :
170+
{
171+
libc.a ( * )
172+
libm.a ( * )
173+
libgcc.a ( * )
174+
}
175+
176+
.ARM.attributes 0 : { *(.ARM.attributes) }
177+
}

Diff for: variants/STM32F1xx/F100C(8-B)T/generic_clock.c

+27-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,33 @@
2020
*/
2121
WEAK void SystemClock_Config(void)
2222
{
23-
/* SystemClock_Config can be generated by STM32CubeMX */
24-
#warning "SystemClock_Config() is empty. Default clock at reset is used."
23+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
24+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
25+
26+
/** Initializes the RCC Oscillators according to the specified parameters
27+
* in the RCC_OscInitTypeDef structure.
28+
*/
29+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
30+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
31+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
32+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
33+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
34+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;
35+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
36+
Error_Handler();
37+
}
38+
/** Initializes the CPU, AHB and APB buses clocks
39+
*/
40+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
41+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
42+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
43+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
44+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
45+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
46+
47+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) {
48+
Error_Handler();
49+
}
2550
}
2651

2752
#endif /* ARDUINO_GENERIC_* */

0 commit comments

Comments
 (0)