Skip to content

Commit e80ed7a

Browse files
tannewtjepler
authored andcommitted
Add more "extern" declarations for gcc10 compat
gcc has tightened the restrictions on forward declarations that lack "extern". Fix them up.
1 parent 4007010 commit e80ed7a

File tree

23 files changed

+60
-58
lines changed

23 files changed

+60
-58
lines changed

ports/cxd56/common-hal/microcontroller/Processor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ typedef struct {
3535
mp_obj_base_t base;
3636
} mcu_processor_obj_t;
3737

38-
const mp_obj_type_t mcu_processor_type;
38+
extern const mp_obj_type_t mcu_processor_type;
3939

4040
#endif // MICROPY_INCLUDED_CXD56_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H

ports/mimxrt10xx/mphalport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ static inline mp_uint_t mp_hal_ticks_ms(void) {
3939
return supervisor_ticks_ms32();
4040
}
4141
// Number of bytes in receive buffer
42-
volatile uint8_t usb_rx_count;
43-
volatile bool mp_cdc_enabled;
42+
extern volatile uint8_t usb_rx_count;
43+
extern volatile bool mp_cdc_enabled;
4444

4545
int receive_usb(void);
4646

ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@
2727
#ifndef MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PERIPH_H
2828
#define MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PERIPH_H
2929

30-
LPI2C_Type *mcu_i2c_banks[2];
30+
extern LPI2C_Type *mcu_i2c_banks[2];
3131

3232
extern const mcu_periph_obj_t mcu_i2c_sda_list[8];
3333
extern const mcu_periph_obj_t mcu_i2c_scl_list[8];
3434

35-
LPSPI_Type *mcu_spi_banks[2];
35+
extern LPSPI_Type *mcu_spi_banks[2];
3636

3737
extern const mcu_periph_obj_t mcu_spi_sck_list[4];
3838
extern const mcu_periph_obj_t mcu_spi_mosi_list[4];
3939
extern const mcu_periph_obj_t mcu_spi_miso_list[4];
4040

41-
LPUART_Type *mcu_uart_banks[4];
41+
extern LPUART_Type *mcu_uart_banks[4];
4242

4343
extern const mcu_periph_obj_t mcu_uart_rx_list[9];
4444
extern const mcu_periph_obj_t mcu_uart_tx_list[9];

ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@
2828
#ifndef MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1021_PERIPH_H
2929
#define MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1021_PERIPH_H
3030

31-
LPI2C_Type *mcu_i2c_banks[4];
31+
extern LPI2C_Type *mcu_i2c_banks[4];
3232

3333
extern const mcu_periph_obj_t mcu_i2c_sda_list[8];
3434
extern const mcu_periph_obj_t mcu_i2c_scl_list[8];
3535

36-
LPSPI_Type *mcu_spi_banks[4];
36+
extern LPSPI_Type *mcu_spi_banks[4];
3737

3838
extern const mcu_periph_obj_t mcu_spi_sck_list[8];
3939
extern const mcu_periph_obj_t mcu_spi_mosi_list[8];
4040
extern const mcu_periph_obj_t mcu_spi_miso_list[8];
4141

42-
LPUART_Type *mcu_uart_banks[8];
42+
extern LPUART_Type *mcu_uart_banks[8];
4343

4444
extern const mcu_periph_obj_t mcu_uart_rx_list[16];
4545
extern const mcu_periph_obj_t mcu_uart_tx_list[16];

ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@
2727
#ifndef MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PERIPH_H
2828
#define MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PERIPH_H
2929

30-
LPI2C_Type *mcu_i2c_banks[4];
30+
extern LPI2C_Type *mcu_i2c_banks[4];
3131

3232
extern const mcu_periph_obj_t mcu_i2c_sda_list[9];
3333
extern const mcu_periph_obj_t mcu_i2c_scl_list[9];
3434

35-
LPSPI_Type *mcu_spi_banks[4];
35+
extern LPSPI_Type *mcu_spi_banks[4];
3636

3737
extern const mcu_periph_obj_t mcu_spi_sck_list[8];
3838
extern const mcu_periph_obj_t mcu_spi_mosi_list[8];
3939
extern const mcu_periph_obj_t mcu_spi_miso_list[8];
4040

41-
LPUART_Type *mcu_uart_banks[8];
41+
extern LPUART_Type *mcu_uart_banks[8];
4242

