@@ -159,25 +159,23 @@ private long getIntPref(String name){
159
159
}
160
160
161
161
private void createAndUpload (){
162
- if (!PreferencesData .get ("target_platform" ).contentEquals ("esp8266 " )){
162
+ if (!PreferencesData .get ("target_platform" ).contentEquals ("rp2040 " )){
163
163
System .err .println ();
164
164
editor .statusError ("LittleFS Not Supported on " +PreferencesData .get ("target_platform" ));
165
165
return ;
166
166
}
167
167
168
- if (!BaseNoGui .getBoardPreferences ().containsKey ("build.spiffs_start " ) || !BaseNoGui .getBoardPreferences ().containsKey ("build.spiffs_end " )){
168
+ if (!BaseNoGui .getBoardPreferences ().containsKey ("build.fs_start " ) || !BaseNoGui .getBoardPreferences ().containsKey ("build.fs_end " )){
169
169
System .err .println ();
170
170
editor .statusError ("LittleFS Not Defined for " +BaseNoGui .getBoardPreferences ().get ("name" ));
171
171
return ;
172
172
}
173
173
long spiStart , spiEnd , spiPage , spiBlock ;
174
174
try {
175
- spiStart = getIntPref ("build.spiffs_start" );
176
- spiEnd = getIntPref ("build.spiffs_end" );
177
- spiPage = getIntPref ("build.spiffs_pagesize" );
178
- if (spiPage == 0 ) spiPage = 256 ;
179
- spiBlock = getIntPref ("build.spiffs_blocksize" );
180
- if (spiBlock == 0 ) spiBlock = 4096 ;
175
+ spiStart = getIntPref ("build.fs_start" );
176
+ spiEnd = getIntPref ("build.fs_end" );
177
+ spiPage = 256 ;
178
+ spiBlock = 4096 ;
181
179
} catch (Exception e ){
182
180
editor .statusError (e );
183
181
return ;
@@ -192,11 +190,11 @@ private void createAndUpload(){
192
190
else
193
191
mkspiffsCmd = "mklittlefs" ;
194
192
195
- File tool = new File (platform .getFolder () + "/tools " , mkspiffsCmd );
193
+ File tool = new File (platform .getFolder () + "/system " , mkspiffsCmd );
196
194
if (!tool .exists () || !tool .isFile ()) {
197
- tool = new File (platform .getFolder () + "/tools /mklittlefs" , mkspiffsCmd );
195
+ tool = new File (platform .getFolder () + "/system /mklittlefs" , mkspiffsCmd );
198
196
if (!tool .exists ()) {
199
- tool = new File (PreferencesData .get ("runtime.tools.mklittlefs.path" ), mkspiffsCmd );
197
+ tool = new File (PreferencesData .get ("runtime.tools.pqt- mklittlefs.path" ), mkspiffsCmd );
200
198
if (!tool .exists ()) {
201
199
System .err .println ();
202
200
editor .statusError ("LittleFS Error: mklittlefs not found!" );
@@ -205,9 +203,6 @@ private void createAndUpload(){
205
203
}
206
204
}
207
205
208
- Boolean isNetwork = false ;
209
- File espota = new File (platform .getFolder ()+"/tools" );
210
- File esptool = new File (platform .getFolder ()+"/tools" );
211
206
String serialPort = PreferencesData .get ("serial.port" );
212
207
String pythonCmd = PreferencesData .get ("runtime.os" ).contentEquals ("windows" ) ? "python3.exe" : "python3" ;
213
208
String uploadCmd = "" ;
@@ -220,7 +215,7 @@ private void createAndUpload(){
220
215
}
221
216
222
217
// Find upload.py, don't fail if not present for backwards compat
223
- File uploadPyFile = new File (platform .getFolder ()+"/tools" , "upload .py" );
218
+ File uploadPyFile = new File (platform .getFolder ()+"/tools" , "uf2conv .py" );
224
219
if (uploadPyFile .exists () && uploadPyFile .isFile ()) {
225
220
uploadCmd = uploadPyFile .getAbsolutePath ();
226
221
}
@@ -235,32 +230,6 @@ private void createAndUpload(){
235
230
}
236
231
// pythonCmd now points to either an installed exe with full path or just plain "python3(.exe)"
237
232
238
- //find espota if IP else find esptool
239
- if (serialPort .split ("\\ ." ).length == 4 ){
240
- isNetwork = true ;
241
- String espotaCmd = "espota.py" ;
242
- espota = new File (platform .getFolder ()+"/tools" , espotaCmd );
243
- if (!espota .exists () || !espota .isFile ()){
244
- System .err .println ();
245
- editor .statusError ("LittleFS Error: espota not found!" );
246
- return ;
247
- }
248
- } else {
249
- String esptoolCmd = platform .getTool ("esptool" ).get ("cmd" );
250
- esptool = new File (platform .getFolder ()+"/tools" , esptoolCmd );
251
- if (!esptool .exists () || !esptool .isFile ()){
252
- esptool = new File (platform .getFolder ()+"/tools/esptool" , esptoolCmd );
253
- if (!esptool .exists ()){
254
- esptool = new File (PreferencesData .get ("runtime.tools.esptool.path" ), esptoolCmd );
255
- if (!esptool .exists () && uploadCmd .isEmpty ()) {
256
- System .err .println ();
257
- editor .statusError ("LittleFS Error: esptool not found!" );
258
- return ;
259
- }
260
- }
261
- }
262
- }
263
-
264
233
//load a list of all files
265
234
int fileCount = 0 ;
266
235
File dataFolder = new File (editor .getSketch ().getFolder (), "data" );
@@ -280,11 +249,6 @@ private void createAndUpload(){
280
249
String toolPath = tool .getAbsolutePath ();
281
250
String sketchName = editor .getSketch ().getName ();
282
251
String imagePath = getBuildFolderPath (editor .getSketch ()) + "/" + sketchName + ".mklittlefs.bin" ;
283
- String resetMethod = BaseNoGui .getBoardPreferences ().get ("upload.resetmethod" );
284
- String uploadSpeed = BaseNoGui .getBoardPreferences ().get ("upload.speed" );
285
- String uploadAddress = BaseNoGui .getBoardPreferences ().get ("build.spiffs_start" );
286
-
287
-
288
252
289
253
Object [] options = { "Yes" , "No" };
290
254
String title = "LittleFS Create" ;
@@ -298,7 +262,7 @@ private void createAndUpload(){
298
262
299
263
editor .statusNotice ("LittleFS Creating Image..." );
300
264
System .out .println ("[LittleFS] data : " +dataPath );
301
- System .out .println ("[LittleFS] size : " +((spiEnd - spiStart )/1024 ));
265
+ System .out .println ("[LittleFS] size : " +((spiEnd - spiStart )/1024 ) + "KB" );
302
266
System .out .println ("[LittleFS] page : " +spiPage );
303
267
System .out .println ("[LittleFS] block : " +spiBlock );
304
268
@@ -315,28 +279,15 @@ private void createAndUpload(){
315
279
}
316
280
317
281
editor .statusNotice ("LittleFS Uploading Image..." );
318
- System .out .println ("[LittleFS] upload : " +imagePath );
319
-
320
- if (isNetwork ){
321
- System .out .println ("[LittleFS] IP : " +serialPort );
322
- System .out .println ();
323
- sysExec (new String []{pythonCmd , espota .getAbsolutePath (), "-i" , serialPort , "-s" , "-f" , imagePath });
324
- } else {
325
- System .out .println ("[LittleFS] address : " +uploadAddress );
326
- System .out .println ("[LittleFS] reset : " +resetMethod );
327
- System .out .println ("[LittleFS] port : " +serialPort );
328
- System .out .println ("[LittleFS] speed : " +uploadSpeed );
329
- if (!uploadCmd .isEmpty ()) {
330
- System .out .println ("[LittleFS] python : " +pythonCmd );
331
- System .out .println ("[LittleFS] uploader : " +uploadCmd );
332
- }
333
-
334
- System .out .println ();
335
- if (!uploadCmd .isEmpty ()) {
336
- sysExec (new String []{pythonCmd , uploadCmd , "--chip" , "esp8266" , "--port" , serialPort , "--baud" , uploadSpeed , "write_flash" , uploadAddress , imagePath });
337
- } else {
338
- sysExec (new String []{esptool .getAbsolutePath (), "-cd" , resetMethod , "-cb" , uploadSpeed , "-cp" , serialPort , "-ca" , uploadAddress , "-cf" , imagePath });
339
- }
282
+ System .out .println ("[LittleFS] upload : " + imagePath );
283
+ System .out .println ("[LittleFS] address : " + spiStart + "" );
284
+ System .out .println ("[LittleFS] swerial : " + serialPort );
285
+ System .out .println ("[LittleFS] python : " + pythonCmd );
286
+ System .out .println ("[LittleFS] uploader : " + uploadCmd );
287
+
288
+ System .out .println ();
289
+ if (!uploadCmd .isEmpty ()) {
290
+ sysExec (new String []{pythonCmd , uploadCmd , "--base" , (spiStart - 0 * 0x10000000 ) + "" , "--serial" , serialPort , "--family" , "RP2040" , imagePath });
340
291
}
341
292
}
342
293
0 commit comments