return board;
}
- private Properties getProperties() throws CoreException {
+ private synchronized Properties getProperties() throws CoreException {
if (properties == null) {
+ ArduinoPlatform platform = board.getPlatform();
+
+ // IDE generated properties
+ properties = new Properties();
+ properties.put("runtime.platform.path", platform.getInstallPath().toString()); //$NON-NLS-1$
+ properties.put("runtime.ide.version", "10607"); //$NON-NLS-1$ //$NON-NLS-2$
+ properties.put("build.arch", platform.getArchitecture().toUpperCase()); //$NON-NLS-1$
+ properties.put("build.path", config.getName()); //$NON-NLS-1$
+ properties.put("build.variant.path", //$NON-NLS-1$
+ platform.getInstallPath().resolve("variants").resolve("{build.variant}").toString()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Platform
+ properties.putAll(board.getPlatform().getPlatformProperties());
+
+ // Tools
+ for (ToolDependency toolDep : platform.getToolsDependencies()) {
+ properties.putAll(toolDep.getTool().getToolProperties());
+ }
+
// Board
ArduinoBoard board = getBoard();
- properties = board.getBoardProperties();
+ properties.putAll(board.getBoardProperties());
// Menus
IEclipsePreferences settings = getSettings();
}
}
}
-
- // Platform
- ArduinoPlatform platform = board.getPlatform();
- properties.putAll(board.getPlatform().getPlatformProperties());
-
- // Tools
- for (ToolDependency toolDep : platform.getToolsDependencies()) {
- properties.putAll(toolDep.getTool().getToolProperties());
- }
-
- properties.put("runtime.platform.path", platform.getInstallPath().toString()); //$NON-NLS-1$
- properties.put("runtime.ide.version", "10607"); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("build.arch", platform.getArchitecture().toUpperCase()); //$NON-NLS-1$
- properties.put("build.path", config.getName()); //$NON-NLS-1$
}
+
// always do this in case the project changes names
properties.put("build.project_name", config.getProject().getName()); //$NON-NLS-1$
return properties;
Path platformPath = platform.getInstallPath();
buildModel.put("platform_path", pathString(platformPath)); //$NON-NLS-1$
- buildModel.put("platform_srcs", platform.getSources(properties.getProperty("build.core"))); //$NON-NLS-1$ //$NON-NLS-2$
+ buildModel.put("platform_srcs", //$NON-NLS-1$
+ platform.getSources(properties.getProperty("build.core"), properties.getProperty("build.variant"))); //$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$
buildModel.put("recipe_c_combine_pattern", resolveProperty("recipe.c.combine.pattern", properties)); //$NON-NLS-1$ //$NON-NLS-2$
buildModel.put("recipe_objcopy_eep_pattern", resolveProperty("recipe.objcopy.eep.pattern", properties)); //$NON-NLS-1$ //$NON-NLS-2$
buildModel.put("recipe_objcopy_hex_pattern", resolveProperty("recipe.objcopy.hex.pattern", properties)); //$NON-NLS-1$ //$NON-NLS-2$
+ buildModel.put("recipe_objcopy_bin_pattern", resolveProperty("recipe.objcopy.bin.pattern", properties)); //$NON-NLS-1$ //$NON-NLS-2$
buildModel.put("recipe_size_pattern", resolveProperty("recipe.size.pattern", properties)); //$NON-NLS-1$ //$NON-NLS-2$
ArduinoTemplateGenerator templateGen = new ArduinoTemplateGenerator();
import org.eclipse.core.runtime.Status;
/**
- * This class is responsible for generating the Makefile for the current build
- * config.
+ * This class is responsible for generating the Makefile for the current build config.
*/
public class ArduinoBuilder extends IncrementalProjectBuilder {
String codeSizeRegex = config.getCodeSizeRegex();
Pattern codeSizePattern = codeSizeRegex != null ? Pattern.compile(codeSizeRegex) : null;
String dataSizeRegex = config.getDataSizeRegex();
- Pattern dataSizePattern = codeSizeRegex != null ? Pattern.compile(dataSizeRegex) : null;
+ Pattern dataSizePattern = dataSizeRegex != null ? Pattern.compile(dataSizeRegex) : null;
if (codeSizePattern == null && dataSizePattern == null) {
return;
}
console.writeOutput(" bytes\n");
- console.writeOutput("Initial RAM usage: " + dataSize);
- if (maxCodeSize > 0) {
- console.writeOutput(" of maximum " + maxDataSize);
+ if (maxDataSize >= 0) {
+ console.writeOutput("Initial RAM usage: " + dataSize);
+ if (maxCodeSize > 0) {
+ console.writeOutput(" of maximum " + maxDataSize);
+ }
+ console.writeOutput(" bytes\n");
}
- console.writeOutput(" bytes\n");
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.getId(), "Checking sizes", e));
}
</#if>
</#list>
-all: ${build_path}/${project_name}.hex ${build_path}/${project_name}.eep
+TARGETS = \
+<#if recipe_objcopy_hex_pattern??>
+ ${build_path}/${project_name}.hex \
+</#if>
+<#if recipe_objcopy_epp_pattern??>
+ ${build_path}/${project_name}.eep \
+</#if>
+<#if recipe_objcopy_bin_pattern??>
+ ${build_path}/${project_name}.bin \
+</#if>
+
+all: $(TARGETS)
+<#if recipe_objcopy_hex_pattern??>
${build_path}/${project_name}.hex: ${build_path}/${project_name}.elf
${recipe_objcopy_hex_pattern}
+</#if>
+<#if recipe_objcopy_epp_pattern??>
${build_path}/${project_name}.eep: ${build_path}/${project_name}.elf
${recipe_objcopy_eep_pattern}
+</#if>
+<#if recipe_objcopy_bin_pattern??>
+${build_path}/${project_name}.bin: ${build_path}/${project_name}.elf
+ ${recipe_objcopy_bin_pattern}
+
+</#if>
${build_path}/${project_name}.elf: $(PROJECT_OBJS) $(LIBRARIES_OBJS) ${build_path}/core.a
${recipe_c_combine_pattern}