4343
extern const mcu_periph_obj_t mcu_uart_rx_list[18];
4444
extern const mcu_periph_obj_t mcu_uart_tx_list[18];

ports/nrf/common-hal/_bleio/__init__.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ void check_sec_status(uint8_t sec_status) {
8787
}
8888
}
8989

90+
bool vm_used_ble;
91+
9092
// Turn off BLE on a reset or reload.
9193
void bleio_reset() {
9294
if (!common_hal_bleio_adapter_get_enabled(&common_hal_bleio_adapter_obj)) {

ports/nrf/common-hal/_bleio/__init__.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ void check_gatt_status(uint16_t gatt_status);
4545
void check_sec_status(uint8_t sec_status);
4646

4747
// Track if the user code modified the BLE state to know if we need to undo it on reload.
48-
bool vm_used_ble;
48+
extern bool vm_used_ble;
4949

5050
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_INIT_H

ports/stm/common-hal/pulseio/PWMOut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
9696
//if pin is same
9797
if (l_tim->pin == pin) {
9898
//check if the timer has a channel active, or is reserved by main timer system
99-
if (reserved_tim[l_tim_index] != 0) {
99+
if (l_tim_index < TIM_BANK_ARRAY_LEN && reserved_tim[l_tim_index] != 0) {
100100
// Timer has already been reserved by an internal module
101101
if (stm_peripherals_timer_is_reserved(mcu_tim_banks[l_tim_index])) {
102102
tim_taken_internal = true;

ports/stm/mphalport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ static inline mp_uint_t mp_hal_ticks_ms(void) {
3838
return supervisor_ticks_ms32();
3939
}
4040
// Number of bytes in receive buffer
41-
volatile uint8_t usb_rx_count;
42-
volatile bool mp_cdc_enabled;
41+
extern volatile uint8_t usb_rx_count;
42+
extern volatile bool mp_cdc_enabled;
4343

4444
int receive_usb(void);
4545

ports/stm/peripherals/stm32f4/stm32f401xe/periph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern const mcu_periph_obj_t mcu_uart_rx_list[6];
5151
//Timers
5252
#define TIM_BANK_ARRAY_LEN 14
5353
#define TIM_PIN_ARRAY_LEN 44
54-
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
55-
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
54+
extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
55+
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
5656

5757
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F401XE_PERIPH_H

ports/stm/peripherals/stm32f4/stm32f405xx/periph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ extern const mcu_periph_obj_t mcu_uart_rx_list[UART_RX_ARRAY_LEN];
5858
//Timers
5959
#define TIM_BANK_ARRAY_LEN 14
6060
#define TIM_PIN_ARRAY_LEN 67
61-
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
62-
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
61+
extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
62+
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
6363

6464
//SDIO
6565
extern SDIO_TypeDef * mcu_sdio_banks[1];

ports/stm/peripherals/stm32f4/stm32f407xx/periph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern const mcu_periph_obj_t mcu_uart_rx_list[12];
5151
//Timers
5252
#define TIM_BANK_ARRAY_LEN 14
5353
#define TIM_PIN_ARRAY_LEN 56
54-
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
55-
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
54+
extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
55+
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
5656

5757
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F407XX_PERIPH_H

ports/stm/peripherals/stm32f4/stm32f411xe/periph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern const mcu_periph_obj_t mcu_uart_rx_list[7];
5151
//Timers
5252
#define TIM_BANK_ARRAY_LEN 14
5353
#define TIM_PIN_ARRAY_LEN 44
54-
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
55-
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
54+
extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
55+
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
5656

5757
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F411XE_PERIPH_H

ports/stm/peripherals/stm32f4/stm32f412zx/periph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ extern const mcu_periph_obj_t mcu_uart_rx_list[12];
5252
//Timers
5353
#define TIM_BANK_ARRAY_LEN 14
5454
#define TIM_PIN_ARRAY_LEN 60
55-
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
56-
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
55+
extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
56+
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
5757

5858
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412ZX_PERIPH_H

ports/stm/peripherals/stm32f7/stm32f746xx/periph.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,28 @@
3131
//I2C
3232
extern I2C_TypeDef * mcu_i2c_banks[4];
3333

34-
const mcu_periph_obj_t mcu_i2c_sda_list[10];
35-
const mcu_periph_obj_t mcu_i2c_scl_list[10];
34+
extern const mcu_periph_obj_t mcu_i2c_sda_list[10];
35+
extern const mcu_periph_obj_t mcu_i2c_scl_list[10];
3636

3737
//SPI
3838
extern SPI_TypeDef * mcu_spi_banks[6];
3939

40-
const mcu_periph_obj_t mcu_spi_sck_list[14];
41-
const mcu_periph_obj_t mcu_spi_mosi_list[15];
42-
const mcu_periph_obj_t mcu_spi_miso_list[12];
40+
extern const mcu_periph_obj_t mcu_spi_sck_list[14];
41+
extern const mcu_periph_obj_t mcu_spi_mosi_list[15];
42+
extern const mcu_periph_obj_t mcu_spi_miso_list[12];
4343

4444
//UART
4545
extern USART_TypeDef * mcu_uart_banks[MAX_UART];
4646
extern bool mcu_uart_has_usart[MAX_UART];
4747

48-
const mcu_periph_obj_t mcu_uart_tx_list[15];
49-
const mcu_periph_obj_t mcu_uart_rx_list[15];
48+
extern const mcu_periph_obj_t mcu_uart_tx_list[15];
49+
extern const mcu_periph_obj_t mcu_uart_rx_list[15];
5050

5151
//Timers
5252
#define TIM_BANK_ARRAY_LEN 14
5353
#define TIM_PIN_ARRAY_LEN 55
5454
extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
5555

56-
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
56+
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
5757

5858
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F746XX_PERIPH_H

ports/stm/peripherals/stm32f7/stm32f767xx/periph.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,28 @@
3030
//I2C
3131
extern I2C_TypeDef * mcu_i2c_banks[4];
3232

33-
const mcu_periph_obj_t mcu_i2c_sda_list[12];
34-
const mcu_periph_obj_t mcu_i2c_scl_list[12];
33+
extern const mcu_periph_obj_t mcu_i2c_sda_list[12];
34+
extern const mcu_periph_obj_t mcu_i2c_scl_list[12];
3535

3636
//SPI
3737
extern SPI_TypeDef * mcu_spi_banks[6];
3838

39-
const mcu_periph_obj_t mcu_spi_sck_list[18];
40-
const mcu_periph_obj_t mcu_spi_mosi_list[18];
41-
const mcu_periph_obj_t mcu_spi_miso_list[15];
39+
extern const mcu_periph_obj_t mcu_spi_sck_list[18];
40+
extern const mcu_periph_obj_t mcu_spi_mosi_list[18];
41+
extern const mcu_periph_obj_t mcu_spi_miso_list[15];
4242

4343
//UART
4444
extern USART_TypeDef * mcu_uart_banks[MAX_UART];
4545
extern bool mcu_uart_has_usart[MAX_UART];
4646

47-
const mcu_periph_obj_t mcu_uart_tx_list[24];
48-
const mcu_periph_obj_t mcu_uart_rx_list[25];
47+
extern const mcu_periph_obj_t mcu_uart_tx_list[24];
48+
extern const mcu_periph_obj_t mcu_uart_rx_list[25];
4949

5050
//Timers
5151
#define TIM_BANK_ARRAY_LEN 14
5252
#define TIM_PIN_ARRAY_LEN 55
53-
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
53+
extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
5454

55-
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
55+
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
5656

5757
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F767XX_PERIPH_H

ports/stm/peripherals/stm32h7/stm32h743xx/periph.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,26 @@
3030
//I2C
3131
extern I2C_TypeDef * mcu_i2c_banks[4];
3232

33-
const mcu_periph_obj_t mcu_i2c_sda_list[12];
34-
const mcu_periph_obj_t mcu_i2c_scl_list[12];
33+
extern const mcu_periph_obj_t mcu_i2c_sda_list[12];
34+
extern const mcu_periph_obj_t mcu_i2c_scl_list[12];
3535

3636
//SPI
3737
extern SPI_TypeDef * mcu_spi_banks[6];
3838

39-
const mcu_periph_obj_t mcu_spi_sck_list[19];
40-
const mcu_periph_obj_t mcu_spi_mosi_list[19];
41-
const mcu_periph_obj_t mcu_spi_miso_list[16];
39+
extern const mcu_periph_obj_t mcu_spi_sck_list[19];
40+
extern const mcu_periph_obj_t mcu_spi_mosi_list[19];
41+
extern const mcu_periph_obj_t mcu_spi_miso_list[16];
4242

4343
//UART
4444
extern USART_TypeDef * mcu_uart_banks[MAX_UART];
4545
extern bool mcu_uart_has_usart[MAX_UART];
4646

47-
const mcu_periph_obj_t mcu_uart_tx_list[25];
48-
const mcu_periph_obj_t mcu_uart_rx_list[26];
47+
extern const mcu_periph_obj_t mcu_uart_tx_list[25];
48+
extern const mcu_periph_obj_t mcu_uart_rx_list[26];
4949

5050
//Timers
5151
#define TIM_BANK_ARRAY_LEN 14
5252
#define TIM_PIN_ARRAY_LEN 58
53-
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
53+
extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
5454

5555
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32H743XX_PERIPH_H

ports/stm/supervisor/internal_flash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ void port_internal_flash_flush(void) {
177177
EraseInitStruct.VoltageRange = VOLTAGE_RANGE_3; // voltage range needs to be 2.7V to 3.6V
178178
// get the sector information
179179
uint32_t sector_size;
180-
uint32_t sector_start_addr;
180+
uint32_t sector_start_addr = 0xffffffff;
181181
#if defined(STM32H7)
182182
EraseInitStruct.Banks = get_bank(_cache_flash_addr);
183183
#endif
184184
EraseInitStruct.Sector = flash_get_sector_info(_cache_flash_addr, &sector_start_addr, &sector_size);
185185
EraseInitStruct.NbSectors = 1;
186-
if (sector_size > sizeof(_flash_cache)) {
186+
if (sector_size > sizeof(_flash_cache) || sector_start_addr == 0xffffffff) {
187187
reset_into_safe_mode(FLASH_WRITE_FAIL);
188188
}
189189

shared-bindings/_bleio/Adapter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "py/objstr.h"
3636
#include "shared-module/_bleio/Address.h"
3737

38-
const mp_obj_type_t bleio_adapter_type;
38+
extern const mp_obj_type_t bleio_adapter_type;
3939

4040
extern bool common_hal_bleio_adapter_get_advertising(bleio_adapter_obj_t *self);
4141
extern bool common_hal_bleio_adapter_get_enabled(bleio_adapter_obj_t *self);

shared-bindings/_bleio/Service.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
#include "py/objtuple.h"
3636

37-
const mp_obj_type_t bleio_service_type;
37+
extern const mp_obj_type_t bleio_service_type;
3838

3939
// Private version that doesn't allocate on the heap
4040
extern uint32_t _common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uuid_obj_t *uuid, bool is_secondary, mp_obj_list_t * characteristic_list);

shared-bindings/gnss/PositionFix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ typedef enum {
1313
POSITIONFIX_3D,
1414
} gnss_positionfix_t;
1515

16-
const mp_obj_type_t gnss_positionfix_type;
16+
extern const mp_obj_type_t gnss_positionfix_type;
1717

1818
gnss_positionfix_t gnss_positionfix_obj_to_type(mp_obj_t obj);
1919
mp_obj_t gnss_positionfix_type_to_obj(gnss_positionfix_t mode);

shared-bindings/gnss/SatelliteSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ typedef enum {
1616
SATELLITESYSTEM_QZSS_L1S = (1U << 4),
1717
} gnss_satellitesystem_t;
1818

19-
const mp_obj_type_t gnss_satellitesystem_type;
19+
extern const mp_obj_type_t gnss_satellitesystem_type;
2020

2121
gnss_satellitesystem_t gnss_satellitesystem_obj_to_type(mp_obj_t obj);
2222
mp_obj_t gnss_satellitesystem_type_to_obj(gnss_satellitesystem_t mode);

shared-bindings/watchdog/WatchDogMode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ typedef enum {
3535
WATCHDOGMODE_RESET,
3636
} watchdog_watchdogmode_t;
3737

38-
const mp_obj_type_t watchdog_watchdogmode_type;
38+
extern const mp_obj_type_t watchdog_watchdogmode_type;
3939

4040
watchdog_watchdogmode_t watchdog_watchdogmode_obj_to_type(mp_obj_t obj);
4141
mp_obj_t watchdog_watchdogmode_type_to_obj(watchdog_watchdogmode_t mode);

0 commit comments

Comments
 (0)