Hi all,
I tried to flash QCA4020 with J-Link, but every time stuck at same place
Command line Log
D:\projects\qca4020-or-3-1_qca_oem_sdk-cdb.git\target\quartz\demo\QCLI_demo\build\gcc>flash.batCould Not Find D:\projects\qca4020-or-3-1_qca_oem_sdk-cdb.git\target\quartz\demo\QCLI_demo\build\gcc\output\firmware_table.binCould Not Find D:\projects\qca4020-or-3-1_qca_oem_sdk-cdb.git\target\quartz\demo\QCLI_demo\build\gcc\output\generated_partition_table.xmlCould Not Find D:\projects\qca4020-or-3-1_qca_oem_sdk-cdb.git\target\quartz\demo\QCLI_demo\build\gcc\output\generated_fwd_table.xml[2020-02-03 09:28:01,513] INFO: Checking for files to add to the image for Firmware Descriptor Table 0 File:gen_fwd_table.py:673 Function:gen_xml_program[2020-02-03 09:28:01,513] INFO: Done Generating XML file to program. File:gen_fwd_table.py:711 Function:gen_xml_programStarting GDB Server....GNU gdb (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 7.12.1.20170417-gitCopyright (C) 2017 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law. Type "show copying"and "show warranty" for details.This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".Type "show configuration" for configuration details.For bug reporting instructions, please see:Find the GDB manual and other documentation resources online at:For help, type "help".Type "apropos word" to search for commands related to "word".warning: No executable has been specified and target does not supportdetermining executable automatically. Try using the "file" command.0x000154e2 in ?? ()Loading section RAM_FOM_APPS_RO_REGION, size 0x5b4c lma 0x10046000Loading section RAM_FOM_APPS_RW_REGION, size 0x5d4 lma 0x10080000Start address 0x100462c2, load size 24864Transfer rate: 54 KB/sec, 8288 bytes/write.Breakpoint 1 at 0x1004614c: file /local/mnt/workspace/CRMBuilds/CNSS_W.QZ.3.1.r2-00004-QZHW-2_20190923_201556/b/ioesw_proc/core/storage/tools/jtagprogrammer/src//JtagProgrammer.c, line 125.
JlinkGDBServerCL Log
SEGGER J-Link GDB Server V6.62 Command Line VersionJLinkARM.dll V6.62 (DLL compiled Jan 24 2020 16:32:09)Command line: -select USB -device Cortex-M4 -endian little -if JTAG -speed 1000 -noir -nolocalhostonly -port 2331-----GDB Server start settings-----GDBInit file: noneGDB Server Listening port: 2331SWO raw output listening port: 2332Terminal I/O port: 2333Accept remote connection: yesGenerate logfile: offVerify download: offInit regs on start: offSilent mode: offSingle run mode: offTarget connection timeout: 0 ms------J-Link related settings------J-Link Host interface: USBJ-Link script: noneJ-Link settings file: none------Target related settings------Target device: Cortex-M4Target interface: JTAGTarget interface speed: 1000kHzTarget endian: littleConnecting to J-Link...J-Link is connected.Firmware: J-Link ARM / Flasher ARM V4 compiled Jan 6 2020 11:24:13Hardware: V4.02S/N: 164211093Feature(s): JFlash, GDBChecking target voltage...Target voltage: 3.32 VListening on TCP/IP port 2331Connecting to target...J-Link found 2 JTAG devices, Total IRLen = 15JTAG ID: 0x4BA00477 (Cortex-M4)Connected to targetWaiting for GDB connection...Connected to 127.0.0.1Reading all registersRead 4 bytes @ address 0x000154E2 (Data = 0x03092000)Read 2 bytes @ address 0x000154E2 (Data = 0x2000)Downloading 16224 bytes @ address 0x10046000Downloading 7148 bytes @ address 0x10049F60Downloading 1492 bytes @ address 0x10080000Writing register (PC = 0x100462c2)Read 4 bytes @ address 0x100462C2 (Data = 0x6800489A)Read 2 bytes @ address 0x100462C2 (Data = 0x489A)Reading all registersRead 4 bytes @ address 0x100462C2 (Data = 0x6800489A)Reading all registersRead 4 bytes @ address 0x100462C2 (Data = 0x6800489A)Writing register (SP = 0x100815d4)Reading all registersRead 4 bytes @ address 0x100462C2 (Data = 0x6800489A)Downloading 4 bytes @ address 0xE000ED94Reading all registersRead 4 bytes @ address 0x100462C2 (Data = 0x6800489A)Downloading 4 bytes @ address 0x44000008Reading all registersRead 4 bytes @ address 0x100462C2 (Data = 0x6800489A)Read 2 bytes @ address 0x1004614C (Data = 0xF04F)Read 2 bytes @ address 0x10046146 (Data = 0xE92D)Read 2 bytes @ address 0x10046148 (Data = 0x41F0)Read 2 bytes @ address 0x1004614A (Data = 0x4E93)Read 4 bytes @ address 0x1004639A (Data = 0x65D31008)Read 2 bytes @ address 0x1004614C (Data = 0xF04F)Read 2 bytes @ address 0x10046146 (Data = 0xE92D)Read 2 bytes @ address 0x10046148 (Data = 0x41F0)Read 2 bytes @ address 0x1004614A (Data = 0x4E93)Read 4 bytes @ address 0x1004639A (Data = 0x65D31008)Read 2 bytes @ address 0x1004614C (Data = 0xF04F)Setting breakpoint @ address 0x1004614C, Size = 2, BPHandle = 0x0001Starting target CPU...
All related software version as folloing
JLink: V6.62Python: 2.7.17QCA4020 SDK: qca4020-or-3-1_qca_oem_sdk-cdbFlash the QCA4020 by OpenOCD is OK, just can not succeed by using JLink, My Jlink connection is following this link https://developer.qualcomm.com/forum/qdn-forums/hardware/qca4020-qca4024...
From JLink log, we can see
J-Link found 2 JTAG devices, Total IRLen = 15
That means Jlink connection is ok, right?
But every time, Jlink side just hang at "Starting target CPU...", no more command can send to JLink
In folder ./gdbout, there one file gdb.commands.txt created with following commands:
target remote localhost:2331load ../../../../../build/tools/flash/JTAGPROGRAMMER_IMG_ARNTRI.elffile ../../../../../build/tools/flash/JTAGPROGRAMMER_IMG_ARNTRI.elfset $pc = jstorage_initset $sp = &jstorage_stack[sizeof(jstorage_stack)]set {int}0xE000ED94 = 0set {int}0x44000008 = 0break main_ccontinueecho "WRITE ./firmware_table.bin, offset=0 start_sector=0 num_sectors=1"set device_type = MEM_DEVICE_SPINORset jtag_prog_param.cmd_status = 10set jtag_prog_param.addr = 0set jtag_prog_param.data_length = 1restore ./firmware_table.bin binary jtag_prog_param.data-0 0 4096continueappend binary memory gdbout/jtagprogrammer.log output_buffer &output_buffer[output_buffer_length+1]set output_buffer_length = 0dump binary value gdbout/command_result.log jtag_prog_param.cmd_status
I tried to one by one to execute these commands, but after command "break main_c", if I execute "continue", Jlink will hang with "Starting target CPU..."
D:\projects\qca4020-or-3-1_qca_oem_sdk-cdb.git\target\quartz\demo\QCLI_demo\build\gcc>arm-none-eabi-gdb.exeGNU gdb (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 7.12.1.20170417-gitCopyright (C) 2017 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law. Type "show copying"and "show warranty" for details.This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".Type "show configuration" for configuration details.For bug reporting instructions, please see:Find the GDB manual and other documentation resources online at:For help, type "help".Type "apropos word" to search for commands related to "word".(gdb) target remote localhost:2331Remote debugging using localhost:2331warning: No executable has been specified and target does not supportdetermining executable automatically. Try using the "file" command.0x000154f0 in ?? ()(gdb) load ../../../../../build/tools/flash/JTAGPROGRAMMER_IMG_ARNTRI.elfLoading section RAM_FOM_APPS_RO_REGION, size 0x5b4c lma 0x10046000Loading section RAM_FOM_APPS_RW_REGION, size 0x5d4 lma 0x10080000Start address 0x100462c2, load size 24864Transfer rate: 240 KB/sec, 8288 bytes/write.(gdb) file ../../../../../build/tools/flash/JTAGPROGRAMMER_IMG_ARNTRI.elfA program is being debugged already.Are you sure you want to change the file? (y or n) yReading symbols from ../../../../../build/tools/flash/JTAGPROGRAMMER_IMG_ARNTRI.elf...done.(gdb) set $pc = jstorage_init(gdb) set $sp = &jstorage_stack[sizeof(jstorage_stack)](gdb) set {int}0xE000ED94 = 0(gdb) set {int}0x44000008 = 0(gdb) break main_cBreakpoint 1 at 0x1004614c: file /local/mnt/workspace/CRMBuilds/CNSS_W.QZ.3.1.r2-00004-QZHW-2_20190923_201556/b/ioesw_proc/core/storage/tools/jtagprogrammer/src//JtagProgrammer.c, line 125.(gdb) continueContinuing.
Connected to 127.0.0.1Reading all registersRead 4 bytes @ address 0x000154F0 (Data = 0x0F01F011)Read 2 bytes @ address 0x000154F0 (Data = 0xF011)Downloading 16224 bytes @ address 0x10046000Downloading 7148 bytes @ address 0x10049F60Downloading 1492 bytes @ address 0x10080000Writing register (PC = 0x100462c2)Read 4 bytes @ address 0x100462C2 (Data = 0x6801489A)Read 2 bytes @ address 0x100462C2 (Data = 0x489A)Reading all registersRead 4 bytes @ address 0x100462C2 (Data = 0x6801489A)Reading all registersRead 4 bytes @ address 0x100462C2 (Data = 0x6801489A)Writing register (SP = 0x100815d4)Reading all registersRead 4 bytes @ address 0x100462C2 (Data = 0x6801489A)Downloading 4 bytes @ address 0xE000ED94Reading all registersRead 4 bytes @ address 0x100462C2 (Data = 0x6801489A)Downloading 4 bytes @ address 0x44000008Reading all registersRead 4 bytes @ address 0x100462C2 (Data = 0x6801489A)Read 2 bytes @ address 0x1004614C (Data = 0xF04F)Read 2 bytes @ address 0x10046146 (Data = 0xE92D)Read 2 bytes @ address 0x10046148 (Data = 0x41F0)Read 2 bytes @ address 0x1004614A (Data = 0x4E93)Read 4 bytes @ address 0x1004639A (Data = 0x65D31008)Read 2 bytes @ address 0x1004614C (Data = 0xF04F)Read 2 bytes @ address 0x10046146 (Data = 0xE92D)Read 2 bytes @ address 0x10046148 (Data = 0x41F0)Read 2 bytes @ address 0x1004614A (Data = 0x4E93)Read 4 bytes @ address 0x1004639A (Data = 0x65D31008)Read 2 bytes @ address 0x1004614C (Data = 0xF04F)Setting breakpoint @ address 0x1004614C, Size = 2, BPHandle = 0x0002Starting target CPU...
I found the problem, it is issue of JLink hardware, replace with other JLink hardware, no problem found