Skip to content

Commit 8c36c59

Browse files
committed
支持为 cosmic stm8 自动选择 crts lib
1 parent 876b67d commit 8c36c59

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

lang/stm8.cosmic.verify.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,19 @@
294294
"type": "boolean",
295295
"default": false
296296
},
297+
"crts-initialize": {
298+
"description": "Range Of Variables To Be Initialized",
299+
"type": "string",
300+
"default": "crtsi",
301+
"enum": [
302+
"crtsi",
303+
"crtsx"
304+
],
305+
"enumDescriptions": [
306+
"@near",
307+
"@near and @far"
308+
]
309+
},
297310
"LD_FLAGS": {
298311
"markdownDescription": "Other Linker Options (clnk)",
299312
"$ref": "#/definitions/misc-controls"

res/template/cosmic_stm8.ept

152 Bytes
Binary file not shown.

src/ToolchainManager.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,22 @@ class COSMIC_STM8 implements IToolchian {
11511151
// | crtsif(0).s | @near | @far
11521152
// | crtsxf(0).s | @near and @far | @far
11531153

1154+
let crts_name = 'crtsi';
1155+
if (options['linker']['crts-initialize']) {
1156+
crts_name = options['linker']['crts-initialize'];
1157+
}
1158+
if (model_option.startsWith('small')) {
1159+
if (model_option == 'small-0') {
1160+
crts_name += '0';
1161+
}
1162+
} else {
1163+
// crtsif or crtsxf
1164+
crts_name += 'f';
1165+
}
1166+
11541167
let machineLibs: string[] = [
1168+
// CRT library
1169+
`${crts_name}.sm8`,
11551170
// standard ANSI libraries
11561171
`libfs${model_suffix}${codes_suffix}.sm8`, // Float Library
11571172
`libis${model_suffix}${codes_suffix}.sm8`, // Integer Only Library

0 commit comments

Comments
 (0)