Skip to content

Commit 62cbf2c

Browse files
committed
add dynamic debug for cortex-debug
1 parent 9212cc2 commit 62cbf2c

File tree

10 files changed

+350
-10
lines changed

10 files changed

+350
-10
lines changed

package.json

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@
114114
"yaml": "^1.10.2"
115115
},
116116
"contributes": {
117+
"debuggers": [
118+
{
119+
"type": "eide.cortex-debug",
120+
"label": "EIDE (Cortex-Debug)"
121+
}
122+
],
117123
"terminal": {
118124
"profiles": [
119125
{
@@ -541,6 +547,20 @@
541547
}
542548
],
543549
"commands": [
550+
{
551+
"command": "eide.debug.start",
552+
"category": "eide",
553+
"title": "%eide.project.debug.start%",
554+
"icon": {
555+
"dark": "./res/icon/Run_16x.svg",
556+
"light": "./res/icon/Run_16x.svg"
557+
}
558+
},
559+
{
560+
"command": "eide.refresh.external_tools_index",
561+
"category": "eide",
562+
"title": "Refresh External Tools Index"
563+
},
544564
{
545565
"command": "eide.open.makelibs.cfg",
546566
"category": "eide",
@@ -1217,17 +1237,22 @@
12171237
{
12181238
"when": "cl.eide.projectActived && config.EIDE.Option.ShowToolbarInEditerTitle",
12191239
"command": "eide.project.build",
1220-
"group": "navigation"
1240+
"group": "navigation@1"
12211241
},
12221242
{
12231243
"when": "cl.eide.projectActived && config.EIDE.Option.ShowToolbarInEditerTitle",
1224-
"command": "eide.project.clean",
1225-
"group": "navigation"
1244+
"command": "eide.project.uploadToDevice",
1245+
"group": "navigation@2"
12261246
},
12271247
{
12281248
"when": "cl.eide.projectActived && config.EIDE.Option.ShowToolbarInEditerTitle",
1229-
"command": "eide.project.uploadToDevice",
1230-
"group": "navigation"
1249+
"command": "eide.debug.start",
1250+
"group": "navigation@3"
1251+
},
1252+
{
1253+
"when": "cl.eide.projectActived && config.EIDE.Option.ShowToolbarInEditerTitle",
1254+
"command": "eide.project.clean",
1255+
"group": "navigation@4"
12311256
}
12321257
],
12331258
"editor/context": [
@@ -1291,10 +1316,15 @@
12911316
"when": "viewItem == SOLUTION && view == cl.eide.view.projects"
12921317
},
12931318
{
1294-
"command": "eide.project.clean",
1319+
"command": "eide.debug.start",
12951320
"group": "inline@4",
12961321
"when": "viewItem == SOLUTION && view == cl.eide.view.projects"
12971322
},
1323+
{
1324+
"command": "eide.project.clean",
1325+
"group": "inline@5",
1326+
"when": "viewItem == SOLUTION && view == cl.eide.view.projects"
1327+
},
12981328
{
12991329
"command": "_cl.eide.project.setActive",
13001330
"when": "viewItem == SOLUTION && view == cl.eide.view.projects && cl.eide.enable.active",
@@ -1315,6 +1345,11 @@
13151345
"when": "viewItem == SOLUTION && view == cl.eide.view.projects",
13161346
"group": "2_build@2"
13171347
},
1348+
{
1349+
"command": "eide.debug.start",
1350+
"when": "viewItem == SOLUTION && view == cl.eide.view.projects",
1351+
"group": "2_build@3"
1352+
},
13181353
{
13191354
"command": "eide.project.uploadToDevice",
13201355
"when": "viewItem == SOLUTION && view == cl.eide.view.projects",

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"eide.project.modify.files.options": "Show Extra Options Of All Source Files",
3333
"eide.project.import.ext.project.src.struct": "Import SourceFile Tree From Other Project",
3434
"eide.project.generate_builder_params": "Generate builder.params",
35+
"eide.project.debug.start": "Start Debugging (Cortex-Debug)",
3536

3637
"eide.prj.menus.main.static-check": "Static Check",
3738
"eide.prj.menus.sub.static-check.cppcheck": "Run Cppcheck",

package.nls.zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"eide.project.modify.files.options": "查看所有源文件的附加编译参数",
3333
"eide.project.import.ext.project.src.struct": "从其他 IDE 的项目中导入源文件树",
3434
"eide.project.generate_builder_params": "生成 builder.params",
35+
"eide.project.debug.start": "启动调试(Cortex-Debug)",
3536

3637
"eide.prj.menus.main.static-check": "静态检查",
3738
"eide.prj.menus.sub.static-check.cppcheck": "执行 Cppcheck",

res/icon/Run_16x.svg

Lines changed: 1 addition & 0 deletions
Loading

res/icon/Run_blue_16x.svg

Lines changed: 1 addition & 0 deletions
Loading

res/icon/Run_grey_16x.svg

Lines changed: 1 addition & 0 deletions
Loading

src/GlobalEvents.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424

2525
import * as events from 'events';
26-
import { Message, ExceptionToMessage, newMessage } from './Message';
26+
import { Message, ExceptionToMessage, newMessage, MessageType } from './Message';
2727

2828
let _globalEvent: GlobalEvent | undefined;
2929

@@ -75,6 +75,9 @@ export class GlobalEvent {
7575

7676
//msg
7777
static emit(event: 'error', error: Error): boolean; // 错误弹框(vscode 右下角)
78+
/**
79+
* @deprecated 已废弃,改用 GlobalEvent.show_msgbox
80+
*/
7881
static emit(event: 'msg', msg: Message): boolean; // 消息弹框(vscode 右下角)
7982
static emit(event: 'globalLog', msg: Message): boolean; // 打印日志+换行 -> 输出面板
8083
static emit(event: 'globalLog.append', log: string): boolean; // 打印原始日志字串 -> 输出面板
@@ -83,6 +86,14 @@ export class GlobalEvent {
8386
return GlobalEvent.GetInstance()._emitter.emit(event, args);
8487
}
8588

89+
//vscode notify
90+
static show_msgbox(type: MessageType, msg: string | Error) {
91+
if (msg instanceof Error)
92+
return GlobalEvent.GetInstance()._emitter.emit('msg', ExceptionToMessage(msg, type));
93+
else
94+
return GlobalEvent.GetInstance()._emitter.emit('msg', newMessage(type, msg));
95+
}
96+
8697
//log
8798
static log_info(msg: string) {
8899
GlobalEvent.GetInstance()._emitter.emit('globalLog', newMessage('Info', msg));

src/HexUploader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ class STLinkUploader extends HexUploader<string[]> {
787787

788788
// run
789789
let cmd = `${commandLine} ${options.otherCmds || ''}`.trimEnd();
790-
if (osType() == 'win32' && exe.noSuffixName.toLowerCase().startsWith('stm32_programmer_cli'))
790+
if (osType() == 'win32')
791791
cmd = 'chcp 437 && ' + cmd; // chcp 437: 去除进度条乱码
792792

793793
this.executeShellCommand(this.toolType, cmd,

src/ResInstaller.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ export class ResInstaller {
295295
this.locker.delete(name.toLowerCase());
296296
}
297297

298-
async refreshExternalToolsIndex() {
298+
async refreshExternalToolsIndex(force?: boolean) {
299299

300300
const indexCacheFile = File.from(ResManager.instance().GetTmpDir().path, 'eide_external_tools.index.json');
301301
const defIdxUrl = 'https://raw.githubusercontent.com/github0null/eide_default_external_tools_index/master/index.json';
@@ -304,6 +304,8 @@ export class ResInstaller {
304304

305305
let cont: string | Error | undefined;
306306
try {
307+
if (force)
308+
throw Error();
307309
if (indexCacheFile.IsFile() &&
308310
new Date().getTime() < fs.statSync(indexCacheFile.path).mtime.getTime() + (6 * 3600 * 1000))
309311
cont = indexCacheFile.Read();

0 commit comments

Comments
 (0)