Skip to content

Commit

Permalink
fix jtag flash on build flash monitor (#1245)
Browse files Browse the repository at this point in the history
* fix jtag flash on build flash monitor

* use file manage webpack plugin instead

* add cdt factory to context subscriptions
  • Loading branch information
brianignacio5 authored Aug 6, 2024
1 parent d167d34 commit b84b268
Show file tree
Hide file tree
Showing 4 changed files with 294 additions and 97 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2107,10 +2107,10 @@
"@vue/compiler-sfc": "^3.3.4",
"bulma": "^0.9.3",
"chai": "^4.3.4",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^3.1.0",
"d3-scale": "^4.0.2",
"file-loader": "^6.2.0",
"filemanager-webpack-plugin": "^8.0.0",
"glob": "^7.1.4",
"husky": "^6.0.0",
"js-yaml": "^4.1.0",
Expand Down
36 changes: 17 additions & 19 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,6 @@ const webIdeCheck = [
cmdNotForWebIdeMsg,
] as utils.PreCheckInput;

const minOpenOcdVersionCheck = async function () {
const currOpenOcdVersion = await openOCDManager.version();
return [
() =>
PreCheck.openOCDVersionValidator(
"v0.10.0-esp32-20201125",
currOpenOcdVersion
),
`Minimum OpenOCD version v0.10.0-esp32-20201125 is required while you have ${currOpenOcdVersion} version installed`,
] as utils.PreCheckInput;
};

const minIdfVersionCheck = async function (
minVersion: string,
workspace: vscode.Uri
Expand Down Expand Up @@ -1193,9 +1181,11 @@ export async function activate(context: vscode.ExtensionContext) {
)
);

vscode.debug.registerDebugAdapterDescriptorFactory(
"gdbtarget",
new CDTDebugAdapterDescriptorFactory()
context.subscriptions.push(
vscode.debug.registerDebugAdapterDescriptorFactory(
"gdbtarget",
new CDTDebugAdapterDescriptorFactory()
)
);

vscode.debug.registerDebugAdapterDescriptorFactory("espidf", {
Expand Down Expand Up @@ -4084,10 +4074,18 @@ async function startFlashing(
}

if (flashType === ESP.FlashType.JTAG) {
const openOcdMinCheck = await minOpenOcdVersionCheck();
PreCheck.perform([openOcdMinCheck], async () => {
return await jtagFlashCommand(workspaceRoot);
});
const currOpenOcdVersion = await openOCDManager.version();
const openOCDVersionIsValid = PreCheck.openOCDVersionValidator(
"v0.10.0-esp32-20201125",
currOpenOcdVersion
);
if (!openOCDVersionIsValid) {
Logger.infoNotify(
`Minimum OpenOCD version v0.10.0-esp32-20201125 is required while you have ${currOpenOcdVersion} version installed`
);
return;
}
return await jtagFlashCommand(workspaceRoot);
} else {
const arrDfuDevices = idfConf.readParameter(
"idf.listDfuDevices",
Expand Down
24 changes: 14 additions & 10 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require("fs");
const path = require("path");
const { VueLoaderPlugin } = require("vue-loader");
const webpack = require("webpack");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const fileManagerPlugin = require("filemanager-webpack-plugin");

const packageConfig = JSON.parse(
fs.readFileSync(path.join(__dirname, "package.json"), "utf8")
Expand Down Expand Up @@ -62,16 +62,20 @@ const extensionConfig = {
],
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(
__dirname,
"./node_modules/@serialport/bindings-cpp/prebuilds"
),
to: path.resolve(__dirname, "./dist/prebuilds"),
new fileManagerPlugin({
events: {
onEnd: {
copy: [
{
source: path.resolve(
__dirname,
"./node_modules/@serialport/bindings-cpp/prebuilds"
),
destination: path.resolve(__dirname, "./dist/prebuilds"),
},
],
},
],
},
}),
],
resolve: {
Expand Down
Loading

0 comments on commit b84b268

Please sign in to comment.