Search in sources :

Example 6 with UsbdmSharedSettings

use of net.sourceforge.usbdm.constants.UsbdmSharedSettings in project usbdm-eclipse-plugins by podonoghue.

the class UsbdmGCCSpecsRunSIProvider method getToolPrefix.

/**
 * @param project       The project to look in for options
 * @return              The prefix for the build tools
 */
private String getToolPrefix(IProject project) {
    IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
    if (info == null) {
        return "";
    }
    IConfiguration cfg = info.getDefaultConfiguration();
    // System.err.println("UsbdmGCCSpecsRunSIProvider.initialize() Found IConfiguration = " + cfg.getName());
    IToolChain toolChain = cfg.getToolChain();
    // System.err.println("UsbdmGCCSpecsRunSIProvider.initialize() Found toolChain = " + toolChain.getName());
    // Find selected build tool (either ARM or Coldfire)
    IOption buildToolOption = toolChain.getOptionBySuperClassId(UsbdmConstants.ARM_BUILDTOOLS_OPTIONS);
    if (buildToolOption == null) {
        buildToolOption = toolChain.getOptionBySuperClassId(UsbdmConstants.COLDFIRE_BUILDTOOLS_OPTIONS);
    }
    if (buildToolOption == null) {
        return "";
    }
    // Get build path variable
    ToolInformationData toolData = ToolInformationData.getToolInformationTable().get(buildToolOption.getValue().toString());
    if (toolData == null) {
        return "";
    }
    String toolPrefixVariableId = toolData.getPrefixVariableName();
    if (toolPrefixVariableId == null) {
        return "";
    }
    UsbdmSharedSettings settings = UsbdmSharedSettings.getSharedSettings();
    String toolPrefix = null;
    if (settings != null) {
        toolPrefix = settings.get(toolPrefixVariableId);
    }
    if (toolPrefix == null) {
        toolPrefix = "Tool Prefix not set";
        return "";
    }
    // System.err.println("UsbdmGCCSpecsRunSIProvider.initialize() Found tool prefix = " + toolPrefix);
    return toolPrefix;
}
Also used : UsbdmSharedSettings(net.sourceforge.usbdm.constants.UsbdmSharedSettings) IManagedBuildInfo(org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo) ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData) IToolChain(org.eclipse.cdt.managedbuilder.core.IToolChain) IOption(org.eclipse.cdt.managedbuilder.core.IOption) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration)

Example 7 with UsbdmSharedSettings

use of net.sourceforge.usbdm.constants.UsbdmSharedSettings in project usbdm-eclipse-plugins by podonoghue.

the class ConfigurationEnvironmentVariableSupplier method getToolPath.

/**
 * @param configuration       The configuration to look in for options
 * @return                    The path to the build tools bin directory or null if error
 */
