Daplink簡(jiǎn)介
Daplink是arm開源的一款燒寫器痹束,硬件電路與stlink可以兼容雄坪,可以用于cortex系列的單片機(jī)調(diào)試與程序燒寫驱犹。V2版本增加串口支持。
由于arm開源了整個(gè)項(xiàng)目息堂,所以任何人使用daplink嚷狞,都不存在版權(quán)的問題。
參考資源
daplink源碼:https://github.com/ARMmbed/DAPLink
參考電路圖:https://github.com/JassyL/DAP-Link-TypeC
v0257版本在keil中無法識(shí)別的接法方案:https://community.arm.com/support-forums/f/keil-forum/52868/keil-cannot-find-daplink-with-new-version-firmware
stlink與daplink電路圖上的區(qū)別:https://stm32world.com/wiki/STM32_USB_Device_Renumeration
keil編譯環(huán)境的搭建
英文資料可參考github:https://github.com/ARMmbed/DAPLink/blob/main/docs/DEVELOPERS-GUIDE.md
下面是部分翻譯:
設(shè)置
DAPLink源文件由 progen
(from project-generator) 生成荣堰。progen
可以運(yùn)行于Linux床未,MacOS和Windows。
安裝下面的必要工具持隧。 如果已經(jīng)安裝即硼,可以跳過這些步驟。
- 安裝 Python 3 . 添加到PATH中屡拨。
- 安裝 Git . 添加到PATH中。
- 安裝一個(gè)編譯器:
-
Keil MDK 或 Arm Compiler 5. 這個(gè)編譯器將被識(shí)別為
armcc
. 只支持Linux和Windows褥实。
-
Keil MDK 或 Arm Compiler 5. 這個(gè)編譯器將被識(shí)別為
- 安裝
make
(用 GNU Make測(cè)試). CMake 也可以和不同的make
實(shí)現(xiàn)以及ninja一起使用呀狼。 - 在你的Python環(huán)境中安裝:
pip install virtualenv
.
第一步. 初始化配置.
獲取源代碼并創(chuàng)建一個(gè)虛擬環(huán)境
$ git clone https://github.com/mbedmicro/DAPLink
$ cd DAPLink
$ pip install virtualenv
$ virtualenv venv
激活虛擬環(huán)境
第二步. 激活虛擬環(huán)境并更新需求。這在你打開一個(gè)新的shell時(shí)是必要的损离。 你每次從git上獲取新的變化時(shí)都應(yīng)進(jìn)行
$ venv/Scripts/activate (For Linux)
$ venv/Scripts/activate.bat (For Windows)
(venv) $ pip install -r requirements.txt
構(gòu)建
你每次從git上獲取新的變化時(shí)都應(yīng)進(jìn)行
有兩種方法來構(gòu)建DAPLink哥艇。你可以使用project-generator中的progen
命令行工具或tools/progen_compile.py
包裝工具。
方法1. 使用 progen_compile.py
(venv) $ python tools/progen_compile.py [-t <tool>] [--clean] [-v] [--parallel] [<project> [<project> ...]]
-
-t <tool>
: 選擇要構(gòu)建的工具鏈僻澎。默認(rèn)是make_gcc_arm
. 其他測(cè)試過的選項(xiàng)是make_gcc_arm
,make_armclang
,make_armcc
,cmake_gcc_arm
,cmake_armclang
,cmake_armcc
. -
--clean
: 將清除現(xiàn)有的編譯產(chǎn)物并強(qiáng)制重新編譯所有文件貌踏。 -
-v
: 將使編譯過程更加冗長(zhǎng)(通常列出所有命令及其參數(shù)) -
--parallel
: 在一個(gè)項(xiàng)目中啟用并行編譯(項(xiàng)目是按順序編譯的)十饥。 -
<project>
: 要編譯的目標(biāo)項(xiàng)目 (例如stm32f103xb_bl
,lpc11u35_if
),如果沒有指定祖乳,所有(140到150)項(xiàng)目都將被編譯逗堵。
方法2. 使用progen進(jìn)行MDK編譯。
該命令在projectfiles/uvision
目錄下生成MDK項(xiàng)目文件眷昆。
$ progen generate -t uvision
要只生成一個(gè)特定的項(xiàng)目蜒秤,使用這樣的命令。
progen generate -f projects.yaml -p stm32f103xb_stm32f746zg_if -t uvision
progen
的參數(shù)選項(xiàng)亚斋。
-
-f
用于輸入項(xiàng)目文件 -
-p
表示項(xiàng)目名稱 -
-t
指定IDE的名稱
Contribute
We would love to have your changes! Pull requests should be made once a changeset is rebased onto main. See the contributing guide for detailed requirements and guidelines for contributions.
Port
There are three defined ways in which DAPLink can be extended. These are adding target support, adding board support and adding HIC support. Details on porting each of these can be found below.
Test
DAPLink has an extensive set of automated tests written in Python. They are used for regression testing, but you can use them to validate your DAPLink port. Details are here
An option to search for the daplink firmware build in uvision and mbedcli build folders. python test/run_test.py --project-tool make_gcc_arm ...
or python test/run_test.py --project-tool uvision ...
.
Release
Release using progen_compile.py
- Create a tag with the correct release version and push it to github
- Clean the repo you will be building from by running 'git clean -xdf' followed by 'git reset --hard'
- Run the
progen_compile.py
command with the following parameters (see above for the-t
flag):
(venv) $ python tools/progen_compile.py [-t <tool>] --clean -v --parallel --release
- All release deliverables will be created and stored in
firmware_<version>
(where<version>
is the DAPLink version). Save this wherever your builds are stored.
Release using uvision
DAPLink contains scripts to automate most of the steps of building a release. In addition to building the release, these scripts also save relevant build information such as git SHA and python tool versions so the same build can be reproduced. The recommended steps for creating a release are below.
- Create a tag with the correct release version and push it to github
- Clean the repo you will be building from by running 'git clean -xdf' followed by 'git reset --hard'
- Run the script
build_release_uvision.bat
to create all builds. - All release deliverables will be created and stored in 'uvision_release'. Save this wherever your builds are stored.
Note: A previous build can be reproduced by using the build_requirements.txt
of that build. To do this add the additional argument build_requirements.txt
when calling build_release_uvision.bat
in step 2. This will install and build with the exact version of the python packages used to create that build.
MDK
If you want to use the MDK (uVision) IDE to work with the DAPLink code, you must launch it in the right environment. The project will fail to build otherwise. To launch uVision properly, use tools/launch_uvision.bat
This script can take arguments to override default virtual environment and python packages to be installed. For example tools\launch_uvision.bat other_env other_requirements.txt