Flash Uploading Tool

This Python-based tool provides the functionality to flash the bootloader and the firmware of the LinkIt 7697 platform (based on the MT7697 SoC), including firmwares for both CM4 and the N9 processors. The official GitHub repository is: https://github.com/MediaTek-Labs/mt76x7-uploader

  • Supports Windows, macOS, and Linux (based on Python 2.7)

  • Flashes bootloader, CM4 (application binary), and N9 firmware sections.

Command Options

-c COM_PORT      COM port, can be COM1, COM2, ..., COMx 
-f BIN_FILE      path of the bin file to be uploaded 
-n DA_FILE       path of the DA file to be used. The default file is da97.bin for mt7697 and da87.bin for mt7687 
-p PLATFORM_NAME platform to be flashed (mt7687 | mt7697). The default platform is mt7697 
-t FLASH_TARGET  target to be flashed (cm4 | ldr | n9). The default target is cm4

Examples

Windows

Upload firmware sample.bin to COM port 24:

upload.exe -c COM24 -f sample.bin

Linux and macOS

Upload firmware sample.bin to the serial device /dev/cu.SLAB_USBtoUART:

python ./upload.py -c /dev/cu.SLAB_USBtoUART -f sample.bin

You can also assign customized download agent, specific SoC platform, and different flash uploading partition by using different parameters (-n / -p / -t).

Flash a build from LinkIt SDK

If you build your project using LinkIt SDK 4.x, the output folder should look like this:

.
├── flash_download.ini
├── your_application.bin
├── mt7697_bootloader.bin
└── WIFI_RAM_CODE_MT76X7_in_flash.bin

You can flash the bootloader (mt7697_bootloader.bin), N9 firmmware (WIFI_RAM_CODE_MT76X7_in_flash.bin) and application binary by copying these files to the uploader tool folder and type the following command:

python upload.py -c /dev/cu.SLAB_USBtoUART -t ldr -f mt7697_bootloader.bin
python upload.py -c /dev/cu.SLAB_USBtoUART -t n9 -f WIFI_RAM_CODE_MT76X7_in_flash.bin
python upload.py -c /dev/cu.SLAB_USBtoUART -t cm4 -f your_application.bin

Flash Access Mode on MT7697

MT7697 have 2 bootstrap modes, a normal mode and a Flash Recovery Mode. The mode is determined by the state of GPIO37 during bootup. The table below is excerpted from MT7697 datasheet:

GPIO37 maps to P6 on LinkIt 7697 HDK, as shown in the pinout diagram:

Switching Flash Mode on LinkIt 7697

On LinkIt 7697, to improve the usability, the GPIO37 state is controlled by the onboard CP2102N USB-to-UART chipset. The GPIO37 pin is connected to the flow contorl pins of CP2102N. This allows the flash uploading tool to reset the board and put the board into Flash Recovery Mode without user intervention.

The truth table of the control logic is:

DTR
RTS
GPIO37
SYS_RST_N

0

0

0

1

1

1

0

1

0

1

0

0

1

0

1

1

As a result, if you use a terminal program to access the serial port of LinkIt 7697, be aware of the flow control settings in the terminal program. For example, the Flow control field in PuTTY (set it to None):

Or the DTR/RTS settings in the Lines tab of eagleCom:

Flash Layout

The flash layout of LinkIt 7697 is shown in the image below.

There are 3 regions that can be uploaded:

  • Bootloader

  • N9 firmware (Wi-Fi and Bluetooth subsystem)

  • CM4 firmwear (the application binary - this is the most commonly updated part during your development)

The following regions are reserved for LinkIt SDK modules:

  • FOTA: reserved for firmware update over-the-air

  • NVDM: reserved for a non-volatile data manager that stores persistent data

Uploading Flow

Initially state of RAM and Flash looks like this:

The Python script resets the board and put it into Flash Recovery mode. Under this mode the MT7697 chipset BootROM (BROM) accepts data from UART0 to write a small program to the RAM. We call this small program the Download Agent (DA) program.

This DA program then takes over the CM4 processor to receive data from the Python script through XModem protocol:

Finally, the script resets the board again and reboot it into normal execution mode. This completes the flash uploading process.

Last updated