private String getToolPath(IConfiguration configuration) {
    if (configuration == null) {
        // No configuration - Use default settings
        // System.err.println("ConfigEnvVarSupplier.getToolPath() configuration = null");
        String toolPath = "";
        String pathVariableId = null;
        if (buildToolOptionId.equals(UsbdmConstants.COLDFIRE_BUILDTOOLS_OPTIONS)) {
            pathVariableId = "usbdm_codesourcery_coldfire_path";
        } else if (buildToolOptionId.equals(UsbdmConstants.ARM_BUILDTOOLS_OPTIONS)) {
            pathVariableId = "usbdm_armLtd_arm_path";
        }
        UsbdmSharedSettings settings = UsbdmSharedSettings.getSharedSettings();
        if ((settings != null) && (pathVariableId != null)) {
            toolPath = settings.get(pathVariableId);
        }
        // System.err.println("ConfigEnvVarSupplier.getToolPath() Found tool path = " + toolPath);
        return toolPath;
    }
    // System.err.println("ConfigEnvVarSupplier.getToolPath() configuration = "+configuration.getId());
    IToolChain toolChain = configuration.getToolChain();
    if (toolChain == null) {
        System.err.println("ConfigEnvVarSupplier.getToolPath() toolChain = null");
        return null;
    }
    // System.err.println("ConfigEnvVarSupplier.getToolPath() Checking toolchain: " + toolChain.getId());
    // Find selected build tool
    IOption buildToolOption = toolChain.getOptionBySuperClassId(buildToolOptionId);
    // }
    if (buildToolOption == null) {
        System.err.println("ConfigEnvVarSupplier.getToolPath() buildToolOption = null");
        return null;
    }
    // Get build path variable
    ToolInformationData toolData = ToolInformationData.getToolInformationTable().get(buildToolOption.getValue().toString());
    if (toolData == null) {
        System.err.println("ConfigEnvVarSupplier.getToolPath() toolData = null");
        System.err.println("ConfigEnvVarSupplier.getToolPath() configuration              = " + configuration.toString());
        System.err.println("ConfigEnvVarSupplier.getToolPath() toolChain                  = " + toolChain.toString());
        System.err.println("ConfigEnvVarSupplier.getToolPath() buildToolOption            = " + buildToolOption.toString());
        System.err.println("ConfigEnvVarSupplier.getToolPath() buildToolOption.getValue() = " + buildToolOption.getValue().toString());
        return null;
    }
    String pathVariableId = toolData.getPathVariableName();
    if (pathVariableId == null) {
        System.err.println("ConfigEnvVarSupplier.getToolPath() pathVariableId = null");
        return null;
    }
    // System.err.println("ConfigEnvVarSupplier.getToolPath() pathVariableId = "+pathVariableId);
    UsbdmSharedSettings settings = UsbdmSharedSettings.getSharedSettings();
    String toolPath = "";
    if (settings != null) {
        toolPath = settings.get(pathVariableId);
    }
    // }
    return toolPath;
}
Also used : UsbdmSharedSettings(net.sourceforge.usbdm.constants.UsbdmSharedSettings) ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData) IToolChain(org.eclipse.cdt.managedbuilder.core.IToolChain) IOption(org.eclipse.cdt.managedbuilder.core.IOption)

Example 8 with UsbdmSharedSettings

use of net.sourceforge.usbdm.constants.UsbdmSharedSettings in project usbdm-eclipse-plugins by podonoghue.

the class PrefixedCommandLineGenerator method getToolPrefix.

/**
 * @param tool       The tool to look in for options
 * @return           The tool prefix e.g.arm-none-eabi-
 */
private String getToolPrefix(ITool tool) {
    if (buildToolOptionId == null) {
        // System.err.println("PrefixedCmdLineGenerator.getToolPrefix() buildToolOptionId null");
        return "";
    }
    IToolChain toolChain = getToolChain(tool);
    if (toolChain == null) {
        // System.err.println("PrefixedCmdLineGenerator.getToolPrefix() Toolchain null");
        return "";
    }
    // System.err.println("PrefixedCmdLineGenerator.getToolPrefix() buildToolOptionId = " +buildToolOptionId);
    // System.err.println("PrefixedCmdLineGenerator.getToolPrefix() Checking toolchain: " + toolChain.getId());
    // Find selected build tool
    IOption buildToolOption = toolChain.getOptionBySuperClassId(buildToolOptionId);
    // }
    if (buildToolOption == null) {
        return "";
    }
    // Get build path variable
    ToolInformationData toolData = ToolInformationData.getToolInformationTable().get(buildToolOption.getValue().toString());
    if (toolData == null) {
        return null;
    }
    String toolPrefixVariableId = toolData.getPrefixVariableName();
    if (toolPrefixVariableId == null) {
        return "";
    }
    UsbdmSharedSettings settings = UsbdmSharedSettings.getSharedSettings();
    String toolPrefix = null;
    if (settings != null) {
        toolPrefix = settings.get(toolPrefixVariableId);
    }
    if (toolPrefix == null) {
        toolPrefix = "Tool Prefix not set";
    }
    // }
    return toolPrefix;
}
Also used : UsbdmSharedSettings(net.sourceforge.usbdm.constants.UsbdmSharedSettings) ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData) IToolChain(org.eclipse.cdt.managedbuilder.core.IToolChain) IOption(org.eclipse.cdt.managedbuilder.core.IOption)

Example 9 with UsbdmSharedSettings

use of net.sourceforge.usbdm.constants.UsbdmSharedSettings in project usbdm-eclipse-plugins by podonoghue.

