diff --git a/main.c b/main.c index 2fb4689136..8c5c9ac37d 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 f119717499..adc65ade53 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 4b5e2054e0..cddc6a83a1 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/shared-bindings/_pixelbuf/PixelBuf.h b/shared-bindings/_pixelbuf/PixelBuf.h index 14ee2e900b..0b09a57715 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 d71f48c2ed..17e1eda8db 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 47d036b3ae..01ecaa4ae9 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 22fb6cd0e7..b97e8fb255 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 1088112f43..0f520f940c 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 5e8b6e6465..ce90ab93a7 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 5eee3ab502..9375bcb857 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 3776fef643..8394890def 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 864b070cdb..2dc59c3ab6 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 cb9a64b5ea..017995ccc3 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 ef88ad346d..066886303e 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 9a8423c323..adec33100e 100644 --- a/tools/gen_usb_descriptor.py +++ b/tools/gen_usb_descriptor.py @@ -539,14 +539,14 @@ h_file.write("""\ #include -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}