Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7624898

Browse files
committedJan 14, 2020
Add STM32G0316-DISCO
1 parent a6f7a98 commit 7624898

File tree

6 files changed

+603
-0
lines changed

6 files changed

+603
-0
lines changed
 

‎boards.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,19 @@ Disco.menu.pnum.DISCO_F746NG.build.product_line=STM32F746xx
584584
Disco.menu.pnum.DISCO_F746NG.build.variant=DISCO_F746NG
585585
Disco.menu.pnum.DISCO_F746NG.build.cmsis_lib_gcc=arm_cortexM7lfsp_math
586586

587+
# DISCO_G0316 board
588+
Disco.menu.pnum.DISCO_G0316=STM32G0316-DISCO
589+
Disco.menu.pnum.DISCO_G0316.node=NODE_G031J6
590+
Disco.menu.pnum.DISCO_G0316.upload.maximum_size=131072
591+
Disco.menu.pnum.DISCO_G0316.upload.maximum_data_size=32768
592+
Disco.menu.pnum.DISCO_G0316.build.mcu=cortex-m0plus
593+
Disco.menu.pnum.DISCO_G0316.build.board=DISCO_G0316
594+
Disco.menu.pnum.DISCO_G0316.build.series=STM32G0xx
595+
Disco.menu.pnum.DISCO_G0316.build.product_line=STM32G031xx
596+
Disco.menu.pnum.DISCO_G0316.build.variant=DISCO_G0316
597+
Disco.menu.pnum.DISCO_G0316.build.cmsis_lib_gcc=arm_cortexM0l_math
598+
Disco.menu.pnum.DISCO_G0316.build.extra_flags=-D{build.product_line} {build.xSerial} -D__CORTEX_SC=0
599+
587600
# DISCO_L475VG_IOT board
588601
Disco.menu.pnum.DISCO_L475VG_IOT=STM32L475VG-DISCOVERY-IOT
589602
Disco.menu.pnum.DISCO_L475VG_IOT.node=DIS_L4IOT

