Skip to content

Commit cb3f47d

Browse files
committed
Modify workaround to fix #1696 on linux
Unfortunately the builddefault ino on all boards fails to run on my linux box due to out of memory
1 parent 2be9546 commit cb3f47d

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

io.sloeber.core/src/io/sloeber/core/txt/WorkAround.java

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,15 @@
4444
public class WorkAround {
4545
// Each time this class is touched consider changing the String below to enforce
4646
// updates
47-
private static final String FIRST_SLOEBER_WORKAROUND_LINE = "#Sloeber created TXT file V3.00.test 25 ";
47+
private static final String FIRST_SLOEBER_WORKAROUND_LINE = "#Sloeber created TXT file V3.00.test 34 ";
4848

4949
private static Map<String, String> USB_replacers;
5050

5151
static
5252
{
5353
USB_replacers = new TreeMap<>();
54+
55+
if (isWindows) {
5456

5557
USB_replacers.put(" '-DUSB_MANUFACTURER={build.usb_manufacturer}' ",
5658
" \"-DUSB_MANUFACTURER={build.usb_manufacturer}\" ");
@@ -66,6 +68,21 @@ public class WorkAround {
6668

6769
USB_replacers.put(" '-DUSB_SERIAL=\"{build.usb_serial}\"' ", " \"-DUSB_SERIAL=\\\"{build.usb_serial}\\\"\" ");
6870
USB_replacers.put(" '-DUSB_SERIAL={build.usb_serial}' ", " \"-DUSB_SERIAL={build.usb_serial}\" ");
71+
}else {
72+
USB_replacers.put(" -DUSB_MANUFACTURER=\"{build.usb_manufacturer}\" ",
73+
" '-DUSB_MANUFACTURER=\"{build.usb_manufacturer}\"' ");
74+
USB_replacers.put(" -DUSB_PRODUCT=\"{build.usb_product}\" "," '-DUSB_PRODUCT=\"{build.usb_product}\"' ");
75+
USB_replacers.put(" -DARDUINO_BOARD=\"{build.board}\" ", " '-DARDUINO_BOARD=\"{build.board}\"' ");
76+
USB_replacers.put(" -DUSB_SERIAL=\"{build.usb_serial}\" ", " '-DUSB_SERIAL=\"{build.usb_serial}\"' ");
77+
78+
//esp32 has
79+
//extraflags=-DARDUINO_HOST_OS=
80+
//so no space in search
81+
USB_replacers.put("-DARDUINO_HOST_OS=\"{runtime.os}\" ", "'-DARDUINO_HOST_OS=\"{runtime.os}\"' ");
82+
USB_replacers.put(" -DARDUINO_VARIANT=\"{build.variant}\" ", " '-DARDUINO_VARIANT=\"{build.variant}\"' ");
83+
USB_replacers.put(" -DARDUINO_FQBN=\"{build.fqbn}\" ", " '-DARDUINO_FQBN=\"{build.fqbn}\"' ");
84+
85+
}
6986

7087
}
7188

@@ -158,10 +175,12 @@ public static String boardsApplyWorkArounds(String inBoardsTXT) {
158175
boardsTXT = boardsTXT.replace("\n", " \n");
159176
boardsTXT = solveOSStuff(boardsTXT);
160177

161-
// replace FI circuitplay32u4cat.build.usb_manufacturer="Adafruit"
162-
// with circuitplay32u4cat.build.usb_manufacturer=\"Adafruit\"
163-
boardsTXT = boardsTXT.replaceAll("(\\S+\\.build\\.usb\\S+)=\\\"(.+)\\\"",
164-
"$1=\\\\\"$2\\\\\"");
178+
if (isWindows) {
179+
// replace FI circuitplay32u4cat.build.usb_manufacturer="Adafruit"
180+
// with circuitplay32u4cat.build.usb_manufacturer=\"Adafruit\"
181+
boardsTXT = boardsTXT.replaceAll("(\\S+\\.build\\.usb\\S+)=\\\"(.+)\\\"",
182+
"$1=\\\\\"$2\\\\\"");
183+
}
165184

166185
// quoting fixes for embedutils
167186
// ['\"]?(-DMBEDTLS_\S+)=\\?"(mbedtls\S+?)\\?\"["']? \"$1=\\\"$2\\\"\"
@@ -241,6 +260,7 @@ public static String platformApplyWorkArounds(String inPlatformTxt, File request
241260
platformTXT = platformTXT.replaceAll("(?m)^(\\S*)\\s*=", "$1=");
242261
// remove -MMD (the dependency generation parameter
243262
platformTXT = platformTXT.replaceAll(" -MMD ", " ");
263+
// add a space at the end of the line
244264
platformTXT = platformTXT.replace("\n", " \n");
245265

246266
platformTXT = solveOSStuff(platformTXT);

0 commit comments

Comments
 (0)