OTA upgrade porting guide*
The OTA upgrade of GX8008 supports two connection methods: UART
and USB
.
GX8008 supports blank chip upgrade, that is to say, if GX8008 itself has not burned any firmware, it can also be upgraded through OTA. Therefore, this upgrade is safe and reliable. If the device is bricked due to a power outage or abnormality during the upgrade process, it can still be re-powered on and reset to restart OTA.
In the read-only ROM inside the GX8008 chip, our upgrade code has been solidified, so it can support blank chip upgrade. The upgrade process has nothing to do with the internal firmware running on the GX8008 itself.
1. Linux platform porting*
1.1 Overview*
If the platform used by the customer is linux, then our official burning program bootx can be transplanted directly. Use bootx as an independent application on linux to perform firmware upgrade operations.
The bootx tool supports USB upgrade and UART upgrade.
1.2 Code download*
bootx_v1.8.3.zip (http://yun.nationalchip.com:10000/l/U110RM)
1.3 Compile*
-
Unzip bootx_v1.8.3.zip
-
Modify the makefile to specify the toolchain corresponding to your platform
makefile 1 2 3 4 5 6 7 8 9 10 11 12 13 14
LINUX_TOOL_HEAD= ARMLINUX_TOOL_HEAD=arm-linux-gnueabihf- // This place is replaced by the tool chain of its own platform ifeq ($(TARGET_MACHINE_32BIT_OR_64BIT), 32) WIN_CPP=i586-mingw32msvc-g++ LINUX_CPP=g++ -m32 LINUX_CC=gcc -m32 else ifeq ($(TARGET_MACHINE_32BIT_OR_64BIT), 64) WIN_CPP=x86_64-w64-mingw32-g++ LINUX_CPP=g++ LINUX_CC=gcc endif ARMLINUX_CPP=arm-linux-gnueabi-g++ // This place is replaced by the tool chain of its own platform ARMLINUXANDROID_CPP=arm-linux-androideabi-g++
If it is a Linux platform, compile as follows:
make clean make
-
If it is an arm platform, you can try the following steps. Install the arm toolchain on PC linux, then compile:
sudo apt install g++-arm-linux-gnueabi sudo apt-get install gcc-arm-linux-gnueabi sudo apt-get install automake autoconf m4 perl make clean make libusb-armlinux make arm-linux
-
We also provide bootx compiled on the ARM platform. The download address is as follows:
- arm_bootx_v1.8.0 (http://yun.nationalchip.com:10000/l/dFgYgk)
1.4 Testing*
-
For serial port upgrade, after starting the following command, power on and off or reset the development board to start the upgrade. Download vsp.bin to address 0x0 of flash.
// GX8008C upgrade (/dev/ttyUSB0 is modified according to your actual serial device) sudo ./bootx -m leo_mini -t s -d /dev/ttyUSB0 -c serialdown 0x0 vsp.bin
// GX8008 upgrade (/dev/ttyUSB0 is modified according to your actual serial device) sudo ./bootx -m leo -t s -d /dev/ttyUSB0 -c serialdown 0x0 vsp.bin
-
For USB upgrade, you need to execute the following command first, then keep the boot pin low, and then power on and off or reset the development board (the boot pin should continue to be low at this time), and then the upgrade can start. After the upgrade is successful, if you turn it on again, you don’t need to continue to lower the boot pin, otherwise it will continue to enter the upgrade mode and cause it to fail to boot normally. Pull down the boot state and power on. On Linux, the device will be recognized as: NationalChip Storage. The device PID/VID is: a7000:0001, you can use the lsusb command to view it.
// GX8008C upgrade sudo ./bootx -m leo_mini -t u -c download 0x0 vsp.bin
// GX8008 upgrade sudo ./bootx -m leo -t u -c download 0x0 vap.bin
NOTE FORMAT:
Attention
GX8008 and GX8008C upgrade command formats are different after -m. For USB upgrade, you need to keep the boot low, and then power on to enter the upgrade mode. If you boot normally, you don’t need this operation.
2. Android platform porting*
2.1 Overview*
For the Android platform, we provide an Android development kit to meet customers' transplanting needs.
Support UART and USB two upgrade methods.
2.2 Code download*
usb_demo_ver2.1.0_delivery version.zip (http://yun.nationalchip.com:10000/l/7F2fCU)
Three binary files are provided in the compressed package res/raw/
directory:
-
leo.boot
supports GX8008 upgrade boot -
leo_mini.boot
supports GX8008C upgrade boot -
test.img
is the firmware that needs to be upgraded, you can replace the firmware you will eventually need, such as vsp.bin
2.3 API introduction*
2.3.1 How to use*
-
Enter upgrade mode:
int EnterUpgradeMode() Description: Use it to enter the upgrade mode in the working mode, return 0 means success
-
send boot file
int SendBootFile(InputStream boot_file) Only available in the upgrade mode, send the boot file to the board to run, and complete the preparatory work before executing the command, wait for the command to be executed, and return 0 to indicate success. The meaning of the parameters is as follows: boot_file: Input stream for Boot file
-
send command
int ExecCmd(String cmd, byte[] bstream) Execute the cmd command, return 0 means success. The meaning of the parameters is as follows: cmd: the command to execute bstream: used as an input/output channel
-
download
int Down(int addr, int len, InputStream datain) Execute the usbslavedown command to download data to the device, and the return value equal to len means success. The meaning of the parameters is as follows: addr: start address in Flash when writing data len: length of write data datain: the input stream to be written to the file
-
export
int Dump(int addr, int len, OutputStream dataout) Execute the usbslavedump command to read data from the device, and the return value equal to len means success. The meaning of the parameters is as follows: addr: start address in Flash when reading data len: the length of the read data datain: the output stream that reads the data
2.3.2 Upgrade process*
-
Enter the upgrade mode. The methods to enter the upgrade mode include:
- Under normal working conditions, the upgrade mode can be entered by calling EnterUpgradeMode. This method needs to interact with the running program, and the running program is required to support entering the upgrade mode through an external trigger
- If there is a power failure during the programming process or other situations that cause the board to become bricked, press the boot button to enter the upgrade mode
-
Execute SendBootFile to send the boot file and run it, complete the preparatory work before executing the command, and start waiting for the command to be executed
-
Execute cmd through ExecCmd (Down, Dump), currently supports cmd
-
download
-
Command format: usbslavedown
-
Example of use:
Example one:
ExecCmd("usbslavedown 0x200000 0x600000", data)
Example two:
Down (0x200000, 0x600000, datain)
-
Example meaning: Read data with a length of 0x600000 from data/datain and write it to the space starting at 0x200000 in flash, the type of datain is InputStream, and the type of data is byte[]
-
export
-
Command format: usbslavedump
-
Example of use:
ExecCmd("usbslavedump 0x200000 0x200",data)
Dump(0x200000, 0x200, dataout)
-
Example meaning: Read data with a length of 0x200 from the space whose starting address is 0x200000 in flash to data/dataout, the type of dataout is OutputStream, and the type of data is byte[]
-
Flash erase
-
Command format: flash erase
or flash eraseall -
Example of use:
ExecCmd("flash erase 0x200000 0x200",null)
ExecCmd("flash eraseall",null)
-
Example meaning: Clear the space starting from address 0x200000 in the flash with a length of 0x200, or clear all spaces
-
reboot
-
Command format: reboot
-
Example of use:
ExecCmd("reboot", null)
-
Example meaning: notify the board to restart
-
3. Porting to other platforms*
3.1 Overview*
For other platforms, you can refer to upgrading OTA to 8008 or 8008C through UART streaming
3.2 Code download*
git clone git@gitlab.com:nationalchip/mcu_ota.git
3.3 Compile*
Output commands under the Linux system to compile and generate an executable file sample.elf
make clean
make

3.4 Testing*
sudo ./sample.elf
After using this command, power on/off or reset the development board again to start the upgrade. When firmware download finish
appears, the upgrade is complete.
Attention
The firmware used for upgrading GX8008 and GX8008C serial ports is mcu_nor.bin and dsp.fw, you need to use the xxd - i command to convert the two files into mcu_nor.h and dsp.h. Please read the code examples for more details.
The default baud rate for serial port upgrade is currently 1.5M. If you need to make any changes, please modify the following code.
#define BOOT_STAGE2_BAUD_GRUS 1500000
4. History*
- Considering that some projects only require serial port upgrade functionality, in order to avoid the need to add many dependent libraries for compiling with USB function upgrade, we have trimmed and removed the USB related code, specifically providing bootx_v1.6.11_uart_compatible.zip to support serial port upgrades. bootx_v2.zip is specifically designed for USB upgrades.
USB upgrade code:
bootx_v2.zip (http://yun.nationalchip.com:10000/l/ZFDsH0)
UART upgrade code:
bootx_v1.6.11_uart_compatible.zip (http://yun.nationalchip.com:10000/l/AFgJxE)
- We also provide two copies of bootx compiled on the ARM platform, you can download and try it directly, the download address is as follows:
bootx_arm.zip (http://yun.nationalchip.com:10000/l/3FjR5n)
bootx_arm_2.zip (http://yun.nationalchip.com:10000/l/fFU34z)
bootx_arm_v1.6.11_uart (http://yun.nationalchip.com:10000/l/RFkDwC)