import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.rt.ide.Messages;
+import org.tizen.rt.ide.util.OSChecker;
import ilg.gnuarmeclipse.debug.gdbjtag.openocd.ConfigurationAttributes;
private static final String PATH_BUILD_CONFIGS = "build/configs"; //$NON-NLS-1$
private static final String PATH_OPENOCD = "openocd"; //$NON-NLS-1$
private static final String PROGRAM_NAME = PATH_BUILD_OUTPUT + "/bin/tinyara"; //$NON-NLS-1$
- private static final String OPENOCD_EXECUTABLE = "openocd_0.10_linux64_t20"; //$NON-NLS-1$
+ private static final String OPENOCD_EXECUTABLE_32 = "openocd_0.10_linux32_t20"; //$NON-NLS-1$
+ private static final String OPENOCD_EXECUTABLE_64 = "openocd_0.10_linux64_t20"; //$NON-NLS-1$
private static final String DEBUGGER_NAME = "arm-none-eabi-gdb"; //$NON-NLS-1$
private final String OPENOCD_LAUNCHTYPE = "ilg.gnuarmeclipse.debug.gdbjtag.openocd.launchConfigurationType"; //$NON-NLS-1$
private ILaunchConfiguration createConfiguration(String projectName, IPath targetPath, String boardName, String debugCfg) throws CoreException {
+ String openocdPath = targetPath.toOSString() + File.separator + PATH_BUILD_CONFIGS + File.separator + boardName + File.separator + PATH_OPENOCD;
+ String openocdExec = null;
+ if (OSChecker.is64bit()) {
+ openocdExec = OPENOCD_EXECUTABLE_64;
+ } else {
+ openocdExec = OPENOCD_EXECUTABLE_32;
+ }
+ openocdExec = openocdPath + File.separator + openocdExec;
+ if (!new File(openocdExec).exists()) {
+ MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", Messages.RtosDebug_ERROR_OPENOCD_NOT_EXIST); //$NON-NLS-1$
+ return null;
+ }
+
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configType = manager.getLaunchConfigurationType(OPENOCD_LAUNCHTYPE);
ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, manager.generateLaunchConfigurationName(targetPath.lastSegment()));
- String openocdPath = targetPath.toOSString() + File.separator + PATH_BUILD_CONFIGS + File.separator + boardName + File.separator + PATH_OPENOCD;
- wc.setAttribute(ConfigurationAttributes.GDB_SERVER_EXECUTABLE, openocdPath + File.separator + OPENOCD_EXECUTABLE);
+ wc.setAttribute(ConfigurationAttributes.GDB_SERVER_EXECUTABLE, openocdExec);
wc.setAttribute(ConfigurationAttributes.GDB_SERVER_OTHER, "-f " + debugCfg); //$NON-NLS-1$
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
try {
ILaunchConfiguration config = createConfiguration(proj.getName(), proj.getLocation(), board, debugCfg);
- DebugUITools.launch(config, mode);
+ if (config != null) {
+ DebugUITools.launch(config, mode);
+ }
} catch (CoreException e) {
logger.error(e.getMessage());
}