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 60e96b2

Browse files
authoredNov 2, 2018
Merge pull request #367 from fpistm/pr366-review
Add STM32F030 demo board
2 parents c8ce456 + 53fd196 commit 60e96b2

File tree

7 files changed

+1010
-0
lines changed

7 files changed

+1010
-0
lines changed
 

‎boards.txt

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,35 @@ Disco.menu.upload_method.STLink.upload.tool=stlink_upload
467467
# Other boards
468468

469469
###############################
470+
# Generic F0
471+
GenF0.name=Generic STM32F0 series
472+
473+
GenF0.build.core=arduino
474+
GenF0.build.board=GenF0
475+
GenF0.build.extra_flags=-D{build.product_line} {build.xSerial}
476+
477+
# DEMO_F030F4 board
478+
# Support: Serial1 (USART1 on PA3, PA2)
479+
GenF0.menu.pnum.DEMO_F030F4=STM32F030F4 Demo board
480+
GenF0.menu.pnum.DEMO_F030F4.upload.maximum_data_size=4096
481+
GenF0.menu.pnum.DEMO_F030F4.upload.maximum_size=16384
482+
GenF0.menu.pnum.DEMO_F030F4.build.mcu=cortex-m0
483+
GenF0.menu.pnum.DEMO_F030F4.build.board=DEMO_F030F4
484+
GenF0.menu.pnum.DEMO_F030F4.build.series=STM32F0xx
485+
GenF0.menu.pnum.DEMO_F030F4.build.product_line=STM32F030x6
486+
GenF0.menu.pnum.DEMO_F030F4.build.variant=DEMO_F030F4
487+
GenF0.menu.pnum.DEMO_F030F4.build.cmsis_lib_gcc=arm_cortexM0l_math
488+
489+
# Upload menu
490+
GenF0.menu.upload_method.STLinkMethod=STLink
491+
GenF0.menu.upload_method.STLinkMethod.upload.protocol=STLink
492+
GenF0.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
493+
494+
GenF0.menu.upload_method.serialMethod=Serial
495+
GenF0.menu.upload_method.serialMethod.upload.protocol=maple_serial
496+
GenF0.menu.upload_method.serialMethod.upload.tool=serial_upload
497+
498+
################################################################################
470499
# Generic F103
471500
GenF103.name=Generic STM32F103 series
472501

@@ -705,6 +734,12 @@ Disco.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE
705734
Disco.menu.xserial.disabled=Disabled (No Serial)
706735
Disco.menu.xserial.disabled.build.xSerial=
707736

737+
GenF0.menu.xserial.generic=Enabled with generic Serial
738+
GenF0.menu.xserial.none=Enabled without generic Serial
739+
GenF0.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE
740+
GenF0.menu.xserial.disabled=Disabled (No Serial)
741+
GenF0.menu.xserial.disabled.build.xSerial=
742+
708743
GenF103.menu.xserial.generic=Enabled with generic Serial
709744
GenF103.menu.xserial.none=Enabled without generic Serial
710745
GenF103.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE
@@ -833,6 +868,24 @@ Disco.menu.opt.o3lto.build.flags.optimize=-O3 -flto
833868
Disco.menu.opt.ogstd=Debug (-g)
834869
Disco.menu.opt.ogstd.build.flags.optimize=-g -Og
835870

