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 f153092

Browse files
MCUdudefpistm
authored andcommittedApr 24, 2020
Add support for F103Tx chips
This adds support for F103T4, T6, T8 and TB
1 parent fd36259 commit f153092

File tree

7 files changed

+742
-0
lines changed

7 files changed

+742
-0
lines changed
 

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
119119
| :green_heart: | [BlackPill F103C(8-B)](https://stm32-base.org/boards/STM32F103C8T6-Black-Pill) | *1.5.0* | |
120120
| :yellow_heart: | Generic F103C(4-6-8-B) | **1.9.0** | |
121121
| :yellow_heart: | [Generic F103R(6-8-B-C-D-E-F-G)](https://stm32-base.org/boards/STM32F103RET6-Generic-Board) | **1.9.0** | |
122+
| :yellow_heart: | Generic F103T(4-6-8-B) | **1.9.0** | |
122123
| :yellow_heart: | Generic F103V(8-B-C-D-E-F-G) | **1.9.0** | |
123124
| :yellow_heart: | Generic F103Z(C-D-E-F-G) | **1.9.0** | |
124125
| :green_heart: | HY-TinySTM103T | *1.5.0* | |

‎boards.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,35 @@ GenF1.menu.pnum.Generic_F103RG.build.board=GENERIC_F103RG
966966
GenF1.menu.pnum.Generic_F103RG.build.product_line=STM32F103xG
967967
GenF1.menu.pnum.Generic_F103RG.build.variant=Generic_F103Rx
968968

969+
# Generic STM32F103Tx boards
970+
GenF1.menu.pnum.Generic_F103T4=Generic F103T4
971+
GenF1.menu.pnum.Generic_F103T4.upload.maximum_size=16384
972+
GenF1.menu.pnum.Generic_F103T4.upload.maximum_data_size=6144
973+
GenF1.menu.pnum.Generic_F103T4.build.board=GENERIC_F103T4
974+
GenF1.menu.pnum.Generic_F103T4.build.product_line=STM32F103x6
975+
GenF1.menu.pnum.Generic_F103T4.build.variant=Generic_F103Tx
976+
977+
GenF1.menu.pnum.Generic_F103T6=Generic F103T6
978+
GenF1.menu.pnum.Generic_F103T6.upload.maximum_size=32768
979+
GenF1.menu.pnum.Generic_F103T6.upload.maximum_data_size=10240
980+
GenF1.menu.pnum.Generic_F103T6.build.board=GENERIC_F103T6
981+
GenF1.menu.pnum.Generic_F103T6.build.product_line=STM32F103x6
982+
GenF1.menu.pnum.Generic_F103T6.build.variant=Generic_F103Tx
983+
984+
GenF1.menu.pnum.Generic_F103T8=Generic F103T8
985+
GenF1.menu.pnum.Generic_F103T8.upload.maximum_size=65536
986+
GenF1.menu.pnum.Generic_F103T8.upload.maximum_data_size=20480
987+
GenF1.menu.pnum.Generic_F103T8.build.board=GENERIC_F103T8
988+
GenF1.menu.pnum.Generic_F103T8.build.product_line=STM32F103xB
989+
GenF1.menu.pnum.Generic_F103T8.build.variant=Generic_F103Tx
990+
991+
GenF1.menu.pnum.Generic_F103TB=Generic F103TB
992+
GenF1.menu.pnum.Generic_F103TB.upload.maximum_size=131072
993+
GenF1.menu.pnum.Generic_F103TB.upload.maximum_data_size=20480
994+
GenF1.menu.pnum.Generic_F103TB.build.board=GENERIC_F103TB
995+
GenF1.menu.pnum.Generic_F103TB.build.product_line=STM32F103xB
996+
GenF1.menu.pnum.Generic_F103TB.build.variant=Generic_F103Tx
997+
969998
# Generic STM32F103Vx boards
970999
GenF1.menu.pnum.Generic_F103V8=Generic F103V8
9711000
GenF1.menu.pnum.Generic_F103V8.upload.maximum_size=65536
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2020, 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 STM32F103T(8-B)Ux.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_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC2_IN0
29+
{PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1
30+
// {PA_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC2_IN1
31+
{PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2
32+
// {PA_2, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC2_IN2
33+
{PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3
34+
// {PA_3, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_IN3
35+
{PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4
36+
// {PA_4, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_IN4
37+
{PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5
38+
// {PA_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_IN5
39+
{PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6
40+
// {PA_6, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC2_IN6
41+
{PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7
42+
// {PA_7, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_IN7
43+
{PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
44+
// {PB_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_IN8
45+
{PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9
46+
// {PB_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_IN9
47+
{NC, NP, 0}
48+
};
49+
#endif
50+
51+
//*** No DAC ***
52+
53+
//*** I2C ***
54+
55+
#ifdef HAL_I2C_MODULE_ENABLED
56+
WEAK const PinMap PinMap_I2C_SDA[] = {
57+
{PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)},
58+
{NC, NP, 0}
59+
};
60+
#endif
61+
62+
#ifdef HAL_I2C_MODULE_ENABLED
63+
WEAK const PinMap PinMap_I2C_SCL[] = {
64+
{PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)},
65+
{NC, NP, 0}
66+
};
67+
#endif
68+
69+
//*** PWM ***
70+
71+
#ifdef HAL_TIM_MODULE_ENABLED
72+
WEAK const PinMap PinMap_PWM[] = {
73+
{PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 1, 0)}, // TIM2_CH1
74+
// {PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_2, 1, 0)}, // TIM2_CH1
75+
{PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 2, 0)}, // TIM2_CH2
76+
// {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_2, 2, 0)}, // TIM2_CH2
77+
{PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 3, 0)}, // TIM2_CH3
78+
// {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_1, 3, 0)}, // TIM2_CH3
79+
{PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 4, 0)}, // TIM2_CH4
80+
// {PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_1, 4, 0)}, // TIM2_CH4
81+
{PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 1, 0)}, // TIM3_CH1
82+
// {PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 1, 1)}, // TIM1_CH1N
83+
{PA_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 2, 0)}, // TIM3_CH2
84+
{PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 1, 0)}, // TIM1_CH1
85+
// {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 1, 0)}, // TIM1_CH1
86+
{PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 2, 0)}, // TIM1_CH2
87+
// {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 2, 0)}, // TIM1_CH2
88+
{PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 3, 0)}, // TIM1_CH3
89+
// {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 3, 0)}, // TIM1_CH3
90+
{PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 4, 0)}, // TIM1_CH4
91+
// {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 4, 0)}, // TIM1_CH4
92+
// {PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_1, 1, 0)}, // TIM2_CH1
93+
{PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_ENABLE, 1, 0)}, // TIM2_CH1
94+
// {PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 2, 1)}, // TIM1_CH2N
95+
{PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 3, 0)}, // TIM3_CH3
96+
// {PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM3_PARTIAL, 3, 0)}, // TIM3_CH3
97+
// {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 3, 1)}, // TIM1_CH3N
98+
{PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 4, 0)}, // TIM3_CH4
99+
// {PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM3_PARTIAL, 4, 0)}, // TIM3_CH4
100+
// {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_1, 2, 0)}, // TIM2_CH2
101+
{PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_ENABLE, 2, 0)}, // TIM2_CH2
102+
{PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM3_PARTIAL, 1, 0)}, // TIM3_CH1
103+
{PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM3_PARTIAL, 2, 0)}, // TIM3_CH2
104+
#ifdef STM32F103xB
105+
{PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 1, 0)}, // TIM4_CH1
106+
{PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 2, 0)}, // TIM4_CH2
107+
#endif
108+
{NC, NP, 0}
109+
};
110+
#endif
111+
112+
//*** SERIAL ***
113+
114+
#ifdef HAL_UART_MODULE_ENABLED
115+
WEAK const PinMap PinMap_UART_TX[] = {
116+
{PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
117+
{PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
118+
{PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_USART1_ENABLE)},
119+
{NC, NP, 0}
120+
};
121+
#endif
122+
123+
#ifdef HAL_UART_MODULE_ENABLED
124+
WEAK const PinMap PinMap_UART_RX[] = {
125+
{PA_3, USART2, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_NONE)},
126+
{PA_10, USART1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_NONE)},
127+
{PB_7, USART1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_USART1_ENABLE)},
128+
{NC, NP, 0}
129+
};
130+
#endif
131+
132+
#ifdef HAL_UART_MODULE_ENABLED
133+
WEAK const PinMap PinMap_UART_RTS[] = {
134+
{PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
135+
{PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
136+
{NC, NP, 0}
137+
};
138+
#endif
139+
140+
#ifdef HAL_UART_MODULE_ENABLED
141+
WEAK const PinMap PinMap_UART_CTS[] = {
142+
{PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
143+
{PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
144+
{NC, NP, 0}
145+
};
146+
#endif
147+
148+
//*** SPI ***
149+
150+
#ifdef HAL_SPI_MODULE_ENABLED
151+
WEAK const PinMap PinMap_SPI_MOSI[] = {
152+
{PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
153+
{PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)},
154+
{NC, NP, 0}
155+
};
156+
#endif
157+
158+
#ifdef HAL_SPI_MODULE_ENABLED
159+
WEAK const PinMap PinMap_SPI_MISO[] = {
160+
{PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
161+
{PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)},
162+
{NC, NP, 0}
163+
};
164+
#endif
165+
166+
#ifdef HAL_SPI_MODULE_ENABLED
167+
WEAK const PinMap PinMap_SPI_SCLK[] = {
168+
{PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
169+
{PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)},
170+
{NC, NP, 0}
171+
};
172+
#endif
173+
174+
#ifdef HAL_SPI_MODULE_ENABLED
175+
WEAK const PinMap PinMap_SPI_SSEL[] = {
176+
{PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
177+
{PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)},
178+
{NC, NP, 0}
179+
};
180+
#endif
181+
182+
//*** CAN ***
183+
184+
#ifdef HAL_CAN_MODULE_ENABLED
185+
WEAK const PinMap PinMap_CAN_RD[] = {
186+
{PA_11, CAN1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, AFIO_NONE)},
187+
{NC, NP, 0}
188+
};
189+
#endif
190+
191+
#ifdef HAL_CAN_MODULE_ENABLED
192+
WEAK const PinMap PinMap_CAN_TD[] = {
193+
{PA_12, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, AFIO_NONE)},
194+
{NC, NP, 0}
195+
};
196+
#endif
197+
198+
//*** No ETHERNET ***
199+
200+
//*** No QUADSPI ***
201+
202+
//*** USB ***
203+
204+
#ifdef HAL_PCD_MODULE_ENABLED
205+
WEAK const PinMap PinMap_USB[] = {
206+
{PA_11, USB, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, AFIO_NONE)}, // USB_DM
207+
{PA_12, USB, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, AFIO_NONE)}, // USB_DP
208+
{NC, NP, 0}
209+
};
210+
#endif
211+
212+
//*** No USB_OTG_FS ***
213+
214+
//*** No USB_OTG_HS ***
215+
216+
//*** No SD ***

