# Source Code of Arduino Package

###

## Overview <a href="#sourcecodeofarduinopackage-overviewgithubpagehttps-github.com-mediatek-labs-arduino-add-on-for-linki" id="sourcecodeofarduinopackage-overviewgithubpagehttps-github.com-mediatek-labs-arduino-add-on-for-linki"></a>

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

The board supporting package of LinkIt 7697 are built from 2 software packages and they are:

* Public version of the [LinkIt SDK v4](https://docs.labs.mediatek.com/resource/mt7687-mt7697/en/downloads).
* An [add-on package](https://github.com/MediaTek-Labs/Arduino-Add-On-for-LinkIt-SDK) that provides an adaptation layer between the native LinkIt SDK and Arduino APIs. This add-on package was developed by [ArcherMind Technology](https://www.archermind.com/en/) for LinkIt 7687 and then ported to LinkIt 7697.

The LinkIt SDK source code is built into a library, **libarduino.a.** This library file, along with other library files provided by the LinkIt SDK, is packed with the source code of the Arduino adaptation layer into the final Arduino board supporting package.

## Requirements <a href="#sourcecodeofarduinopackage-requirements" id="sourcecodeofarduinopackage-requirements"></a>

To build the package, you'll need the following:

* Ubuntu Linux&#x20;
* `make` utility - installed
* **Perl** - installed

### How to Build the Arduino Board Support Package <a href="#sourcecodeofarduinopackage-howtobuildthearduinoboardsupportpackage" id="sourcecodeofarduinopackage-howtobuildthearduinoboardsupportpackage"></a>

1. Visit the [source code repository](https://github.com/MediaTek-Labs/Arduino-Add-On-for-LinkIt-SDK) of the add-on package.

2. Download the[ LinkIt SDK v4](https://docs.labs.mediatek.com/resource/mt7687-mt7697/en/downloads) according to the instructions in the add-on package. The version number **must** exactly match because the add-on package may modify or replace some of the LinkIt SDK files.

3. Extract the downloaded LinkIt SDK v4 package to your directory of choice.

4. Clone the add-on package and **merge** it with the SDK directory. The resulting directory structure should look like the following:<br>

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

5. Create a `out` directory using the following command:<br>

   ```
   mkdir out
   ```

6. Build the board support package using the following command: <br>

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

```
You should change the version number 1.1.1.
```

The board support package can be found under the `out` folder, with a **flash\_tool** directory containing the upload tool, and a **mt7697** folder containing the essential board supporting code and libraries.

If you want to install this package to your Arduino IDE, you can replace them into your 3rd party package folder. To learn how to do this, read the documentation [here](https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification).

## The Upload Tool <a href="#sourcecodeofarduinopackage-theuploadtool" id="sourcecodeofarduinopackage-theuploadtool"></a>

The upload tool uploads the compiled sketch and it's written in Python. You can find the tool source code in <https://github.com/MediaTek-Labs/mt76x7-uploader>.
