Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bundles/com.espressif.idf.core/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,5 +341,10 @@ config-only component and an interface library is created instead."
name="serial_port"
resolver="com.espressif.idf.core.variable.UartVariableResolver">
</variable>
<variable
description="flash_command: Specifies which idf.py flash command should be executed, depending on whether flash encryption is enabled (e.g., &quot;flash&quot; or &quot;encrypted-app-flash&quot;)."
name="flash_command"
resolver="com.espressif.idf.core.variable.UartVariableResolver">
</variable>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify command naming consistency ("encrypted-flash" vs "encrypted-app-flash").

The description mentions "encrypted-app-flash" while the new constant reportedly uses "encrypted-flash". Ensure the emitted value exactly matches supported idf.py targets across ESP-IDF versions.

Run:


🏁 Script executed:

#!/bin/bash
# Confirm resolver mapping and constants are consistent and valid.
rg -nC2 -g '!**/node_modules/**' -P '\bFLASH_ENCRYPTED_CMD\b|encrypted-.*flash\b|FLASH_CMD\b' bundles
echo
# Check UartVariableResolver maps FLASH_COMMAND correctly
rg -nC3 -P 'FLASH_COMMAND|resolveForDynamicEnum|flash_command' bundles
echo
# Ensure localization key exists
fd -a plugin.properties | xargs -r rg -n '^flash_command='

Length of output: 14698


Align plugin.xml description with actual command name
In plugin.xml (lines 345–348), replace “encrypted-app-flash” with “encrypted-flash” so the description matches IDFConstants.FLASH_ENCRYPTED_CMD ("encrypted-flash") and the idf.py CLI targets.

🤖 Prompt for AI Agents
In bundles/com.espressif.idf.core/plugin.xml around lines 344 to 348, the
description currently references the wrong encrypted flash command name
("encrypted-app-flash"); update that string to "encrypted-flash" so the
human-readable description matches IDFConstants.FLASH_ENCRYPTED_CMD and the
idf.py CLI target names.

</extension>
</plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ public interface IDFConstants
* idf python file
*/
String IDF_PYTHON_SCRIPT = "idf.py"; //$NON-NLS-1$

/**
* idf.py list targets
*/
String IDF_LIST_TARGETS_CMD = "--list-targets"; //$NON-NLS-1$
String IDF_LIST_TARGETS_CMD = "--list-targets"; //$NON-NLS-1$

/**
* idf_monitor python file
*/
String IDF_MONITOR_PYTHON_SCRIPT = "idf_monitor.py"; //$NON-NLS-1$

/**
* idf sysviewtrace_proc script file
*/
String IDF_SYSVIEW_TRACE_SCRIPT = "sysviewtrace_proc.py"; //$NON-NLS-1$

/**
* idf app_trace_folder
*/
Expand All @@ -64,17 +64,17 @@ public interface IDFConstants
* idf tools file
*/
String IDF_TOOLS_SCRIPT = "idf_tools.py"; //$NON-NLS-1$

/**
* idf_monitor.py
*/
String IDF_MONITOR_SCRIPT = "idf_monitor.py"; //$NON-NLS-1$

/**
* idf size file
*/
String IDF_SIZE_SCRIPT = "idf_size.py"; //$NON-NLS-1$

/**
* idf tools.json file for installable tools
*/
Expand All @@ -84,9 +84,11 @@ public interface IDFConstants
* <IDF_PATH>/tools
*/
String TOOLS_FOLDER = "tools"; //$NON-NLS-1$

String FLASH_CMD = "flash"; //$NON-NLS-1$

String FLASH_ENCRYPTED_CMD = "encrypted-flash"; //$NON-NLS-1$

Comment on lines 88 to +91
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Encrypted command name likely incorrect; align with idf.py target "encrypted-app-flash".

idf.py exposes "encrypted-app" and "encrypted-app-flash" targets; "encrypted-flash" is not a known target. Using the wrong subcommand will fail at runtime. Recommend switching the value to "encrypted-app-flash" (keep the constant name if you want to minimize ripples), and audit call sites.

Apply:

- String FLASH_ENCRYPTED_CMD = "encrypted-flash"; //$NON-NLS-1$
+ String FLASH_ENCRYPTED_CMD = "encrypted-app-flash"; //$NON-NLS-1$

To double-check usages and docs across the repo:


🏁 Script executed:

#!/bin/bash
# Look for potential mismatches
rg -nP -C2 '(encrypted[-_]app[-_]flash|encrypted[-_]flash|FLASH_ENCRYPTED_CMD|flash_command)'

Length of output: 3520


Replace incorrect “encrypted-flash” constant and update UI tooltip