‎variants/DISCO_G0316/PeripheralPins.c

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2019, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* This software component is licensed by ST under BSD 3-Clause license,
7+
* the "License"; You may not use this file except in compliance with the
8+
* License. You may obtain a copy of the License at:
9+
* opensource.org/licenses/BSD-3-Clause
10+
*
11+
*******************************************************************************
12+
* Automatically generated from STM32G031J(4-6)Mx.xml
13+
*/
14+
#include "Arduino.h"
15+
#include "PeripheralPins.h"
16+
17+
/* =====
18+
* Note: Commented lines are alternative possibilities which are not used per default.
19+
* If you change them, you will have to know what you do
20+
* =====
21+
*/
22+
23+
//*** ADC ***
24+
25+
#ifdef HAL_ADC_MODULE_ENABLED
26+
WEAK const PinMap PinMap_ADC[] = {
27+
{PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0
28+
{PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1
29+
{PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2
30+
{PA_11, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15
31+
{PA_12, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_IN16
32+
{PA_13, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC1_IN17
33+
{PA_14, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC1_IN18
34+
{PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
35+
{PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9
36+
{PB_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11
37+
{NC, NP, 0}
38+
};
39+
#endif
40+
41+
//*** No DAC ***
42+
43+
//*** I2C ***
44+
45+
#ifdef HAL_I2C_MODULE_ENABLED
46+
WEAK const PinMap PinMap_I2C_SDA[] = {
47+
{PA_10, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
48+
{PA_12, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C2)},
49+
{PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
50+
{PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
51+
{NC, NP, 0}
52+
};
53+
#endif
54+
55+
#ifdef HAL_I2C_MODULE_ENABLED
56+
WEAK const PinMap PinMap_I2C_SCL[] = {
57+
{PA_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
58+
{PA_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C2)},
59+
{PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
60+
{PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
61+
{NC, NP, 0}
62+
};
63+
#endif
64+
65+
//*** PWM ***
66+
67+
#ifdef HAL_TIM_MODULE_ENABLED
68+
WEAK const PinMap PinMap_PWM[] = {
69+
{PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 1, 0)}, // TIM2_CH1
70+
{PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 2, 0)}, // TIM2_CH2
71+
{PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 3, 0)}, // TIM2_CH3
72+
{PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 1, 0)}, // TIM1_CH1
73+
{PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 2, 0)}, // TIM1_CH2
74+
{PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 0)}, // TIM1_CH3
75+
{PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 4, 0)}, // TIM1_CH4
76+
{PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 1, 0)}, // TIM2_CH1
77+
{PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 2, 1)}, // TIM1_CH2N
78+
{PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 3, 0)}, // TIM3_CH3
79+
{PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 1)}, // TIM1_CH3N
80+
{PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 4, 0)}, // TIM3_CH4
81+
{PB_1, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_TIM14, 1, 0)}, // TIM14_CH1
82+
{PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 2, 0)}, // TIM3_CH2
83+
{PB_6, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
84+
{PB_6, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM16, 1, 1)}, // TIM16_CH1N
85+
{PB_7, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM17, 1, 1)}, // TIM17_CH1N
86+
{PB_8, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM16, 1, 0)}, // TIM16_CH1
87+
{PB_9, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM17, 1, 0)}, // TIM17_CH1
88+
{NC, NP, 0}
89+
};
90+
#endif
91+
92+
//*** SERIAL ***
93+
94+
#ifdef HAL_UART_MODULE_ENABLED
95+
WEAK const PinMap PinMap_UART_TX[] = {
96+
{PA_2, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_LPUART1)},
97+
{PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
98+
{PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART1)},
99+
{NC, NP, 0}
100+
};
101+
#endif
102+
103+
#ifdef HAL_UART_MODULE_ENABLED
104+
WEAK const PinMap PinMap_UART_RX[] = {
105+
{PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
106+
{PB_7, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART1)},
107+
{NC, NP, 0}
108+
};
109+
#endif
110+
111+
#ifdef HAL_UART_MODULE_ENABLED
112+
WEAK const PinMap PinMap_UART_RTS[] = {
113+
{PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
114+
{PB_1, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_LPUART1)},
115+
{NC, NP, 0}
116+
};
117+
#endif
118+
119+
#ifdef HAL_UART_MODULE_ENABLED
120+
WEAK const PinMap PinMap_UART_CTS[] = {
121+
{PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
122+
{NC, NP, 0}
123+
};
124+
#endif
125+
126+
//*** SPI ***
127+
128+
#ifdef HAL_SPI_MODULE_ENABLED
129+
WEAK const PinMap PinMap_SPI_MOSI[] = {
130+
{PA_2, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
131+
{PA_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI2)},
132+
{PA_12, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
133+
{PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
134+
{PB_7, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
135+
{NC, NP, 0}
136+
};
137+
#endif
138+
139+
#ifdef HAL_SPI_MODULE_ENABLED
140+
WEAK const PinMap PinMap_SPI_MISO[] = {
141+
{PA_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_SPI2)},
142+
{PA_11, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
143+
{PB_6, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_SPI2)},
144+
{NC, NP, 0}
145+
};
146+
#endif
147+
148+
#ifdef HAL_SPI_MODULE_ENABLED
149+
WEAK const PinMap PinMap_SPI_SCLK[] = {
150+
{PA_0, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI2)},
151+
{PA_1, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
152+
{PB_8, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
153+
{NC, NP, 0}
154+
};
155+
#endif
156+
157+
#ifdef HAL_SPI_MODULE_ENABLED
158+
WEAK const PinMap PinMap_SPI_SSEL[] = {
159+
{PA_8, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
160+
{PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
161+
{PB_0, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
162+
{PB_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
163+
{NC, NP, 0}
164+
};
165+
#endif
166+
167+
//*** No CAN ***
168+
169+
//*** No ETHERNET ***
170+
171+
//*** No QUADSPI ***
172+
173+
//*** No USB ***
174+
175+
//*** No SD ***

‎variants/DISCO_G0316/PinNamesVar.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* SYS_WKUP */
2+
#ifdef PWR_WAKEUP_PIN1
3+
SYS_WKUP1 = PA_0,
4+
#endif
5+
#ifdef PWR_WAKEUP_PIN2
6+
SYS_WKUP2 = NC,
7+
#endif
8+
#ifdef PWR_WAKEUP_PIN3
9+
SYS_WKUP3 = NC,
10+
#endif
11+
#ifdef PWR_WAKEUP_PIN4
12+
SYS_WKUP4 = PA_2,
13+
#endif
14+
#ifdef PWR_WAKEUP_PIN5
15+
SYS_WKUP5 = NC,
16+
#endif
17+
#ifdef PWR_WAKEUP_PIN6
18+
SYS_WKUP6 = PB_5,
19+
#endif
20+
#ifdef PWR_WAKEUP_PIN7
21+
SYS_WKUP7 = NC,
22+
#endif
23+
#ifdef PWR_WAKEUP_PIN8
24+
SYS_WKUP8 = NC,
25+
#endif

‎variants/DISCO_G0316/ldscript.ld

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
/*
2+
******************************************************************************
3+
**
4+
5+
** File : LinkerScript.ld
6+
**
7+
** Author : Auto-generated by Ac6 System Workbench
8+
**
9+
** Abstract : Linker script for STM32G031J6Mx series
10+
** 32Kbytes FLASH and 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) 2014 Ac6</center></h2>
26+
**
27+
** Redistribution and use in source and binary forms, with or without modification,
28+
** are permitted provided that the following conditions are met:
29+
** 1. Redistributions of source code must retain the above copyright notice,
30+
** this list of conditions and the following disclaimer.
31+
** 2. Redistributions in binary form must reproduce the above copyright notice,
32+
** this list of conditions and the following disclaimer in the documentation
33+
** and/or other materials provided with the distribution.
34+
** 3. Neither the name of Ac6 nor the names of its contributors
35+
** may be used to endorse or promote products derived from this software
36+
** without specific prior written permission.
37+
**
38+
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
39+
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40+
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
41+
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
42+
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43+
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
44+
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
45+
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46+
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
47+
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48+
**
49+
*****************************************************************************
50+
*/
51+
52+
/* Entry Point */
53+
ENTRY(Reset_Handler)
54+
55+
/* Highest address of the user mode stack */
56+
_estack = 0x20002000; /* end of RAM */
57+
/* Generate a link error if heap and stack don't fit into RAM */
58+
_Min_Heap_Size = 0x200; /* required amount of heap */
59+
_Min_Stack_Size = 0x400; /* required amount of stack */
60+
61+
/* Specify the memory areas */
62+
MEMORY
63+
{
64+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K
65+
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 32K
66+
}
67+
68+
/* Define output sections */
69+
SECTIONS
70+
{
71+
/* The startup code goes first into FLASH */
72+
.isr_vector :
73+
{
74+
. = ALIGN(4);
75+
KEEP(*(.isr_vector)) /* Startup code */
76+
. = ALIGN(4);
77+
} >FLASH
78+
79+
/* The program code and other data goes into FLASH */
80+
.text :
81+
{
82+
. = ALIGN(4);
83+
*(.text) /* .text sections (code) */
84+
*(.text*) /* .text* sections (code) */
85+
*(.glue_7) /* glue arm to thumb code */
86+
*(.glue_7t) /* glue thumb to arm code */
87+
*(.eh_frame)
88+
89+
KEEP (*(.init))
90+
KEEP (*(.fini))
91+
92+
. = ALIGN(4);
93+
_etext = .; /* define a global symbols at end of code */
94+
} >FLASH
95+
96+
/* Constant data goes into FLASH */
97+
.rodata :
98+
{
99+
. = ALIGN(4);
100+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
101+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
102+
. = ALIGN(4);
103+
} >FLASH
104+
105+
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
106+
.ARM : {
107+
__exidx_start = .;
108+
*(.ARM.exidx*)
109+
__exidx_end = .;
110+
} >FLASH
111+
112+
.preinit_array :
113+
{
114+
PROVIDE_HIDDEN (__preinit_array_start = .);
115+
KEEP (*(.preinit_array*))
116+
PROVIDE_HIDDEN (__preinit_array_end = .);
117+
} >FLASH
118+
.init_array :
119+
{
120+
PROVIDE_HIDDEN (__init_array_start = .);
121+
KEEP (*(SORT(.init_array.*)))
122+
KEEP (*(.init_array*))
123+
PROVIDE_HIDDEN (__init_array_end = .);
124+
} >FLASH
125+
.fini_array :
126+
{
127+
PROVIDE_HIDDEN (__fini_array_start = .);
128+
KEEP (*(SORT(.fini_array.*)))
129+
KEEP (*(.fini_array*))
130+
PROVIDE_HIDDEN (__fini_array_end = .);
131+
} >FLASH
132+
133+
/* used by the startup to initialize data */
134+
_sidata = LOADADDR(.data);
135+
136+
/* Initialized data sections goes into RAM, load LMA copy after code */
137+
.data :
138+
{
139+
. = ALIGN(4);
140+
_sdata = .; /* create a global symbol at data start */
141+
*(.data) /* .data sections */
142+
*(.data*) /* .data* sections */
143+
144+
. = ALIGN(4);
145+
_edata = .; /* define a global symbol at data end */
146+
} >RAM AT> FLASH
147+
148+
149+
/* Uninitialized data section */
150+
. = ALIGN(4);
151+
.bss :
152+
{
153+
/* This is used by the startup in order to initialize the .bss secion */
154+
_sbss = .; /* define a global symbol at bss start */
155+
__bss_start__ = _sbss;
156+
*(.bss)
157+
*(.bss*)
158+
*(COMMON)
159+
160+
. = ALIGN(4);
161+
_ebss = .; /* define a global symbol at bss end */
162+
__bss_end__ = _ebss;
163+
} >RAM
164+
165+
/* User_heap_stack section, used to check that there is enough RAM left */
166+
._user_heap_stack :
167+
{
168+
. = ALIGN(8);
169+
PROVIDE ( end = . );
170+
PROVIDE ( _end = . );
171+
. = . + _Min_Heap_Size;
172+
. = . + _Min_Stack_Size;
173+
. = ALIGN(8);
174+
} >RAM
175+
176+
177+
178+
/* Remove information from the standard libraries */
179+
/DISCARD/ :
180+
{
181+
libc.a ( * )
182+
libm.a ( * )
183+
libgcc.a ( * )
184+
}
185+
186+
.ARM.attributes 0 : { *(.ARM.attributes) }
187+
}
188+

‎variants/DISCO_G0316/variant.cpp

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/*
2+
Copyright (c) 2011 Arduino. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#include "pins_arduino.h"
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
// Pin number
26+
const PinName digitalPin[] = {
27+
PC_14, //D0/A0
28+
PF_2, //D1/A1
29+
PB_0, //D2/A2
30+
PA_12, //D3/A3/LED
31+
PA_13, //D4/A4/SWD
32+
PA_14 //D5/A5/SWD
33+
};
34+
35+
#ifdef __cplusplus
36+
}
37+
#endif
38+
39+
// ----------------------------------------------------------------------------
40+
41+
#ifdef __cplusplus
42+
extern "C" {
43+
#endif
44+
45+
/**
46+
* @brief System Clock Configuration
47+
* The system Clock is configured as follows :
48+
* System Clock source = PLL (HSI)
49+
* SYSCLK(Hz) = 64000000
50+
* HCLK(Hz) = 64000000
51+
* AHB Prescaler = 1
52+
* APB1 Prescaler = 1
53+
* MSI Frequency(Hz) = 16000000
54+
* PLL_M = 1
55+
* PLL_N = 8
56+
* PLL_R = 2
57+
* PLL_P = 2
58+
* PLL_Q = 2
59+
* Flash Latency(WS) = 2
60+
* @param None
61+
* @retval None
62+
*/
63+
WEAK void SystemClock_Config(void)
64+
{
65+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
66+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
67+
68+
/* Configure the main internal regulator output voltage */
69+
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
70+
/* Initializes the CPU, AHB and APB busses clocks */
71+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
72+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
73+
RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;
74+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
75+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
76+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
77+
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
78+
RCC_OscInitStruct.PLL.PLLN = 8;
79+
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
80+
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
81+
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
82+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
83+
Error_Handler();
84+
}
85+
/* Initializes the CPU, AHB and APB busses clocks */
86+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
87+
| RCC_CLOCKTYPE_PCLK1;
88+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
89+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
90+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
91+
92+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
93+
Error_Handler();
94+
}
95+
}
96+
97+
#ifdef __cplusplus
98+
}
99+
#endif

‎variants/DISCO_G0316/variant.h

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/*
2+
Copyright (c) 2011 Arduino. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#ifndef _VARIANT_ARDUINO_STM32_
20+
#define _VARIANT_ARDUINO_STM32_
21+
22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif // __cplusplus
25+
26+
/*----------------------------------------------------------------------------
27+
* Pins
28+
*----------------------------------------------------------------------------*/
29+
30+
#define PB7 1
31+
#define PB8 1
32+
#define PB9 1
33+
#define PC14 1
34+
#define PA0 4
35+
#define PA1 4
36+
#define PA2 4
37+
#define PF2 4
38+
#define PA8 5
39+
#define PA11 5
40+
#define PA9 5
41+
#define PB0 5
42+
#define PB1 5
43+
#define PA12 6 // LED
44+
#define PA10 6
45+
#define PA13 7
46+
#define PB5 8
47+
#define PB6 8
48+
#define PA14 8
49+
#define PA15 8
50+
51+
// This must be a literal
52+
#define NUM_DIGITAL_PINS 6
53+
// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
54+
#define NUM_ANALOG_INPUTS 6
55+
#define NUM_ANALOG_FIRST 0
56+
57+
// On-board LED pin number
58+
#define LED_BUILTIN 6
59+
#define LED_GREEN LED_BUILTIN
60+
61+
// On-board user button
62+
#define USER_BTN PF2
63+
64+
// Timer Definitions
65+
// Use TIM14/TIM16/TIM17 when possible as servo and tone don't need GPIO output pin
66+
#define TIMER_TONE TIM16
67+
#define TIMER_SERVO TIM17
68+
69+
// UART Definitions
70+
#define SERIAL_UART_INSTANCE 1
71+
72+
// Default pin used for 'Serial' instance (ex: ST-Link)
73+
// Mandatory for Firmata
74+
#define PIN_SERIAL_RX PB7
75+
#define PIN_SERIAL_TX PB6
76+
77+
#ifdef __cplusplus
78+
} // extern "C"
79+
#endif
80+
/*----------------------------------------------------------------------------
81+
* Arduino objects - C++ only
82+
*----------------------------------------------------------------------------*/
83+
84+
#ifdef __cplusplus
85+
// These serial port names are intended to allow libraries and architecture-neutral
86+
// sketches to automatically default to the correct port name for a particular type
87+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
88+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
89+
//
90+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
91+
//
92+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
93+
//
94+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
95+
//
96+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
97+
//
98+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
99+
// pins are NOT connected to anything by default.
100+
#define SERIAL_PORT_MONITOR Serial
101+
#endif
102+
103+
#endif /* _VARIANT_ARDUINO_STM32_ */

0 commit comments

Comments
 (0)
Please sign in to comment.