1. Environmental introduction
Host environment: ubuntu18.04 64-bit
Target development board: Loongson II (2K1000)
Requirement description: In the process of using the development board, if you accidentally burn the wrong POPM and the development board cannot start normally, you can use EJTAG to complete the POPM programming at this time.
2. Download the ejtag driver
Download link: http://ftp.loongnix.org/embedd/ls1b/ejtag/
After downloading, unzip it to the designated Linux directory.
wbyq@wbyq:~/loongson$ tar xvf /mnt/hgfs/linux-share-dir/ejtag-debug-v3.25.19.tar.gz
wbyq@wbyq:~/loongson$ cd ejtag-debug/
wbyq@wbyq:~/loongson/ejtag-debug$ ls
bin ejtag.a ejtag_debug_pp include logic mipsel-gdb-6.8 scripts version.txt
configs ejtag.cfg ejtag_debug_usb local Makefile mycc terminfo WinIo.sys
doc ejtag_debug_gpio example.c log mipsel-gdb mycpp.pl tools workspace
Then connect the USB EJTAG to the USB port of the computer and mount it to the ubuntu system in the virtual machine.
The plug of EJTAG is 14P, which is not completely matched with the slot of the development board. When inserting into the slot of the development board, just align it with the small triangle on the development board slot .
Next, run the command to program.
wbyq@wbyq:~/loongson/ejtag-debug$ sudo ./ejtag_debug_usb -t
cpu0 -source configs/config.ls2k
cpu0 -program_cachelock
After running ejtag_debug_usb with administrator privileges on the command line, the command line will pop up. cpu0-
cpu0- source configs/config.ls2k This is to select the model of the development board.
cpu0- program_cachelock This is to execute the instruction to program the POPM . The default is to burn the /tmp/gzrom.bin file to the development board, so you need to copy the file in advance.
You can also put the absolute path of gzrom.bin after this program_cachelock command, for example: program_cachelock /home/tftpboot/gzrom.bin
After the above programming command is executed, you will see the indicator light on EJTAG flashing. After programming is completed (the phenomenon is that the prompt will be repeated), press the reset button on the development board to restart.