‎variants/Generic_F103Tx/PinNamesVar.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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 = NC,
13+
#endif
14+
#ifdef PWR_WAKEUP_PIN5
15+
SYS_WKUP5 = NC,
16+
#endif
17+
#ifdef PWR_WAKEUP_PIN6
18+
SYS_WKUP6 = NC,
19+
#endif
20+
#ifdef PWR_WAKEUP_PIN7
21+
SYS_WKUP7 = NC,
22+
#endif
23+
#ifdef PWR_WAKEUP_PIN8
24+
SYS_WKUP8 = NC,
25+
#endif
26+
/* USB */
27+
#ifdef USBCON
28+
USB_DM = PA_11,
29+
USB_DP = PA_12,
30+
#endif

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

‎variants/Generic_F103Tx/variant.cpp

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2018, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
#include "pins_arduino.h"
31+
32+
#ifdef __cplusplus
33+
extern "C" {
34+
#endif
35+
36+
// Digital PinName array
37+
const PinName digitalPin[] = {
38+
PA_0, // Digital pin 0
39+
PA_1, // Digital pin 1
40+
PA_2, // Digital pin 2
41+
PA_3, // Digital pin 3
42+
PA_4, // Digital pin 4
43+
PA_5, // Digital pin 5
44+
PA_6, // Digital pin 6
45+
PA_7, // Digital pin 7
46+
PA_8, // Digital pin 8
47+
PA_9, // Digital pin 9
48+
PA_10, // Digital pin 10
49+
PA_11, // Digital pin 11
50+
PA_12, // Digital pin 12
51+
PA_13, // Digital pin 13
52+
PA_14, // Digital pin 14
53+
PA_15, // Digital pin 15
54+
55+
PB_0, // Digital pin 16
56+
PB_1, // Digital pin 17
57+
PB_2, // Digital pin 18
58+
PB_3, // Digital pin 19
59+
PB_4, // Digital pin 20
60+
PB_5, // Digital pin 21
61+
PB_6, // Digital pin 22
62+
PB_7, // Digital pin 23
63+
64+
PD_0, // Digital pin 24, used by the external oscillator
65+
PD_1 // Digital pin 25, used by the external oscillator
66+
};
67+
68+
// Analog (Ax) pin number array
69+
const uint32_t analogInputPin[] = {
70+
0, // A0, PA0
71+
1, // A1, PA1
72+
2, // A2, PA2
73+
3, // A3, PA3
74+
4, // A4, PA4
75+
5, // A5, PA5
76+
6, // A6, PA6
77+
7, // A7, PA7
78+
16, // A8, PB0
79+
17, // A9, PB1
80+
};
81+
82+
#ifdef __cplusplus
83+
}
84+
#endif
85+
86+
// ----------------------------------------------------------------------------
87+
88+
#ifdef __cplusplus
89+
extern "C" {
90+
#endif
91+
92+
/**
93+
* @brief System Clock Configuration
94+
* The system Clock is configured as follow :
95+
* System Clock source = PLL (HSE)
96+
* SYSCLK(Hz) = 72000000
97+
* HCLK(Hz) = 72000000
98+
* AHB Prescaler = 1
99+
* APB1 Prescaler = 2
100+
* APB2 Prescaler = 1
101+
* PLL_Source = HSE
102+
* PLL_Mul = 9
103+
* Flash Latency(WS) = 2
104+
* ADC Prescaler = 6
105+
* USB Prescaler = 1.5
106+
* @param None
107+
* @retval None
108+
*/
109+
WEAK void SystemClock_Config(void)
110+
{
111+
RCC_OscInitTypeDef RCC_OscInitStruct;
112+
RCC_ClkInitTypeDef RCC_ClkInitStruct;
113+
RCC_PeriphCLKInitTypeDef PeriphClkInit;
114+
115+
/* Initializes the CPU, AHB and APB busses clocks */
116+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
117+
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
118+
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
119+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
120+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
121+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
122+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
123+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
124+
while (1);
125+
}
126+
127+
/* Initializes the CPU, AHB and APB busses clocks */
128+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
129+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
130+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
131+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
132+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
133+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
134+
135+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
136+
while (1);
137+
}
138+
139+
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC | RCC_PERIPHCLK_USB;
140+
PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6;
141+
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5;
142+
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
143+
while (1);
144+
}
145+
}
146+
147+
#ifdef __cplusplus
148+
}
149+
#endif

