Skip to content

Commit 3eb08f8

Browse files
committed
Merge branch 'master' into cdc
2 parents e1fab94 + 54478a1 commit 3eb08f8

21 files changed

+1538
-548
lines changed

Diff for: README.md

+4
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
115115
| :---: | --- | :---: | :--- |
116116
| :green_heart: | [RAK811 LoRa Tracker](https://www.rakwireless.com/en/) | *1.4.0* | Basic support |
117117

118+
| Status | Sparky flight controllers | Release | Comment |
119+
| :---: | --- | :---: | :--- |
120+
| :yellow_heart: | [Sparky V1](https://github.com/TauLabs/TauLabs/wiki/Sparky) | **1.5.1/1.6.0** | |
121+
118122
## Next release
119123

120124
See [milestones](https://github.com/stm32duino/Arduino_Core_STM32/milestones) to have an overview of the next release content.

Diff for: boards.txt

+72
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,33 @@ GenF4.menu.upload_method.bmpMethod=BMP (Black Magic Probe)
709709
GenF4.menu.upload_method.bmpMethod.upload.protocol=gdb_bmp
710710
GenF4.menu.upload_method.bmpMethod.upload.tool=bmp_upload
711711

712+
###############################
713+
# Sparky Flight Controllers
714+
715+
Sparky.name=Sparky flight controllers
716+
717+
Sparky.build.vid=0x0483
718+
Sparky.build.core=arduino
719+
Sparky.build.board=Sparky
720+
Sparky.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial}
721+
722+
# Sparky_V1 board
723+
# Support: Serial1 (USART1 on PA10, PA9)
724+
Sparky.menu.pnum.Sparky_V1=Sparky V1
725+
Sparky.menu.pnum.Sparky_V1.upload.maximum_size=262144
726+
Sparky.menu.pnum.Sparky_V1.upload.maximum_data_size=40960
727+
Sparky.menu.pnum.Sparky_V1.build.mcu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard
728+
Sparky.menu.pnum.Sparky_V1.build.board=Sparky_V1
729+
Sparky.menu.pnum.Sparky_V1.build.series=STM32F3xx
730+
Sparky.menu.pnum.Sparky_V1.build.product_line=STM32F303xC
731+
Sparky.menu.pnum.Sparky_V1.build.variant=SPARKY_F303CC
732+
Sparky.menu.pnum.Sparky_V1.build.cmsis_lib_gcc=arm_cortexM4l_math
733+
734+
# Upload menu
735+
Sparky.menu.upload_method.STLinkMethod=STLink
736+
Sparky.menu.upload_method.STLinkMethod.upload.protocol=STLink
737+
Sparky.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
738+
712739
################################################################################
713740
# RAK boards
714741

@@ -897,6 +924,12 @@ GenF4.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE
897924
GenF4.menu.xserial.disabled=Disabled (no Serial support)
898925
GenF4.menu.xserial.disabled.build.xSerial=
899926

927+
Sparky.menu.xserial.generic=Enabled (generic 'Serial')
928+
Sparky.menu.xserial.none=Enabled (no generic 'Serial')
929+
Sparky.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE
930+
Sparky.menu.xserial.disabled=Disabled (no Serial support)
931+
Sparky.menu.xserial.disabled.build.xSerial=
932+
900933
RAK.menu.xserial.generic=Enabled (generic 'Serial')
901934
RAK.menu.xserial.none=Enabled (no generic 'Serial')
902935
RAK.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE
@@ -988,6 +1021,17 @@ GenF4.menu.xusb.HS.build.usb_speed=-DUSE_USB_HS
9881021
GenF4.menu.xusb.HSFS=High Speed in Full Speed mode
9891022
GenF4.menu.xusb.HSFS.build.usb_speed=-DUSE_USB_HS -DUSE_USB_HS_IN_FS
9901023

1024+
Sparky.menu.usb.none=None
1025+
Sparky.menu.usb.CDCgen=CDC (generic 'Serial' supersede U(S)ART)
1026+
Sparky.menu.usb.CDCgen.build.enable_usb={build.usb_flags} -DUSBD_USE_CDC
1027+
Sparky.menu.usb.CDC=CDC (no generic 'Serial')
1028+
Sparky.menu.usb.CDC.build.enable_usb={build.usb_flags} -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB
1029+
Sparky.menu.xusb.FS=Low/Full Speed
1030+
Sparky.menu.xusb.HS=High Speed
1031+
Sparky.menu.xusb.HS.build.usb_speed=-DUSE_USB_HS
1032+
Sparky.menu.xusb.HSFS=High Speed in Full Speed mode
1033+
Sparky.menu.xusb.HSFS.build.usb_speed=-DUSE_USB_HS -DUSE_USB_HS_IN_FS
1034+
9911035
3dprinter.menu.usb.none=None
9921036
3dprinter.menu.usb.CDCgen=CDC (generic 'Serial' supersede U(S)ART)
9931037
3dprinter.menu.usb.CDCgen.build.enable_usb={build.usb_flags} -DUSBD_USE_CDC
@@ -1127,6 +1171,24 @@ GenF4.menu.opt.o3lto.build.flags.optimize=-O3 -flto
11271171
GenF4.menu.opt.ogstd=Debug (-g)
11281172
GenF4.menu.opt.ogstd.build.flags.optimize=-g -Og
11291173

1174+
Sparky.menu.opt.osstd=Smallest (-Os default)
1175+
Sparky.menu.opt.oslto=Smallest (-Os) with LTO
1176+
Sparky.menu.opt.oslto.build.flags.optimize=-Os -flto
1177+
Sparky.menu.opt.o1std=Fast (-O1)
1178+
Sparky.menu.opt.o1std.build.flags.optimize=-O1
1179+
Sparky.menu.opt.o1lto=Fast (-O1) with LTO
1180+
Sparky.menu.opt.o1lto.build.flags.optimize=-O1 -flto
1181+
Sparky.menu.opt.o2std=Faster (-O2)
1182+
Sparky.menu.opt.o2std.build.flags.optimize=-O2
1183+
Sparky.menu.opt.o2lto=Faster (-O2) with LTO
1184+
Sparky.menu.opt.o2lto.build.flags.optimize=-O2 -flto
1185+
Sparky.menu.opt.o3std=Fastest (-O3)
1186+
Sparky.menu.opt.o3std.build.flags.optimize=-O3
1187+
Sparky.menu.opt.o3lto=Fastest (-O3) with LTO
1188+
Sparky.menu.opt.o3lto.build.flags.optimize=-O3 -flto
1189+
Sparky.menu.opt.ogstd=Debug (-g)
1190+
Sparky.menu.opt.ogstd.build.flags.optimize=-g -Og
1191+
11301192
RAK.menu.opt.osstd=Smallest (-Os default)
11311193
RAK.menu.opt.oslto=Smallest (-Os) with LTO
11321194
RAK.menu.opt.oslto.build.flags.optimize=-Os -flto
@@ -1234,6 +1296,16 @@ GenF4.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs -u _printf_float
12341296
GenF4.menu.rtlib.full=Newlib Standard
12351297
GenF4.menu.rtlib.full.build.flags.ldspecs=
12361298

1299+
Sparky.menu.rtlib.nano=Newlib Nano (default)
1300+
Sparky.menu.rtlib.nanofp=Newlib Nano + Float Printf
1301+
Sparky.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs -u _printf_float
1302+
Sparky.menu.rtlib.nanofs=Newlib Nano + Float Scanf
1303+
Sparky.menu.rtlib.nanofs.build.flags.ldspecs=--specs=nano.specs -u _scanf_float
1304+
Sparky.menu.rtlib.nanofps=Newlib Nano + Float Printf/Scanf
1305+
Sparky.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs -u _printf_float -u _scanf_float
1306+
Sparky.menu.rtlib.full=Newlib Standard
1307+
Sparky.menu.rtlib.full.build.flags.ldspecs=
1308+
12371309
RAK.menu.rtlib.nano=Newlib Nano (default)
12381310
RAK.menu.rtlib.nanofp=Newlib Nano + Float Printf
12391311
RAK.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs -u _printf_float

Diff for: cores/arduino/board.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
* Core and peripherals registers definitions
66
*/
77
#include "interrupt.h"
8-
#ifdef __cplusplus
9-
extern "C" {
10-
#endif // __cplusplus
118
#include "analog.h"
129
#include "clock.h"
1310
#include "core_callback.h"
@@ -21,8 +18,11 @@ extern "C" {
2118
#include "twi.h"
2219
#include "uart.h"
2320

21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif /* __cplusplus */
2424
void init(void) ;
2525
#ifdef __cplusplus
2626
}
27-
#endif // __cplusplus
27+
#endif /* __cplusplus */
2828
#endif /* _BOARD_H_ */

Diff for: cores/arduino/stm32/analog.c

+3-63
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,6 @@
3535
*
3636
******************************************************************************
3737
*/
38-
/** @addtogroup CMSIS
39-
* @{
40-
*/
41-
42-
/** @addtogroup stm32f4xx_system
43-
* @{
44-
*/
45-
46-
/** @addtogroup STM32F4xx_System_Private_Includes
47-
* @{
48-
*/
4938
#include "stm32_def.h"
5039
#include "analog.h"
5140
#include "timer.h"
@@ -55,20 +44,7 @@
5544
extern "C" {
5645
#endif
5746

58-
/**
59-
* @}
60-
*/
61-
62-
/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
63-
* @{
64-
*/
65-
/**
66-
* @}
67-
*/
68-
69-
/** @addtogroup STM32F4xx_System_Private_Defines
70-
* @{
71-
*/
47+
/* Private_Defines */
7248
#if defined(ADC_SAMPLETIME_8CYCLES_5)
7349
#define SAMPLINGTIME ADC_SAMPLETIME_8CYCLES_5;
7450
#elif defined(ADC_SAMPLETIME_12CYCLES_5)
@@ -102,30 +78,11 @@ extern "C" {
10278
#ifndef ADC_REGULAR_RANK_1
10379
#define ADC_REGULAR_RANK_1 1
10480
#endif
105-
/**
106-
* @}
107-
*/
108-
109-
/** @addtogroup STM32F4xx_System_Private_Macros
110-
* @{
111-
*/
112-
113-
/**
114-
* @}
115-
*/
11681

117-
/** @addtogroup STM32F4xx_System_Private_Variables
118-
* @{
119-
*/
82+
/* Private_Variables */
12083
static PinName g_current_pin = NC;
12184

122-
/**
123-
* @}
124-
*/
125-
126-
/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
127-
* @{
128-
*/
85+
/* Private Functions */
12986
static uint32_t get_adc_channel(PinName pin)
13087
{
13188
uint32_t function = pinmap_function(pin, PinMap_ADC);
@@ -804,23 +761,6 @@ void pwm_stop(PinName pin)
804761
HAL_TIM_PWM_DeInit(&timHandle);
805762
}
806763

807-
808-
/**
809-
* @}
810-
*/
811-
812-
813-
/**
814-
* @}
815-
*/
816-
817-
/**
818-
* @}
819-
*/
820-
821-
/**
822-
* @}
823-
*/
824764
#ifdef __cplusplus
825765
}
826766
#endif

Diff for: cores/arduino/stm32/analog.h

-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
extern "C" {
4848
#endif
4949

50-
/* Exported types ------------------------------------------------------------*/
51-
/* Exported constants --------------------------------------------------------*/
52-
/* Exported macro ------------------------------------------------------------*/
5350
/* Exported functions ------------------------------------------------------- */
5451
void dac_write_value(PinName pin, uint32_t value, uint8_t do_init);
5552
void dac_stop(PinName pin);

Diff for: cores/arduino/stm32/interrupt.cpp

+5-63
Original file line numberDiff line numberDiff line change
@@ -35,57 +35,21 @@
3535
*
3636
******************************************************************************
3737
*/
38-
/** @addtogroup CMSIS
39-
* @{
40-
*/
41-
42-
/** @addtogroup stm32f4xx_system
43-
* @{
44-
*/
45-
46-
/** @addtogroup STM32F4xx_System_Private_Includes
47-
* @{
48-
*/
4938
#include "stm32_def.h"
5039
#include "interrupt.h"
5140

52-
/**
53-
* @}
54-
*/
55-
56-
/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
57-
* @{
58-
*/
41+
/* Private Types */
5942

6043
/*As we can have only one interrupt/pin id, don't need to get the port info*/
6144
typedef struct {
6245
IRQn_Type irqnb;
6346
std::function<void(void)> callback;
6447
} gpio_irq_conf_str;
6548

66-
/**
67-
* @}
68-
*/
69-
70-
/** @addtogroup STM32F4xx_System_Private_Defines
71-
* @{
72-
*/
49+
/* Private_Defines */
7350
#define NB_EXTI (16)
74-
/**
75-
* @}
76-
*/
77-
78-
/** @addtogroup STM32F4xx_System_Private_Macros
79-
* @{
80-
*/
81-
82-
/**
83-
* @}
84-
*/
8551

86-
/** @addtogroup STM32F4xx_System_Private_Variables
87-
* @{
88-
*/
52+
/* Private Variables */
8953
static gpio_irq_conf_str gpio_irq_conf[NB_EXTI] = {
9054
#if defined (STM32F0xx) || defined (STM32L0xx)
9155
{.irqnb = EXTI0_1_IRQn, .callback = NULL}, //GPIO_PIN_0
@@ -123,25 +87,14 @@ static gpio_irq_conf_str gpio_irq_conf[NB_EXTI] = {
12387
{.irqnb = EXTI15_10_IRQn, .callback = NULL} //GPIO_PIN_15
12488
#endif
12589
};
126-
/**
127-
* @}
128-
*/
12990

130-
/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
131-
* @{
132-
*/
133-
134-
static uint8_t get_pin_id(uint16_t pin);
135-
136-
/**
137-
* @}
138-
*/
91+
/* Private Functions */
13992
/**
14093
* @brief This function returns the pin ID function of the HAL PIN definition
14194
* @param pin : one of the gpio pin
14295
* @retval None
14396
*/
144-
uint8_t get_pin_id(uint16_t pin)
97+
static uint8_t get_pin_id(uint16_t pin)
14598
{
14699
uint8_t id = 0;
147100

@@ -397,15 +350,4 @@ void EXTI15_10_IRQHandler(void)
397350
}
398351
#endif
399352
#endif
400-
/**
401-
* @}
402-
*/
403-
404-
/**
405-
* @}
406-
*/
407-
408-
/**
409-
* @}
410-
*/
411353
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Diff for: cores/arduino/stm32/interrupt.h

-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ typedef std::function<void(void)> callback_function_t;
5454
void stm32_interrupt_enable(GPIO_TypeDef *port, uint16_t pin, callback_function_t callback, uint32_t mode);
5555
#endif
5656

57-
/* Exported types ------------------------------------------------------------*/
58-
/* Exported constants --------------------------------------------------------*/
59-
/* Exported macro ------------------------------------------------------------*/
6057
/* Exported functions ------------------------------------------------------- */
6158
void stm32_interrupt_enable(GPIO_TypeDef *port, uint16_t pin, void (*callback)(void), uint32_t mode);
6259
void stm32_interrupt_disable(GPIO_TypeDef *port, uint16_t pin);

Diff for: cores/arduino/stm32/rtc.c

+9-2
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,16 @@ static void RTC_initClock(sourceClock_t source)
146146
#ifndef RCC_RTCCLKSOURCE_HSE_DIVX
147147
#define RCC_RTCCLKSOURCE_HSE_DIVX 0x00000300U
148148
#endif /* RCC_RTCCLKSOURCE_HSE_DIVX */
149-
for (HSEDiv = 2; HSEDiv < 32; HSEDiv++) {
149+
#if defined(STM32H7xx)
150+
#define HSEDIV_MAX 64
151+
#define HSESHIFT 12
152+
#else
153+
#define HSEDIV_MAX 32
154+
#define HSESHIFT 16
155+
#endif
156+
for (HSEDiv = 2; HSEDiv < HSEDIV_MAX; HSEDiv++) {
150157
if ((HSE_VALUE / HSEDiv) <= HSE_RTC_MAX) {
151-
PeriphClkInit.RTCClockSelection = (HSEDiv << 16) | RCC_RTCCLKSOURCE_HSE_DIVX;
158+
PeriphClkInit.RTCClockSelection = (HSEDiv << HSESHIFT) | RCC_RTCCLKSOURCE_HSE_DIVX;
152159
break;
153160
}
154161
}

0 commit comments

Comments
 (0)