Skip to content

Commit

Permalink
pyocd: Group flash mode constants in a namespace class.
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Reed <flit@me.com>
  • Loading branch information
flit committed Jan 5, 2021
1 parent e5beb4b commit fd46408
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ public static String[] getGdbServerCommandLineArray(ILaunchConfiguration configu
int flashMode = configuration.getAttribute(ConfigurationAttributes.GDB_SERVER_FLASH_MODE,
DefaultPreferences.GDB_SERVER_FLASH_MODE_DEFAULT);
switch (flashMode) {
case PreferenceConstants.AUTO_ERASE:
case PreferenceConstants.FlashMode.AUTO_ERASE:
lst.add("--erase=auto");
break;
case PreferenceConstants.CHIP_ERASE:
case PreferenceConstants.FlashMode.CHIP_ERASE:
lst.add("--erase=chip");
break;
case PreferenceConstants.SECTOR_ERASE:
case PreferenceConstants.FlashMode.SECTOR_ERASE:
lst.add("--erase=sector");
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class DefaultPreferences extends org.eclipse.embedcdt.debug.gdbjtag.core.
public static final String GDB_SERVER_TARGET_NAME_DEFAULT = ""; //$NON-NLS-1$
public static final boolean GDB_SERVER_HALT_AT_HARD_FAULT_DEFAULT = true;
public static final boolean GDB_SERVER_STEP_INTO_INTERRUPTS_DEFAULT = false;
public static final int GDB_SERVER_FLASH_MODE_DEFAULT = PreferenceConstants.SECTOR_ERASE;
public static final int GDB_SERVER_FLASH_MODE_DEFAULT = PreferenceConstants.FlashMode.SECTOR_ERASE;
public static final boolean GDB_SERVER_FLASH_FAST_VERIFY_DEFAULT = false;
public static final boolean GDB_SERVER_ENABLE_SEMIHOSTING_DEFAULT = true;
public static final boolean GDB_SERVER_USE_GDB_SYSCALLS_DEFAULT = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2013 Liviu Ionescu.
* Copyright (c) 2015-2016 Chris Reed.
* Copyright (c) 2015-2020 Chris Reed.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -20,9 +20,11 @@ public interface PreferenceConstants {

public static final String DEFAULT_GDB_COMMAND = "arm-none-eabi-gdb"; //$NON-NLS-1$

public static final int AUTO_ERASE = 0;
public static final int CHIP_ERASE = 1;
public static final int SECTOR_ERASE = 2;
public static final int FAST_PROGRAM = 3;
public static final class FlashMode {
public static final int AUTO_ERASE = 0;
public static final int CHIP_ERASE = 1;
public static final int SECTOR_ERASE = 2;
public static final int FAST_PROGRAM = 3;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,12 @@ private void createGdbServerGroup(Composite parent) {
gd = new GridData();
gd.widthHint = 120;
fGdbServerFlashMode.setLayoutData(gd);
fGdbServerFlashMode.setItems(new String[] { Messages.getString("DebuggerTab.gdbServerFlashMode.AutoErase"),
// Note: the index of these items must match the PreferenceConstants.FlashMode constants.
fGdbServerFlashMode.setItems(new String[] {
Messages.getString("DebuggerTab.gdbServerFlashMode.AutoErase"),
Messages.getString("DebuggerTab.gdbServerFlashMode.ChipErase"),
Messages.getString("DebuggerTab.gdbServerFlashMode.SectorErase"), });
Messages.getString("DebuggerTab.gdbServerFlashMode.SectorErase"),
});
fGdbServerFlashMode.select(0);

fGdbServerFlashFastVerify = new Button(comp, SWT.CHECK);
Expand Down

0 comments on commit fd46408

Please sign in to comment.