summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2020-07-23 14:39:21 -0700
committerGitHub <noreply@github.com>2020-07-23 14:39:21 -0700
commit060ab8a1f030730b1b7d7fc000143c908ab844e1 (patch)
tree553077dbd3bcad8af80cedd35e255fe93d747b51
parent6a46fd5b91d92609cf33eb93f1c4e24632451d25 (diff)
parentf43834aba2ed9f8f69d961a6554bc81ecaa98f08 (diff)
Merge pull request #3194 from tannewt/gcc10
Prep for GCC10
-rwxr-xr-xmain.c2
-rw-r--r--ports/atmel-samd/mphalport.h4
-rw-r--r--py/objstr.h4
-rw-r--r--py/py.mk5
-rw-r--r--shared-bindings/_pixelbuf/PixelBuf.h2
-rw-r--r--shared-bindings/digitalio/Direction.h2
-rw-r--r--shared-bindings/digitalio/DriveMode.h2
-rw-r--r--shared-bindings/digitalio/Pull.h2
-rw-r--r--shared-bindings/microcontroller/Processor.h2
-rw-r--r--shared-bindings/microcontroller/RunMode.h2
-rw-r--r--shared-bindings/nvm/ByteArray.h2
-rw-r--r--shared-bindings/os/__init__.h2
-rwxr-xr-xshared-bindings/supervisor/Runtime.h2
-rw-r--r--shared-bindings/usb_hid/Device.h2
-rw-r--r--supervisor/serial.h2
-rw-r--r--tools/gen_usb_descriptor.py10
16 files changed, 27 insertions, 20 deletions
diff --git a/main.c b/main.c
index 2fb468913..8c5c9ac37 100755
--- a/main.c
+++ b/main.c
@@ -331,6 +331,8 @@ bool run_code_py(safe_mode_t safe_mode) {
}
}
+FIL* boot_output_file;
+
void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
// If not in safe mode, run boot before initing USB and capture output in a
// file.
diff --git a/ports/atmel-samd/mphalport.h b/ports/atmel-samd/mphalport.h
index f11971749..adc65ade5 100644
--- a/ports/atmel-samd/mphalport.h
+++ b/ports/atmel-samd/mphalport.h
@@ -37,8 +37,8 @@
#define mp_hal_ticks_ms() ((mp_uint_t) supervisor_ticks_ms32())
// Number of bytes in receive buffer
-volatile uint8_t usb_rx_count;
-volatile bool mp_cdc_enabled;
+extern volatile uint8_t usb_rx_count;
+extern volatile bool mp_cdc_enabled;
int receive_usb(void);
diff --git a/py/objstr.h b/py/objstr.h
index 4b5e2054e..cddc6a83a 100644
--- a/py/objstr.h
+++ b/py/objstr.h
@@ -77,8 +77,8 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
mp_obj_t index, bool is_slice);
const byte *find_subbytes(const byte *haystack, size_t hlen, const byte *needle, size_t nlen, int direction);
-const char nibble_to_hex_upper[16];
-const char nibble_to_hex_lower[16];
+extern const char nibble_to_hex_upper[16];
+extern const char nibble_to_hex_lower[16];
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_encode_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_find_obj);
diff --git a/py/py.mk b/py/py.mk
index 3cb505920..3e1d7989f 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -346,6 +346,11 @@ $(HEADER_BUILD)/qstrdefs.generated.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/
$(PY_BUILD)/qstr.o: $(HEADER_BUILD)/qstrdefs.generated.h
+# Standard C functions like memset need to be compiled with special flags so
+# the compiler does not optimise these functions in terms of themselves.
+CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto
+$(BUILD)/lib/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN)
+
# Force nlr code to always be compiled with space-saving optimisation so
# that the function preludes are of a minimal and predictable form.
$(PY_BUILD)/nlr%.o: CFLAGS += -Os
diff --git a/shared-bindings/_pixelbuf/PixelBuf.h b/shared-bindings/_pixelbuf/PixelBuf.h
index 14ee2e900..0b09a5771 100644
--- a/shared-bindings/_pixelbuf/PixelBuf.h
+++ b/shared-bindings/_pixelbuf/PixelBuf.h
@@ -29,7 +29,7 @@
#include "shared-module/_pixelbuf/PixelBuf.h"
-const mp_obj_type_t pixelbuf_pixelbuf_type;
+extern const mp_obj_type_t pixelbuf_pixelbuf_type;
void common_hal__pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size_t n,
pixelbuf_byteorder_details_t* byteorder, mp_float_t brightness, bool auto_write, uint8_t* header,
diff --git a/shared-bindings/digitalio/Direction.h b/shared-bindings/digitalio/Direction.h
index d71f48c2e..17e1eda8d 100644
--- a/shared-bindings/digitalio/Direction.h
+++ b/shared-bindings/digitalio/Direction.h
@@ -37,7 +37,7 @@ typedef struct {
mp_obj_base_t base;
} digitalio_direction_obj_t;
-const mp_obj_type_t digitalio_direction_type;
+extern const mp_obj_type_t digitalio_direction_type;
extern const digitalio_direction_obj_t digitalio_direction_input_obj;
extern const digitalio_direction_obj_t digitalio_direction_output_obj;
diff --git a/shared-bindings/digitalio/DriveMode.h b/shared-bindings/digitalio/DriveMode.h
index 47d036b3a..01ecaa4ae 100644
--- a/shared-bindings/digitalio/DriveMode.h
+++ b/shared-bindings/digitalio/DriveMode.h
@@ -38,7 +38,7 @@ typedef struct {
mp_obj_base_t base;
} digitalio_drive_mode_obj_t;
-const mp_obj_type_t digitalio_drive_mode_type;
+extern const mp_obj_type_t digitalio_drive_mode_type;
extern const digitalio_drive_mode_obj_t digitalio_drive_mode_push_pull_obj;
extern const digitalio_drive_mode_obj_t digitalio_drive_mode_open_drain_obj;
diff --git a/shared-bindings/digitalio/Pull.h b/shared-bindings/digitalio/Pull.h
index 22fb6cd0e..b97e8fb25 100644
--- a/shared-bindings/digitalio/Pull.h
+++ b/shared-bindings/digitalio/Pull.h
@@ -35,7 +35,7 @@ typedef enum _digitalio_pull_t {
PULL_DOWN
} digitalio_pull_t;
-const mp_obj_type_t digitalio_pull_type;
+extern const mp_obj_type_t digitalio_pull_type;
typedef struct {
mp_obj_base_t base;
diff --git a/shared-bindings/microcontroller/Processor.h b/shared-bindings/microcontroller/Processor.h
index 1088112f4..0f520f940 100644
--- a/shared-bindings/microcontroller/Processor.h
+++ b/shared-bindings/microcontroller/Processor.h
@@ -31,7 +31,7 @@
#include "common-hal/microcontroller/Processor.h"
-const mp_obj_type_t mcu_processor_type;
+extern const mp_obj_type_t mcu_processor_type;
uint32_t common_hal_mcu_processor_get_frequency(void);
float common_hal_mcu_processor_get_temperature(void);
diff --git a/shared-bindings/microcontroller/RunMode.h b/shared-bindings/microcontroller/RunMode.h
index 5e8b6e646..ce90ab93a 100644
--- a/shared-bindings/microcontroller/RunMode.h
+++ b/shared-bindings/microcontroller/RunMode.h
@@ -35,7 +35,7 @@ typedef enum {
RUNMODE_BOOTLOADER
} mcu_runmode_t;
-const mp_obj_type_t mcu_runmode_type;
+extern const mp_obj_type_t mcu_runmode_type;
typedef struct {
mp_obj_base_t base;
diff --git a/shared-bindings/nvm/ByteArray.h b/shared-bindings/nvm/ByteArray.h
index 5eee3ab50..9375bcb85 100644
--- a/shared-bindings/nvm/ByteArray.h
+++ b/shared-bindings/nvm/ByteArray.h
@@ -29,7 +29,7 @@
#include "common-hal/nvm/ByteArray.h"
-const mp_obj_type_t nvm_bytearray_type;
+extern const mp_obj_type_t nvm_bytearray_type;
uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t *self);
diff --git a/shared-bindings/os/__init__.h b/shared-bindings/os/__init__.h
index 3776fef64..8394890de 100644
--- a/shared-bindings/os/__init__.h
+++ b/shared-bindings/os/__init__.h
@@ -32,7 +32,7 @@
#include "py/objtuple.h"
-const mp_rom_obj_tuple_t common_hal_os_uname_info_obj;
+extern const mp_rom_obj_tuple_t common_hal_os_uname_info_obj;
mp_obj_t common_hal_os_uname(void);
void common_hal_os_chdir(const char* path);
diff --git a/shared-bindings/supervisor/Runtime.h b/shared-bindings/supervisor/Runtime.h
index 864b070cd..2dc59c3ab 100755
--- a/shared-bindings/supervisor/Runtime.h
+++ b/shared-bindings/supervisor/Runtime.h
@@ -31,7 +31,7 @@
#include "py/obj.h"
-const mp_obj_type_t supervisor_runtime_type;
+extern const mp_obj_type_t supervisor_runtime_type;
bool common_hal_get_serial_connected(void);
diff --git a/shared-bindings/usb_hid/Device.h b/shared-bindings/usb_hid/Device.h
index cb9a64b5e..017995ccc 100644
--- a/shared-bindings/usb_hid/Device.h
+++ b/shared-bindings/usb_hid/Device.h
@@ -29,7 +29,7 @@
#include "shared-module/usb_hid/Device.h"
-const mp_obj_type_t usb_hid_device_type;
+extern const mp_obj_type_t usb_hid_device_type;
void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t* report, uint8_t len);
uint8_t common_hal_usb_hid_device_get_usage_page(usb_hid_device_obj_t *self);
diff --git a/supervisor/serial.h b/supervisor/serial.h
index ef88ad346..066886303 100644
--- a/supervisor/serial.h
+++ b/supervisor/serial.h
@@ -35,7 +35,7 @@
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
#include "lib/oofatfs/ff.h"
-FIL* boot_output_file;
+extern FIL* boot_output_file;
#endif
void serial_early_init(void);
diff --git a/tools/gen_usb_descriptor.py b/tools/gen_usb_descriptor.py
index 9a8423c32..adec33100 100644
--- a/tools/gen_usb_descriptor.py
+++ b/tools/gen_usb_descriptor.py
@@ -539,14 +539,14 @@ h_file.write("""\
#include <stdint.h>
-const uint8_t usb_desc_dev[{device_length}];
+extern const uint8_t usb_desc_dev[{device_length}];
// Make sure the control buffer is big enough to fit the descriptor.
#define CFG_TUD_ENUM_BUFFER_SIZE {max_configuration_length}
-const uint8_t usb_desc_cfg[{configuration_length}];
-uint16_t usb_serial_number[{serial_number_length}];
-uint16_t const * const string_desc_arr [{string_descriptor_length}];
+extern const uint8_t usb_desc_cfg[{configuration_length}];
+extern uint16_t usb_serial_number[{serial_number_length}];
+extern uint16_t const * const string_desc_arr [{string_descriptor_length}];
-const uint8_t hid_report_descriptor[{hid_report_descriptor_length}];
+extern const uint8_t hid_report_descriptor[{hid_report_descriptor_length}];
#define USB_HID_NUM_DEVICES {hid_num_devices}