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 8ef0a5e

Browse files
committedJul 11, 2017
DISCO_F100RB (STM32VLDiscovery) added.
Signed-off-by: fpr <[email protected]>
1 parent b8a2534 commit 8ef0a5e

File tree

7 files changed

+1111
-2
lines changed

7 files changed

+1111
-2
lines changed
 

‎boards.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,20 @@ Disco.build.core=arduino
203203
Disco.build.board=Disco
204204
Disco.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.enable_Serialx}
205205

206+
#DISCO_F100RB board
207+
# Support: Serial1 (USART1 on PA10, PA9) and Serial2 (USART3 on PB11, PB10)
208+
Disco.menu.board_part_num.DISCO_F100RB=STM32F100RB-DISCVL
209+
Disco.menu.board_part_num.DISCO_F100RB.node=DIS_F100RB
210+
Disco.menu.board_part_num.DISCO_F100RB.upload.maximum_size=131071
211+
Disco.menu.board_part_num.DISCO_F100RB.upload.maximum_data_size=8192
212+
Disco.menu.board_part_num.DISCO_F100RB.build.mcu=cortex-m3
213+
Disco.menu.board_part_num.DISCO_F100RB.build.f_cpu=24000000L
214+
Disco.menu.board_part_num.DISCO_F100RB.build.board=DISCO_F100RB
215+
Disco.menu.board_part_num.DISCO_F100RB.build.series=STM32F1xx
216+
Disco.menu.board_part_num.DISCO_F100RB.build.product_line=STM32F100xB
217+
Disco.menu.board_part_num.DISCO_F100RB.build.variant=DISCO_F100RB
218+
Disco.menu.board_part_num.DISCO_F100RB.build.cmsis_lib_gcc=arm_cortexM3l_math
219+
206220
# DISCO_F407VG board
207221
# Support: USB HID
208222
Disco.menu.board_part_num.DISCO_F407VG=STM32F407G-DISC1