the class GdbServerParameters method loadDefaultSettings.

/**
 * Load the GDB settings from the system default
 *
 * Assumes the interface type has been set
 *
 * @throws Exception if interface type has not already been set
 */
public void loadDefaultSettings() throws Exception {
    // System.err.println("GdbServerParameters.loadDefaultSettings()\n");
    if (interfaceType == null) {
        throw new Exception("Interface type must be set before loading defaults");
    }
    extendedOptions = Usbdm.getDefaultExtendedOptions(interfaceType.targetType);
    UsbdmSharedSettings settings = UsbdmSharedSettings.getSharedSettings();
    setDeviceName(settings.get(getKey(deviceNameKey), ""));
    setBdmSerialNumber(settings.get(getKey(bdmSerialNumberKey), ""));
    enableBdmSerialNumberMatchRequired(settings.get(getKey(bdmSerialNumberMatchRequiredKey), false));
    setGdbServerPortNumber(settings.get(getKey(SERVER_PORT_KEY), 1234));
    setGdbTtyPortNumber(settings.get(getKey(TTY_PORT_KEY), 4321));
    enableUseSemiHosting(settings.get(getKey(USE_SEMI_HOSTING_KEY), false));
    enableUseDebugVersion(settings.get(getKey(useDebugVersionKey), false));
    enableExitOnClose(settings.get(getKey(exitOnCloseKey), false));
    setServerType(GdbServerType.valueOf(settings.get(getKey(serverTypeKey), GdbServerType.SERVER_SOCKET.name())));
    setInterfaceFrequency(ClockSpeed.findSuitable(settings.get(getKey(interfaceFrequencyKey), 4000000)).getFrequency());
    setAutoReconnect(AutoConnect.valueOf(settings.get(getKey(autoReconnectKey), AutoConnect.AUTOCONNECT_ALWAYS.name())));
    enableUseReset(settings.get(getKey(useResetKey), isUseReset()));
    enableUsePstSignals(settings.get(getKey(usePstSignalsKey), isUsePstSignals()));
    setEraseMethod(EraseMethod.getEraseMethod(settings.get(getKey(eraseMethodKey), EraseMethod.ERASE_TARGETDEFAULT.name())));
    setResetMethod(ResetMethod.getResetMethod(settings.get(getKey(resetMethodKey), ResetMethod.RESET_TARGETDEFAULT.name())));
    setSecurityOption(SecurityOptions.valueOf(settings.get(getKey(securityOptionKey), SecurityOptions.SECURITY_SMART.name())));
    setTargetVdd(TargetVddSelect.valueOf(settings.get(getKey(targetVddKey), TargetVddSelect.BDM_TARGET_VDD_OFF.name())));
    enableTrimClock(settings.get(getKey(trimClockKey), false));
    setClockTrimFrequency(settings.get(getKey(clockTrimFrequencyKey), 0));
    setNvmClockTrimLocation(settings.get(getKey(nvmClockTrimLocationKey), 0L));
    setConnectionTimeout(settings.get(getKey(connectionTimeoutKey), 10));
    enableCatchVLLSxEvents(settings.get(getKey(catchVLLSxEventsKey), false));
}
Also used : UsbdmSharedSettings(net.sourceforge.usbdm.constants.UsbdmSharedSettings) UsbdmException(net.sourceforge.usbdm.jni.UsbdmException) CoreException(org.eclipse.core.runtime.CoreException)

Aggregations

UsbdmSharedSettings (net.sourceforge.usbdm.constants.UsbdmSharedSettings)9 ToolInformationData (net.sourceforge.usbdm.constants.ToolInformationData)4 IOption (org.eclipse.cdt.managedbuilder.core.IOption)4 IToolChain (org.eclipse.cdt.managedbuilder.core.IToolChain)4 UsbdmException (net.sourceforge.usbdm.jni.UsbdmException)2 IConfiguration (org.eclipse.cdt.managedbuilder.core.IConfiguration)2 IManagedBuildInfo (org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo)2 CoreException (org.eclipse.core.runtime.CoreException)2 VariableInformationData (net.sourceforge.usbdm.constants.VariableInformationData)1