RT-Thread Studio增加软件包操作
1. 在本地中完成如下操作
打开RTthread Studio的安装目录
在当前目录下找到env的目录
在env的目录下找到要添加软件包的分类文件夹
本次以peripherals作为例子,进入peripherals点击鼠标右键在当前目录打开ConEmu Here,如果鼠标右键的列表中没有这个选项参考如下教程
接着按照如下教程使用索引生成向导
其中github的ID查询方法:https://api.github.com/users/+你的github用户名
完成向导后就会在当前目录下生成对应的软件包文件夹
修改文件夹下的两个文件
Kconfig文件示例
# Kconfig file for package ad7606
menuconfig PKG_USING_AD7606
bool "AD7606: An ADC chip."
default n
if PKG_USING_AD7606
config PKG_AD7606_PATH
string
default "/packages/peripherals/ad7606"
choice
prompt "Version"
default PKG_USING_AD7606_LATEST_VERSION
help
Select the package version
config PKG_USING_AD7606_V100
bool "v1.0.0"
config PKG_USING_AD7606_LATEST_VERSION
bool "latest"
endchoice
config PKG_AD7606_VER
string
default "v1.0.0" if PKG_USING_AD7606_V100
default "latest" if PKG_USING_AD7606_LATEST_VERSION
endif
package.json文件示例
{
"name": "ad7606",
"description": "Please add description of ad7606 in English.",
"description_zh": "请添加软件包 ad7606 的中文描述。",
"enable": "PKG_USING_AD7606",
"keywords": [
"ad7606"
],
"category": "peripherals",
"author": {
"name": "59213512",
"email": "1754915734@qq.com",
"github": "59213512"
},
"license": "MIT",
"repository": "https://github.com/fateful-Y/rtthread",
"icon": "unknown",
"homepage": "unknown",
"doc": "unknown",
"site": [
{
"version": "v1.0.0",
"URL": "https://github.com/fateful-Y/rtthread.git",
"filename": "ad7606-1.0.0.zip",
"VER_SHA": "master"
},
{
"version": "latest",
"URL": "https://github.com/fateful-Y/rtthread.git",
"filename": "",
"VER_SHA": "master"
}
]
}
2. 在对应的git仓库中建立如下目录列表
其中docs放一些说明文件
examples放软件包的demo示例文件
inc放头文件
src放源文件
.gitignore放如下代码
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
LICENSE放如下代码
hello/LICENSE at master · RT-Thread-packages/hello
SConscript构建文件示例:
from building import *
Import('rtconfig')
src = []
cwd = GetCurrentDir()
# add ad7606 src files.
if GetDepend('PKG_USING_AD7606'):
src += Glob('src/ad7606.c')
# add ad7606 include path.
path = [cwd + '/inc']
# add src and include to group.
group = DefineGroup('ad7606', src, depend = ['PKG_USING_AD7606'], CPPPATH = path)
Return('group')