From 788a49bc5beb46e403e94678e2831b4e8d6aa3e1 Mon Sep 17 00:00:00 2001 From: IOsetting Date: Sat, 11 Jun 2022 20:53:50 +0800 Subject: [PATCH] docs: add `__SDCC_SYNTAX_FIX` comments --- README.cn.md | 12 ++++++++++++ README.md | 16 ++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/README.cn.md b/README.cn.md index 0f3d5d0..3837fa7 100644 --- a/README.cn.md +++ b/README.cn.md @@ -52,6 +52,18 @@ build_flags = #include "fw_hal.h" ``` +## VS Code 代码高亮错误 + +VS Code 并不完全支持 SDCC 的 Intel 8051 语法 ([issue 7146](https://github.com/microsoft/vscode-cpptools/issues/7146)), 如果您需要在代码编辑中消除错误提示, 需要增加一个env, 并在 build_flags 中添加 `__SDCC_SYNTAX_FIX`: +``` +build_flags = + -D__SDCC_SYNTAX_FIX + -D__CONF_FOSC=36864000UL + -D__CONF_MCU_MODEL=MCU_MODEL_STC8H3K32S2 + ... +``` +这个特殊的env仅用于代码编辑, 编译和上载依然需要使用正常的env. + # Keil C51 快速上手 diff --git a/README.md b/README.md index f8e0c75..464e794 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,19 @@ build_flags = ```c #include "fw_hal.h" ``` -then it's ready to use. +then it's ready to go. + +## VS Code Syntax Problem + +VS Code doesn't support some of SDCC syntax for Intel 8051 ([issue 7146](https://github.com/microsoft/vscode-cpptools/issues/7146)), if you want to eliminate syntax errors in code editor, add a separate env for code editing and add `__SDCC_SYNTAX_FIX` in build_flags: +``` +build_flags = + -D__SDCC_SYNTAX_FIX + -D__CONF_FOSC=36864000UL + -D__CONF_MCU_MODEL=MCU_MODEL_STC8H3K32S2 + ... +``` +This special env is for code editing only, building and uploading should use the normal env. # Keil C51 Quick Start @@ -78,7 +90,7 @@ The explanation of these arguments ```c #include "fw_hal.h" ``` -then it's ready to use. +then it's ready to go. # Macros