mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-20 06:35:50 +02:00
Things I do to get Intel Arduino Working.
Use versions in platform installs just like tools. Make sure those version numbers don't have +'s in them since it screws up Freemarker. Add cheat in so that the Intel toolchains extract properly. Change-Id: I7f4e6a92844461b6cbfe21436151d876558a4d2a
This commit is contained in:
parent
3447d2a00a
commit
452d57aa7a
7 changed files with 35 additions and 76 deletions
|
@ -63,11 +63,13 @@ public class FullIntegration {
|
|||
private ArduinoBoard board;
|
||||
|
||||
private static void setPreferences() throws Exception {
|
||||
URL[] urls = new URL[] { new URL("http://downloads.arduino.cc/packages/package_index.json"),
|
||||
URL[] urls = new URL[] {
|
||||
new URL("http://downloads.arduino.cc/packages/package_index.json"),
|
||||
new URL("https://adafruit.github.io/arduino-board-index/package_adafruit_index.json"),
|
||||
new URL("http://arduino.esp8266.com/stable/package_esp8266com_index.json"),
|
||||
new URL("http://drazzy.com/package_drazzy.com_index.json") };
|
||||
// new URL("https://github.com/chipKIT32/chipKIT-core/raw/master/package_chipkit_index.json")
|
||||
new URL("http://drazzy.com/package_drazzy.com_index.json"),
|
||||
//new URL("https://github.com/chipKIT32/chipKIT-core/raw/master/package_chipkit_index.json"),
|
||||
};
|
||||
ArduinoPreferences.setBoardUrlList(urls);
|
||||
|
||||
Path workspace = Paths.get(ResourcesPlugin.getWorkspace().getRoot().getLocationURI());
|
||||
|
@ -84,20 +86,6 @@ public class FullIntegration {
|
|||
|
||||
// What is Microsoft doing?
|
||||
skipBuild.add(arduinoManager.getBoard("Microsoft", "win10", "w10iotcore"));
|
||||
|
||||
if (Platform.getOS().equals(Platform.OS_WIN32)) {
|
||||
// tool chain incorrect?
|
||||
skipBuild.add(arduinoManager.getBoard("Intel", "i586", "izmir_fd"));
|
||||
skipBuild.add(arduinoManager.getBoard("Intel", "i586", "izmir_fg"));
|
||||
skipBuild.add(arduinoManager.getBoard("Intel", "i686", "izmir_ec"));
|
||||
}
|
||||
|
||||
if (Platform.getOS().equals(Platform.OS_LINUX)) {
|
||||
// i586/pokysdk missing
|
||||
skipBuild.add(arduinoManager.getBoard("Intel", "i586", "izmir_fd"));
|
||||
skipBuild.add(arduinoManager.getBoard("Intel", "i586", "izmir_fg"));
|
||||
skipBuild.add(arduinoManager.getBoard("Intel", "i686", "izmir_ec"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void setupSkipUpload() throws Exception {
|
||||
|
|
|
@ -577,7 +577,16 @@ public class ArduinoManager {
|
|||
}
|
||||
|
||||
// Strip the first directory of the path
|
||||
Path entryPath = installPath.resolve(path.subpath(1, path.getNameCount()));
|
||||
Path entryPath;
|
||||
switch (path.getName(0).toString()) {
|
||||
case "i586":
|
||||
case "i686":
|
||||
// Cheat for Intel
|
||||
entryPath = installPath.resolve(path);
|
||||
break;
|
||||
default:
|
||||
entryPath = installPath.resolve(path.subpath(1, path.getNameCount()));
|
||||
}
|
||||
|
||||
Files.createDirectories(entryPath.getParent());
|
||||
|
||||
|
|
|
@ -7,20 +7,15 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.arduino.core.internal.board;
|
||||
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.arduino.core.internal.Activator;
|
||||
import org.eclipse.cdt.arduino.core.internal.ArduinoPreferences;
|
||||
import org.eclipse.cdt.arduino.core.internal.LinkedProperties;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class ArduinoPackage {
|
||||
|
@ -89,32 +84,19 @@ public class ArduinoPackage {
|
|||
if (installedPlatforms == null) {
|
||||
installedPlatforms = new HashMap<>();
|
||||
|
||||
if (Files.isDirectory(getInstallPath())) {
|
||||
Path platformTxt = Paths.get("platform.txt"); //$NON-NLS-1$
|
||||
try {
|
||||
Path hardware = getInstallPath().resolve("hardware"); //$NON-NLS-1$
|
||||
if (Files.exists(hardware)) {
|
||||
Files.find(hardware, 2, // $NON-NLS-1$
|
||||
(path, attrs) -> path.getFileName().equals(platformTxt)).forEach(path -> {
|
||||
try (FileReader reader = new FileReader(path.toFile())) {
|
||||
LinkedProperties platformProperties = new LinkedProperties();
|
||||
platformProperties.load(reader);
|
||||
String arch = path.getName(path.getNameCount() - 2).toString();
|
||||
String version = platformProperties.getProperty("version"); //$NON-NLS-1$
|
||||
if (Files.isDirectory(hardware)) {
|
||||
for (ArduinoPlatform platform : platforms) {
|
||||
String arch = platform.getArchitecture();
|
||||
String version = platform.getVersion();
|
||||
|
||||
ArduinoPlatform platform = getPlatform(arch, version);
|
||||
if (platform != null) {
|
||||
platform.setPlatformProperties(platformProperties);
|
||||
Path platPath = hardware.resolve(arch).resolve(version);
|
||||
if (Files.exists(platPath)) {
|
||||
ArduinoPlatform current = installedPlatforms.get(arch);
|
||||
if (current == null || ArduinoManager.compareVersions(version, current.getVersion()) > 0) {
|
||||
installedPlatforms.put(arch, platform);
|
||||
} // TODO manually add it if was removed
|
||||
// from index
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw Activator.coreException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Collection;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.cdt.arduino.core.internal.Activator;
|
||||
import org.eclipse.cdt.arduino.core.internal.ArduinoPreferences;
|
||||
|
@ -83,7 +82,7 @@ public class ArduinoPlatform {
|
|||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
return version.replace('+', '_');
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
|
@ -219,7 +218,7 @@ public class ArduinoPlatform {
|
|||
} else {
|
||||
// TODO for now, grab the one from the arduino package
|
||||
ArduinoManager manager = Activator.getService(ArduinoManager.class);
|
||||
ArduinoPackage arduinoPkg = manager.getPackage("arduino");
|
||||
ArduinoPackage arduinoPkg = manager.getPackage("arduino"); //$NON-NLS-1$
|
||||
if (arduinoPkg != null) {
|
||||
ArduinoPlatform arduinoPlat = arduinoPkg.getInstalledPlatform(getArchitecture());
|
||||
if (arduinoPlat != null) {
|
||||
|
@ -232,7 +231,7 @@ public class ArduinoPlatform {
|
|||
}
|
||||
|
||||
public Path getInstallPath() {
|
||||
return getPackage().getInstallPath().resolve("hardware").resolve(architecture); //$NON-NLS-1$
|
||||
return getPackage().getInstallPath().resolve("hardware").resolve(getArchitecture()).resolve(getVersion()); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private void initLibraries() throws CoreException {
|
||||
|
|
|
@ -38,7 +38,7 @@ public class ArduinoTool {
|
|||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
return version.replace('+', '_');
|
||||
}
|
||||
|
||||
public List<ArduinoToolSystem> getSystems() {
|
||||
|
@ -53,26 +53,7 @@ public class ArduinoTool {
|
|||
}
|
||||
|
||||
public Path getInstallPath() {
|
||||
// TODO remove migration in Neon
|
||||
Path oldPath = ArduinoPreferences.getArduinoHome().resolve("tools").resolve(pkg.getName()).resolve(name) //$NON-NLS-1$
|
||||
.resolve(version);
|
||||
Path newPath = getPackage().getInstallPath().resolve("tools").resolve(name).resolve(version); //$NON-NLS-1$
|
||||
if (Files.exists(oldPath)) {
|
||||
try {
|
||||
Files.createDirectories(newPath.getParent());
|
||||
Files.move(oldPath, newPath);
|
||||
for (Path parent = oldPath.getParent(); parent != null; parent = parent.getParent()) {
|
||||
if (Files.newDirectoryStream(parent).iterator().hasNext()) {
|
||||
break;
|
||||
} else {
|
||||
Files.delete(parent);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
return newPath;
|
||||
return getPackage().getInstallPath().resolve("tools").resolve(getName()).resolve(getVersion()); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public boolean isInstalled() {
|
||||
|
|
|
@ -28,18 +28,18 @@ public class ToolDependency {
|
|||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
return version.replace('+', '_');
|
||||
}
|
||||
|
||||
public ArduinoTool getTool() throws CoreException {
|
||||
return Activator.getService(ArduinoManager.class).getTool(packager, name, version);
|
||||
return Activator.getService(ArduinoManager.class).getTool(getPackager(), getName(), getVersion());
|
||||
}
|
||||
|
||||
public void install(IProgressMonitor monitor) throws CoreException {
|
||||
ArduinoTool tool = getTool();
|
||||
if (tool == null) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getId(),
|
||||
String.format("Tool not found %s %s", name, version)));
|
||||
String.format("Tool not found %s %s", getName(), getVersion())));
|
||||
}
|
||||
getTool().install(monitor);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue