From 39a83b401664670be071607a7b4417f39c00a81b Mon Sep 17 00:00:00 2001 From: "gyeongmin.ju" Date: Thu, 9 Mar 2017 20:26:06 +0900 Subject: [PATCH] RTSDK: fixed openocd opt on launch shortcut Change-Id: If7601b055afe28847800703a581a91fd69203516 Signed-off-by: gyeongmin.ju --- .../tizen.rt.product.plugin/META-INF/MANIFEST.MF | 2 ++ .../rt/product/plugin/launch/LaunchShortcut.java | 40 +++++++++++++--------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/rt-ide/tizen.rt.product.plugin/META-INF/MANIFEST.MF b/rt-ide/tizen.rt.product.plugin/META-INF/MANIFEST.MF index 9d3153c..c6e5d5d 100644 --- a/rt-ide/tizen.rt.product.plugin/META-INF/MANIFEST.MF +++ b/rt-ide/tizen.rt.product.plugin/META-INF/MANIFEST.MF @@ -29,6 +29,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.debug.core, org.eclipse.debug.ui, org.eclipse.cdt.debug.core, + org.eclipse.cdt.dsf.gdb, + org.eclipse.cdt.debug.gdbjtag.core, ilg.gnuarmeclipse.core, ilg.gnuarmeclipse.debug.core, ilg.gnuarmeclipse.debug.gdbjtag.openocd diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/product/plugin/launch/LaunchShortcut.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/product/plugin/launch/LaunchShortcut.java index 90e6601..6ba847c 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/product/plugin/launch/LaunchShortcut.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/product/plugin/launch/LaunchShortcut.java @@ -4,7 +4,7 @@ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: -* jm.jemin.kim +* gyeongmin.ju * HyeongSeok Heo * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,9 +26,11 @@ package org.tizen.rt.product.plugin.launch; +import java.io.File; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; +import org.tizen.rt.ide.util.SDKUtil; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.debug.core.DebugPlugin; @@ -36,15 +38,16 @@ import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchManager; - -import java.io.File; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.ILaunchShortcut; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IEditorPart; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants; +import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import ilg.gnuarmeclipse.debug.gdbjtag.openocd.ConfigurationAttributes; /** @@ -53,23 +56,29 @@ import ilg.gnuarmeclipse.debug.gdbjtag.openocd.ConfigurationAttributes; */ public class LaunchShortcut implements ILaunchShortcut { + private static final Logger logger = LoggerFactory.getLogger(LaunchShortcut.class); + + private final String OPENOCD_LAUNCHTYPE = "ilg.gnuarmeclipse.debug.gdbjtag.openocd.launchConfigurationType"; + private ILaunchConfiguration createConfiguration(String projectName, IPath targetPath) throws CoreException { ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); - ILaunchConfigurationType configType = manager.getLaunchConfigurationType("ilg.gnuarmeclipse.debug.gdbjtag.openocd.launchConfigurationType"); + ILaunchConfigurationType configType = manager.getLaunchConfigurationType(OPENOCD_LAUNCHTYPE); - ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, manager.generateUniqueLaunchConfigurationNameFrom(targetPath.lastSegment())); + ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, manager.generateLaunchConfigurationName(targetPath.lastSegment())); String openocdPath = targetPath.toOSString() + File.separator + "build/configs/sidk_s5jt200/openocd"; wc.setAttribute(ConfigurationAttributes.GDB_SERVER_EXECUTABLE, openocdPath + File.separator + "openocd_0.10_linux64_t20"); wc.setAttribute(ConfigurationAttributes.GDB_SERVER_OTHER, "-f " + openocdPath + File.separator + "s5jt200_attach_cr4_debug.cfg"); + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName); wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "build/output/bin/tinyara"); - // wc.setAttribute(ConfigurationAttributes.OTHER_RUN_COMMANDS, "arm-none-eabi-gdb"); + wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, "arm-none-eabi-gdb"); + wc.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, false); - IResource targetResource = ResourcesPlugin.getWorkspace().getRoot().findMember(targetPath); - if (targetResource != null && targetResource.exists()) { - // wc.setAttribute(ILaunchConfigurationConstants.ATTR_PROJECT_NAME, LaunchUtils.getLaunchProjectName(targetResource)); - } + // IResource targetResource = ResourcesPlugin.getWorkspace().getRoot().findMember(targetPath); + // if (targetResource != null && targetResource.exists()) { + // wc.setAttribute(ILaunchConfigurationConstants.ATTR_PROJECT_NAME, LaunchUtils.getLaunchProjectName(targetResource)); + // } return wc.doSave(); } @@ -85,8 +94,7 @@ public class LaunchShortcut implements ILaunchShortcut { ILaunchConfiguration config = createConfiguration(proj.getName(), proj.getLocation()); DebugUITools.launch(config, mode); } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + logger.error(e.getMessage()); } } } @@ -94,8 +102,6 @@ public class LaunchShortcut implements ILaunchShortcut { @Override public void launch(IEditorPart editor, String mode) { - // TODO Auto-generated method stub - + // do nothing } - } -- 2.7.4