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 ArduinoBoard board;
|
||||||
|
|
||||||
private static void setPreferences() throws Exception {
|
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("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://arduino.esp8266.com/stable/package_esp8266com_index.json"),
|
||||||
new URL("http://drazzy.com/package_drazzy.com_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("https://github.com/chipKIT32/chipKIT-core/raw/master/package_chipkit_index.json"),
|
||||||
|
};
|
||||||
ArduinoPreferences.setBoardUrlList(urls);
|
ArduinoPreferences.setBoardUrlList(urls);
|
||||||
|
|
||||||
Path workspace = Paths.get(ResourcesPlugin.getWorkspace().getRoot().getLocationURI());
|
Path workspace = Paths.get(ResourcesPlugin.getWorkspace().getRoot().getLocationURI());
|
||||||
|
@ -84,20 +86,6 @@ public class FullIntegration {
|
||||||
|
|
||||||
// What is Microsoft doing?
|
// What is Microsoft doing?
|
||||||
skipBuild.add(arduinoManager.getBoard("Microsoft", "win10", "w10iotcore"));
|
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 {
|
private static void setupSkipUpload() throws Exception {
|
||||||
|
|
|
@ -577,7 +577,16 @@ public class ArduinoManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strip the first directory of the path
|
// 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());
|
Files.createDirectories(entryPath.getParent());
|
||||||
|
|
||||||
|
|
|
@ -7,20 +7,15 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.arduino.core.internal.board;
|
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.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
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.ArduinoPreferences;
|
||||||
import org.eclipse.cdt.arduino.core.internal.LinkedProperties;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
public class ArduinoPackage {
|
public class ArduinoPackage {
|
||||||
|
@ -89,32 +84,19 @@ public class ArduinoPackage {
|
||||||
if (installedPlatforms == null) {
|
if (installedPlatforms == null) {
|
||||||
installedPlatforms = new HashMap<>();
|
installedPlatforms = new HashMap<>();
|
||||||
|
|
||||||
if (Files.isDirectory(getInstallPath())) {
|
Path hardware = getInstallPath().resolve("hardware"); //$NON-NLS-1$
|
||||||
Path platformTxt = Paths.get("platform.txt"); //$NON-NLS-1$
|
if (Files.isDirectory(hardware)) {
|
||||||
try {
|
for (ArduinoPlatform platform : platforms) {
|
||||||
Path hardware = getInstallPath().resolve("hardware"); //$NON-NLS-1$
|
String arch = platform.getArchitecture();
|
||||||
if (Files.exists(hardware)) {
|
String version = platform.getVersion();
|
||||||
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$
|
|
||||||
|
|
||||||
ArduinoPlatform platform = getPlatform(arch, version);
|
Path platPath = hardware.resolve(arch).resolve(version);
|
||||||
if (platform != null) {
|
if (Files.exists(platPath)) {
|
||||||
platform.setPlatformProperties(platformProperties);
|
ArduinoPlatform current = installedPlatforms.get(arch);
|
||||||
installedPlatforms.put(arch, platform);
|
if (current == null || ArduinoManager.compareVersions(version, current.getVersion()) > 0) {
|
||||||
} // TODO manually add it if was removed
|
installedPlatforms.put(arch, platform);
|
||||||
// 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.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.arduino.core.internal.Activator;
|
import org.eclipse.cdt.arduino.core.internal.Activator;
|
||||||
import org.eclipse.cdt.arduino.core.internal.ArduinoPreferences;
|
import org.eclipse.cdt.arduino.core.internal.ArduinoPreferences;
|
||||||
|
@ -83,7 +82,7 @@ public class ArduinoPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return version;
|
return version.replace('+', '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCategory() {
|
public String getCategory() {
|
||||||
|
@ -219,7 +218,7 @@ public class ArduinoPlatform {
|
||||||
} else {
|
} else {
|
||||||
// TODO for now, grab the one from the arduino package
|
// TODO for now, grab the one from the arduino package
|
||||||
ArduinoManager manager = Activator.getService(ArduinoManager.class);
|
ArduinoManager manager = Activator.getService(ArduinoManager.class);
|
||||||
ArduinoPackage arduinoPkg = manager.getPackage("arduino");
|
ArduinoPackage arduinoPkg = manager.getPackage("arduino"); //$NON-NLS-1$
|
||||||
if (arduinoPkg != null) {
|
if (arduinoPkg != null) {
|
||||||
ArduinoPlatform arduinoPlat = arduinoPkg.getInstalledPlatform(getArchitecture());
|
ArduinoPlatform arduinoPlat = arduinoPkg.getInstalledPlatform(getArchitecture());
|
||||||
if (arduinoPlat != null) {
|
if (arduinoPlat != null) {
|
||||||
|
@ -232,7 +231,7 @@ public class ArduinoPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Path getInstallPath() {
|
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 {
|
private void initLibraries() throws CoreException {
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class ArduinoTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return version;
|
return version.replace('+', '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ArduinoToolSystem> getSystems() {
|
public List<ArduinoToolSystem> getSystems() {
|
||||||
|
@ -53,26 +53,7 @@ public class ArduinoTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Path getInstallPath() {
|
public Path getInstallPath() {
|
||||||
// TODO remove migration in Neon
|
return getPackage().getInstallPath().resolve("tools").resolve(getName()).resolve(getVersion()); //$NON-NLS-1$
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInstalled() {
|
public boolean isInstalled() {
|
||||||
|
|
|
@ -28,18 +28,18 @@ public class ToolDependency {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return version;
|
return version.replace('+', '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArduinoTool getTool() throws CoreException {
|
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 {
|
public void install(IProgressMonitor monitor) throws CoreException {
|
||||||
ArduinoTool tool = getTool();
|
ArduinoTool tool = getTool();
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getId(),
|
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);
|
getTool().install(monitor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,7 +381,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration implements Te
|
||||||
getSources(variantSources, variantPath, true);
|
getSources(variantSources, variantPath, true);
|
||||||
}
|
}
|
||||||
buildModel.put("platform_variant_srcs", variantSources); //$NON-NLS-1$
|
buildModel.put("platform_variant_srcs", variantSources); //$NON-NLS-1$
|
||||||
|
|
||||||
properties.put("object_file", "$@"); //$NON-NLS-1$ //$NON-NLS-2$
|
properties.put("object_file", "$@"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
properties.put("source_file", "$<"); //$NON-NLS-1$ //$NON-NLS-2$
|
properties.put("source_file", "$<"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
properties.put("archive_file", "core.a"); //$NON-NLS-1$ //$NON-NLS-2$
|
properties.put("archive_file", "core.a"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
Loading…
Add table
Reference in a new issue