Skip to content

Commit 814f5bf

Browse files
author
Kees Bakker
committed
The GCC string "Known MCU names:" was not found for non-English locale
The output of avr-gcc -Wa,-mlist-devices --target-help is parsed to find the names of the supported MCU's. And we were relying on finding the string "Known MCU names:". That does work anymore since it is sometines translated. So now we simply look for lines starting with " at" of " avr".
1 parent 9065a90 commit 814f5bf

File tree

1 file changed

+9
-19
lines changed
  • de.innot.avreclipse.core/src/de/innot/avreclipse/core/toolinfo

1 file changed

+9
-19
lines changed

de.innot.avreclipse.core/src/de/innot/avreclipse/core/toolinfo/GCC.java

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -142,24 +142,16 @@ private Map<String, String> loadMCUList() throws IOException {
142142
return fMCUmap;
143143
}
144144

145-
boolean start = false;
146-
147-
// The parsing is done by reading the output line by line until a line
148-
// with "Known MCU names:" is found. Then the parsing starts and all
149-
// following lines are split into the mcu ids until a line is reached
150-
// that does not start with a space (the mcu id lines start always with
151-
// a space).
152-
//
153-
// Maybe this could be done with a Pattern matcher, but I don't know how
154-
// to do multiline pattern matching and this is probably faster anyway
145+
// The parsing, if you can call it that, it done by looking at all the
146+
// lines starting with " at" or " avr". Then the line is split into the
147+
// mcu ids.
155148
for (String line : stdout) {
156-
if ("Known MCU names:".equals(line)) {
157-
start = true;
158-
} else if (start && !line.startsWith(" ")) {
159-
// finished
160-
start = false;
161-
} else if (start) {
162-
String[] names = line.split(" ");
149+
if (!line.startsWith(" ")) {
150+
continue;
151+
}
152+
if (line.trim().startsWith("at") ||
153+
line.trim().startsWith("avr")) {
154+
String[] names = line.trim().split(" ");
163155
for (String mcuid : names) {
164156
String mcuname = AVRMCUidConverter.id2name(mcuid);
165157
if (mcuname == null) {
@@ -169,8 +161,6 @@ private Map<String, String> loadMCUList() throws IOException {
169161
}
170162
fMCUmap.put(mcuid, mcuname);
171163
}
172-
} else {
173-
// a line outside of the "Known MCU names:" section
174164
}
175165
}
176166

0 commit comments

Comments
 (0)