Skip to content

Commit 8718d5d

Browse files
authored
IEP-1297 Consolidate information about the target and board in one place (#1027)
* feat: revamp the launch target editor page * feat: refactoring code before providing new default values in target * feat: introducing gdb_client_executable dynamic variable * feat: added info message with an icon and text buttons with reveal button * feat: moved custom swt to the separate module, updated launch config * feat: updated custom swt plugin.xml * fix: fixed fefault_argument_prefix * fix: fixing notification that target has been changed * feat: introducing serial_port dynamic variable * fix: fixing jSerialComm exception during init page
1 parent 7d22ed0 commit 8718d5d

61 files changed

Lines changed: 1353 additions & 843 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bundles/.settings/org.eclipse.m2e.core.prefs

Lines changed: 0 additions & 4 deletions
This file was deleted.

bundles/com.espressif.idf.core/OSGI-INF/l10n/bundle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ Bundle-Vendor = ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD
33
Bundle-Name = ESP-IDF Core
44
openocd_bin_path = path to openocd bin folder specified in Espressif -> Global OpenOCD path
55
openocd_exe = openocd executable file
6-
openocd_scripts = OPENOCD_SCRIPTS represents the value specified in environment variables
6+
openocd_scripts = OPENOCD_SCRIPTS represents the value specified in environment variables
7+
jtag_flash_args = JTAG_FLASH_ARGS dynamically converts ${JTAG_FLASH_ARGS} into a command line with -c and -f options. These options are generated based on the current launch target, configuring settings like flash voltage and specifying configuration files for the JTAG interface and target device.
8+
gdb_client_executable = GDB_CLIENT_EXECUTABLE is a dynamic variable that is replaced during the debug session with the appropriate toolchain path automatically based on the selected target.
9+
serial_port = serial_port is a dynamic variable that is replaced by the serial port specified in the launch target

bundles/com.espressif.idf.core/plugin.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,28 @@ config-only component and an interface library is created instead."
318318
</variable>
319319
<variable
320320
description="%openocd_exe"
321-
name="openocd_exe"
321+
name="openocd_executable"
322322
resolver="com.espressif.idf.core.variable.OpenocdVariableResolver">
323323
</variable>
324324
<variable
325325
description="%openocd_scripts"
326326
name="OPENOCD_SCRIPTS"
327327
resolver="com.espressif.idf.core.variable.OpenocdVariableResolver">
328328
</variable>
329+
<variable
330+
description="%jtag_flash_args"
331+
name="JTAG_FLASH_ARGS"
332+
resolver="com.espressif.idf.core.variable.JtagVariableResolver">
333+
</variable>
334+
<variable
335+
description="%gdb_client_executable"
336+
name="GDB_CLIENT_EXECUTABLE"
337+
resolver="com.espressif.idf.core.variable.GdbClientVariableResolver">
338+
</variable>
339+
<variable
340+
description="%serial_port"
341+
name="serial_port"
342+
resolver="com.espressif.idf.core.variable.UartVariableResolver">
343+
</variable>
329344
</extension>
330345
</plugin>

bundles/com.espressif.idf.core/src/com/espressif/idf/core/DefaultBoardProvider.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
import java.util.stream.IntStream;
99
import java.util.stream.Stream;
1010

11+
import com.espressif.idf.core.util.EspConfigParser;
1112
import com.espressif.idf.core.util.StringUtil;
1213

1314
public class DefaultBoardProvider
1415
{
1516
private static final int DEFAULT_BOARD_EMPTY_INDEX = 0;
1617
private static final String ESP32C3_DEFAULT_BOARD = "ESP32-C3 chip (via builtin USB-JTAG)"; //$NON-NLS-1$
1718
private static final String ESP32S3_DEFAULT_BOARD = "ESP32-S3 chip (via builtin USB-JTAG)"; //$NON-NLS-1$
19+
private EspConfigParser espConfigParser;
1820

1921
private enum EspTarget
2022
{
@@ -34,7 +36,12 @@ public static EspTarget enumOf(String value)
3436
}
3537

3638
}
37-
39+
40+
public DefaultBoardProvider()
41+
{
42+
this.espConfigParser = new EspConfigParser();
43+
}
44+
3845
public int getIndexOfDefaultBoard(String targetName, String[] boardsForTarget)
3946
{
4047
String defaultBoard = EspTarget.enumOf(targetName).board;
@@ -45,4 +52,11 @@ public int getIndexOfDefaultBoard(String targetName, String[] boardsForTarget)
4552
return index.orElse(DEFAULT_BOARD_EMPTY_INDEX);
4653
}
4754

55+
public String getDefaultBoard(String targetName)
56+
{
57+
var boardConfigMap = this.espConfigParser.getBoardsConfigs(targetName);
58+
var boards = boardConfigMap.keySet().toArray(new String[0]);
59+
return boards[getIndexOfDefaultBoard(targetName, boards)];
60+
}
61+
4862
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*******************************************************************************
2+
* Copyright 2024 Espressif Systems (Shanghai) PTE LTD. All rights reserved.
3+
* Use is subject to license terms.
4+
*******************************************************************************/
5+
package com.espressif.idf.core;
6+
7+
/**
8+
* This class defines constants used to access attributes in the launch bar target. These constants are used to uniquely
9+
* identify settings such as the board, flash voltage, serial port, and target within the launch configuration.
10+
*/
11+
public final class LaunchBarTargetConstants
12+
{
13+
public static final String PREFIX = "com.espressif.idf.launch.serial.core"; //$NON-NLS-1$
14+
public static final String BOARD = PREFIX + ".board"; //$NON-NLS-1$
15+
public static final String FLASH_VOLTAGE = PREFIX + ".flash_voltage"; //$NON-NLS-1$
16+
public static final String SERIAL_PORT = PREFIX + ".serialPort"; //$NON-NLS-1$
17+
public static final String TARGET = PREFIX + ".idfTarget"; //$NON-NLS-1$
18+
19+
private LaunchBarTargetConstants()
20+
{
21+
}
22+
}

bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
import com.espressif.idf.core.IDFCorePlugin;
8282
import com.espressif.idf.core.IDFCorePreferenceConstants;
8383
import com.espressif.idf.core.IDFEnvironmentVariables;
84+
import com.espressif.idf.core.LaunchBarTargetConstants;
8485
import com.espressif.idf.core.internal.CMakeConsoleWrapper;
8586
import com.espressif.idf.core.internal.CMakeErrorParser;
8687
import com.espressif.idf.core.logging.Logger;
@@ -515,7 +516,7 @@ private void runCmakeCommand(IConsole console, IProgressMonitor monitor, IProjec
515516

516517
if (launchtarget != null)
517518
{
518-
String idfTargetName = launchtarget.getAttribute(IDFLaunchConstants.ATTR_IDF_TARGET, StringUtil.EMPTY);
519+
String idfTargetName = launchtarget.getAttribute(LaunchBarTargetConstants.TARGET, StringUtil.EMPTY);
519520
if (!idfTargetName.isEmpty())
520521
{
521522
command.add("-DIDF_TARGET=" + idfTargetName); //$NON-NLS-1$
@@ -651,7 +652,7 @@ public IToolChain getToolChain() throws CoreException
651652
ILaunchBarManager launchBarManager = CCorePlugin.getService(ILaunchBarManager.class);
652653
Collection<IToolChain> matchedToolChains = toolChainManager
653654
.getToolChainsMatching(Map.of(IToolChain.ATTR_OS, launchBarManager.getActiveLaunchTarget()
654-
.getAttribute(IDFLaunchConstants.ATTR_IDF_TARGET, StringUtil.EMPTY), TOOLCHAIN_TYPE, typeId));
655+
.getAttribute(LaunchBarTargetConstants.TARGET, StringUtil.EMPTY), TOOLCHAIN_TYPE, typeId));
655656
return matchedToolChains.stream().findAny().orElse(toolChainManager.getToolChain(typeId, id));
656657
}
657658

bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFLaunchConstants.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
public final class IDFLaunchConstants
44
{
55
public static final String ESP_LAUNCH_TARGET_TYPE = "com.espressif.idf.launch.serial.core.serialFlashTarget"; //$NON-NLS-1$
6-
public static final String ATTR_IDF_TARGET = "com.espressif.idf.launch.serial.core.idfTarget"; //$NON-NLS-1$
76
public static final String DEBUG_LAUNCH_CONFIG_TYPE = "com.espressif.idf.debug.gdbjtag.openocd.launchConfigurationType"; //$NON-NLS-1$
87
public static final String RUN_LAUNCH_CONFIG_TYPE = "com.espressif.idf.launch.serial.launchConfigurationType"; //$NON-NLS-1$
98
public static final String FLASH_OVER_JTAG = "FLASH_OVER_JTAG"; //$NON-NLS-1$
@@ -15,7 +14,6 @@ public final class IDFLaunchConstants
1514
public static final String ATTR_DFU_FLASH_ARGUMENTS = "com.espressif.idf.launch.serial.core.dfuFlashArguments"; //$NON-NLS-1$
1615
public static final String ATTR_JTAG_FLASH_ARGUMENTS = "com.espressif.idf.debug.gdbjtag.openocd.jtagFlashArguments"; //$NON-NLS-1$
1716
public static final String ATTR_LAUNCH_CONFIGURATION_NAME = "com.espressif.idf.debug.gdbjtag.openocd.launchConfigurationName"; //$NON-NLS-1$
18-
public static final String ATTR_SERIAL_PORT = "com.espressif.idf.launch.serial.core.serialPort"; //$NON-NLS-1$
1917
public static final String IDF_TARGET_TYPE = "com.espressif.idf.launch.serial.core.serialFlashTarget"; //$NON-NLS-1$
2018
public static final String OPEN_SERIAL_MONITOR = "OPEN_SERIAL_MONITOR"; //$NON-NLS-1$
2119
public static final String SERIAL_MONITOR_ENCODING = "SERIAL_MONITOR_ENCODING"; //$NON-NLS-1$

0 commit comments

Comments
 (0)