MT7688 Development Board_Widora-Neo_Starting from scratch process record

0. Environment

Notebook: win7 64bit notebook 4G memory i5-5200U. 100G hard drive.

Development board: widora-neo

1. Process

1.1 PC

Install vmware 10.0.1, select the installation path, the other one is default, enter the registration code after the installation is complete.
Install Ubuntu14 (32-bit) in the virtual machine. Configure 2 cores, 2 threads per core. Linux system (Ubuntu 14.04/16.04 32-bit/64-bit version is recommended).

1.2 Install dependencies in the virtual machine

$ sudo apt-get update 
$ sudo apt-get install git g++ make libncurses5-dev subversion libssl-dev gawk libxml-parser-perl unzip wget python xz-utils vim zlibc zlib1g zlib1g-dev openjdk-7-jdk build-essential ccache gettext xsltproc

 

1.3 Download the firmware source code

$ git clone https://github.com/widora/openwrt_widora.git
//或者
$ git clone https://dev.tencent.com/u/widora/p/openwrt_widora

Update source code

$ git pull

Update and install the package 

$ ./scripts/feeds update -a   
$ ./scripts/feeds install -a

Configure OpenWrt 

$ rm .config
$ make menuconfig

32MB+128MB配置(BIT3 BIT4,32MB FLASH):  

Target System: Ralink RT288x/RT3xxx
   Subtarget: MT7688 based boards
     Target Profile: WIDORA32128

Save and exit 

$ make -j4 V=s

After compiling, the firmware will be generated in the bin/ramips directory, about 6MB, the name is similar to the following
 

openwrt-ramips-mt7688-WIDORAxxxx-squashfs-sysupgrade.bin 

1.4 U-Boot compilation


Use git tool to download u-boot-mt7688 source code 

$ git clone https://github.com/widora/u-boot-mt7688.git

Unzip the compiler toolchain to the /opt/ directory 

$ cd u-boot-mt7688
$ sudo tar xvfj buildroot-gcc342.tar.bz2 -C /opt/


Enter u-boot-mt7688 source code, compile 

$ cd u-boot-mt7688
$ make clean
$ make -j4 V=s

After compiling, generate uboot.bin in this directory
 

$ls uboot.bin

1.5 Other information

Official firmware
https://www.widora.io/zh/firmware

1.6 Flash

https://www.widora.io/zh/flash

I got the development board already with factory firmware. I will not modify uboot. Instead, use the following method:


Based on the existing OpenWrt flashing
condition: The premise of this mode of operation is that there is already a normal OpenWrt firmware in the 7688 module. With the help of the existing firmware sysupgrade command only. Therefore, to use this update method, there are two steps: 
copy the new firmware to the file system of the module, preferably the /tmp memory directory.
Run the sysupgrade /tmp/newimage.bin command on the console of the board to update the firmware.
After running and restarting, run firstboot -y.
Transfer firmware to Widora Use
SCP to transfer firmware to Widora. 
Enter the board console to execute the update command

root@widora:/# cd /tmp  
root@widora:/# sysupgrade openwrt.bin

Perform a cleanup operation

root@widora:/# firstboot -y


After the operation is executed, restart to take effect

2. Cross compile helloworld.c

After the normal execution of 1.3 in the previous section is completed, the toolchain for the adapter board will be generated in openwrt_widora.

2.1 Set environment variables

Add toolchain to PATH to 
execute commands

sudo vi /etc/bash.bashrc    

 

And add the following two lines of configuration at the end of the file 

export STAGING_DIR=/path/to/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin 
export PATH=$STAGING_DIR/:$PATH


Note that the above /path/to/openwrt is the path of openwrt_widora.

Execute the following command to make the configuration take effect.

source /etc/bash.bashrc 

2.2 Testing

Execute mipsel-openwrt-linux-uclibc-gcc -v If the version information can be output normally, the installation is successful 

 

2.3 Application compilation

hello_world write a 
new file in ubuntu

gedit ~/helloworld.c


Enter the following:

#include "stdio.h"
int main(int argc, char *argv)
{
    printf("hello world!\r\n");
    return 0;
}


carried out:

$ mipsel-openwrt-linux-uclibc-gcc -o helloworld.out helloworld.c
$ file helloworld.out

The file command can see that the generated out file format is MIPS.

 

2.4 Copy to Widora

Connect the computer to Widora-neo's WIFI, and then enter ipconfig in CMD to view the IP address of the wireless network card and the router address. The router address is the development board address.
Using winscp, SCP protocol, enter the address of widora-neo, the port number is 22. The default account root, password 12345678.

Use the mouse to click the file and drag it to the widora file system.

2.5 Executing the program in the development board

$ chmod +x helloworld.out 
$ ./helloworld.out

Effect picture:

 

Unexpected question 1: line 1: syntax error: word unexpected (expecting ")")

This happens because gcc uses the wrong parameter -c when compiling the file. As a result, only the library is generated, not the executable file. If it is to generate an executable file, -c is not required.

 

 

Reference materials:

1. Set up the compilation environment,  https://www.widora.io/zh/compile
2. [Solved] The executable program cannot run on Linux, and it displays line 1: syntax error: word unexpected (expecting “),  https: //www.crifan.com/resolved_executable_program_can_not_run_on_linux_display_line_1_syntax_error_word_unexpected_expecting_quot/

3. Openwrt MT7688 development board from scratch tutorial,  https://blog.csdn.net/u014624241/article/details/78844331
4. Compile c running on openwrt under mips-openwrt-linux-gcc under Ubuntu,  http:// blog.chinaunix.net/uid-28790518-id-5113217.html

 

 

Guess you like

Origin blog.csdn.net/qq_27158179/article/details/103136476