871+
GenF0.menu.opt.osstd=Smallest (-Os default)
872+
GenF0.menu.opt.oslto=Smallest (-Os) with LTO
873+
GenF0.menu.opt.oslto.build.flags.optimize=-Os -flto
874+
GenF0.menu.opt.o1std=Fast (-O1)
875+
GenF0.menu.opt.o1std.build.flags.optimize=-O1
876+
GenF0.menu.opt.o1lto=Fast (-O1) with LTO
877+
GenF0.menu.opt.o1lto.build.flags.optimize=-O1 -flto
878+
GenF0.menu.opt.o2std=Faster (-O2)
879+
GenF0.menu.opt.o2std.build.flags.optimize=-O2
880+
GenF0.menu.opt.o2lto=Faster (-O2) with LTO
881+
GenF0.menu.opt.o2lto.build.flags.optimize=-O2 -flto
882+
GenF0.menu.opt.o3std=Fastest (-O3)
883+
GenF0.menu.opt.o3std.build.flags.optimize=-O3
884+
GenF0.menu.opt.o3lto=Fastest (-O3) with LTO
885+
GenF0.menu.opt.o3lto.build.flags.optimize=-O3 -flto
886+
GenF0.menu.opt.ogstd=Debug (-g)
887+
GenF0.menu.opt.ogstd.build.flags.optimize=-g -Og
888+
836889
GenF103.menu.opt.osstd=Smallest (-Os default)
837890
GenF103.menu.opt.oslto=Smallest (-Os) with LTO
838891
GenF103.menu.opt.oslto.build.flags.optimize=-Os -flto
@@ -965,6 +1018,16 @@ Disco.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs -u _printf_float
9651018
Disco.menu.rtlib.full=Newlib Standard
9661019
Disco.menu.rtlib.full.build.flags.ldspecs=
9671020

1021+
GenF0.menu.rtlib.nano=Newlib Nano (default)
1022+
GenF0.menu.rtlib.nanofp=Newlib Nano + Float Printf
1023+
GenF0.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs -u _printf_float
1024+
GenF0.menu.rtlib.nanofs=Newlib Nano + Float Scanf
1025+
GenF0.menu.rtlib.nanofs.build.flags.ldspecs=--specs=nano.specs -u _scanf_float
1026+
GenF0.menu.rtlib.nanofps=Newlib Nano + Float Printf/Scanf
1027+
GenF0.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs -u _printf_float -u _scanf_float
1028+
GenF0.menu.rtlib.full=Newlib Standard
1029+
GenF0.menu.rtlib.full.build.flags.ldspecs=
1030+
9681031
GenF103.menu.rtlib.nano=Newlib Nano (default)
9691032
GenF103.menu.rtlib.nanofp=Newlib Nano + Float Printf
9701033
GenF103.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs -u _printf_float