‎cores/arduino/stm32/stm32_def_build.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
#define CMSIS_STARTUP_FILE "startup_stm32f091xc.s"
2727
#elif defined(STM32F030x8)
2828
#define CMSIS_STARTUP_FILE "startup_stm32f030x8.s"
29+
#elif defined(STM32F100xB)
30+
#define CMSIS_STARTUP_FILE "startup_stm32f100xb.s"
31+
#elif defined(STM32F103xB)
32+
#define CMSIS_STARTUP_FILE "startup_stm32f103xb.s"
2933
#elif defined(STM32F303xE)
3034
#define CMSIS_STARTUP_FILE "startup_stm32f303xe.s"
3135
#elif defined(STM32F407xx)
@@ -40,8 +44,6 @@
4044
#define CMSIS_STARTUP_FILE "startup_stm32l476xx.s"
4145
#elif defined(STM32L432xx)
4246
#define CMSIS_STARTUP_FILE "startup_stm32l432xx.s"
43-
#elif defined(STM32F103xB)
44-
#define CMSIS_STARTUP_FILE "startup_stm32f103xb.s"
4547
#else
4648
#error UNKNOWN CHIP
4749
#endif
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2016, 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 "Arduino.h"
31+
#include "PeripheralPins.h"
32+
33+
// =====
34+
// Note: Commented lines are alternative possibilities which are not used per default.
35+
// If you change them, you will have to know what you do
36+
// =====
37+
38+
39+
//*** ADC ***
40+
41+
const PinMap PinMap_ADC[] = {
42+
{PA0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0
43+
{PA1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1
44+
{PA2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2
45+
{PA3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3
46+
{PA4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4
47+
{PA5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5
48+
{PA6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6
49+
{PA7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7
50+
{PB0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
51+
{PB1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9
52+
{PC0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10
53+
{PC1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11
54+
{PC2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12
55+
{PC3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13
56+
{PC4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14
57+
{PC5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15
58+
{NC, NC, 0}
59+
};
60+
61+
//*** DAC ***
62+
63+
const PinMap PinMap_DAC[] = {
64+
{PA4, DAC, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC_OUT1
65+
{PA5, DAC, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC_OUT2
66+
{NC, NC, 0}
67+
};
68+
69+
//*** I2C ***
70+
71+
const PinMap PinMap_I2C_SDA[] = {
72+
{PB7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 0)},
73+
{PB9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 2)}, // GPIO_Remap_I2C1
74+
{PB11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 0)},
75+
{NC, NC, 0}
76+
};
77+
78+
const PinMap PinMap_I2C_SCL[] = {
79+
{PB6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 0)},
80+
{PB8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 2)}, // GPIO_Remap_I2C1
81+
{PB10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 0)},
82+
{NC, NC, 0}
83+
};
84+
85+
//*** PWM ***
86+
87+
const PinMap PinMap_PWM[] = {
88+
{PA0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 0)}, // TIM2_CH1
89+
{PA1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 2, 0)}, // TIM2_CH2
90+
// {PA2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 0)}, // TIM15_CH1
91+
{PA2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 3, 0)}, // TIM2_CH3
92+
// {PA3, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 2, 0)}, // TIM15_CH2
93+
{PA3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 4, 0)}, // TIM2_CH4
94+
// {PA6, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 0)}, // TIM16_CH1
95+
{PA6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 0)}, // TIM3_CH1
96+
// {PA7, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 0)}, // TIM17_CH1
97+
// {PA7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 6, 1, 1)}, // TIM1_CH1N - GPIO_PartialRemap_TIM1
98+
{PA7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 2, 0)}, // TIM3_CH2
99+
{PA8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 0)}, // TIM1_CH1
100+
{PA9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 2, 0)}, // TIM1_CH2
101+
{PA10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 3, 0)}, // TIM1_CH3
102+
{PA11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 4, 0)}, // TIM1_CH4
103+
{PA15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 8, 1, 0)}, // TIM2_CH1 - GPIO_FullRemap_TIM2
104+
// {PB0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 6, 2, 1)}, // TIM1_CH2N - GPIO_PartialRemap_TIM1
105+
{PB0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 3, 0)}, // TIM3_CH3
106+
// {PB1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 6, 3, 1)}, // TIM1_CH3N - GPIO_PartialRemap_TIM1
107+
{PB1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 4, 0)}, // TIM3_CH4
108+
{PB3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 8, 2, 0)}, // TIM2_CH2 - GPIO_FullRemap_TIM2
109+
{PB4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 7, 1, 0)}, // TIM3_CH1 - GPIO_PartialRemap_TIM3
110+
{PB5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 7, 2, 0)}, // TIM3_CH2 - GPIO_PartialRemap_TIM3
111+
// {PB6, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 1)}, // TIM16_CH1N
112+
{PB6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 0)}, // TIM4_CH1
113+
// {PB7, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 1)}, // TIM17_CH1N
114+
{PB7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 2, 0)}, // TIM4_CH2
115+
// {PB8, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 0)}, // TIM16_CH1
116+
{PB8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 3, 0)}, // TIM4_CH3
117+
// {PB9, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 0)}, // TIM17_CH1
118+
{PB9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 4, 0)}, // TIM4_CH4
119+
{PB10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 8, 3, 0)}, // TIM2_CH3 - GPIO_FullRemap_TIM2
120+
{PB11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 8, 4, 0)}, // TIM2_CH4 - GPIO_FullRemap_TIM2
121+
{PB13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 1)}, // TIM1_CH1N
122+
// {PB14, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 0)}, // TIM15_CH1
123+
{PB14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 2, 1)}, // TIM1_CH2N
124+
// {PB15, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 1, 1)}, // TIM15_CH1N
125+
// {PB15, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 2, 0)}, // TIM15_CH2
126+
{PB15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 0, 3, 1)}, // TIM1_CH3N
127+
{PC6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 9, 1, 0)}, // TIM3_CH1 - GPIO_FullRemap_TIM3
128+
{PC7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 9, 2, 0)}, // TIM3_CH2 - GPIO_FullRemap_TIM3
129+
{PC8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 9, 3, 0)}, // TIM3_CH3 - GPIO_FullRemap_TIM3
130+
{PC9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, 9, 4, 0)}, // TIM3_CH4 - GPIO_FullRemap_TIM3
131+
{NC, NC, 0}
132+
};
133+
134+
//*** SERIAL ***
135+
136+
const PinMap PinMap_UART_TX[] = {
137+
{PA2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
138+
{PA9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
139+
{PB6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 3)}, // GPIO_Remap_USART1
140+
{PB10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
141+
{PC10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 5)}, // GPIO_PartialRemap_USART3
142+
{NC, NC, 0}
143+
};
144+
145+
const PinMap PinMap_UART_RX[] = {
146+
{PA3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
147+
{PA10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
148+
{PB7, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 3)}, // GPIO_Remap_USART1
149+
{PB11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
150+
{PC11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 5)}, // GPIO_PartialRemap_USART3
151+
{NC, NC, 0}
152+
};
153+
154+
const PinMap PinMap_UART_RTS[] = {
155+
{PA1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
156+
{PA12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
157+
{PB14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
158+
{NC, NC, 0}
159+
};
160+
161+
const PinMap PinMap_UART_CTS[] = {
162+
{PA0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
163+
{PA11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
164+
{PB13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
165+
{NC, NC, 0}
166+
};
167+
168+
//*** SPI ***
169+
170+
const PinMap PinMap_SPI_MOSI[] = {
171+
{PA7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
172+
{PB5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 1)}, // GPIO_Remap_SPI1
173+
{PB15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
174+
{NC, NC, 0}
175+
};
176+
177+
const PinMap PinMap_SPI_MISO[] = {
178+
{PA6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
179+
{PB4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 1)}, // GPIO_Remap_SPI1
180+
{PB14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
181+
{NC, NC, 0}
182+
};
183+
184+
const PinMap PinMap_SPI_SCLK[] = {
185+
{PA5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
186+
{PB3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 1)}, // GPIO_Remap_SPI1
187+
{PB13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
188+
{NC, NC, 0}
189+
};
190+
191+
const PinMap PinMap_SPI_SSEL[] = {
192+
{PA4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
193+
{PA15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 1)}, // GPIO_Remap_SPI1
194+
{PB12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
195+
{NC, NC, 0}
196+
};
197+
198+
//*** No CAN ***
199+

‎variants/DISCO_F100RB/ldscript.ld

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
/**
2+
******************************************************************************
3+
* @file STM32F103RB_FLASH.ld
4+
* @author WI6LABS
5+
* @version V1.0.1
6+
* @date 21-September-2016
7+
* @brief Linker script for STM32F100RB Device with
8+
* 128KByte FLASH, 8KByte 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+
******************************************************************************
16+
* @attention
17+
*
18+
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
19+
*
20+
* Redistribution and use in source and binary forms, with or without modification,
21+
* are permitted provided that the following conditions are met:
22+
* 1. Redistributions of source code must retain the above copyright notice,
23+
* this list of conditions and the following disclaimer.
24+
* 2. Redistributions in binary form must reproduce the above copyright notice,
25+
* this list of conditions and the following disclaimer in the documentation
26+
* and/or other materials provided with the distribution.
27+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
28+
* may be used to endorse or promote products derived from this software
29+
* without specific prior written permission.
30+
*
31+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
32+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
35+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
37+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
38+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
39+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41+
*
42+
******************************************************************************
43+
*/
44+
45+
/* Entry Point */
46+
ENTRY(Reset_Handler)
47+
48+
/* Highest address of the user mode stack */
49+
_estack = 0x20002000; /* end of RAM */
50+
/* Generate a link error if heap and stack don't fit into RAM */
51+
_Min_Heap_Size = 0x200; /* required amount of heap */
52+
_Min_Stack_Size = 0x400; /* required amount of stack */
53+
54+
/* Specify the memory areas */
55+
MEMORY
56+
{
57+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K
58+
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 128K
59+
}
60+
61+
/* Define output sections */
62+
SECTIONS
63+
{
64+
/* The startup code goes first into FLASH */
65+
.isr_vector :
66+
{
67+
. = ALIGN(4);
68+
KEEP(*(.isr_vector)) /* Startup code */
69+
. = ALIGN(4);
70+
} >FLASH
71+
72+
/* The program code and other data goes into FLASH */
73+
.text :
74+
{
75+
. = ALIGN(4);
76+
*(.text) /* .text sections (code) */
77+
*(.text*) /* .text* sections (code) */
78+
*(.glue_7) /* glue arm to thumb code */
79+
*(.glue_7t) /* glue thumb to arm code */
80+
*(.eh_frame)
81+
82+
KEEP (*(.init))
83+
KEEP (*(.fini))
84+
85+
. = ALIGN(4);
86+
_etext = .; /* define a global symbols at end of code */
87+
} >FLASH
88+
89+
/* Constant data goes into FLASH */
90+
.rodata :
91+
{
92+
. = ALIGN(4);
93+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
94+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
95+
. = ALIGN(4);
96+
} >FLASH
97+
98+
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
99+
.ARM : {
100+
__exidx_start = .;
101+
*(.ARM.exidx*)
102+
__exidx_end = .;
103+
} >FLASH
104+
105+
.preinit_array :
106+
{
107+
PROVIDE_HIDDEN (__preinit_array_start = .);
108+
KEEP (*(.preinit_array*))
109+
PROVIDE_HIDDEN (__preinit_array_end = .);
110+
} >FLASH
111+
.init_array :
112+
{
113+
PROVIDE_HIDDEN (__init_array_start = .);
114+
KEEP (*(SORT(.init_array.*)))
115+
KEEP (*(.init_array*))
116+
PROVIDE_HIDDEN (__init_array_end = .);
117+
} >FLASH
118+
.fini_array :
119+
{
120+
PROVIDE_HIDDEN (__fini_array_start = .);
121+
KEEP (*(SORT(.fini_array.*)))
122+
KEEP (*(.fini_array*))
123+
PROVIDE_HIDDEN (__fini_array_end = .);
124+
} >FLASH
125+
126+
/* used by the startup to initialize data */
127+
_sidata = LOADADDR(.data);
128+
129+
/* Initialized data sections goes into RAM, load LMA copy after code */
130+
.data :
131+
{
132+
. = ALIGN(4);
133+
_sdata = .; /* create a global symbol at data start */
134+
*(.data) /* .data sections */
135+
*(.data*) /* .data* sections */
136+
137+
. = ALIGN(4);
138+
_edata = .; /* define a global symbol at data end */
139+
} >RAM AT> FLASH
140+
141+
142+
/* Uninitialized data section */
143+
. = ALIGN(4);
144+
.bss :
145+
{
146+
/* This is used by the startup in order to initialize the .bss secion */
147+
_sbss = .; /* define a global symbol at bss start */
148+
__bss_start__ = _sbss;
149+
*(.bss)
150+
*(.bss*)
151+
*(COMMON)
152+
153+
. = ALIGN(4);
154+
_ebss = .; /* define a global symbol at bss end */
155+
__bss_end__ = _ebss;
156+
} >RAM
157+
158+
/* User_heap_stack section, used to check that there is enough RAM left */
159+
._user_heap_stack :
160+
{
161+
. = ALIGN(4);
162+
PROVIDE ( end = . );
163+
PROVIDE ( _end = . );
164+
. = . + _Min_Heap_Size;
165+
. = . + _Min_Stack_Size;
166+
. = ALIGN(4);
167+
} >RAM
168+
169+
170+
171+
/* Remove information from the standard libraries */
172+
/DISCARD/ :
173+
{
174+
libc.a ( * )
175+
libm.a ( * )
176+
libgcc.a ( * )
177+
}
178+
179+
.ARM.attributes 0 : { *(.ARM.attributes) }
180+
}
Lines changed: 367 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,367 @@
1+
/**
2+
******************************************************************************
3+
* @file stm32f1xx_hal_conf.h
4+
* @author MCD Application Team
5+
* @version V1.0.4
6+
* @date 29-April-2016
7+
* @brief HAL configuration template file.
8+
* This file should be copied to the application folder and renamed
9+
* to stm32f1xx_hal_conf.h.
10+
******************************************************************************
11+
* @attention
12+
*
13+
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
14+
*
15+
* Redistribution and use in source and binary forms, with or without modification,
16+
* are permitted provided that the following conditions are met:
17+
* 1. Redistributions of source code must retain the above copyright notice,
18+
* this list of conditions and the following disclaimer.
19+
* 2. Redistributions in binary form must reproduce the above copyright notice,
20+
* this list of conditions and the following disclaimer in the documentation
21+
* and/or other materials provided with the distribution.
22+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
23+
* may be used to endorse or promote products derived from this software
24+
* without specific prior written permission.
25+
*
26+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
30+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
*
37+
******************************************************************************
38+
*/
39+
40+
/* Define to prevent recursive inclusion -------------------------------------*/
41+
#ifndef __STM32F1xx_HAL_CONF_H
42+
#define __STM32F1xx_HAL_CONF_H
43+
44+
#ifdef __cplusplus
45+
extern "C" {
46+
#endif
47+
48+
/* Exported types ------------------------------------------------------------*/
49+
/* Exported constants --------------------------------------------------------*/
50+
51+
/* ########################## Module Selection ############################## */
52+
/**
53+
* @brief This is the list of modules to be used in the HAL driver
54+
*/
55+
#define HAL_MODULE_ENABLED
56+
#define HAL_ADC_MODULE_ENABLED
57+
//#define HAL_CAN_MODULE_ENABLED
58+
//#define HAL_CEC_MODULE_ENABLED
59+
#define HAL_CORTEX_MODULE_ENABLED
60+
//#define HAL_CRC_MODULE_ENABLED
61+
#define HAL_DAC_MODULE_ENABLED
62+
#define HAL_DMA_MODULE_ENABLED
63+
//#define HAL_ETH_MODULE_ENABLED
64+
#define HAL_FLASH_MODULE_ENABLED
65+
#define HAL_GPIO_MODULE_ENABLED
66+
//#define HAL_HCD_MODULE_ENABLED
67+
#define HAL_I2C_MODULE_ENABLED
68+
//#define HAL_I2S_MODULE_ENABLED
69+
//#define HAL_IRDA_MODULE_ENABLED
70+
//#define HAL_IWDG_MODULE_ENABLED
71+
//#define HAL_NAND_MODULE_ENABLED
72+
//#define HAL_NOR_MODULE_ENABLED
73+
//#define HAL_PCCARD_MODULE_ENABLED
74+
//#define HAL_PCD_MODULE_ENABLED
75+
//#define HAL_PWR_MODULE_ENABLED
76+
#define HAL_RCC_MODULE_ENABLED
77+
//#define HAL_RTC_MODULE_ENABLED
78+
//#define HAL_SD_MODULE_ENABLED
79+
//#define HAL_SMARTCARD_MODULE_ENABLED
80+
#define HAL_SPI_MODULE_ENABLED
81+
//#define HAL_SRAM_MODULE_ENABLED
82+
#define HAL_TIM_MODULE_ENABLED
83+
#define HAL_UART_MODULE_ENABLED
84+
//#define HAL_USART_MODULE_ENABLED
85+
//#define HAL_WWDG_MODULE_ENABLED
86+
87+
/* ########################## Oscillator Values adaptation ####################*/
88+
/**
89+
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
90+
* This value is used by the RCC HAL module to compute the system frequency
91+
* (when HSE is used as system clock source, directly or through the PLL).
92+
*/
93+
#if !defined (HSE_VALUE)
94+
#if defined(USE_STM3210C_EVAL)
95+
#define HSE_VALUE ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */
96+
#else
97+
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
98+
#endif
99+
#endif /* HSE_VALUE */
100+
101+
#if !defined (HSE_STARTUP_TIMEOUT)
102+
#define HSE_STARTUP_TIMEOUT ((uint32_t)100) /*!< Time out for HSE start up, in ms */
103+
#endif /* HSE_STARTUP_TIMEOUT */
104+
105+
/**
106+
* @brief Internal High Speed oscillator (HSI) value.
107+
* This value is used by the RCC HAL module to compute the system frequency
108+
* (when HSI is used as system clock source, directly or through the PLL).
109+
*/
110+
#if !defined (HSI_VALUE)
111+
#define HSI_VALUE ((uint32_t)8000000) /*!< Value of the Internal oscillator in Hz*/
112+
#endif /* HSI_VALUE */
113+
114+
/**
115+
* @brief External Low Speed oscillator (LSE) value.
116+
* This value is used by the UART, RTC HAL module to compute the system frequency
117+
*/
118+
#if !defined (LSE_VALUE)
119+
#define LSE_VALUE ((uint32_t)32768) /*!< Value of the External oscillator in Hz*/
120+
#endif /* LSE_VALUE */
121+
122+
123+
#if !defined (LSE_STARTUP_TIMEOUT)
124+
#define LSE_STARTUP_TIMEOUT ((uint32_t)5000) /*!< Time out for LSE start up, in ms */
125+
#endif /* HSE_STARTUP_TIMEOUT */
126+
127+
128+
/* Tip: To avoid modifying this file each time you need to use different HSE,
129+
=== you can define the HSE value in your toolchain compiler preprocessor. */
130+
131+
/* ########################### System Configuration ######################### */
132+
/**
133+
* @brief This is the HAL system configuration section
134+
*/
135+
#define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */
136+
#define TICK_INT_PRIORITY ((uint32_t)0x000F) /*!< tick interrupt priority */
137+
#define USE_RTOS 0
138+
#define PREFETCH_ENABLE 1
139+
140+
/* ########################## Assert Selection ############################## */
141+
/**
142+
* @brief Uncomment the line below to expanse the "assert_param" macro in the
143+
* HAL drivers code
144+
*/
145+
/*#define USE_FULL_ASSERT 1*/
146+
147+
148+
/* ################## Ethernet peripheral configuration ##################### */
149+
150+
/* Section 1 : Ethernet peripheral configuration */
151+
152+
/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
153+
#define MAC_ADDR0 2
154+
#define MAC_ADDR1 0
155+
#define MAC_ADDR2 0
156+
#define MAC_ADDR3 0
157+
#define MAC_ADDR4 0
158+
#define MAC_ADDR5 0
159+
160+
/* Definition of the Ethernet driver buffers size and count */
161+
#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
162+
#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
163+
#define ETH_RXBUFNB ((uint32_t)8) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
164+
#define ETH_TXBUFNB ((uint32_t)4) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
165+
166+
/* Section 2: PHY configuration section */
167+
168+
/* DP83848 PHY Address*/
169+
#define DP83848_PHY_ADDRESS 0x01
170+
/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
171+
#define PHY_RESET_DELAY ((uint32_t)0x000000FF)
172+
/* PHY Configuration delay */
173+
#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFF)
174+
175+
#define PHY_READ_TO ((uint32_t)0x0000FFFF)
176+
#define PHY_WRITE_TO ((uint32_t)0x0000FFFF)
177+
178+
/* Section 3: Common PHY Registers */
179+
180+
#define PHY_BCR ((uint16_t)0x00) /*!< Transceiver Basic Control Register */
181+
#define PHY_BSR ((uint16_t)0x01) /*!< Transceiver Basic Status Register */
182+
183+
#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */
184+
#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */
185+
#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */
186+
#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */
187+
#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */
188+
#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */
189+
#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */
190+
#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */
191+
#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */
192+
#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */
193+
194+
#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */
195+
#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */
196+
#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */
197+
198+
/* Section 4: Extended PHY Registers */
199+
200+
#define PHY_SR ((uint16_t)0x10) /*!< PHY status register Offset */
201+
#define PHY_MICR ((uint16_t)0x11) /*!< MII Interrupt Control Register */
202+
#define PHY_MISR ((uint16_t)0x12) /*!< MII Interrupt Status and Misc. Control Register */
203+
204+
#define PHY_LINK_STATUS ((uint16_t)0x0001) /*!< PHY Link mask */
205+
#define PHY_SPEED_STATUS ((uint16_t)0x0002) /*!< PHY Speed mask */
206+
#define PHY_DUPLEX_STATUS ((uint16_t)0x0004) /*!< PHY Duplex mask */
207+
208+
#define PHY_MICR_INT_EN ((uint16_t)0x0002) /*!< PHY Enable interrupts */
209+
#define PHY_MICR_INT_OE ((uint16_t)0x0001) /*!< PHY Enable output interrupt events */
210+
211+
#define PHY_MISR_LINK_INT_EN ((uint16_t)0x0020) /*!< Enable Interrupt on change of link status */
212+
#define PHY_LINK_INTERRUPT ((uint16_t)0x2000) /*!< PHY link status interrupt mask */
213+
214+
215+
216+
/* Includes ------------------------------------------------------------------*/
217+
/**
218+
* @brief Include module's header file
219+
*/
220+
221+
#ifdef HAL_RCC_MODULE_ENABLED
222+
#include "stm32f1xx_hal_rcc.h"
223+
#endif /* HAL_RCC_MODULE_ENABLED */
224+
225+
#ifdef HAL_GPIO_MODULE_ENABLED
226+
#include "stm32f1xx_hal_gpio.h"
227+
#endif /* HAL_GPIO_MODULE_ENABLED */
228+
229+
#ifdef HAL_DMA_MODULE_ENABLED
230+
#include "stm32f1xx_hal_dma.h"
231+
#endif /* HAL_DMA_MODULE_ENABLED */
232+
233+
#ifdef HAL_ETH_MODULE_ENABLED
234+
#include "stm32f1xx_hal_eth.h"
235+
#endif /* HAL_ETH_MODULE_ENABLED */
236+
237+
#ifdef HAL_CAN_MODULE_ENABLED
238+
#include "stm32f1xx_hal_can.h"
239+
#endif /* HAL_CAN_MODULE_ENABLED */
240+
241+
#ifdef HAL_CEC_MODULE_ENABLED
242+
#include "stm32f1xx_hal_cec.h"
243+
#endif /* HAL_CEC_MODULE_ENABLED */
244+
245+
#ifdef HAL_CORTEX_MODULE_ENABLED
246+
#include "stm32f1xx_hal_cortex.h"
247+
#endif /* HAL_CORTEX_MODULE_ENABLED */
248+
249+
#ifdef HAL_ADC_MODULE_ENABLED
250+
#include "stm32f1xx_hal_adc.h"
251+
#endif /* HAL_ADC_MODULE_ENABLED */
252+
253+
#ifdef HAL_CRC_MODULE_ENABLED
254+
#include "stm32f1xx_hal_crc.h"
255+
#endif /* HAL_CRC_MODULE_ENABLED */
256+
257+
#ifdef HAL_DAC_MODULE_ENABLED
258+
#include "stm32f1xx_hal_dac.h"
259+
#endif /* HAL_DAC_MODULE_ENABLED */
260+
261+
#ifdef HAL_FLASH_MODULE_ENABLED
262+
#include "stm32f1xx_hal_flash.h"
263+
#endif /* HAL_FLASH_MODULE_ENABLED */
264+
265+
#ifdef HAL_SRAM_MODULE_ENABLED
266+
#include "stm32f1xx_hal_sram.h"
267+
#endif /* HAL_SRAM_MODULE_ENABLED */
268+
269+
#ifdef HAL_NOR_MODULE_ENABLED
270+
#include "stm32f1xx_hal_nor.h"
271+
#endif /* HAL_NOR_MODULE_ENABLED */
272+
273+
#ifdef HAL_I2C_MODULE_ENABLED
274+
#include "stm32f1xx_hal_i2c.h"
275+
#endif /* HAL_I2C_MODULE_ENABLED */
276+
277+
#ifdef HAL_I2S_MODULE_ENABLED
278+
#include "stm32f1xx_hal_i2s.h"
279+
#endif /* HAL_I2S_MODULE_ENABLED */
280+
281+
#ifdef HAL_IWDG_MODULE_ENABLED
282+
#include "stm32f1xx_hal_iwdg.h"
283+
#endif /* HAL_IWDG_MODULE_ENABLED */
284+
285+
#ifdef HAL_PWR_MODULE_ENABLED
286+
#include "stm32f1xx_hal_pwr.h"
287+
#endif /* HAL_PWR_MODULE_ENABLED */
288+
289+
#ifdef HAL_RTC_MODULE_ENABLED
290+
#include "stm32f1xx_hal_rtc.h"
291+
#endif /* HAL_RTC_MODULE_ENABLED */
292+
293+
#ifdef HAL_PCCARD_MODULE_ENABLED
294+
#include "stm32f1xx_hal_pccard.h"
295+
#endif /* HAL_PCCARD_MODULE_ENABLED */
296+
297+
#ifdef HAL_SD_MODULE_ENABLED
298+
#include "stm32f1xx_hal_sd.h"
299+
#endif /* HAL_SD_MODULE_ENABLED */
300+
301+
#ifdef HAL_NAND_MODULE_ENABLED
302+
#include "stm32f1xx_hal_nand.h"
303+
#endif /* HAL_NAND_MODULE_ENABLED */
304+
305+
#ifdef HAL_SPI_MODULE_ENABLED
306+
#include "stm32f1xx_hal_spi.h"
307+
#endif /* HAL_SPI_MODULE_ENABLED */
308+
309+
#ifdef HAL_TIM_MODULE_ENABLED
310+
#include "stm32f1xx_hal_tim.h"
311+
#endif /* HAL_TIM_MODULE_ENABLED */
312+
313+
#ifdef HAL_UART_MODULE_ENABLED
314+
#include "stm32f1xx_hal_uart.h"
315+
#endif /* HAL_UART_MODULE_ENABLED */
316+
317+
#ifdef HAL_USART_MODULE_ENABLED
318+
#include "stm32f1xx_hal_usart.h"
319+
#endif /* HAL_USART_MODULE_ENABLED */
320+
321+
#ifdef HAL_IRDA_MODULE_ENABLED
322+
#include "stm32f1xx_hal_irda.h"
323+
#endif /* HAL_IRDA_MODULE_ENABLED */
324+
325+
#ifdef HAL_SMARTCARD_MODULE_ENABLED
326+
#include "stm32f1xx_hal_smartcard.h"
327+
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
328+
329+
#ifdef HAL_WWDG_MODULE_ENABLED
330+
#include "stm32f1xx_hal_wwdg.h"
331+
#endif /* HAL_WWDG_MODULE_ENABLED */
332+
333+
#ifdef HAL_PCD_MODULE_ENABLED
334+
#include "stm32f1xx_hal_pcd.h"
335+
#endif /* HAL_PCD_MODULE_ENABLED */
336+
337+
338+
#ifdef HAL_HCD_MODULE_ENABLED
339+
#include "stm32f1xx_hal_hcd.h"
340+
#endif /* HAL_HCD_MODULE_ENABLED */
341+
342+
343+
/* Exported macro ------------------------------------------------------------*/
344+
#ifdef USE_FULL_ASSERT
345+
/**
346+
* @brief The assert_param macro is used for function's parameters check.
347+
* @param expr: If expr is false, it calls assert_failed function
348+
* which reports the name of the source file and the source
349+
* line number of the call that failed.
350+
* If expr is true, it returns no value.
351+
* @retval None
352+
*/
353+
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
354+
/* Exported functions ------------------------------------------------------- */
355+
void assert_failed(uint8_t* file, uint32_t line);
356+
#else
357+
#define assert_param(expr) ((void)0)
358+
#endif /* USE_FULL_ASSERT */
359+
360+
#ifdef __cplusplus
361+
}
362+
#endif
363+
364+
#endif /* __STM32F1xx_HAL_CONF_H */
365+
366+
367+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

‎variants/DISCO_F100RB/variant.cpp

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
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 "variant.h"
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
// Pin number following UM0919 table 4,5 and 6
26+
const PinName digitalPin[] = {
27+
// P1 connector
28+
PC13, //D0
29+
PC0, //D1
30+
PC1, //D2
31+
PC2, //D3
32+
PC3, //D4
33+
PA0, //D5 - User button
34+
PA1, //D6
35+
PA2, //D7
36+
PA3, //D8
37+
PA4, //D9
38+
PA5, //D10
39+
PA6, //D11
40+
PA7, //D12
41+
PC4, //D13
42+
PC5, //D14
43+
PB0, //D15
44+
PB1, //D16
45+
PB2, //D17
46+
// P2 connector
47+
PC6, //D18
48+
PC7, //D19
49+
PC8, //D20 - LED blue
50+
PC9, //D21 - LED green
51+
PA8, //D22
52+
PA9, //D23
53+
PA10, //D24
54+
PA11, //D25
55+
PA12, //D26
56+
PA13, //D27
57+
PA14, //D28
58+
PA15, //D29
59+
PC10, //D30
60+
PC11, //D31
61+
PC12, //D32
62+
PD2, //D33
63+
PB3, //D34
64+
PB4, //D35
65+
PB5, //D36 - I2C SCL
66+
PB6, //D37 - I2C SDA
67+
PB7, //D38
68+
PB8, //D39
69+
PB9, //D40
70+
// P3 connector
71+
PB10, //D41
72+
PB11, //D42
73+
PB12, //D43 - SPI SS
74+
PB13, //D44 - SPI SCLK
75+
PB14, //D45 - SPI MISO
76+
PB15, //D46 - SPI MOSI
77+
// Duplicated pins in order to be aligned with PinMap_ADC
78+
PC0, //D47/A0 = D0
79+
PC1, //D48/A1 = D1
80+
PC2, //D49/A2 = D2
81+
PC3, //D50/A3 = D3
82+
PA0, //D51/A4 = D4
83+
PA1, //D52/A5 = D5
84+
PA2, //D53/A6 = D6
85+
PA3, //D54/A7 = D7
86+
PA4, //D55/A8 = D8
87+
PA5, //D56/A9 = D9
88+
PA6, //D57/A10 = D10
89+
PA7, //D58/A11 = D11
90+
PC4, //D59/A12 = D12
91+
PC5, //D60/A13 = D13
92+
PB0, //D61/A14 = D14
93+
PB1 //D62/A15 = D15
94+
};
95+
96+
#ifdef __cplusplus
97+
}
98+
#endif
99+
100+
/*
101+
* UART objects
102+
*/
103+
104+
HardwareSerial Serial(PA3, PA2);
105+
#ifdef ENABLE_SERIAL1
106+
HardwareSerial Serial1(PA10, PA9);
107+
#endif
108+
#ifdef ENABLE_SERIAL2
109+
HardwareSerial Serial2(PB11, PB10);
110+
#endif
111+
112+
void serialEvent() __attribute__((weak));
113+
void serialEvent() { }
114+
#ifdef ENABLE_SERIAL1
115+
void serialEvent1() __attribute__((weak));
116+
void serialEvent1() { }
117+
#endif
118+
#ifdef ENABLE_SERIAL2
119+
void serialEvent2() __attribute__((weak));
120+
void serialEvent2() { }
121+
#endif
122+
123+
void serialEventRun(void)
124+
{
125+
if (Serial.available()) serialEvent();
126+
#ifdef ENABLE_SERIAL1
127+
if (Serial1.available()) serialEvent1();
128+
#endif
129+
#ifdef ENABLE_SERIAL2
130+
if (Serial2.available()) serialEvent2();
131+
#endif
132+
}
133+
134+
// ----------------------------------------------------------------------------
135+
136+
#ifdef __cplusplus
137+
extern "C" {
138+
#endif
139+
140+
/**
141+
* @brief System Clock Configuration
142+
* The system Clock is configured as follow :
143+
* System Clock source = PLL (HSE)
144+
* SYSCLK(Hz) = 24000000
145+
* HCLK(Hz) = 24000000
146+
* AHB Prescaler = 1
147+
* APB1 Prescaler = 1
148+
* APB2 Prescaler = 1
149+
* PLL_Source = HSE
150+
* PLL_Mul = 6
151+
* Flash Latency(WS) = 0
152+
* ADC Prescaler = 2
153+
* @param None
154+
* @retval None
155+
*/
156+
WEAK void SystemClock_Config(void)
157+
{
158+
RCC_OscInitTypeDef RCC_OscInitStruct;
159+
RCC_ClkInitTypeDef RCC_ClkInitStruct;
160+
RCC_PeriphCLKInitTypeDef PeriphClkInit;
161+
162+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
163+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
164+
RCC_OscInitStruct.HSICalibrationValue = 16;
165+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
166+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
167+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;
168+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
169+
{
170+
while(1);
171+
}
172+
173+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
174+
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
175+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
176+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
177+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
178+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
179+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
180+
{
181+
while(1);
182+
}
183+
184+
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;
185+
PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV2;
186+
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
187+
{
188+
while(1);
189+
}
190+
191+
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
192+
193+
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
194+
195+
/* SysTick_IRQn interrupt configuration */
196+
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
197+
}
198+
199+
#ifdef __cplusplus
200+
}
201+
#endif

‎variants/DISCO_F100RB/variant.h

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
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+
/*----------------------------------------------------------------------------
23+
* Headers
24+
*----------------------------------------------------------------------------*/
25+
26+
#include "Arduino.h"
27+
28+
#ifdef __cplusplus
29+
extern "C"{
30+
#endif // __cplusplus
31+
32+
/*----------------------------------------------------------------------------
33+
* Pins
34+
*----------------------------------------------------------------------------*/
35+
#include "PeripheralPins.h"
36+
37+
extern const PinName digitalPin[];
38+
39+
enum {
40+
D0, D1, D2, D3, D4, D5, D6, D7, D8, D9,
41+
D10, D11, D12, D13, D14, D15, D16, D17, D18, D19,
42+
D20, D21, D22, D23, D24, D25, D26, D27, D28, D29,
43+
D30, D31, D32, D33, D34, D35, D36, D37, D38, D39,
44+
D40, D41, D42, D43, D44, D45, D46, D47, D48, D49,
45+
D50, D51, D52, D53, D54, D55, D56, D57, D58, D59,
46+
D60, D61, D62,
47+
DEND
48+
};
49+
50+
enum {
51+
A_START_AFTER = D46,
52+
A0, A1, A2, A3, A4, A5, A6, A7, A8, A9,
53+
A10, A11, A12, A13, A14, A15,
54+
AEND
55+
};
56+
57+
//ADC resolution is 12bits
58+
#define ADC_RESOLUTION 12
59+
#define DACC_RESOLUTION 12
60+
61+
//PWR resolution
62+
#define PWM_RESOLUTION 8
63+
#define PWM_FREQUENCY 1000
64+
#define PWM_MAX_DUTY_CYCLE 255
65+
66+
//On-board LED pin number
67+
#define LED_BUILTIN 21
68+
#define LED_GREEN LED_BUILTIN
69+
#define LED_BLUE 20
70+
71+
//On-board user button
72+
#define USER_BTN 5
73+
74+
//SPI definitions
75+
//define 16 channels. As many channel as digital IOs
76+
#define SPI_CHANNELS_NUM 16
77+
78+
//default chip salect pin
79+
#define BOARD_SPI_DEFAULT_SS 43
80+
81+
//In case SPI CS channel is not used we define a default one
82+
#define BOARD_SPI_OWN_SS SPI_CHANNELS_NUM
83+
84+
#define SS BOARD_SPI_DEFAULT_SS
85+
#define SS1 40
86+
#define SS2 41
87+
#define SS3 42
88+
#define MOSI 46
89+
#define MISO 45
90+
#define SCLK 44
91+
#define SCK SCLK
92+
93+
//I2C Definitions
94+
#define SDA 38
95+
#define SCL 37
96+
97+
//Timer Definitions
98+
//Do not use timer used by PWM pins when possible. See PinMap_PWM.
99+
#define TIMER_TONE TIM15
100+
#define TIMER_UART_EMULATED TIM16
101+
102+
//Do not use basic timer: OC is required
103+
#define TIMER_SERVO TIM17 //TODO: advanced-control timers don't work
104+
105+
#define DEBUG_UART ((USART_TypeDef *) USART2)
106+
107+
// Serial Pin Firmata
108+
#define PIN_SERIAL_RX 8
109+
#define PIN_SERIAL_TX 7
110+
#define PIN_SERIAL1_RX 24
111+
#define PIN_SERIAL1_TX 23
112+
#define PIN_SERIAL2_RX 42
113+
#define PIN_SERIAL2_TX 41
114+
115+
#ifdef __cplusplus
116+
} // extern "C"
117+
#endif
118+
/*----------------------------------------------------------------------------
119+
* Arduino objects - C++ only
120+
*----------------------------------------------------------------------------*/
121+
122+
#ifdef __cplusplus
123+
extern HardwareSerial Serial;
124+
extern HardwareSerial Serial1;
125+
extern HardwareSerial Serial2;
126+
127+
// These serial port names are intended to allow libraries and architecture-neutral
128+
// sketches to automatically default to the correct port name for a particular type
129+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
130+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
131+
//
132+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
133+
//
134+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
135+
//
136+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
137+
//
138+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
139+
//
140+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
141+
// pins are NOT connected to anything by default.
142+
#define SERIAL_PORT_MONITOR Serial
143+
#define SERIAL_PORT_HARDWARE Serial
144+
#endif
145+
146+
#endif /* _VARIANT_ARDUINO_STM32_ */

0 commit comments

Comments
 (0)
Please sign in to comment.