Skip to content

Commit 892160d

Browse files
authored
variants: add generic G030C(6-8)T support
Signed-off-by: hitech95 <nicveronese@gmail.com>
1 parent 7e56d54 commit 892160d

File tree

4 files changed

+234
-2
lines changed

4 files changed

+234
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
293293

294294
| Status | Device(s) | Name | Release | Notes |
295295
| :----: | :-------: | ---- | :-----: | :---- |
296+
| :yellow_heart: | STM32G030C6<br>STM32G030C8 | Generic Board | **2.2.0** |
296297
| :green_heart: | STM32G030K8 | [Aurora One](https://www.bfy.kr/aurora-one/) | *2.0.0* |
297298
| :green_heart: | STM32G030K6<br>STM32G030K8 | Generic Board | *2.0.0* | |
298299
| :green_heart: | STM32G031J4<br>STM32G031J6 | Generic Board | *2.0.0* | |

boards.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3190,6 +3190,22 @@ GenG0.menu.pnum.AURORA_ONE.build.product_line=STM32G030xx
31903190
GenG0.menu.pnum.AURORA_ONE.build.variant=STM32G0xx/G030K(6-8)T
31913191
GenG0.menu.pnum.AURORA_ONE.build.variant_h=variant_{build.board}.h
31923192

3193+
# Generic G030C6Tx
3194+
GenG0.menu.pnum.GENERIC_G030C6TX=Generic G030C6Tx
3195+
GenG0.menu.pnum.GENERIC_G030C6TX.upload.maximum_size=32768
3196+
GenG0.menu.pnum.GENERIC_G030C6TX.upload.maximum_data_size=8192
3197+
GenG0.menu.pnum.GENERIC_G030C6TX.build.board=GENERIC_G030C6TX
3198+
GenG0.menu.pnum.GENERIC_G030C6TX.build.product_line=STM32G030xx
3199+
GenG0.menu.pnum.GENERIC_G030C6TX.build.variant=STM32G0xx/G030C(6-8)T
3200+
3201+
# Generic G030C8Tx
3202+
GenG0.menu.pnum.GENERIC_G030C8TX=Generic G030C8Tx
3203+
GenG0.menu.pnum.GENERIC_G030C8TX.upload.maximum_size=65536
3204+
GenG0.menu.pnum.GENERIC_G030C8TX.upload.maximum_data_size=8192
3205+
GenG0.menu.pnum.GENERIC_G030C8TX.build.board=GENERIC_G030C8TX
3206+
GenG0.menu.pnum.GENERIC_G030C8TX.build.product_line=STM32G030xx
3207+
GenG0.menu.pnum.GENERIC_G030C8TX.build.variant=STM32G0xx/G030C(6-8)T
3208+
31933209
# Generic G030K6Tx
31943210
GenG0.menu.pnum.GENERIC_G030K6TX=Generic G030K6Tx
31953211
GenG0.menu.pnum.GENERIC_G030K6TX.upload.maximum_size=32768

variants/STM32G0xx/G030C(6-8)T/generic_clock.c

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,37 @@
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+
/* Configure the main internal regulator output voltage */
27+
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
28+
/*
29+
* Initializes the RCC Oscillators according to the specified parameters
30+
* in the RCC_OscInitTypeDef structure.
31+
*/
32+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
33+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
34+
RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;
35+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
36+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
37+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
38+
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
39+
RCC_OscInitStruct.PLL.PLLN = 8;
40+
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
41+
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
42+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
43+
Error_Handler();
44+
}
45+
/* Initializes the CPU, AHB and APB buses clocks */
46+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1;
47+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
48+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
49+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
50+
51+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
52+
Error_Handler();
53+
}
2554
}
2655

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

0 commit comments

Comments
 (0)