Add externs. GCC10 complains about duplicate defines

This commit is contained in:
Scott Shawcroft 2020-07-21 16:26:46 -07:00
parent d22283c9c4
commit 2bd6d05663
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
15 changed files with 22 additions and 20 deletions

2
main.c
View File

@ -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) { 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 // If not in safe mode, run boot before initing USB and capture output in a
// file. // file.

View File

@ -37,8 +37,8 @@
#define mp_hal_ticks_ms() ((mp_uint_t) supervisor_ticks_ms32()) #define mp_hal_ticks_ms() ((mp_uint_t) supervisor_ticks_ms32())
// Number of bytes in receive buffer // Number of bytes in receive buffer
volatile uint8_t usb_rx_count; extern volatile uint8_t usb_rx_count;
volatile bool mp_cdc_enabled; extern volatile bool mp_cdc_enabled;
int receive_usb(void); int receive_usb(void);

View File

@ -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); 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 byte *find_subbytes(const byte *haystack, size_t hlen, const byte *needle, size_t nlen, int direction);
const char nibble_to_hex_upper[16]; extern const char nibble_to_hex_upper[16];
const char nibble_to_hex_lower[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_encode_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_find_obj); MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_find_obj);

View File

@ -29,7 +29,7 @@
#include "shared-module/_pixelbuf/PixelBuf.h" #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, 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, pixelbuf_byteorder_details_t* byteorder, mp_float_t brightness, bool auto_write, uint8_t* header,

View File

@ -37,7 +37,7 @@ typedef struct {
mp_obj_base_t base; mp_obj_base_t base;
} digitalio_direction_obj_t; } 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_input_obj;
extern const digitalio_direction_obj_t digitalio_direction_output_obj; extern const digitalio_direction_obj_t digitalio_direction_output_obj;

View File

@ -38,7 +38,7 @@ typedef struct {
mp_obj_base_t base; mp_obj_base_t base;
} digitalio_drive_mode_obj_t; } 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_push_pull_obj;
extern const digitalio_drive_mode_obj_t digitalio_drive_mode_open_drain_obj; extern const digitalio_drive_mode_obj_t digitalio_drive_mode_open_drain_obj;

View File

@ -35,7 +35,7 @@ typedef enum _digitalio_pull_t {
PULL_DOWN PULL_DOWN
} digitalio_pull_t; } digitalio_pull_t;
const mp_obj_type_t digitalio_pull_type; extern const mp_obj_type_t digitalio_pull_type;
typedef struct { typedef struct {
mp_obj_base_t base; mp_obj_base_t base;

View File

@ -31,7 +31,7 @@
#include "common-hal/microcontroller/Processor.h" #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); uint32_t common_hal_mcu_processor_get_frequency(void);
float common_hal_mcu_processor_get_temperature(void); float common_hal_mcu_processor_get_temperature(void);

View File

@ -35,7 +35,7 @@ typedef enum {
RUNMODE_BOOTLOADER RUNMODE_BOOTLOADER
} mcu_runmode_t; } mcu_runmode_t;
const mp_obj_type_t mcu_runmode_type; extern const mp_obj_type_t mcu_runmode_type;
typedef struct { typedef struct {
mp_obj_base_t base; mp_obj_base_t base;

View File

@ -29,7 +29,7 @@
#include "common-hal/nvm/ByteArray.h" #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); uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t *self);

View File

@ -32,7 +32,7 @@
#include "py/objtuple.h" #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); mp_obj_t common_hal_os_uname(void);
void common_hal_os_chdir(const char* path); void common_hal_os_chdir(const char* path);

View File

@ -31,7 +31,7 @@
#include "py/obj.h" #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); bool common_hal_get_serial_connected(void);

View File

@ -29,7 +29,7 @@
#include "shared-module/usb_hid/Device.h" #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); 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); uint8_t common_hal_usb_hid_device_get_usage_page(usb_hid_device_obj_t *self);

View File

@ -35,7 +35,7 @@
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE #ifdef CIRCUITPY_BOOT_OUTPUT_FILE
#include "lib/oofatfs/ff.h" #include "lib/oofatfs/ff.h"
FIL* boot_output_file; extern FIL* boot_output_file;
#endif #endif
void serial_early_init(void); void serial_early_init(void);

View File

@ -539,14 +539,14 @@ h_file.write("""\
#include <stdint.h> #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. // Make sure the control buffer is big enough to fit the descriptor.
#define CFG_TUD_ENUM_BUFFER_SIZE {max_configuration_length} #define CFG_TUD_ENUM_BUFFER_SIZE {max_configuration_length}
const uint8_t usb_desc_cfg[{configuration_length}]; extern const uint8_t usb_desc_cfg[{configuration_length}];
uint16_t usb_serial_number[{serial_number_length}]; extern uint16_t usb_serial_number[{serial_number_length}];
uint16_t const * const string_desc_arr [{string_descriptor_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} #define USB_HID_NUM_DEVICES {hid_num_devices}