From 46faad2ed42a81d67b1cd2ceaf5c16c7edf60f6d Mon Sep 17 00:00:00 2001 From: "gyeongmin.ju" Date: Mon, 17 Apr 2017 19:33:42 +0900 Subject: [PATCH] RTSDK: support new flash method support new flash method Change-Id: I2f0a265f6f346cf90d0af669d051f8d010e91b25 Signed-off-by: gyeongmin.ju --- .../src/org/tizen/rt/ide/FlashCommand.java | 46 +++++++++++++--------- .../src/org/tizen/rt/ide/flash/FlashOption.java | 10 ++--- .../tizen/rt/ide/flash/RtosFlashDialogPage.java | 12 +++--- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/FlashCommand.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/FlashCommand.java index c019d87..5a1662b 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/FlashCommand.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/FlashCommand.java @@ -53,10 +53,10 @@ public class FlashCommand { private String LINUX_FLASH_RTOS_HOME_PATH; private String LINUX_FLASH_OPTION_PATH; - private static final String LINUX_EXECUTE_BUILD = "./openocd_linux64 -f"; //$NON-NLS-1$ - private static final String FILE_EXTENSION_CFG = ".cfg"; //$NON-NLS-1$ - private static final String PATH_OPENOCD = "openocd"; //$NON-NLS-1$ - private static final String PATH_BUILD_CONFIGS = "build/configs"; //$NON-NLS-1$ + private static final String LINUX_EXECUTE_BUILD[] = new String[] {"make", "download", ""}; //$NON-NLS-1$ + //private static final String FILE_EXTENSION_CFG = ".cfg"; //$NON-NLS-1$ + //private static final String PATH_OPENOCD = "openocd"; //$NON-NLS-1$ + private static final String PATH_BUILD_CONFIGS = "os"; //$NON-NLS-1$ private List resultFlashOptionList = new ArrayList(); private List resultFlashExecute = new ArrayList(); @@ -69,21 +69,27 @@ public class FlashCommand { String activeProjectName = project.getLocation().toString(); LINUX_FLASH_RTOS_HOME_PATH = activeProjectName; - LINUX_FLASH_OPTION_PATH = LINUX_FLASH_RTOS_HOME_PATH + File.separator + PATH_BUILD_CONFIGS + File.separator + board + File.separator + PATH_OPENOCD; + //LINUX_FLASH_OPTION_PATH = LINUX_FLASH_RTOS_HOME_PATH + File.separator + PATH_BUILD_CONFIGS + File.separator + board + File.separator + PATH_OPENOCD; RtosCommandManager.rtoshome = LINUX_FLASH_RTOS_HOME_PATH; - File home = new File(LINUX_FLASH_OPTION_PATH); - File[] cfgs = home.listFiles(new FilenameFilter() { - @Override - public boolean accept(File arg0, String arg1) { - return arg1.endsWith(FILE_EXTENSION_CFG); - } - }); - - if (cfgs != null) { - for (File cfg : cfgs) { - resultFlashOptionList.add(new FlashOption(board, cfg.getName())); - } + // File home = new File(LINUX_FLASH_OPTION_PATH); + // File[] cfgs = home.listFiles(new FilenameFilter() { + // @Override + // public boolean accept(File arg0, String arg1) { + // return arg1.endsWith(FILE_EXTENSION_CFG); + // } + // }); + // + // if (cfgs != null) { + // for (File cfg : cfgs) { + // //resultFlashOptionList.add(new FlashOption(board, cfg.getName())); + // resultFlashOptionList.add(new FlashOption(board, cfg.getName())); + // } + // } + + String[] cfgs = new String[] { "ALL", "RESOURCE", "FOTA_ALL", "TINYARA_OTA0", "TINYARA_OTA1" }; + for (String cfg : cfgs) { + resultFlashOptionList.add(new FlashOption(cfg, cfg)); } return resultFlashOptionList; @@ -92,10 +98,12 @@ public class FlashCommand { protected int executeFlash(FlashOption flashOption, ConsoleManager consoleManager, IProgressMonitor monitor) { - LINUX_FLASH_OPTION_PATH = RtosCommandManager.rtoshome + File.separator + PATH_BUILD_CONFIGS + File.separator + flashOption.getBoard() + File.separator + PATH_OPENOCD; + LINUX_FLASH_OPTION_PATH = RtosCommandManager.rtoshome + File.separator + PATH_BUILD_CONFIGS; resultFlashExecute.clear(); - int result = ProcUtil.executeProcess(null, new String[] { LINUX_EXECUTE_BUILD, flashOption.getFlashOption() }, + LINUX_EXECUTE_BUILD[2] = flashOption.getFlashOption(); + + int result = ProcUtil.executeProcess(null, LINUX_EXECUTE_BUILD, LINUX_FLASH_OPTION_PATH, consoleManager, resultFlashExecute); monitor.worked(1); diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/flash/FlashOption.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/flash/FlashOption.java index a32dea4..915f42d 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/flash/FlashOption.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/flash/FlashOption.java @@ -30,16 +30,16 @@ package org.tizen.rt.ide.flash; * @author jm.jaemin.kim{@literal } (S-Core) */ public class FlashOption { - private final String board; + private final String title; private final String flashOption; - public FlashOption(String board, String flashOption) { - this.board = board; + public FlashOption(String title, String flashOption) { + this.title = title; this.flashOption = flashOption; } - public String getBoard() { - return board; + public String getTitle() { + return title; } public String getFlashOption() { diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/flash/RtosFlashDialogPage.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/flash/RtosFlashDialogPage.java index 3217f2f..6977528 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/flash/RtosFlashDialogPage.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/flash/RtosFlashDialogPage.java @@ -76,15 +76,15 @@ public class RtosFlashDialogPage extends WizardPage { Composite composite = new Composite(parentComposite, SWT.NONE); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - composite.setLayout(new GridLayout(1, false)); + TableColumnLayout layout = new TableColumnLayout(); + composite.setLayout(layout); + + //composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + //composite.setLayout(new GridLayout(1, false)); GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); gridData.minimumHeight = 0; composite.setLayoutData(gridData); - TableColumnLayout layout = new TableColumnLayout(); - composite.setLayout(layout); - tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override @@ -174,7 +174,7 @@ public class RtosFlashDialogPage extends WizardPage { FlashOption bOption = (FlashOption) element; switch (columnIndex) { case 0: - return bOption.getFlashOption(); + return bOption.getTitle(); default: break; } -- 2.7.4