@@ -189,15 +189,15 @@ def install_tool(TOOL, retry_count=0):
189189 if check_tool in package :
190190 install_tool (package )
191191
192- if "buildfs" in targets :
192+ if "buildfs" or "uploadfs" in targets :
193193 filesystem = variables .get ("board_build.filesystem" , "littlefs" )
194194 if filesystem == "littlefs" :
195195 # ensure use of mklittlefs 3.2.0
196196 piopm_path = os .path .join (ProjectConfig .get_instance ().get ("platformio" , "packages_dir" ), "tool-mklittlefs" , ".piopm" )
197197 if os .path .exists (piopm_path ):
198198 with open (piopm_path , "r" ) as file :
199199 package_data = json .load (file )
200- if package_data ['version' ] == "4.0 .0" :
200+ if package_data ['version' ] != "3.2 .0" :
201201 os .remove (piopm_path )
202202 install_tool ("tool-mklittlefs" )
203203 elif filesystem == "fatfs" :
@@ -228,10 +228,15 @@ def install_tool(TOOL, retry_count=0):
228228 os .path .join (mklittlefs400_dir , "package.json" ),
229229 )
230230 shutil .copytree (mklittlefs400_dir , mklittlefs_dir , dirs_exist_ok = True )
231+ del self .packages ["tool-mkfatfs" ]
232+ elif filesystem == "fatfs" :
233+ install_tool ("tool-mkfatfs" )
231234
232235 # Currently only Arduino Nano ESP32 uses the dfuutil tool as uploader
233236 if variables .get ("board" ) == "arduino_nano_esp32" :
234237 install_tool ("tool-dfuutil-arduino" )
238+ else :
239+ del self .packages ["tool-dfuutil-arduino" ]
235240
236241 return super ().configure_default_packages (variables , targets )
237242
0 commit comments