1.构建工具文档重构。

This commit is contained in:
MacRsh
2023-12-30 03:29:37 +08:00
parent 714a3bec20
commit 2073e3d7fe
4 changed files with 44 additions and 202 deletions

View File

@@ -1,6 +1,6 @@
# 如何为项目引入Kconfig配置系统
[English](Kconfig_EN.md)
[English](introduce_Kconfig_EN.md)
<!-- TOC -->
* [如何为项目引入Kconfig配置系统](#如何为项目引入kconfig配置系统)

View File

@@ -1,6 +1,6 @@
# How to introduce the Kconfig configuration system into a project
[中文](Kconfig.md)
[中文](introduce_Kconfig.md)
<!-- TOC -->
* [How to introduce the Kconfig configuration system into a project](#how-to-introduce-the-kconfig-configuration-system-into-a-project)

View File

@@ -1,114 +1,32 @@
# MR开发工具Python库
# 自动构建工具
[English](build_EN.md)
此Python库提供了用于构建和配置嵌入式项目的MDK-ARM和Eclipse IDE功能。
----------
<!-- TOC -->
* [MR开发工具Python库](#mr开发工具python库)
* [](#)
* [MDK5](#mdk5)
* [Eclipse](#eclipse)
* [函数](#函数)
* [build_mdk()](#buildmdk)
* [build_eclipse()](#buildeclipse)
* [menuconfig()](#menuconfig)
* [show_logo()](#showlogo)
* [show_license()](#showlicense)
* [](#类-1)
* [命令行](#命令行)
* [使用示例](#使用示例)
* [自动构建工具](#自动构建工具)
* [构建流程](#构建流程)
* [支持的命令](#支持的命令)
<!-- TOC -->
----------
`MR` 框架提供自动化构建系统,通过脚本驱动的构建工具可以根据不同`IDE`自动、高效地完成引入与配置。大大降低了框架使用的学习成本以及与不同环境的集成难度。
##
## 构建流程
### MDK5
1. 在命令行中运行`python build.py`,自动完成工具所需环境的安装。
2. 运行`python build.py -m`,在图形化界面中完成`MR` 框架的配置。配置完成后,会自动生成`mr_config.h`头文件。
3. 运行`python build.py -ide`,根据`IDE`类型(`-mdk``-ecl`),完成自动化配置。
表示MDK-ARM项目文件(.uvprojx)。
自动构建工具将完成:
**方法**
- `MR` 框架文件的自动导入。
- `MR` 框架头文件路径的自动添加。
- 自动使能IDE编译工具链的`GNU`支持。
- **add_include_path(path)** - 添加包含路径到项目中
## 支持的命令
- **add_include_paths(paths)** - 批量添加包含路径到项目中
- `m`:启动图形用户界面来配置框架
- `lic`:显示框架的许可证信息
- `mdk`为Keil开发环境构建项目
- `ecl`为Eclipse开发环境构建项目设置
- **add_files_new_group(name, files)** - 向项目中添加文件到新组中
- **add_path_files(path)** - 向组中添加路径中的所有文件
- **add_path_c_files(path)** - 向组中添加路径中的C/C++文件
- **use_gnu(enable)** - 启用或禁用GNU编译器
- **save()** - 保存项目文件更改
### Eclipse
表示Eclipse CDT项目文件(.cproject)。
**方法**
- **add_include_path(path)** - 添加包含路径到项目中
- **use_auto_init()** - 在链接脚本中启用自动初始化段
- **save()** - 保存项目文件更改
## 函数
### build_mdk()
构建MDK项目
### build_eclipse()
构建Eclipse项目
### menuconfig()
运行Kconfig菜单配置工具
### show_logo()
显示库logo
### show_license()
显示或说明许可证
## 类
- **MR** - 表示库根路径和文件
- **log_print(level, text)** - 打印格式化日志消息
## 命令行
可以使用以下选项从命令行运行库:
- `-m``--menuconfig` - 运行菜单配置
- `-mdk``--mdk` - 使用MDK构建
- `-ecl``--eclipse` - 使用Eclipse构建
- `-lic``--license` - 显示许可证
## 使用示例
```python
mdk_proj_path = "D:/workspace"
include_path = "D:/workspace/include"
c_file_path = "D:/workspace/source"
# 实例MDK对象
mdk_proj = MDK5(mdk_proj_path)
# 添加包含路径
mdk_proj.add_include_path(include_path)
# 添加C文件
mdk_proj.add_path_c_files(c_file_path)
# 使用GNU
mdk_proj.use_gnu(True)
# 保存
mdk_proj.save()
```
构建脚本大大简化了配置和集成流程,开发者无需了解工程内部,就可以快速启动开发。

View File

@@ -1,114 +1,38 @@
# MR Development Tools Python Library
# Automated Build Tool
[中文](build.md)
This Python library provides functions for building and configuring embedded projects using the MDK-ARM and Eclipse IDEs.
----------
<!-- TOC -->
* [MR Development Tools Python Library](#mr-development-tools-python-library)
* [Classes](#classes)
* [MDK5](#mdk5)
* [Eclipse](#eclipse)
* [Functions](#functions)
* [build_mdk()](#buildmdk)
* [build_eclipse()](#buildeclipse)
* [menuconfig()](#menuconfig)
* [show_logo()](#showlogo)
* [show_license()](#showlicense)
* [Classes](#classes-1)
* [Command Line](#command-line)
* [Usage Example](#usage-example)
* [Automated Build Tool](#automated-build-tool)
* [Build Process](#build-process)
* [Supported Commands](#supported-commands)
<!-- TOC -->
----------
The MR framework provides an automated build system. The script-driven build tool can automatically and efficiently
complete the introduction and configuration according to different IDEs, greatly reducing the learning cost of using the
framework and the difficulty of integration with different environments.
## Classes
## Build Process
### MDK5
1. Run `python build.py` in the command line to automatically install the required environment for the tool.
Represents an MDK-ARM project file (.uvprojx).
2. Run `python build.py -m` to complete the configuration of the MR framework in a graphical interface. After the
configuration is completed, it will automatically generate the `mr_config.h` header file.
**Methods**
3. Run `python build.py -ide` according to the IDE type (`-mdk` or `-ecl`) to complete the automatic configuration.
- **add_include_path(path)** - Adds an include path to the project.
The automated build tool will complete:
- **add_include_paths(paths)** - Adds multiple include paths to the project.
- Automatic import of MR framework files
- Automatic addition of MR framework header file paths
- Automatically enable GNU support for the IDE compilation toolchain
- **add_files_new_group(name, files)** - Adds files to a new group in the project.
## Supported Commands
- **add_path_files(path)** - Adds all files in a path to a group.
- `m`: Launches the graphical configuration interface
- `lic`: Displays license information
- `mdk`: Configures the project for MDK (Keil)
- `ecl`: Configures the project for Eclipse
- **add_path_c_files(path)** - Adds C/C++ files in a path to a group.
- **use_gnu(enable)** - Enables or disables the GNU compiler.
- **save()** - Saves changes to the project file.
### Eclipse
Represents an Eclipse CDT project file (.cproject).
**Methods**
- **add_include_path(path)** - Adds an include path to the project.
- **use_auto_init()** - Enables automatic initialization section in linker script.
- **save()** - Saves changes to the project file.
## Functions
### build_mdk()
Builds an MDK project.
### build_eclipse()
Builds an Eclipse project.
### menuconfig()
Runs the Kconfig menuconfig tool.
### show_logo()
Displays the library logo.
### show_license()
Displays or explains the license.
## Classes
- **MR** - Represents the library root path and files.
- **log_print(level, text)** - Prints formatted log messages.
## Command Line
The library can be run from the command line with the following options:
- `-m, --menuconfig` - Runs menuconfig
- `-mdk, --mdk` - Builds with MDK
- `-ecl, --eclipse` - Builds with Eclipse
- `-lic, --license` - Shows license
## Usage Example
```python
mdk_proj_path = "D:/workspace"
include_path = "D:/workspace/include"
c_file_path = "D:/workspace/source"
# Instance MDK object
mdk_proj = MDK5(mdk_proj_path)
# Add contain path
mdk_proj.add_include_path(include_path)
# Add C file
mdk_proj.add_path_c_files(c_file_path)
# Use GNU
mdk_proj.use_gnu(True)
# Save
mdk_proj.save()
```
The build script greatly simplifies the configuration and integration process, allowing developers to quickly start
development without needing to understand the internal workings of the project.