diff --git a/stmhal/Makefile b/stmhal/Makefile
index c457e2ff13632895ed79922e214c991a2f8bfb77..46125d10b551a184b7edb5ee20f0c4e27513cd84 100644
--- a/stmhal/Makefile
+++ b/stmhal/Makefile
@@ -39,7 +39,6 @@ INC += -I$(CMSIS_DIR)/devinc
 INC += -I$(HAL_DIR)/inc
 INC += -I$(USBDEV_DIR)/core/inc -I$(USBDEV_DIR)/class/inc
 #INC += -I$(USBHOST_DIR)
-INC += -I../$(FATFS_DIR)
 INC += -I../lib/mp-readline
 
 CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion
diff --git a/stmhal/diskio.c b/stmhal/diskio.c
index 948297aa48aad82be4073abfc8055040a88b63dd..9cae46eb18307dcc652ad5920b487df99cc209d8 100644
--- a/stmhal/diskio.c
+++ b/stmhal/diskio.c
@@ -33,12 +33,11 @@
 #include "stm32f4xx_hal.h"
 
 #include "py/runtime.h"
-#include "systick.h"
+#include "lib/fatfs/ff.h"        /* FatFs lower layer API */
+#include "lib/fatfs/diskio.h"        /* FatFs lower layer API */
 #include "rtc.h"
 #include "storage.h"
 #include "sdcard.h"
-#include "ff.h"        /* FatFs lower layer API */
-#include "diskio.h"        /* FatFs lower layer API */
 #include "fsusermount.h"
 
 const PARTITION VolToPart[] = {
diff --git a/stmhal/ffconf.c b/stmhal/ffconf.c
index 0a4745462eb9aa5c082e0648d3a1cddd4ee82f08..b8dada3cca3060cf34ca385c53cbfb1debabf8f7 100644
--- a/stmhal/ffconf.c
+++ b/stmhal/ffconf.c
@@ -27,7 +27,7 @@
 #include <string.h>
 
 #include "py/obj.h"
-#include "ff.h"
+#include "lib/fatfs/ff.h"
 #include "ffconf.h"
 #include "fsusermount.h"
 
diff --git a/stmhal/file.c b/stmhal/file.c
index 66bb51f49cdbd79cd3d07e0ef006d7258611d300..62e582874747ba7f8cdce45d64b0a9f24b02ae65 100644
--- a/stmhal/file.c
+++ b/stmhal/file.c
@@ -30,8 +30,8 @@
 #include "py/nlr.h"
 #include "py/runtime.h"
 #include "py/stream.h"
+#include "lib/fatfs/ff.h"
 #include "file.h"
-#include "ff.h"
 
 extern const mp_obj_type_t mp_type_fileio;
 extern const mp_obj_type_t mp_type_textio;
diff --git a/stmhal/fsusermount.c b/stmhal/fsusermount.c
index 0cd36480e6e3cdac8b50fb7499843b8c448e1860..5ddb4c29baa8f3d6a25b7e3f03465db5b4598f0f 100644
--- a/stmhal/fsusermount.c
+++ b/stmhal/fsusermount.c
@@ -26,7 +26,7 @@
 
 #include "py/nlr.h"
 #include "py/runtime.h"
-#include "ff.h"
+#include "lib/fatfs/ff.h"
 #include "fsusermount.h"
 
 // for user-mountable block device
diff --git a/stmhal/import.c b/stmhal/import.c
index e94cf620e0e864835edda57ed7d928d1e8ab8fd8..c28fe87628737f8acce37672ffa74b779ae6575d 100644
--- a/stmhal/import.c
+++ b/stmhal/import.c
@@ -27,7 +27,7 @@
 #include <stdio.h>
 
 #include "py/lexer.h"
-#include "ff.h"
+#include "lib/fatfs/ff.h"
 
 mp_import_stat_t mp_import_stat(const char *path) {
     FILINFO fno;
diff --git a/stmhal/lexerfatfs.c b/stmhal/lexerfatfs.c
index 639cd1f2f1826a1fe26e0b4e8f290791dee06ecd..ddab89a5c3fa7b9cc6eed39de0cbeeb22fc39634 100644
--- a/stmhal/lexerfatfs.c
+++ b/stmhal/lexerfatfs.c
@@ -27,8 +27,8 @@
 #include <stdio.h>
 
 #include "py/lexer.h"
+#include "lib/fatfs/ff.h"
 #include "lexerfatfs.h"
-#include "ff.h"
 
 typedef struct _mp_lexer_file_buf_t {
     FIL fp;
diff --git a/stmhal/main.c b/stmhal/main.c
index f91d10d32537f1e100240099a46946222be15560..d57bb2b2d422ac957921b6693bfdc26bd2d798b7 100644
--- a/stmhal/main.c
+++ b/stmhal/main.c
@@ -35,6 +35,8 @@
 #include "py/stackctrl.h"
 #include "py/gc.h"
 
+#include "lib/fatfs/ff.h"
+
 #include "systick.h"
 #include "pendsv.h"
 #include "gccollect.h"
@@ -52,7 +54,6 @@
 #include "rtc.h"
 #include "storage.h"
 #include "sdcard.h"
-#include "ff.h"
 #include "rng.h"
 #include "accel.h"
 #include "servo.h"
diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c
index 40189c1e778d04d6f75508d08c23939a19b6258a..b81f43c1d01c6baac701b70fd125726718176de1 100644
--- a/stmhal/modpyb.c
+++ b/stmhal/modpyb.c
@@ -33,6 +33,8 @@
 #include "py/nlr.h"
 #include "py/obj.h"
 #include "py/gc.h"
+#include "lib/fatfs/ff.h"
+#include "lib/fatfs/diskio.h"
 #include "gccollect.h"
 #include "irq.h"
 #include "systick.h"
@@ -56,8 +58,6 @@
 #include "dac.h"
 #include "lcd.h"
 #include "usb.h"
-#include "ff.h"
-#include "diskio.h"
 #include "fsusermount.h"
 #include "portmodules.h"
 
diff --git a/stmhal/moduos.c b/stmhal/moduos.c
index 9f8de8046eabb25d7396ef01880f583fa057a7d5..7c73d6051067bde9f8b8493b800101b473558601 100644
--- a/stmhal/moduos.c
+++ b/stmhal/moduos.c
@@ -30,11 +30,10 @@
 #include "py/nlr.h"
 #include "py/obj.h"
 #include "py/objtuple.h"
-#include "systick.h"
+#include "lib/fatfs/ff.h"
+#include "lib/fatfs/diskio.h"
 #include "rng.h"
 #include "storage.h"
-#include "ff.h"
-#include "diskio.h"
 #include "file.h"
 #include "sdcard.h"
 #include "fsusermount.h"
diff --git a/stmhal/usbd_msc_storage.c b/stmhal/usbd_msc_storage.c
index 03483ef093459ea8aa917c94cd244cda73ce21a2..82fa550dc99a3f56747c98d64391f28293a75402 100644
--- a/stmhal/usbd_msc_storage.c
+++ b/stmhal/usbd_msc_storage.c
@@ -37,8 +37,8 @@
 #include "usbd_msc_storage.h"
 
 #include "py/misc.h"
+#include "lib/fatfs/diskio.h"
 #include "storage.h"
-#include "diskio.h"
 #include "sdcard.h"
 
 // These are needed to support removal of the medium, so that the USB drive