Skip to content

Commit 8199deb

Browse files
committed
do not output bin by default
1 parent 9b2ae77 commit 8199deb

3 files changed

Lines changed: 85 additions & 19 deletions

File tree

lang/any.gcc.verify.json

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,9 @@
245245
"markdownDescription": "Warning Level",
246246
"description.zh-cn": "警告等级",
247247
"type": "string",
248-
"default": "all-warnings",
248+
"default": "unspecified",
249249
"enum": [
250+
"unspecified",
250251
"no-warnings",
251252
"all-warnings"
252253
]
@@ -323,6 +324,33 @@
323324
"LIB"
324325
]
325326
},
327+
"$disableOutputTask": {
328+
"type": "boolean",
329+
"markdownDescription": "Don't Output Hex/Bin/S19 Files",
330+
"description.zh-cn": "不生成 Hex/Bin/S19 等二进制文件",
331+
"enum": [
332+
true,
333+
false
334+
]
335+
},
336+
"$outputTaskExcludes": {
337+
"type": "array",
338+
"markdownDescription": "Don't Output Specific Binary Files",
339+
"description.zh-cn": "不生成指定的二进制文件",
340+
"default": [],
341+
"items": {
342+
"type": "string",
343+
"default": ".bin",
344+
"enum": [
345+
".bin",
346+
".hex"
347+
],
348+
"enumDescriptions": [
349+
"*.bin file",
350+
"*.hex file"
351+
]
352+
}
353+
},
326354
"remove-unused-input-sections": {
327355
"markdownDescription": "Remove Unused Input Sections (-Wl,--gc-sections)",
328356
"type": "boolean"

res/data/models/any.gcc.model.json

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
"type": "selectable",
124124
"command": {
125125
"false": "",
126+
"unspecified": "",
126127
"no-warnings": "-w",
127128
"all-warnings": "-Wall"
128129
},
@@ -271,7 +272,21 @@
271272
"LD_FLAGS": {
272273
"type": "list",
273274
"command": ""
274-
}
275+
},
276+
"$outputBin": [
277+
{
278+
"name": "output hex file",
279+
"toolPath": "bin/${toolPrefix}objcopy",
280+
"outputSuffix": ".hex",
281+
"command": "-O ihex ${linkerOutput} ${output}"
282+
},
283+
{
284+
"name": "output bin file",
285+
"toolPath": "bin/${toolPrefix}objcopy",
286+
"outputSuffix": ".bin",
287+
"command": "-O binary ${linkerOutput} ${output}"
288+
}
289+
]
275290
},
276291
"linker-g++": {
277292
"$path": "bin/${toolPrefix}g++",
@@ -317,7 +332,21 @@
317332
"LD_FLAGS": {
318333
"type": "list",
319334
"command": ""
320-
}
335+
},
336+
"$outputBin": [
337+
{
338+
"name": "output hex file",
339+
"toolPath": "bin/${toolPrefix}objcopy",
340+
"outputSuffix": ".hex",
341+
"command": "-O ihex ${linkerOutput} ${output}"
342+
},
343+
{
344+
"name": "output bin file",
345+
"toolPath": "bin/${toolPrefix}objcopy",
346+
"outputSuffix": ".bin",
347+
"command": "-O binary ${linkerOutput} ${output}"
348+
}
349+
]
321350
},
322351
"linker-ld": {
323352
"$path": "bin/${toolPrefix}ld",
@@ -363,7 +392,21 @@
363392
"LD_FLAGS": {
364393
"type": "list",
365394
"command": ""
366-
}
395+
},
396+
"$outputBin": [
397+
{
398+
"name": "output hex file",
399+
"toolPath": "bin/${toolPrefix}objcopy",
400+
"outputSuffix": ".hex",
401+
"command": "-O ihex ${linkerOutput} ${output}"
402+
},
403+
{
404+
"name": "output bin file",
405+
"toolPath": "bin/${toolPrefix}objcopy",
406+
"outputSuffix": ".bin",
407+
"command": "-O binary ${linkerOutput} ${output}"
408+
}
409+
]
367410
},
368411
"linker-lib": {
369412
"$path": "bin/${toolPrefix}ar",

src/ToolchainManager.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,6 +1758,7 @@ class AC5 implements IToolchian {
17581758
},
17591759
'asm-compiler': {},
17601760
linker: {
1761+
"$outputTaskExcludes": [".bin"],
17611762
"output-format": 'elf'
17621763
}
17631764
};
@@ -1982,6 +1983,7 @@ class AC6 implements IToolchian {
19821983
"$use": "asm-auto"
19831984
},
19841985
linker: {
1986+
"$outputTaskExcludes": [".bin"],
19851987
"output-format": 'elf',
19861988
'misc-controls': '--diag_suppress=L6329'
19871989
}
@@ -2234,6 +2236,7 @@ class GCC implements IToolchian {
22342236
"ASM_FLAGS": ""
22352237
},
22362238
linker: {
2239+
"$outputTaskExcludes": [".bin"],
22372240
"output-format": "elf",
22382241
"remove-unused-input-sections": true,
22392242
"LD_FLAGS": "",
@@ -2372,6 +2375,7 @@ class IARARM implements IToolchian {
23722375
"case-sensitive-user-symbols": true
23732376
},
23742377
'linker': {
2378+
"$outputTaskExcludes": [".bin"],
23752379
"output-format": 'elf',
23762380
"auto-search-runtime-lib": true,
23772381
"perform-cpp-virtual-func-elimination": "enable",
@@ -2901,6 +2905,7 @@ class LLVM_ARM implements IToolchian {
29012905
"ASM_FLAGS": ""
29022906
},
29032907
linker: {
2908+
"$outputTaskExcludes": [".bin"],
29042909
"output-format": "elf",
29052910
"remove-unused-input-sections": true,
29062911
"LD_FLAGS": "",
@@ -3582,6 +3587,7 @@ class RISCV_GCC implements IToolchian {
35823587
"ASM_FLAGS": "-Wl,-Bstatic"
35833588
},
35843589
linker: {
3590+
"$outputTaskExcludes": [".bin"],
35853591
"output-format": "elf",
35863592
"remove-unused-input-sections": true,
35873593
"LD_FLAGS": "-Wl,--cref -Wl,--no-relax -nostartfiles",
@@ -3815,6 +3821,7 @@ class AnyGcc implements IToolchian {
38153821
options["c/cpp-compiler"]["language-c"] = "c11";
38163822
options["c/cpp-compiler"]["language-cpp"] = "gnu++11";
38173823
options["c/cpp-compiler"]["signed-char"] = true;
3824+
options["linker"]["$disableOutputTask"] = true;
38183825
// remove -c -x options
38193826
cflags = cflags
38203827
.replace('-c -xc', '').trim();
@@ -3825,7 +3832,7 @@ class AnyGcc implements IToolchian {
38253832
// replace '--print-memory-usage'
38263833
if (ldflags.includes('--print-memory-usage')) {
38273834
ldflags = ldflags.replace(/(-Wl,)?--print-memory-usage/, '').trim();
3828-
options.linker['print-mem-usage'] = true;
3835+
options["linker"]['print-mem-usage'] = true;
38293836
}
38303837
}
38313838

@@ -3840,20 +3847,7 @@ class AnyGcc implements IToolchian {
38403847
return <BuilderOptions>{
38413848
version: this.version,
38423849
beforeBuildTasks: [],
3843-
afterBuildTasks: [
3844-
{
3845-
"name": "output hex file",
3846-
"disable": true,
3847-
"abortAfterFailed": false,
3848-
"command": "${CompilerPrefix}objcopy -O ihex \"${OutDir}/${ProjectName}.elf\" \"${OutDir}/${ProjectName}.hex\""
3849-
},
3850-
{
3851-
"name": "output bin file",
3852-
"disable": true,
3853-
"abortAfterFailed": false,
3854-
"command": "${CompilerPrefix}objcopy -O binary \"${OutDir}/${ProjectName}.elf\" \"${OutDir}/${ProjectName}.bin\""
3855-
}
3856-
],
3850+
afterBuildTasks: [],
38573851
global: {
38583852
"output-debug-info": "enable"
38593853
},
@@ -3871,6 +3865,7 @@ class AnyGcc implements IToolchian {
38713865
},
38723866
linker: {
38733867
"output-format": "elf",
3868+
"$disableOutputTask": true,
38743869
"remove-unused-input-sections": true,
38753870
"print-mem-usage": true,
38763871
"LD_FLAGS": "",

0 commit comments

Comments
 (0)