‎variants/Generic_F103Tx/variant.h

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2018, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
#ifndef _VARIANT_ARDUINO_STM32_
31+
#define _VARIANT_ARDUINO_STM32_
32+
33+
#ifdef __cplusplus
34+
extern "C" {
35+
#endif // __cplusplus
36+
37+
// * = F103C8-CB | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL |
38+
// |---------|--------|------------|-----------|------------|-----------|
39+
#define PA0 A0 // | 0 | A0 | | | | |
40+
#define PA1 A1 // | 1 | A1 | | | | |
41+
#define PA2 A2 // | 2 | A2 | USART2_TX | | | |
42+
#define PA3 A3 // | 2 | A2 | USART2_RX | | | |
43+
#define PA4 A4 // | 4 | A4 | | | SPI1_SS | |
44+
#define PA5 A5 // | 5 | A5 | | | SPI1_SCK | |
45+
#define PA6 A6 // | 6 | A6 | | | SPI1_MISO | |
46+
#define PA7 A7 // | 7 | A7 | | | SPI1_MOSI | |
47+
#define PA8 8 // | 8 | | | | | |
48+
#define PA9 9 // | 9 | | USART1_TX | | | |
49+
#define PA10 10 // | 10 | | USART1_RX | | | |
50+
#define PA11 11 // | 11 | | | | | USB_DM |
51+
#define PA12 12 // | 12 | | | | | USB_DP |
52+
#define PA13 13 // | 13 | | | | | SWD_SWDIO |
53+
#define PA14 14 // | 14 | | | | | SWD_SWCLK |
54+
#define PA15 15 // | 15 | | | | SPI1_SS | |
55+
// |---------|--------|------------|-----------|------------|-----------|
56+
#define PB0 A8 // | 16 | A8 | | | | |
57+
#define PB1 A9 // | 17 | A9 | | | | |
58+
#define PB2 18 // | 18 | | | | | BOOT1 |
59+
#define PB3 19 // | 19 | | | | SPI1_SCK | |
60+
#define PB4 20 // | 20 | | | | SPI1_MISO | |
61+
#define PB5 21 // | 21 | | | | SPI1_MOSI | |
62+
#define PB6 22 // | 22 | | USART1_TX | TWI1_SCL | | |
63+
#define PB7 23 // | 23 | | USART1_RX | TWI1_SDA | | |
64+
// |---------|--------|------------|-----------|------------|-----------|
65+
#define PD0 24 // | 35 | | | | | OSC_IN |
66+
#define PD1 25 // | 36 | | | | | OSC_OUT |
67+
// |---------|--------|------------|-----------|------------|-----------|
68+
69+
70+
// This must be a literal
71+
#define NUM_DIGITAL_PINS 26
72+
#define NUM_ANALOG_INPUTS 10
73+
74+
// On-board LED pin number
75+
#ifndef LED_BUILTIN
76+
#define LED_BUILTIN PA0
77+
#endif
78+
#define LED_GREEN LED_BUILTIN
79+
80+
// SPI Definitions
81+
#define PIN_SPI_SS PA4
82+
#define PIN_SPI_MOSI PA7
83+
#define PIN_SPI_MISO PA6
84+
#define PIN_SPI_SCK PA5
85+
86+
// I2C Definitions
87+
#define PIN_WIRE_SDA PB7
88+
#define PIN_WIRE_SCL PB6
89+
90+
// Timer Definitions
91+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
92+
#define TIMER_TONE TIM3
93+
#define TIMER_SERVO TIM2
94+
95+
// UART Definitions
96+
#define SERIAL_UART_INSTANCE 1
97+
// Default pin used for 'Serial' instance
98+
// Mandatory for Firmata
99+
#define PIN_SERIAL_RX PA10
100+
#define PIN_SERIAL_TX PA9
101+
102+
#ifdef __cplusplus
103+
} // extern "C"
104+
#endif
105+
/*----------------------------------------------------------------------------
106+
* Arduino objects - C++ only
107+
*----------------------------------------------------------------------------*/
108+
109+
#ifdef __cplusplus
110+
// These serial port names are intended to allow libraries and architecture-neutral
111+
// sketches to automatically default to the correct port name for a particular type
112+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
113+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
114+
//
115+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
116+
//
117+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
118+
//
119+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
120+
//
121+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
122+
//
123+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
124+
// pins are NOT connected to anything by default.
125+
#define SERIAL_PORT_MONITOR Serial
126+
#define SERIAL_PORT_HARDWARE Serial1
127+
#endif
128+
129+
#endif /* _VARIANT_ARDUINO_STM32_ */

0 commit comments

Comments
 (0)
Please sign in to comment.