--- a/bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFConstants.java
+++ b/bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFConstants.java
@@ -88,7 +88,7 @@
 	String FLASH_CMD = "flash"; //$NON-NLS-1$
 
-	String FLASH_ENCRYPTED_CMD = "encrypted-flash"; //$NON-NLS-1$
+	String FLASH_ENCRYPTED_CMD = "encrypted-app-flash"; //$NON-NLS-1$

Also update the Messages.properties tooltip so it reflects the two valid targets (“flash” and “encrypted-app-flash”):

--- a/bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/nls/Messages.properties
+++ b/bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/nls/Messages.properties
@@ -15,1 +15,1 @@
-SerialSettingsPage_EncryptionOptionTooltip1=Enable Flash Encryption. Ctrl+F and Ctrl+A will trigger the encrypted-flash and encrypted-app-flash commands.
+SerialSettingsPage_EncryptionOptionTooltip1=Enable Flash Encryption. Ctrl+F and Ctrl+A will trigger the flash and encrypted-app-flash commands.

Audit any other references to “encrypted-flash” to ensure consistency.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
String FLASH_CMD = "flash"; //$NON-NLS-1$
String FLASH_ENCRYPTED_CMD = "encrypted-flash"; //$NON-NLS-1$
String FLASH_CMD = "flash"; //$NON-NLS-1$
String FLASH_ENCRYPTED_CMD = "encrypted-app-flash"; //$NON-NLS-1$
Suggested change
String FLASH_CMD = "flash"; //$NON-NLS-1$
String FLASH_ENCRYPTED_CMD = "encrypted-flash"; //$NON-NLS-1$
SerialSettingsPage_EncryptionOptionTooltip1=Enable Flash Encryption. Ctrl+F and Ctrl+A will trigger the flash and encrypted-app-flash commands.
🤖 Prompt for AI Agents
In bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFConstants.java
around lines 88 to 91 the FLASH_ENCRYPTED_CMD constant is set to the incorrect
value "encrypted-flash"; change it to the correct target "encrypted-app-flash".
After updating the constant, update the corresponding tooltip text in
Messages.properties to list the two valid targets "flash" and
"encrypted-app-flash", and search the codebase for any other occurrences of
"encrypted-flash" to replace them with "encrypted-app-flash" or adjust
references to use the new constant to keep everything consistent.

/**
* <IDF_PATH>/tools/cmake
*/
Expand All @@ -106,7 +108,7 @@ public interface IDFConstants
* Json config menu file name
*/
String KCONFIG_MENUS_JSON = "kconfig_menus.json"; //$NON-NLS-1$

/**
* sdk config json file
*/
Expand All @@ -130,28 +132,28 @@ public interface IDFConstants
String TOOLS_INSTALL_CMD = "install"; //$NON-NLS-1$

String TOOLS_INSTALL_ALL_CMD = "all"; //$NON-NLS-1$

String TOOLS_INSTALL_PYTHON_CMD = "install-python-env"; //$NON-NLS-1$

String TOOLS_LIST_CMD = "list"; //$NON-NLS-1$

String TOOLS_EXPORT_FORMAT_KEYVALUE = "key-value"; //$NON-NLS-1$

String TOOLS_EXPORT_CMD_FORMAT = "--format"; //$NON-NLS-1$

String TOOLS_EXPORT_CMD_FORMAT_VAL = TOOLS_EXPORT_CMD_FORMAT + "=" + TOOLS_EXPORT_FORMAT_KEYVALUE; //$NON-NLS-1$

String PYTHON_CMD = "python"; //$NON-NLS-1$

String PYTHON3_CMD = "python3"; //$NON-NLS-1$

/**
* <IDF_PATH>/components
*/
String COMPONENTS_FOLDER = "components"; //$NON-NLS-1$

String ESP_CORE_DUMP_FOLDER = "espcoredump"; //$NON-NLS-1$

String ESP_CORE_DUMP_SCRIPT = "espcoredump.py"; //$NON-NLS-1$

/**
Expand All @@ -172,13 +174,13 @@ public interface IDFConstants
String ESP_TOOL_CHIP_ID_CMD = "chip_id"; //$NON-NLS-1$

String ESP_TOOL_ERASE_FLASH_CMD = "erase_flash"; //$NON-NLS-1$

String ESP_WRITE_FLASH_CMD = "write_flash"; //$NON-NLS-1$

/**
* Property to store project custom build directory
*/
String BUILD_DIR_PROPERTY = "idf.buildDirectory.property"; //$NON-NLS-1$

String PROECT_DESCRIPTION_JSON = "project_description.json"; //$NON-NLS-1$
}
Original file line number Diff line number Diff line change
Expand Up @@ -717,37 +717,63 @@ public static void updateEspressifPrefPageOpenocdPath()

