8000 Merge pull request #3194 from tannewt/gcc10 · kvc0/circuitpython@060ab8a · GitHub
[go: up one dir, main page]

Skip to content

Commit 060ab8a

Browse files
authored
Merge pull request adafruit#3194 from tannewt/gcc10
Prep for GCC10
2 parents 6a46fd5 + f43834a commit 060ab8a

File tree

16 files changed

+27
-20
lines changed

16 files changed

+27
-20
lines changed

main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ bool run_code_py(safe_mode_t safe_mode) {
331331
}
332332
}
333333

334+
FIL* boot_output_file;
335+
334336
void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
335337
// If not in safe mode, run boot before initing USB and capture output in a
336338
// file.

ports/atmel-samd/mphalport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
#define mp_hal_ticks_ms() ((mp_uint_t) supervisor_ticks_ms32())
3838

3939
// Number of bytes in receive buffer
40-
volatile uint8_t usb_rx_count;
41-
volatile bool mp_cdc_enabled;
40+
extern volatile uint8_t usb_rx_count;
41+
extern volatile bool mp_cdc_enabled;
4242

4343
int receive_usb(void);
4444

py/objstr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
7777
mp_obj_t index, bool is_slice);
7878
const byte *find_subbytes(const byte *haystack, size_t hlen, const byte *needle, size_t nlen, int direction);
7979

80-
const char nibble_to_hex_upper[16];
81-
const char nibble_to_hex_lower[16];
80+
extern const char nibble_to_hex_upper[16];
81+
extern const char nibble_to_hex_lower[16];
8282

8383
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_encode_obj);
8484
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_find_obj);

py/py.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,11 @@ $(HEADER_BUILD)/qstrdefs.generated.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/
346346

347347
$(PY_BUILD)/qstr.o: $(HEADER_BUILD)/qstrdefs.generated.h
348348

349+
# Standard C functions like memset need to be compiled with special flags so
350+
# the compiler does not optimise these functions in terms of themselves.
351+
CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto
352+
$(BUILD)/lib/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN)
353+
349354
# Force nlr code to always be compiled with space-saving optimisation so
350355
# that the function preludes are of a minimal and predictable form.
351356
$(PY_BUILD)/nlr%.o: CFLAGS += -Os

shared-bindings/_pixelbuf/PixelBuf.h

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

3030
#include "shared-module/_pixelbuf/PixelBuf.h"
3131

32-
const mp_obj_type_t pixelbuf_pixelbuf_type;
32+
extern const mp_obj_type_t pixelbuf_pixelbuf_type;
3333

3434
void common_hal__pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size_t n,
3535
pixelbuf_byteorder_details_t* byteorder, mp_float_t brightness, bool auto_write, uint8_t* header,

shared-bindings/digitalio/Direction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ typedef struct {
3737
mp_obj_base_t base;
3838
} digitalio_direction_obj_t;
3939

40-
const mp_obj_type_t digitalio_direction_type;
40+
extern const mp_obj_type_t digitalio_direction_type;
4141

4242
extern const digitalio_direction_obj_t digitalio_direction_input_obj;
4343
extern const digitalio_direction_obj_t digitalio_direction_output_obj;

shared-bindings/digitalio/DriveMode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ typedef struct {
3838
mp_obj_base_t base;
3939
} digitalio_drive_mode_obj_t;
4040

41-
const mp_obj_type_t digitalio_drive_mode_type;
41+
extern const mp_obj_type_t digitalio_drive_mode_type;
4242

4343
extern const digitalio_drive_mode_obj_t digitalio_drive_mode_push_pull_obj;
4444
extern const digitalio_drive_mode_obj_t digitalio_drive_mode_open_drain_obj;

shared-bindings/digitalio/Pull.h

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

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

4040
typedef struct {
4141
mp_obj_base_t base;

shared-bindings/microcontroller/Processor.h

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

3232
#include "common-hal/microcontroller/Processor.h"
3333

34-
const mp_obj_type_t mcu_processor_type;
34+
extern const mp_obj_type_t mcu_processor_type;
3535

3636
uint32_t common_hal_mcu_processor_get_frequency(void);
3737
float common_hal_mcu_processor_get_temperature(void);

shared-bindings/microcontroller/RunMode.h

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

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

4040
typedef struct {
4141
mp_obj_base_t base;

shared-bindings/nvm/ByteArray.h

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

3030
#include "common-hal/nvm/ByteArray.h"
3131

32-
const mp_obj_type_t nvm_bytearray_type;
32+
extern const mp_obj_type_t nvm_bytearray_type;
3333

3434
uint32_t common_hal_nvm_bytearray_get_length 10000 (nvm_bytearray_obj_t *self);
3535

shared-bindings/os/__init__.h

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

3333
#include "py/objtuple.h"
3434

35-
const mp_rom_obj_tuple_t common_hal_os_uname_info_obj;
35+
extern const mp_rom_obj_tuple_t common_hal_os_uname_info_obj;
3636

3737
mp_obj_t common_hal_os_uname(void);
3838
void common_hal_os_chdir(const char* path);

shared-bindings/supervisor/Runtime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "py/obj.h"
3232

3333

34-
const mp_obj_type_t supervisor_runtime_type;
34+
extern const mp_obj_type_t supervisor_runtime_type;
3535

3636
bool common_hal_get_serial_connected(void);
3737

shared-bindings/usb_hid/Device.h

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

3030
#include "shared-module/usb_hid/Device.h"
3131

32-
const mp_obj_type_t usb_hid_device_type;
32+
extern const mp_obj_type_t usb_hid_device_type;
3333

3434
void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t* report, uint8_t len);
3535
uint8_t common_hal_usb_hid_device_get_usage_page(usb_hid_device_obj_t *self);

supervisor/serial.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
3636
#include "lib/oofatfs/ff.h"
3737

38-
FIL* boot_output_file;
38+
extern FIL* boot_output_file;
3939
#endif
4040

4141
void serial_early_init(void);

tools/gen_usb_descriptor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,14 +539,14 @@ def strings_in_order(cls):
539539
540540
#include <stdint.h>
541541
542-
const uint8_t usb_desc_dev[{device_length}];
542+
extern const uint8_t usb_desc_dev[{device_length}];
543543
// Make sure the control buffer is big enough to fit the descriptor.
544544
#define CFG_TUD_ENUM_BUFFER_SIZE {max_configuration_length}
545-
const uint8_t usb_desc_cfg[{configuration_length}];
546-
uint16_t usb_serial_number[{serial_number_length}];
547-
uint16_t const * const string_desc_arr [{string_descriptor_length}];
545+
extern const uint8_t usb_desc_cfg[{configuration_length}];
546+
extern uint16_t usb_serial_number[{serial_number_length}];
547+
extern uint16_t const * const string_desc_arr [{string_descriptor_length}];
548548
549-
const uint8_t hid_report_descriptor[{hid_report_descriptor_length}];
549+
extern const uint8_t hid_report_descriptor[{hid_report_descriptor_length}];
550550
551551
#define USB_HID_NUM_DEVICES {hid_num_devices}
552552

0 commit comments

Comments
 (0)
0