RT-Thread Studio增加軟體包操作
RT-Thread Studio增加軟體包操作
1. 在本地中完成如下操作
打開RTthread Studio的安裝目錄
在當前目錄下找到env的目錄
在env的目錄下找到要添加軟體包的分類文件夾
本次以peripherals作為例子,進入peripherals點擊滑鼠右鍵在當前目錄打開ConEmu Here,如果滑鼠右鍵的列表中沒有這個選項參考如下教程
接著按照如下教程使用索引生成嚮導
其中github的ID查詢方法://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": "[email protected]",
"github": "59213512"
},
"license": "MIT",
"repository": "//github.com/fateful-Y/rtthread",
"icon": "unknown",
"homepage": "unknown",
"doc": "unknown",
"site": [
{
"version": "v1.0.0",
"URL": "//github.com/fateful-Y/rtthread.git",
"filename": "ad7606-1.0.0.zip",
"VER_SHA": "master"
},
{
"version": "latest",
"URL": "//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')