{
    "title": "IAR for STM8 Options",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "definitions": {
        "misc-controls": {
            "markdownDescription": "Other Options",
            "description.zh-cn": "其他选项",
            "size": "huge",
            "type": "string",
            "default": ""
        }
    },
    "properties": {
        "beforeBuildTasks": {
            "markdownDescription": "List of commands to execute before build",
            "description.zh-cn": "构建前要执行的命令列表",
            "type": "array",
            "default": [
                {
                    "name": "clean",
                    "command": "del /Q \"${OutDir}\\*.*\""
                }
            ],
            "items": {
                "type": "object",
                "required": [
                    "name",
                    "command"
                ],
                "properties": {
                    "name": {
                        "markdownDescription": "A readable name for display",
                        "description.zh-cn": "用于显示的可读名称",
                        "type": "string"
                    },
                    "command": {
                        "markdownDescription": "Shell command line",
                        "description.zh-cn": "Shell 命令行",
                        "type": "string"
                    },
                    "disable": {
                        "markdownDescription": "Disable this command",
                        "description.zh-cn": "禁用此命令",
                        "type": "boolean",
                        "enum": [
                            true,
                            false
                        ]
                    },
                    "abortAfterFailed": {
                        "markdownDescription": "Whether to skip subsequent commands if this command failed",
                        "description.zh-cn": "是否在此命令失败时，跳过后续的命令",
                        "type": "boolean",
                        "enum": [
                            true,
                            false
                        ]
                    },
                    "stopBuildAfterFailed": {
                        "markdownDescription": "Whether to stop compiling directly when this command failed",
                        "description.zh-cn": "是否在此命令失败时，直接停止编译",
                        "type": "boolean",
                        "enum": [
                            true,
                            false
                        ]
                    }
                }
            }
        },
        "afterBuildTasks": {
            "markdownDescription": "List of commands to execute after build",
            "description.zh-cn": "构建结束后要执行的命令列表",
            "type": "array",
            "default": [
                {
                    "name": "clean",
                    "command": "del \"${OutDir}\\*._*\""
                }
            ],
            "items": {
                "type": "object",
                "required": [
                    "name",
                    "command"
                ],
                "properties": {
                    "name": {
                        "markdownDescription": "A readable name for display",
                        "description.zh-cn": "用于显示的可读名称",
                        "type": "string"
                    },
                    "command": {
                        "markdownDescription": "Shell command line",
                        "description.zh-cn": "Shell 命令行",
                        "type": "string"
                    },
                    "disable": {
                        "markdownDescription": "Disable this command",
                        "description.zh-cn": "禁用此命令",
                        "type": "boolean",
                        "enum": [
                            true,
                            false
                        ]
                    },
                    "abortAfterFailed": {
                        "markdownDescription": "Whether to skip subsequent commands if this command failed",
                        "description.zh-cn": "是否在此命令失败时，跳过后续的命令",
                        "type": "boolean",
                        "enum": [
                            true,
                            false
                        ]
                    }
                }
            }
        },
        "global": {
            "markdownDescription": "Global Options",
            "description.zh-cn": "全局选项",
            "type": "object",
            "properties": {
                "code-mode": {
                    "description": "code mode",
                    "type": "string",
                    "default": "small",
                    "enum": [
                        "small",
                        "medium",
                        "large"
                    ]
                },
                "data-mode": {
                    "description": "data mode",
                    "type": "string",
                    "default": "medium",
                    "enum": [
                        "small",
                        "medium",
                        "large"
                    ]
                },
                "output-debug-info": {
                    "markdownDescription": "Output debug information",
                    "description.zh-cn": "输出调试信息",
                    "type": "string",
                    "default": "disable",
                    "enum": [
                        "disable",
                        "enable"
                    ]
                },
                "printf-formatter": {
                    "type": "string",
                    "description": "printf formatter option",
                    "default": "auto",
                    "enum": [
                        "auto",
                        "tiny",
                        "small",
                        "small-without-multibyte",
                        "large",
                        "large-without-multibyte",
                        "full",
                        "full-without-multibyte"
                    ],
                    "enumDescriptions": [
                        "Automatic choice of formatter.",
                        "No specifier a or A, no specifier n, no float, no flags.",
                        "No specifier a or A, no specifier n, no float.",
                        "No specifier a or A, no specifier n, no float, without multibytes",
                        "No specifier a or A.",
                        "No specifier a or A, without multibytes.",
                        "Full formatting.",
                        "Full formatting, without multibytes."
                    ]
                },
                "scanf-formatter": {
                    "type": "string",
                    "description": "scanf formatter option",
                    "default": "auto",
                    "enum": [
                        "auto",
                        "small",
                        "small-without-multibyte",
                        "large",
                        "large-without-multibyte",
                        "full",
                        "full-without-multibyte"
                    ],
                    "enumDescriptions": [
                        "Automatic choice of formatter.",
                        "No specifier n, no float, no scan set, no assignment suppressing.",
                        "No specifier n, no float, no scan set, no assignment suppressing, without multibytes.",
                        "No specifier n, no float.",
                        "No specifier n, no float, without multibytes.",
                        "Full formatting.",
                        "Full formatting, without multibytes."
                    ]
                },
                "math-functions": {
                    "type": "string",
                    "description": "math functions option",
                    "default": "default",
                    "enum": [
                        "default",
                        "smaller"
                    ],
                    "enumDescriptions": [
                        "Default variants of cos, sin, tan, log, log10, pow, and exp.",
                        "Smaller size, higher execution speed, less precision, smaller input range."
                    ]
                }
            }
        },
        "c/cpp-compiler": {
            "markdownDescription": "C/C++ Compiler Options",
            "description.zh-cn": "C/C++ 编译器选项",
            "type": "object",
            "properties": {
                "language-c": {
                    "markdownDescription": "C Standard",
                    "description.zh-cn": "C 标准",
                    "type": "string",
                    "default": "c99",
                    "enum": [
                        "c89",
                        "c99"
                    ]
                },
                "language-cpp": {
                    "markdownDescription": "C++ Standard",
                    "description.zh-cn": "C++ 标准",
                    "type": "string",
                    "default": "Extended-EC++",
                    "enum": [
                        "Embedded-C++",
                        "Extended-EC++"
                    ]
                },
                "optimization": {
                    "markdownDescription": "Optimization Level",
                    "description.zh-cn": "代码优化级别",
                    "type": "string",
                    "default": "no",
                    "enum": [
                        "no",
                        "low",
                        "medium",
                        "high",
                        "size",
                        "speed",
                        "speed-no-size-constraints"
                    ],
                    "enumDescriptions": [
                        "not optimize",
                        "low",
                        "medium",
                        "high, balanced",
                        "high, size",
                        "high, speed",
                        "high, speed, no size constraints"
                    ]
                },
                "runtime-lib": {
                    "description": "The C/EC++ runtime library configuration",
                    "type": "string",
                    "default": "null",
                    "enum": [
                        "normal",
                        "full",
                        "null"
                    ],
                    "enumDescriptions": [
                        "No locale interface, C locale, no file descriptor support, no multibytes in printf and scanf, and no hex floats in strtod.",
                        "Full locale interface, C locale, file descriptor support, multibytes in printf and scanf, and hex floats in strtod.",
                        "No use"
                    ]
                },
                "language-conformance": {
                    "description": "language conformance",
                    "type": "string",
                    "default": "IAR-extensions",
                    "enum": [
                        "strict",
                        "standard",
                        "IAR-extensions"
                    ]
                },
                "virtual-bytes": {
                    "description": "virtual bytes",
                    "type": "string",
                    "default": "16",
                    "enum": [
                        "16",
                        "12"
                    ]
                },
                "destroy-cpp-static-object": {
                    "description": "destroy c++ static object",
                    "type": "boolean",
                    "default": false,
                    "enum": [
                        true,
                        false
                    ]
                },
                "allow-VLA": {
                    "description": "allow VLA, for language c",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "use-cpp-inline-semantics": {
                    "description": "use c++ inline semantics, for language c++",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "require-prototypes": {
                    "description": "require prototypes",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "floating-point": {
                    "description": "floating point",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "multibyte-support": {
                    "description": "multibyte support",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "plain-char-is-signed": {
                    "markdownDescription": "Plain Char is Signed",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "turn-Warning-into-errors": {
                    "markdownDescription": "Turn warnings into errors",
                    "description.zh-cn": "将警告转化为错误",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "misc-controls": {
                    "markdownDescription": "Other C/C++ Compiler Options",
                    "description.zh-cn": "C/C++ 编译器附加选项",
                    "$ref": "#/definitions/misc-controls"
                }
            }
        },
        "asm-compiler": {
            "markdownDescription": "Assembler Options",
            "description.zh-cn": "汇编器选项",
            "type": "object",
            "properties": {
                "defines": {
                    "readable_name": "Preprocessor Definitions",
                    "readable_name.zh-cn": "预处理器定义",
                    "markdownDescription": "Preprocessor Definitions",
                    "description.zh-cn": "预处理器定义",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "case-sensitive-user-symbols": {
                    "description": "case sensitive user symbols",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "multibyte-support": {
                    "description": "multibyte support",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "allow-mnemonics-first-column": {
                    "description": "allow mnemonics first column",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "allow-directives-first-column": {
                    "description": "allow directives first column",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "misc-controls": {
                    "markdownDescription": "Other Assembler Options",
                    "description.zh-cn": "汇编器附加选项",
                    "$ref": "#/definitions/misc-controls"
                }
            }
        },
        "linker": {
            "markdownDescription": "Linker Options",
            "description.zh-cn": "链接器选项",
            "type": "object",
            "required": [
                "linker-config"
            ],
            "dependencies": {
                "use-C_SPY-debug-lib": [
                    "auto-search-runtime-lib"
                ]
            },
            "properties": {
                "output-format": {
                    "type": "string",
                    "default": "elf",
                    "description": "Output Format",
                    "description.zh-cn": "输出格式",
                    "enum": [
                        "elf",
                        "lib"
                    ],
                    "enumDescriptions": [
                        "ELF",
                        "LIB"
                    ]
                },
                "$disableOutputTask": {
                    "type": "boolean",
                    "markdownDescription": "Don't Output Hex/Bin/S19 Files",
                    "description.zh-cn": "不生成 Hex/Bin/S19 等二进制文件",
                    "enum": [
                        true,
                        false
                    ]
                },
                "$outputTaskExcludes": {
                    "type": "array",
                    "markdownDescription": "Don't Output Specific Binary Files",
                    "description.zh-cn": "不生成指定的二进制文件",
                    "default": [],
                    "items": {
                        "type": "string",
                        "default": ".bin",
                        "enum": [
                            ".bin",
                            ".hex",
                            ".s19"
                        ],
                        "enumDescriptions": [
                            "*.bin file",
                            "*.hex file",
                            "*.s19 file"
                        ]
                    }
                },
                "auto-search-runtime-lib": {
                    "description": "auto search runtime lib",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "use-C_SPY-debug-lib": {
                    "description": "Use C-SPY debug library",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "merge-duplicate-sections": {
                    "description": "merge duplicate sections",
                    "type": "boolean",
                    "enum": [
                        true,
                        false
                    ]
                },
                "config-defines": {
                    "description": "define some config symbols",
                    "type": "array",
                    "default": [
                        "_CSTACK_SIZE=0x0200",
                        "_HEAP_SIZE=0x0000"
                    ],
                    "items": {
                        "type": "string"
                    }
                },
                "program-entry": {
                    "readable_name": "Program Entry",
                    "readable_name.zh-cn": "程序入口",
                    "description": "Program entry，default: __iar_program_start",
                    "description.zh-cn": "程序入口，默认：__iar_program_start",
                    "type": "string",
                    "default": "__iar_program_start"
                },
                "linker-config": {
                    "readable_name": "Linker config file path",
                    "readable_name.zh-cn": "链接脚本路径",
                    "description": "linker config file path.\n Example: \"lnkstm8xxx.icf\"\n or \"./lnkstm8xxx.icf\" (relative by workspace folder)\n or \"${ToolchainRoot}/stm8/config/lnkstm8xxx.icf\"",
                    "type": "string",
                    "default": "lnkstm8s103f3.icf"
                },
                "misc-controls": {
                    "markdownDescription": "Other Linker Options",
                    "description.zh-cn": "链接器附加选项",
                    "$ref": "#/definitions/misc-controls"
                },
                "object-order": {
                    "type": "array",
                    "readable_name": "Object Order",
                    "readable_name.zh-cn": "Object Order",
                    "markdownDescription": "Object Order (used to determine the order in which object files are linked)",
                    "description.zh-cn": "Object Order（用于决定某些 obj 文件的链接顺序）",
                    "default": [],
                    "items": {
                        "type": "object",
                        "properties": {
                            "pattern": {
                                "type": "string",
                                "readable_name": "Pattern",
                                "description": "A glob pattern (https://github.com/dazinator/DotNet.Glob) to match a object (*.o) file",
                                "default": "**/your/pattern/for/object/file/path/*.o"
                            },
                            "order": {
                                "type": "number",
                                "readable_name": "Order",
                                "description": "An integer number (The smaller the value, the higher the priority)",
                                "default": 0
                            }
                        }
                    }
                }
            }
        }
    }
}