‎variants/DEMO_F030F4/PeripheralPins.c

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
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+
* Automatically generated from STM32F030F4Px.xml
30+
*/
31+
#include "Arduino.h"
32+
#include "PeripheralPins.h"
33+
34+
/* =====
35+
* Note: Commented lines are alternative possibilities which are not used per default.
36+
* If you change them, you will have to know what you do
37+
* =====
38+
*/
39+
40+
41+
//*** ADC ***
42+
#ifdef HAL_ADC_MODULE_ENABLED
43+
const PinMap PinMap_ADC[] = {
44+
{PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC_IN0
45+
{PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC_IN1
46+
{PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC_IN2
47+
{PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC_IN3
48+
{PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC_IN4
49+
{PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC_IN5 - LED
50+
{PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC_IN6
51+
{PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC_IN7
52+
{PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC_IN9
53+
{NC, NP, 0}
54+
};
55+
#endif
56+
57+
//*** DAC ***
58+
//*** No DAC ***
59+
60+
//*** I2C ***
61+
62+
#ifdef HAL_I2C_MODULE_ENABLED
63+
const PinMap PinMap_I2C_SDA[] = {
64+
{PA_10, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
65+
{NC, NP, 0}
66+
};
67+
#endif
68+
69+
#ifdef HAL_I2C_MODULE_ENABLED
70+
const PinMap PinMap_I2C_SCL[] = {
71+
{PA_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
72+
{NC, NP, 0}
73+
};
74+
#endif
75+
76+
//*** PWM ***
77+
78+
#ifdef HAL_TIM_MODULE_ENABLED
79+
const PinMap PinMap_PWM[] = {
80+
{PA_4, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM14, 1, 0)}, // TIM14_CH1
81+
{PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 1, 0)}, // TIM3_CH1
82+
// {PA_6, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM16, 1, 0)}, // TIM16_CH1
83+
// {PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 1, 1)}, // TIM1_CH1N
84+
{PA_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 2, 0)}, // TIM3_CH2
85+
// {PA_7, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM14, 1, 0)}, // TIM14_CH1
86+
// {PA_7, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM17, 1, 0)}, // TIM17_CH1
87+
{PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 2, 0)}, // TIM1_CH2
88+
{PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 0)}, // TIM1_CH3
89+
// {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 1)}, // TIM1_CH3N
90+
{PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 4, 0)}, // TIM3_CH4
91+
// {PB_1, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_TIM14, 1, 0)}, // TIM14_CH1
92+
{NC, NP, 0}
93+
};
94+
#endif
95+
96+
//*** SERIAL ***
97+
98+
#ifdef HAL_UART_MODULE_ENABLED
99+
const PinMap PinMap_UART_TX[] = {
100+
{PA_2, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
101+
{PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
102+
{PA_14, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
103+
{NC, NP, 0}
104+
};
105+
#endif
106+
107+
#ifdef HAL_UART_MODULE_ENABLED
108+
const PinMap PinMap_UART_RX[] = {
109+
{PA_3, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
110+
{PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
111+
{NC, NP, 0}
112+
};
113+
#endif
114+
115+
#ifdef HAL_UART_MODULE_ENABLED
116+
const PinMap PinMap_UART_RTS[] = {
117+
{PA_1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
118+
{NC, NP, 0}
119+
};
120+
#endif
121+
122+
#ifdef HAL_UART_MODULE_ENABLED
123+
const PinMap PinMap_UART_CTS[] = {
124+
{PA_0, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
125+
{NC, NP, 0}
126+
};
127+
#endif
128+
129+
//*** SPI ***
130+
131+
#ifdef HAL_SPI_MODULE_ENABLED
132+
const PinMap PinMap_SPI_MOSI[] = {
133+
{PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
134+
{NC, NP, 0}
135+
};
136+
#endif
137+
138+
#ifdef HAL_SPI_MODULE_ENABLED
139+
const PinMap PinMap_SPI_MISO[] = {
140+
{PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
141+
{NC, NP, 0}
142+
};
143+
#endif
144+
145+
#ifdef HAL_SPI_MODULE_ENABLED
146+
const PinMap PinMap_SPI_SCLK[] = {
147+
{PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, // LED
148+
{NC, NP, 0}
149+
};
150+
#endif
151+
152+
#ifdef HAL_SPI_MODULE_ENABLED
153+
const PinMap PinMap_SPI_SSEL[] = {
154+
{PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
155+
{NC, NP, 0}
156+
};
157+
#endif
158+
159+
160+
//*** CAN ***
161+
//*** No CAN_RD ***
162+
163+
//*** No CAN_TD ***
164+
165+
//*** ETHERNET ***
166+
167+
//*** No Ethernet ***
168+
169+
//*** QUADSPI ***
170+
171+
//*** No QUADSPI ***

‎variants/DEMO_F030F4/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 = 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

‎variants/DEMO_F030F4/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+
** Abstract : Linker script for STM32F030F4Px Device with
8+
** 16KByte FLASH, 4KByte 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 = 0x20001000; /* 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 = 4K
64+
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 16K
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 :
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+
Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
/**
2+
******************************************************************************
3+
* @file stm32f0xx_hal_conf.h
4+
* @author MCD Application Team
5+
* @brief HAL configuration file.
6+
******************************************************************************
7+
* @attention
8+
*
9+
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
10+
*
11+
* Redistribution and use in source and binary forms, with or without modification,
12+
* are permitted provided that the following conditions are met:
13+
* 1. Redistributions of source code must retain the above copyright notice,
14+
* this list of conditions and the following disclaimer.
15+
* 2. Redistributions in binary form must reproduce the above copyright notice,
16+
* this list of conditions and the following disclaimer in the documentation
17+
* and/or other materials provided with the distribution.
18+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
19+
* may be used to endorse or promote products derived from this software
20+
* without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
*
33+
******************************************************************************
34+
*/
35+
36+
/* Define to prevent recursive inclusion -------------------------------------*/
37+
#ifndef __STM32F0xx_HAL_CONF_H
38+
#define __STM32F0xx_HAL_CONF_H
39+
40+
#ifdef __cplusplus
41+
extern "C" {
42+
#endif
43+
44+
/* Exported types ------------------------------------------------------------*/
45+
/* Exported constants --------------------------------------------------------*/
46+
47+
/* ########################## Module Selection ############################## */
48+
/**
49+
* @brief This is the list of modules to be used in the HAL driver
50+
*/
51+
#define HAL_MODULE_ENABLED
52+
#define HAL_ADC_MODULE_ENABLED
53+
/*#define HAL_CAN_MODULE_ENABLED*/
54+
/*#define HAL_CEC_MODULE_ENABLED*/
55+
/*#define HAL_COMP_MODULE_ENABLED*/
56+
#define HAL_CORTEX_MODULE_ENABLED
57+
#define HAL_CRC_MODULE_ENABLED
58+
/*#define HAL_DAC_MODULE_ENABLED*/
59+
#define HAL_DMA_MODULE_ENABLED
60+
#define HAL_FLASH_MODULE_ENABLED
61+
#define HAL_GPIO_MODULE_ENABLED
62+
#define HAL_I2C_MODULE_ENABLED
63+
/*#define HAL_I2S_MODULE_ENABLED*/
64+
/*#define HAL_IRDA_MODULE_ENABLED*/
65+
#define HAL_IWDG_MODULE_ENABLED
66+
/*#define HAL_PCD_MODULE_ENABLED*/
67+
/*#define HAL_PWR_MODULE_ENABLED*/
68+
#define HAL_RCC_MODULE_ENABLED
69+
/*#define HAL_RTC_MODULE_ENABLED*/
70+
/*#define HAL_SMARTCARD_MODULE_ENABLED*/
71+
/*#define HAL_SMBUS_MODULE_ENABLED*/
72+
#define HAL_SPI_MODULE_ENABLED
73+
#define HAL_TIM_MODULE_ENABLED
74+
/*#define HAL_TSC_MODULE_ENABLED*/
75+
/*#define HAL_UART_MODULE_ENABLED*/
76+
/*#define HAL_USART_MODULE_ENABLED*/
77+
/*#define HAL_WWDG_MODULE_ENABLED*/
78+
79+
/* ######################### Oscillator Values adaptation ################### */
80+
/**
81+
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
82+
* This value is used by the RCC HAL module to compute the system frequency
83+
* (when HSE is used as system clock source, directly or through the PLL).
84+
*/
85+
#if !defined (HSE_VALUE)
86+
#define HSE_VALUE 8000000U /*!< Value of the External oscillator in Hz */
87+
#endif /* HSE_VALUE */
88+
89+
/**
90+
* @brief In the following line adjust the External High Speed oscillator (HSE) Startup
91+
* Timeout value
92+
*/
93+
#if !defined (HSE_STARTUP_TIMEOUT)
94+
#define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */
95+
#endif /* HSE_STARTUP_TIMEOUT */
96+
97+
/**
98+
* @brief Internal High Speed oscillator (HSI) value.
99+
* This value is used by the RCC HAL module to compute the system frequency
100+
* (when HSI is used as system clock source, directly or through the PLL).
101+
*/
102+
#if !defined (HSI_VALUE)
103+
#define HSI_VALUE 8000000U /*!< Value of the Internal oscillator in Hz*/
104+
#endif /* HSI_VALUE */
105+
106+
/**
107+
* @brief In the following line adjust the Internal High Speed oscillator (HSI) Startup
108+
* Timeout value
109+
*/
110+
#if !defined (HSI_STARTUP_TIMEOUT)
111+
#define HSI_STARTUP_TIMEOUT 5000U /*!< Time out for HSI start up */
112+
#endif /* HSI_STARTUP_TIMEOUT */
113+
114+
/**
115+
* @brief Internal High Speed oscillator for ADC (HSI14) value.
116+
*/
117+
#if !defined (HSI14_VALUE)
118+
#define HSI14_VALUE 14000000U /*!< Value of the Internal High Speed oscillator for ADC in Hz.
119+
The real value may vary depending on the variations
120+
in voltage and temperature. */
121+
#endif /* HSI14_VALUE */
122+
123+
/**
124+
* @brief Internal High Speed oscillator for USB (HSI48) value.
125+
*/
126+
#if !defined (HSI48_VALUE)
127+
#define HSI48_VALUE 48000000U /*!< Value of the Internal High Speed oscillator for USB in Hz.
128+
The real value may vary depending on the variations
129+
in voltage and temperature. */
130+
#endif /* HSI48_VALUE */
131+
132+
/**
133+
* @brief Internal Low Speed oscillator (LSI) value.
134+
*/
135+
#if !defined (LSI_VALUE)
136+
#define LSI_VALUE 40000U
137+
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
138+
The real value may vary depending on the variations
139+
in voltage and temperature. */
140+
/**
141+
* @brief External Low Speed oscillator (LSE) value.
142+
*/
143+
#if !defined (LSE_VALUE)
144+
#define LSE_VALUE 32768U /*!< Value of the External Low Speed oscillator in Hz */
145+
#endif /* LSE_VALUE */
146+
147+
/**
148+
* @brief Time out for LSE start up value in ms.
149+
*/
150+
#if !defined (LSE_STARTUP_TIMEOUT)
151+
#define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */
152+
#endif /* LSE_STARTUP_TIMEOUT */
153+
154+
155+
/* Tip: To avoid modifying this file each time you need to use different HSE,
156+
=== you can define the HSE value in your toolchain compiler preprocessor. */
157+
158+
/* ########################### System Configuration ######################### */
159+
/**
160+
* @brief This is the HAL system configuration section
161+
*/
162+
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
163+
#define TICK_INT_PRIORITY ((uint32_t)(1U<<__NVIC_PRIO_BITS) - 1U) /*!< tick interrupt priority (lowest by default) */
164+
/* Warning: Must be set to higher priority for HAL_Delay() */
165+
/* and HAL_GetTick() usage under interrupt context */
166+
#define USE_RTOS 0U
167+
#define PREFETCH_ENABLE 1U
168+
#define INSTRUCTION_CACHE_ENABLE 0U
169+
#define DATA_CACHE_ENABLE 0U
170+
#define USE_SPI_CRC 0U
171+
172+
/* ########################## Assert Selection ############################## */
173+
/**
174+
* @brief Uncomment the line below to expanse the "assert_param" macro in the
175+
* HAL drivers code
176+
*/
177+
/*#define USE_FULL_ASSERT 1*/
178+
179+
/* Includes ------------------------------------------------------------------*/
180+
/**
181+
* @brief Include module's header file
182+
*/
183+
184+
#ifdef HAL_RCC_MODULE_ENABLED
185+
#include "stm32f0xx_hal_rcc.h"
186+
#endif /* HAL_RCC_MODULE_ENABLED */
187+
188+
#ifdef HAL_GPIO_MODULE_ENABLED
189+
#include "stm32f0xx_hal_gpio.h"
190+
#endif /* HAL_GPIO_MODULE_ENABLED */
191+
192+
#ifdef HAL_DMA_MODULE_ENABLED
193+
#include "stm32f0xx_hal_dma.h"
194+
#endif /* HAL_DMA_MODULE_ENABLED */
195+
196+
#ifdef HAL_CORTEX_MODULE_ENABLED
197+
#include "stm32f0xx_hal_cortex.h"
198+
#endif /* HAL_CORTEX_MODULE_ENABLED */
199+
200+
#ifdef HAL_ADC_MODULE_ENABLED
201+
#include "stm32f0xx_hal_adc.h"
202+
#endif /* HAL_ADC_MODULE_ENABLED */
203+
204+
#ifdef HAL_CAN_MODULE_ENABLED
205+
#include "stm32f0xx_hal_can.h"
206+
#endif /* HAL_CAN_MODULE_ENABLED */
207+
208+
#ifdef HAL_CEC_MODULE_ENABLED
209+
#include "stm32f0xx_hal_cec.h"
210+
#endif /* HAL_CEC_MODULE_ENABLED */
211+
212+
#ifdef HAL_COMP_MODULE_ENABLED
213+
#include "stm32f0xx_hal_comp.h"
214+
#endif /* HAL_COMP_MODULE_ENABLED */
215+
216+
#ifdef HAL_CRC_MODULE_ENABLED
217+
#include "stm32f0xx_hal_crc.h"
218+
#endif /* HAL_CRC_MODULE_ENABLED */
219+
220+
#ifdef HAL_DAC_MODULE_ENABLED
221+
#include "stm32f0xx_hal_dac.h"
222+
#endif /* HAL_DAC_MODULE_ENABLED */
223+
224+
#ifdef HAL_FLASH_MODULE_ENABLED
225+
#include "stm32f0xx_hal_flash.h"
226+
#endif /* HAL_FLASH_MODULE_ENABLED */
227+
228+
#ifdef HAL_I2C_MODULE_ENABLED
229+
#include "stm32f0xx_hal_i2c.h"
230+
#endif /* HAL_I2C_MODULE_ENABLED */
231+
232+
#ifdef HAL_I2S_MODULE_ENABLED
233+
#include "stm32f0xx_hal_i2s.h"
234+
#endif /* HAL_I2S_MODULE_ENABLED */
235+
236+
#ifdef HAL_IRDA_MODULE_ENABLED
237+
#include "stm32f0xx_hal_irda.h"
238+
#endif /* HAL_IRDA_MODULE_ENABLED */
239+
240+
#ifdef HAL_IWDG_MODULE_ENABLED
241+
#include "stm32f0xx_hal_iwdg.h"
242+
#endif /* HAL_IWDG_MODULE_ENABLED */
243+
244+
#ifdef HAL_PCD_MODULE_ENABLED
245+
#include "stm32f0xx_hal_pcd.h"
246+
#endif /* HAL_PCD_MODULE_ENABLED */
247+
248+
#ifdef HAL_PWR_MODULE_ENABLED
249+
#include "stm32f0xx_hal_pwr.h"
250+
#endif /* HAL_PWR_MODULE_ENABLED */
251+
252+
#ifdef HAL_RTC_MODULE_ENABLED
253+
#include "stm32f0xx_hal_rtc.h"
254+
#endif /* HAL_RTC_MODULE_ENABLED */
255+
256+
#ifdef HAL_SMARTCARD_MODULE_ENABLED
257+
#include "stm32f0xx_hal_smartcard.h"
258+
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
259+
260+
#ifdef HAL_SMBUS_MODULE_ENABLED
261+
#include "stm32f0xx_hal_smbus.h"
262+
#endif /* HAL_SMBUS_MODULE_ENABLED */
263+
264+
#ifdef HAL_SPI_MODULE_ENABLED
265+
#include "stm32f0xx_hal_spi.h"
266+
#endif /* HAL_SPI_MODULE_ENABLED */
267+
268+
#ifdef HAL_TIM_MODULE_ENABLED
269+
#include "stm32f0xx_hal_tim.h"
270+
#endif /* HAL_TIM_MODULE_ENABLED */
271+
272+
#ifdef HAL_TSC_MODULE_ENABLED
273+
#include "stm32f0xx_hal_tsc.h"
274+
#endif /* HAL_TSC_MODULE_ENABLED */
275+
276+
#ifdef HAL_UART_MODULE_ENABLED
277+
#include "stm32f0xx_hal_uart.h"
278+
#endif /* HAL_UART_MODULE_ENABLED */
279+
280+
#ifdef HAL_USART_MODULE_ENABLED
281+
#include "stm32f0xx_hal_usart.h"
282+
#endif /* HAL_USART_MODULE_ENABLED */
283+
284+
#ifdef HAL_WWDG_MODULE_ENABLED
285+
#include "stm32f0xx_hal_wwdg.h"
286+
#endif /* HAL_WWDG_MODULE_ENABLED */
287+
288+
/* Exported macro ------------------------------------------------------------*/
289+
#ifdef USE_FULL_ASSERT
290+
/**
291+
* @brief The assert_param macro is used for function's parameters check.
292+
* @param expr If expr is false, it calls assert_failed function
293+
* which reports the name of the source file and the source
294+
* line number of the call that failed.
295+
* If expr is true, it returns no value.
296+
* @retval None
297+
*/
298+
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((char *)__FILE__, __LINE__))
299+
/* Exported functions ------------------------------------------------------- */
300+
void assert_failed(char* file, uint32_t line);
301+
#else
302+
#define assert_param(expr) ((void)0U)
303+
#endif /* USE_FULL_ASSERT */
304+
305+
#ifdef __cplusplus
306+
}
307+
#endif
308+
309+
#endif /* __STM32F0xx_HAL_CONF_H */
310+
311+
312+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

‎variants/DEMO_F030F4/variant.cpp

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2017, 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+
31+
#include "variant.h"
32+
33+
#ifdef __cplusplus
34+
extern "C" {
35+
#endif
36+
37+
// Pin number
38+
// This array allows to wrap Arduino pin number(Dx or x)
39+
// to STM32 PinName (PX_n)
40+
const PinName digitalPin[] = {
41+
// USB connector on the top, MCU side
42+
// Left Side
43+
PA_0, //D0
44+
PA_1, //D1
45+
PA_2, //D2 - TX
46+
PA_3, //D3 - RX
47+
PA_4, //D4 - LED
48+
// Right side
49+
PA_5, //D5 - SCK
50+
PA_6, //D6 - MISO
51+
PA_7, //D7 - MOSI
52+
PB_1, //D8 - SS
53+
PA_9, //D9 - SCL (TX UART Header)
54+
PA_10, //D10 - SDA (RX UART Header)
55+
PA_13, //D11 - SWDIO
56+
PA_14, //D12 - SWCLK
57+
// Duplicated pins in order to be aligned with PinMap_ADC
58+
// A0 have to be greater than NUM_ANALOG_INPUTS
59+
PA_0, //D13/A0 ~ D0
60+
PA_1, //D14/A1 ~ D1
61+
PA_2, //D15/A2 ~ D2
62+
PA_3, //D16/A3 ~ D3
63+
PA_4, //D17/A4 ~ D4
64+
PA_5, //D18/A5 ~ D5
65+
PA_6, //D19/A6 ~ D6
66+
PA_7, //D20/A7 ~ D7
67+
PB_1 //D21/A8 ~ D8
68+
};
69+
70+
#ifdef __cplusplus
71+
}
72+
#endif
73+
74+
// ----------------------------------------------------------------------------
75+
76+
#ifdef __cplusplus
77+
extern "C" {
78+
#endif
79+
80+
/**
81+
* @brief System Clock Configuration
82+
* @param None
83+
* @retval None
84+
*/
85+
WEAK void SystemClock_Config(void)
86+
{
87+
RCC_OscInitTypeDef RCC_OscInitStruct;
88+
RCC_ClkInitTypeDef RCC_ClkInitStruct;
89+
90+
/* Initializes the CPU, AHB and APB busses clocks */
91+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI14|RCC_OSCILLATORTYPE_HSE;
92+
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
93+
RCC_OscInitStruct.HSI14State = RCC_HSI14_ON;
94+
RCC_OscInitStruct.HSI14CalibrationValue = 16;
95+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
96+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
97+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;
98+
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1;
99+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
100+
_Error_Handler(__FILE__, __LINE__);
101+
}
102+
103+
/* Initializes the CPU, AHB and APB busses clocks */
104+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
105+
|RCC_CLOCKTYPE_PCLK1;
106+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
107+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
108+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
109+
110+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
111+
_Error_Handler(__FILE__, __LINE__);
112+
}
113+
114+
/* Configure the Systick interrupt time */
115+
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
116+
117+
/* Configure the Systick */
118+
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
119+
120+
/* SysTick_IRQn interrupt configuration */
121+
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
122+
}
123+
124+
#ifdef __cplusplus
125+
}
126+
#endif

‎variants/DEMO_F030F4/variant.h

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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+
/*----------------------------------------------------------------------------
34+
* Headers
35+
*----------------------------------------------------------------------------*/
36+
#include "PeripheralPins.h"
37+
38+
#ifdef __cplusplus
39+
extern "C"{
40+
#endif // __cplusplus
41+
42+
/*----------------------------------------------------------------------------
43+
* Pins
44+
*----------------------------------------------------------------------------*/
45+
extern const PinName digitalPin[];
46+
47+
// USB connector on the top, MCU side
48+
// Left Side
49+
#define PA0 0 //D0/A0
50+
#define PA1 1 //D1/A1
51+
#define PA2 2 //D2/A2 - TX
52+
#define PA3 3 //D3/A3 - RX
53+
#define PA4 4 //D4/A4 - LED
54+
// Right side
55+
#define PA5 5 //D5/A5 - SCK
56+
#define PA6 6 //D6/A6 - MISO
57+
#define PA7 7 //D7/A7 - MOSI
58+
#define PB1 8 //D8/A8 - SS
59+
#define PA9 9 //D9 - SCL (TX UART header)
60+
#define PA10 10 //D10 - SDA (RX UART header)
61+
#define PA13 11 //D11 - SWDIO
62+
#define PA14 12 //D12 - SWCLK
63+
64+
// This must be a literal with the same value as PEND
65+
#define NUM_DIGITAL_PINS 22
66+
// This must be a literal with a value less than or equal to MAX_ANALOG_INPUTS
67+
#define NUM_ANALOG_INPUTS 9
68+
#define NUM_ANALOG_FIRST 13
69+
70+
// On-board LED pin number
71+
#define LED_BUILTIN PA4
72+
#define LED_GREEN LED_BUILTIN
73+
74+
// SPI Definitions
75+
#define PIN_SPI_SS PB1
76+
#define PIN_SPI_MOSI PA7
77+
#define PIN_SPI_MISO PA6
78+
#define PIN_SPI_SCK PA5
79+
80+
// I2C Definitions
81+
#define PIN_WIRE_SDA PA10 // Default for Arduino connector compatibility
82+
#define PIN_WIRE_SCL PA9 // Default for Arduino connector compatibility
83+
84+
// Timer Definitions
85+
// Do not use timer used by PWM pins when possible. See PinMap_PWM.
86+
#define TIMER_TONE TIM17
87+
88+
// Do not use basic timer: OC is required
89+
#define TIMER_SERVO TIM16 //TODO: advanced-control timers don't work
90+
91+
// UART Definitions
92+
#define SERIAL_UART_INSTANCE 1
93+
// Default pin used for 'Serial' instance
94+
// Mandatory for Firmata
95+
#define PIN_SERIAL_RX PA3
96+
#define PIN_SERIAL_TX PA2
97+
98+
#ifdef __cplusplus
99+
} // extern "C"
100+
#endif
101+
/*----------------------------------------------------------------------------
102+
* Arduino objects - C++ only
103+
*----------------------------------------------------------------------------*/
104+
105+
#ifdef __cplusplus
106+
// These serial port names are intended to allow libraries and architecture-neutral
107+
// sketches to automatically default to the correct port name for a particular type
108+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
109+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
110+
//
111+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
112+
//
113+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
114+
//
115+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
116+
//
117+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
118+
//
119+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
120+
// pins are NOT connected to anything by default.
121+
#define SERIAL_PORT_MONITOR Serial
122+
#define SERIAL_PORT_HARDWARE Serial
123+
#endif
124+
125+
#endif /* _VARIANT_ARDUINO_STM32_ */

0 commit comments

Comments
 (0)
Please sign in to comment.