IAR progress

This commit is contained in:
rusEfi 2017-03-30 22:26:51 -04:00
parent 3cfc413ba6
commit f8feea5374
2 changed files with 975 additions and 267 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,9 @@
package com.rusefi; package com.rusefi;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
/** /**
* (c) Andrey Belomutskiy * (c) Andrey Belomutskiy
@ -11,18 +14,20 @@ public class Path2IAR {
private static final String RELATIVE = "..\\..\\firmware/ChibiOS/os"; private static final String RELATIVE = "..\\..\\firmware/ChibiOS/os";
private static String includes = ""; private static String includes = "";
public static void main(String[] args) { public static void main(String[] args) throws IOException {
String result = process("", new File(RELATIVE)); String result = process(" ", new File(RELATIVE));
System.out.println("Result:" + EOL + EOL + EOL + EOL + EOL + EOL); System.out.println("Result:" + EOL + EOL + EOL + EOL + EOL + EOL);
System.out.println(result); System.out.println(result.length());
new FileOutputStream("group.txt", false).write(result.getBytes());
System.out.println("Headers:" + EOL + EOL + EOL + EOL + EOL + EOL); System.out.println("Headers:" + EOL + EOL + EOL + EOL + EOL + EOL);
System.out.println(includes); System.out.println(includes);
} }
private static String process(String s, File folder) { private static String process(String offset, File folder) {
System.out.println("Folder " + folder); System.out.println("Folder " + folder);
if (!folder.isDirectory()) if (!folder.isDirectory())
throw new IllegalStateException("Not a directory: " + folder); throw new IllegalStateException("Not a directory: " + folder);
@ -31,8 +36,8 @@ public class Path2IAR {
includes += "<state>$PROJ_DIR$\\..\\ChibiOS\\os" + folder.getPath().substring(RELATIVE.length()) + "</state>" + EOL; includes += "<state>$PROJ_DIR$\\..\\ChibiOS\\os" + folder.getPath().substring(RELATIVE.length()) + "</state>" + EOL;
String group = "<group>\n" + String group = offset + "<group>\n" +
" <name>" + folder.getName() + "</name>"; offset + " <name>" + folder.getName() + "</name>\n";
for (String fileName : folder.list()) { for (String fileName : folder.list()) {
@ -40,7 +45,7 @@ public class Path2IAR {
System.out.println(file); System.out.println(file);
if (file.isDirectory()) { if (file.isDirectory()) {
group += process("", file); group += process(offset + " ", file);
continue; continue;
} }
@ -50,15 +55,16 @@ public class Path2IAR {
String name = file.getPath().substring(RELATIVE.length()); String name = file.getPath().substring(RELATIVE.length());
group += "<file>\n<name>$PROJ_DIR$\\..\\ChibiOS" + name + "</name>\n" + group += offset + "<file>\n" +
" </file>\n"; offset + " <name>$PROJ_DIR$\\..\\ChibiOS\\os" + name + "</name>\n" +
offset + "</file>\n";
} }
return group + "</group>"; return group + offset + "</group>" + EOL;
} }
} }