> For the complete documentation index, see [llms.txt](https://cavedu.gitbook.io/linkit-7697/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cavedu.gitbook.io/linkit-7697/linkit-7697-arduinoide/kai-fa-zhi-nan/zi-xing-bian-yi-arduino-package.md).

# 自行編譯 Arduino Package

## 簡介  <a href="#sourcecodeofarduinopackage-jian-jie-linkit7697bspgithub-ye-mian-httpsgithub.commediateklabsarduinoad" id="sourcecodeofarduinopackage-jian-jie-linkit7697bspgithub-ye-mian-httpsgithub.commediateklabsarduinoad"></a>

[LinkIt 7697 BSP GitHub頁面](https://github.com/MediaTek-Labs/Arduino-Add-On-for-LinkIt-SDK)

LinkIt 7697 的 Arduino board supporting package (BSP) 由下列兩部分所組成：

* 公開下載版的 [LinkIt SDK v4](https://docs.labs.mediatek.com/resource/mt7687-mt7697/en/downloads)。
* 作為原生 LinkIt SDK 與 Arduino API 之間中介層的 [add-on package](https://github.com/MediaTek-Labs/Arduino-Add-On-for-LinkIt-SDK)。此中介層是以 [ArcherMind Technology](https://www.archermind.com/en/) 在 LinkIt 7687 上的相關開發為基礎，由 MediaTek Labs 擴充移植至 LinkIt 7697 開發平台。

### 編譯需求 <a href="#sourcecodeofarduinopackage-bian-yi-xu-qiu" id="sourcecodeofarduinopackage-bian-yi-xu-qiu"></a>

* Ubuntu Linux&#x20;
* `make`
* **Perl**

### 如何編譯 Arduino BSP <a href="#sourcecodeofarduinopackage-ru-he-bian-yi-arduinobsp" id="sourcecodeofarduinopackage-ru-he-bian-yi-arduinobsp"></a>

1. 至 add-on package 的 [repository](https://github.com/MediaTek-Labs/Arduino-Add-On-for-LinkIt-SDK) 取得原始碼以及相關資訊。

2. 依照 add-on package 說明下載[ LinkIt SDK v4](https://docs.labs.mediatek.com/resource/mt7687-mt7697/en/downloads)。**注意**：由於 add-on package 會修改和取代 SDK 內部的檔案，因此 SDK 的版本號碼必須與 add-on package 所要求的版本**完全一致**。

3. 將下載下來的 LinkIt SDK v4 檔案解壓縮。

4. 將 add-on package 的檔案拷貝並覆蓋至上一步驟解出來的 LinkIt SDK 目錄。最終的目錄結構如下：<br>

   ```
   .
   ├── build.sh
   ├── config
   ├── driver
   ├── kernel
   ├── middleware
   ├── mk_ide_pkg.pl
   ├── project
   ├── README.md
   ├── readme.txt
   └── tools
   ```

5. 使用下列指令新增一個名為 `out` 的目錄：<br>

   ```
   mkdir out
   ```

6. 使用下列指令進行 BSP 編譯： <br>

   ```
   ./mk_ide_pkg.pl -o out -v 1.1.1
   ```

   ```
   這裡的 1.1.1 指的是產生出來的 BSP 版本號碼 (不是 LinkIt SDk 版本)，開發者可自行指定不同的 BSP 版本號以做為區別。
   ```

編譯完成後，BSP 檔案會被放至 `out` 目錄，並同時產生 **flash\_tool** 以及 **mt7697** 這兩個目錄，用來存放燒錄工具及開發板所需的相關程式碼和函式庫。

若要進一步把 BSP 安裝進 Arduino IDE 裡，需將 BSP 檔案放至 3rd-party package 目錄。詳細步驟說明請參考[官方文件](https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification)。

## 燒錄工具 <a href="#sourcecodeofarduinopackage-shao-lu-gong-ju" id="sourcecodeofarduinopackage-shao-lu-gong-ju"></a>

LinkIt 7697 使用透過 Python 撰寫、可跨平台運作的燒錄程式，將使用者開發好的 sketch 檔案傳至開發板執行。相關程式碼及運作原理請參考 <https://github.com/MediaTek-Labs/mt76x7-uploader>。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cavedu.gitbook.io/linkit-7697/linkit-7697-arduinoide/kai-fa-zhi-nan/zi-xing-bian-yi-arduino-package.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