public static String getCurrentTarget()
{
IProject project = null;
IProject project = getProjectFromActiveLaunchConfig();
if (project == null)
{
Logger.log(Messages.IDFUtil_CantFindProjectMsg);
return null;
}
return new SDKConfigJsonReader(project).getValue("IDF_TARGET"); //$NON-NLS-1$
}

public static boolean isFlashEncrypted()
{
IProject project = getProjectFromActiveLaunchConfig();
if (project == null)
{
Logger.log(Messages.IDFUtil_CantFindProjectMsg);
return false;
}
return Boolean.parseBoolean(new SDKConfigJsonReader(project).getValue("SECURE_FLASH_ENC_ENABLED")); //$NON-NLS-1$
}

/**
* Returns the active project from the currently selected launch configuration.
*/
public static IProject getProjectFromActiveLaunchConfig()
{
try
{
ILaunchBarManager launchBarManager = IDFCorePlugin.getService(ILaunchBarManager.class);
if (launchBarManager == null)
{
Logger.log("LaunchBarManager service not found."); //$NON-NLS-1$
return null;
}

ILaunchConfiguration activeConfig = launchBarManager.getActiveLaunchConfiguration();
if (activeConfig == null || activeConfig.getMappedResources() == null)
if (activeConfig == null)
{
Logger.log(Messages.IDFUtil_CantFindProjectMsg);
return StringUtil.EMPTY;
Logger.log("No active launch configuration."); //$NON-NLS-1$
return null;
}
project = activeConfig.getMappedResources()[0].getProject();
Logger.log("Project:: " + project); //$NON-NLS-1$

IResource[] resources = activeConfig.getMappedResources();
if (resources == null || resources.length == 0)
{
Logger.log("No mapped resources in active launch configuration."); //$NON-NLS-1$
return null;
}

IProject project = resources[0].getProject();
Logger.log("Active project: " + project); //$NON-NLS-1$
return project;
}
catch (CoreException e)
{
Logger.log(e);
return null;
}
return new SDKConfigJsonReader(project).getValue("IDF_TARGET"); //$NON-NLS-1$
}

public static IProject getProjectFromActiveLaunchConfig() throws CoreException
{
final ILaunchBarManager launchBarManager = IDFCorePlugin.getService(ILaunchBarManager.class);
ILaunchConfiguration launchConfiguration = launchBarManager.getActiveLaunchConfiguration();
IResource[] mappedResources = launchConfiguration.getMappedResources();
if (mappedResources != null && mappedResources[0].getProject() != null)
{
return mappedResources[0].getProject();
}

return null;
}

public static String getGitExecutablePathFromSystem()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

public enum UartDynamicVariable
{
SERIAL_PORT("serial_port"); //$NON-NLS-1$
SERIAL_PORT("serial_port"), //$NON-NLS-1$
FLASH_COMMAND("flash_command"); //$NON-NLS-1$

private String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import org.eclipse.launchbar.core.ILaunchBarManager;
import org.eclipse.launchbar.core.target.ILaunchTarget;

import com.espressif.idf.core.IDFConstants;
import com.espressif.idf.core.IDFCorePlugin;
import com.espressif.idf.core.LaunchBarTargetConstants;
import com.espressif.idf.core.logging.Logger;
import com.espressif.idf.core.util.IDFUtil;
import com.espressif.idf.core.util.StringUtil;

public class UartVariableResolver implements IDynamicVariableResolver
Expand All @@ -34,6 +36,7 @@ private String resolveForDynamicEnum(UartDynamicVariable enumVariable)
return switch (enumVariable)
{
case SERIAL_PORT -> getSerialPort(); // $NON-NLS-1$
case FLASH_COMMAND -> IDFUtil.isFlashEncrypted() ? IDFConstants.FLASH_ENCRYPTED_CMD : IDFConstants.FLASH_CMD;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.espressif.idf.core.configparser.EspConfigParser;
import com.espressif.idf.core.logging.Logger;
import com.espressif.idf.core.util.IDFUtil;
import com.espressif.idf.core.variable.UartDynamicVariable;

public class ESPFlashUtil
{
Expand Down Expand Up @@ -75,7 +76,8 @@ public static String getParseableEspFlashCommand(String serialPort)
.generateVariableExpression(IDFDynamicVariables.BUILD_DIR.name(), null));
commands.add("-p"); //$NON-NLS-1$
commands.add(serialPort);
commands.add(IDFConstants.FLASH_CMD);
commands.add(VariablesPlugin.getDefault().getStringVariableManager()
.generateVariableExpression(UartDynamicVariable.FLASH_COMMAND.getValue(), null));

return String.join(" ", commands); //$NON-NLS-1$
}
Expand Down
Loading