Skip to content

Commit f316365

Browse files
authored
Merge pull request #1 from stm32duino/master
Sync_180531
2 parents 3c55893 + 2229039 commit f316365

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1210
-62
lines changed

boards.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,10 @@ GenF103.menu.upload_method.serialMethod=Serial
418418
GenF103.menu.upload_method.serialMethod.upload.protocol=maple_serial
419419
GenF103.menu.upload_method.serialMethod.upload.tool=serial_upload
420420

421+
GenF103.menu.upload_method.bmpMethod=BMP (Black Magic Probe)
422+
GenF103.menu.upload_method.bmpMethod.upload.protocol=gdb_bmp
423+
GenF103.menu.upload_method.bmpMethod.upload.tool=bmp_upload
424+
421425
###############################
422426
# Maple
423427
Maple.name=Maple series

cores/arduino/HardwareSerial.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,16 @@ void HardwareSerial::init(void)
182182
_serial.tx_tail = 0;
183183
}
184184

185+
void HardwareSerial::configForLowPower(void)
186+
{
187+
#if defined(HAL_PWR_MODULE_ENABLED) && defined(UART_IT_WUF)
188+
// Reconfigure properly Serial instance to use HSI as clock source
189+
end();
190+
uart_config_lowpower(&_serial);
191+
begin(_serial.baudrate, _config);
192+
#endif
193+
}
194+
185195
// Actual interrupt handlers //////////////////////////////////////////////////////////////
186196

187197
void HardwareSerial::_rx_complete_irq(serial_t* obj)
@@ -226,6 +236,7 @@ void HardwareSerial::begin(unsigned long baud, byte config)
226236
uint32_t databits = 0;
227237

228238
_serial.baudrate = (uint32_t)baud;
239+
_config = config;
229240

230241
// Manage databits
231242
switch(config & 0x07) {

cores/arduino/HardwareSerial.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,15 @@ class HardwareSerial : public Stream
125125
void setRx(PinName _rx);
126126
void setTx(PinName _tx);
127127

128+
friend class STM32LowPower;
129+
128130
// Interrupt handlers
129131
static void _rx_complete_irq(serial_t* obj);
130132
static int _tx_complete_irq(serial_t* obj);
131133
private:
134+
uint8_t _config;
132135
void init(void);
136+
void configForLowPower(void);
133137
};
134138

135139
extern HardwareSerial Serial1;

cores/arduino/board.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ extern "C"{
1414
#include "digital_io.h"
1515
#include "hal_uart_emul.h"
1616
#include "hw_config.h"
17+
#include "low_power.h"
1718
#include "rtc.h"
1819
#include "spi_com.h"
1920
#include "stm32_eeprom.h"

cores/arduino/main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ void initVariant() { }
3333
// Required by FreeRTOS, see http://www.freertos.org/RTOS-Cortex-M3-M4.html
3434
#ifdef NVIC_PRIORITYGROUP_4
3535
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
36+
#endif
37+
#if (__CORTEX_M == 0x07U)
38+
// Defined in CMSIS core_cm7.h
39+
#ifndef I_CACHE_DISABLED
40+
SCB_EnableICache();
41+
#endif
42+
#ifndef D_CACHE_DISABLED
43+
SCB_EnableDCache();
44+
#endif
3645
#endif
3746

3847
init();

cores/arduino/stm32/PinNames.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ extern "C" {
99
#endif
1010

1111
typedef enum {
12+
// Not connected
13+
NC = (int)0xFFFFFFFF,
1214

15+
// Pin name definition
1316
PA_0 = (PortA << 4) + 0x00,
1417
PA_1 = (PortA << 4) + 0x01,
1518
PA_2 = (PortA << 4) + 0x02,
@@ -205,8 +208,11 @@ typedef enum {
205208
PK_14 = (PortK << 4) + 0x0E,
206209
PK_15 = (PortK << 4) + 0x0F,
207210
#endif
208-
// Not connected
209-
NC = (int)0xFFFFFFFF
211+
// Specific pin name define in the variant
212+
#if __has_include("PinNamesVar.h")
213+
#include "PinNamesVar.h"
214+
#endif
215+
P_END = NC
210216
} PinName;
211217

212218
#ifdef __cplusplus

0 commit comments

Comments
 (0)