diff --git a/stmhal/file.h b/stmhal/file.h
index 7522a337dc2b180a36eb04bb5dded8d97a213e7c..f21ec6dab6b6a3e73b604d1099ab8e873f120c10 100644
--- a/stmhal/file.h
+++ b/stmhal/file.h
@@ -24,6 +24,6 @@
  * THE SOFTWARE.
  */
 
-const byte fresult_to_errno_table[20];
+extern const byte fresult_to_errno_table[20];
 
 MP_DECLARE_CONST_FUN_OBJ(mp_builtin_open_obj);
diff --git a/stmhal/usb.h b/stmhal/usb.h
index 594e99e18ddc97e8fd93ad408c241f6d43401908..168bfbd5fef686dbfa5944ee066ca7d0c6481a5a 100644
--- a/stmhal/usb.h
+++ b/stmhal/usb.h
@@ -41,7 +41,7 @@ typedef enum {
     USB_STORAGE_MEDIUM_SDCARD,
 } usb_storage_medium_t;
 
-const mp_obj_type_t pyb_usb_vcp_type;
+extern const mp_obj_type_t pyb_usb_vcp_type;
 
 void pyb_usb_init0(void);
 void pyb_usb_dev_init(usb_device_mode_t mode, usb_storage_medium_t medium);