Daplink基于keil編譯環(huán)境的搭建

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 MDKArm Compiler 5. 這個(gè)編譯器將被識(shí)別為 armcc. 只支持Linux和Windows褥实。
  • 安裝 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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末作媚,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子帅刊,更是在濱河造成了極大的恐慌纸泡,老刑警劉巖,帶你破解...
    沈念sama閱讀 221,695評(píng)論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件赖瞒,死亡現(xiàn)場(chǎng)離奇詭異弟灼,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)冒黑,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,569評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門田绑,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人抡爹,你說我怎么就攤上這事掩驱。” “怎么了冬竟?”我有些...
    開封第一講書人閱讀 168,130評(píng)論 0 360
  • 文/不壞的土叔 我叫張陵欧穴,是天一觀的道長(zhǎng)。 經(jīng)常有香客問我泵殴,道長(zhǎng)涮帘,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 59,648評(píng)論 1 297
  • 正文 為了忘掉前任笑诅,我火速辦了婚禮调缨,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘吆你。我一直安慰自己弦叶,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,655評(píng)論 6 397
  • 文/花漫 我一把揭開白布妇多。 她就那樣靜靜地躺著伤哺,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上立莉,一...
    開封第一講書人閱讀 52,268評(píng)論 1 309
  • 那天绢彤,我揣著相機(jī)與錄音,去河邊找鬼蜓耻。 笑死茫舶,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的媒熊。 我是一名探鬼主播奇适,決...
    沈念sama閱讀 40,835評(píng)論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼芦鳍!你這毒婦竟也來了嚷往?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,740評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤柠衅,失蹤者是張志新(化名)和其女友劉穎皮仁,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體菲宴,經(jīng)...
    沈念sama閱讀 46,286評(píng)論 1 318
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡贷祈,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,375評(píng)論 3 340
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了喝峦。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片势誊。...
    茶點(diǎn)故事閱讀 40,505評(píng)論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖谣蠢,靈堂內(nèi)的尸體忽然破棺而出粟耻,到底是詐尸還是另有隱情,我是刑警寧澤眉踱,帶...
    沈念sama閱讀 36,185評(píng)論 5 350
  • 正文 年R本政府宣布挤忙,位于F島的核電站,受9級(jí)特大地震影響谈喳,放射性物質(zhì)發(fā)生泄漏册烈。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,873評(píng)論 3 333
  • 文/蒙蒙 一婿禽、第九天 我趴在偏房一處隱蔽的房頂上張望赏僧。 院中可真熱鬧,春花似錦谈宛、人聲如沸次哈。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,357評(píng)論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至琼牧,卻和暖如春恢筝,著一層夾襖步出監(jiān)牢的瞬間哀卫,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,466評(píng)論 1 272
  • 我被黑心中介騙來泰國(guó)打工撬槽, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留此改,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,921評(píng)論 3 376
  • 正文 我出身青樓侄柔,卻偏偏與公主長(zhǎng)得像共啃,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子暂题,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,515評(píng)論 2 359

推薦閱讀更多精彩內(nèi)容