Skip to content

Commit cd75923

Browse files
committed
Parse partition csv file line' Offset(Start address) and Size values
containing 0x 0X hexadecimal or M,m,K,k bytes as described in https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html#offset-size Similarily to gen_esp32part.py
1 parent 83a0e1a commit cd75923

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: src/ESP32FS.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ private String getBuildFolderPath(Sketch s) {
154154
}
155155

156156
private long parseInt(String value){
157-
if(value.startsWith("0x")) return Long.parseLong(value.substring(2), 16);
157+
if(value.endsWith("m") || value.endsWith("M")) return 1024*1024*Long.parseLong(value.substring(0, (value.length() - 1)));
158+
else if(value.endsWith("k") || value.endsWith("K")) return 1024*Long.parseLong(value.substring(0, (value.length() - 1)));
159+
else if(value.startsWith("0x") || value.startsWith("0X")) return Long.parseLong(value.substring(2), 16);
158160
else return Integer.parseInt(value);
159161
}
160162

0 commit comments

Comments
 (0)