GDB server for KM4

Hi All,
After successful build of app from SDK if uploaded firmware for KM0. But I can’t do it for KM4 via JLINK9.

GDB server starts for KM0. See log below;

sudo /opt/SEGGER/JLink/JLinkGDBServer -select USB -device cortex-m23 -if SWD -scriptfile "AP1_KM0.JLinkScript" -port 2331 -SWOPort 2332 -TelnetPort 2333
SEGGER J-Link GDB Server V7.82d Command Line Version

JLinkARM.dll V7.82d (DLL compiled Nov 23 2022 16:09:15)

Command line: -select USB -device cortex-m23 -if SWD -scriptfile AP1_KM0.JLinkScript -port 2331 -SWOPort 2332 -TelnetPort 2333
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      yes
Generate logfile:              off
Verify download:               off
Init regs on start:            off
Silent mode:                   off
Single run mode:               off
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 AP1_KM0.JLinkScript
J-Link settings file:          none
------Target related settings------
Target device:                 cortex-m23
Target device parameters:      none
Target interface:              SWD
Target interface speed:        4000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V9 compiled May  7 2021 16:26:12
Hardware: V9.60
S/N: <skip>
Feature(s): RDI, GDB, FlashDL, FlashBP, JFlash
Checking target voltage...
Target voltage: 3.33 V
Listening on TCP/IP port 2331
Connecting to target...
Connected to target
Waiting for GDB connection...

But for KM4 It doesn’t want to connect.

sudo /opt/SEGGER/JLink/JLinkGDBServer -select USB -device cortex-m33 -if SWD -scriptfile "AP2_KM4.JLinkScript" -port 2335 -SWOPort 2332 -TelnetPort 2333
[sudo] password for user: 
SEGGER J-Link GDB Server V7.82d Command Line Version

JLinkARM.dll V7.82d (DLL compiled Nov 23 2022 16:09:15)

Command line: -select USB -device cortex-m33 -if SWD -scriptfile AP2_KM4.JLinkScript -port 2335 -SWOPort 2332 -TelnetPort 2333
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2335
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      yes
Generate logfile:              off
Verify download:               off
Init regs on start:            off
Silent mode:                   off
Single run mode:               off
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 AP2_KM4.JLinkScript
J-Link settings file:          none
------Target related settings------
Target device:                 cortex-m33
Target device parameters:      none
Target interface:              SWD
Target interface speed:        4000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V9 compiled May  7 2021 16:26:12
Hardware: V9.60
S/N: <skip>
Feature(s): RDI, GDB, FlashDL, FlashBP, JFlash
Checking target voltage...
Target voltage: 3.33 V
Listening on TCP/IP port 2335
Connecting to target...
ERROR: Could not connect to target.
Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...
Shutting down...
Could not connect to target.
Please check power, connection and settings

What is missed?
Can chip be broken?
It was used only powered by JLink. No connections except 3.3v. gnd. SWD_CLK, SWD_DATA.

Hi @Tuxford

The reason you cannot start GDB server for KM4 should be this:
The boot process for RTL872xD chip is KM0 boot -> KM4 boot -> KM0 + KM4 application code, where KM0 is in charge of booting up KM4.

If I start with an empty flash, I cannot connect JLINK to KM4 as well, this is because there is no KM0 boot code, thus it does not boot up KM4, and JLINK cannot connect.

What you can try is this:

  1. Compile image for KM0
  2. Compile image for KM4
  3. Start GDB server for KM0 only
  4. run make flash in the project_lp folder, this should upload km0_boot_all.bin and km0_km4_image2.bin
  5. run make flash in the project_hp folder, this should upload km4_boot_all.bin and km0_km4_image2.bin
  6. All three images are now present, reset and you should see the application code run

After the first time, there is no need to run through all the steps every time, if KM0 code is not modified, step 1 and 4 can be skipped.
Take note that you only need to connect JLINK to KM0 to upload.
You will still need to connect JLINK to KM4 to debug KM4.

Hi @wyy ,
Unfortunately something else if wrong because it doesn’t work.
First issue is this strange message during make flash in *lp:

88      /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c: No such file or directory.

Also there are next issues for hp.:

stat: cannot stat '/home/<skip>/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/system.bin': No such file or directory
stat: cannot stat '/home/<skip>/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/km4_image3_all.bin': No such file or directory
stat: cannot stat '/home/<skip>/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/flash_all.bin': No such file or directory

and

88      /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c: No such file or directory.

it seems like the files are present in the GitHub repo though? Where did you obtain the SDK you are using and what version is it?

stat: cannot stat '/home/<skip>/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/system.bin': No such file or directory
stat: cannot stat '/home/<skip>/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/km4_image3_all.bin': No such file or directory
stat: cannot stat '/home/<skip>/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/flash_all.bin': No such file or directory

did this occur during make flash in hp?

Hi @wyy
I use this repo. I fetched latest changes with git fetch and git pull. Branch dev.

did this occur during make flash in hp?

Yes.

Hi,

using a fresh clone from GitHub, I could not reproduce the errors.
Can you try again with a new clone of the SDK?

Hi @wyy
I cloned repository and build everything from scratch by ‘make all’ in lp and hp project. Then make ‘make setup GDB_SERVER=jlink’ in both subprojects.
Then I ran make flash. Message “No such file or directory” spill present.

~/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp$ make flash 
make -C asdk gdb
make[1]: Entering directory '/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk'
cp /home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/gnu_utility/gnu_script/acut_loader/*  /home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/gnu_utility/gnu_script/
/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/gnu_utility/gnu_script/SetupGDB_FPGA.sh /home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/gnu_utility/gnu_script
...
/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk
/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/image
/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/../toolchain/linux/asdk-6.4.1/linux/newlib/bin/arm-none-eabi-gdb -x /home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/gnu_utility/gnu_script/rtl_gdb_flash_write.txt
GNU gdb (Realtek ASDK-6.4.1 Build 3026) 7.12.50.20170111-git
Copyright (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=x86_64-pc-linux --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0x00000000 in ?? ()
Notification of completion for asynchronous execution commands is off.
Resets the core only, not peripherals.
Sleep 20ms
Resets the core only, not peripherals.
Sleep 20ms
Resets the core only, not peripherals.
Sleep 20ms
Load flash loader.
Restoring binary file gnu_utility/gnu_script/flash_loader_ram_1.bin into memory (0x82000 to 0x8223e)
$1 = 0x201
$2 = 0x4000201
....
wakeup bit(480003f8):4000201
$3 = 0x20000
$4 = 0x20000
....
wakeup bit(480003f8):20000
Breakpoint 1: file /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c, line 88.
Breakpoint 2: file /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c, line 118.

Breakpoint 1, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:88
88      /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c: No such file or directory

And make flash for hp project the same:

Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp$ make flash 
make -C asdk gdb
make[1]: Entering directory '/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk'
cp /home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/../../project_lp/asdk/gnu_utility/gnu_script/acut_loader/*  /home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/gnu_utility/gnu_script/acut_loader/
cp /home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/gnu_utility/gnu_script/acut_loader/*  /home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/gnu_utility/gnu_script/
/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/gnu_utility/gnu_script/SetupGDB_FPGA.sh /home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/gnu_utility/gnu_script
...
/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk
/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image
stat: cannot stat '/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/system.bin': No such file or directory
stat: cannot stat '/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/km4_image3_all.bin': No such file or directory
stat: cannot stat '/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/flash_all.bin': No such file or directory
/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/../toolchain/linux/asdk-6.4.1/linux/newlib/bin/arm-none-eabi-gdb -x /home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/gnu_utility/gnu_script/rtl_gdb_flash_write.txt
GNU gdb (Realtek ASDK-6.4.1 Build 3026) 7.12.50.20170111-git
Copyright (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=x86_64-pc-linux --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0x000820e8 in ?? ()
Notification of completion for asynchronous execution commands is off.
Resets the core only, not peripherals.
Sleep 20ms
Resets the core only, not peripherals.
Sleep 20ms
Resets the core only, not peripherals.
Sleep 20ms
Load flash loader.
Restoring binary file gnu_utility/gnu_script/flash_loader_ram_1.bin into memory (0x82000 to 0x8223e)
$1 = 0x4000201
$2 = 0x4000201
....
wakeup bit(480003f8):4000201
$3 = 0x20000
$4 = 0x20000
....
Breakpoint 1: file /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c, line 88.
Breakpoint 2: file /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c, line 118.

Breakpoint 1, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:88
88      /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c: No such file or directory.

Python must be changed before making because of:

  • no exec attribute;
  • end of lines is not unix, so I ran doe2unix for conversion.

*.sh scripts are not executable too. Why those files are not executable?
checksum util is also not executable but it is execution during build.

Q: Is RTL8720DN chip flashed with system.bin during production or not?

Hi @Tuxford

stat: cannot stat '/home/<skip>/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/system.bin': No such file or directory
stat: cannot stat '/home/<skip>/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/km4_image3_all.bin': No such file or directory
stat: cannot stat '/home/<skip>/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/flash_all.bin': No such file or directory

This is not an issue, I can still upload even with these three files missing.
system.bin only needs to be uploaded when certain settings need to be changed, such as low level BLE debug output

Latitude-3400:~/Documents/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp$ make flash
make -C asdk gdb
make[1]: Entering directory '/home/<user>/Documents/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk'
cp /home/<user>/Documents/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/gnu_utility/gnu_script/acut_loader/*  /home/<user>/Documents/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/gnu_utility/gnu_script/
/home/<user>/Documents/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/gnu_utility/gnu_script/SetupGDB_FPGA.sh /home/<user>/Documents/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/gnu_utility/gnu_script
...
/home/<user>/Documents/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk
/home/<user>/Documents/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/image
/home/<user>/Documents/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/../toolchain/linux/asdk-6.4.1/linux/newlib/bin/arm-none-eabi-gdb -x /home/<user>/Documents/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/gnu_utility/gnu_script/rtl_gdb_flash_write.txt
GNU gdb (Realtek ASDK-6.4.1 Build 3026) 7.12.50.20170111-git
Copyright (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=x86_64-pc-linux --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0x0c003324 in ?? ()
Notification of completion for asynchronous execution commands is off.
Resets the core only, not peripherals.
Sleep 20ms
Resets the core only, not peripherals.
Sleep 20ms
Resets the core only, not peripherals.
Sleep 20ms
Load flash loader.
Restoring binary file gnu_utility/gnu_script/flash_loader_ram_1.bin into memory (0x82000 to 0x8223e)
$1 = 0x201
$2 = 0x4000201
....
wakeup bit(480003f8):4000201
$3 = 0x101001f
$4 = 0x10017
....
wakeup bit(480003f8):10017
Breakpoint 1: file /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c, line 88.
Breakpoint 2: file /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c, line 118.

Breakpoint 1, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:88
88	/cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c: No such file or directory.
flash_write FileName:1 
flash_write FileSize:4144 
flash_write FlashAddrForWrite:0 
FileSize: 1030
Loopnumber = 2
TailSize = 48
global variables
FlashDatSrc:82258
FlashBlockWriteSize:800
FlashAddrForWrite:0Flash write start...
FILESTARTADDR$5 = 0x0
$6 = 0x0
$7 = 0x0
Restoring binary file ./image/km0_boot_all.bin into memory (0x82258 to 0x82a58)

Breakpoint 1, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:88
88	in /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c
FILESTARTADDR$8 = 0x800
$9 = 0x800
$10 = 0x1
Restoring binary file ./image/km0_boot_all.bin into memory (0x82258 to 0x82a58)

Breakpoint 1, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:88
88	in /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c
FILESTARTADDR$11 = 0x1000
$12 = 0x1000
$13 = 0x2
Restoring binary file ./image/km0_boot_all.bin into memory (0x82258 to 0x82288)

Breakpoint 1, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:88
88	in /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c
flash_write FileName:2 
flash_write FileSize:651264 
flash_write FlashAddrForWrite:6000 
FileSize: 9f000
Loopnumber = 318
TailSize = 0
global variables
FlashDatSrc:82258
FlashBlockWriteSize:800
FlashAddrForWrite:6000Flash write start...
FILESTARTADDR$14 = 0x0
$15 = 0x6000
$16 = 0x0
Restoring binary file ./image/km0_km4_image2.bin into memory (0x82258 to 0x82a58)

and I am still able to upload despite the /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c: No such file or directory. message

When you use make flash, does the upload go through, or is it getting stuck at that message?

Hi @wyy
The end of flash is

Breakpoint 1, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:88
88      in /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c
FILESTARTADDR$962 = 0x9e000
$963 = 0xa4000
$964 = 0x13c
Restoring binary file ./image/km0_km4_image2.bin into memory (0x100082258 to 0x100082a58)

Breakpoint 1, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:88
88      in /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c
FILESTARTADDR$965 = 0x9e800
$966 = 0xa4800
$967 = 0x13d
Restoring binary file ./image/km0_km4_image2.bin into memory (0x100082258 to 0x100082a58)

Breakpoint 1, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:88
88      in /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c
dump for check

Breakpoint 2, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:120
120     in /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c
make[1]: Leaving directory '/home/<skip>/Src/VVG/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk'

And make flash in hp:

Breakpoint 1, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:88
88      in /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c
FILESTARTADDR$962 = 0x9e000
$963 = 0xa4000
$964 = 0x13c
Restoring binary file ./image/km0_km4_image2.bin into memory (0x100082258 to 0x100082a58)

Breakpoint 1, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:88
88      in /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c
FILESTARTADDR$965 = 0x9e800
$966 = 0xa4800
$967 = 0x13d
Restoring binary file ./image/km0_km4_image2.bin into memory (0x100082258 to 0x100082a58)

Breakpoint 1, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:88
88      in /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c
dump for check

Breakpoint 2, RtlFlashProgram () at /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c:120
120     in /cygdrive/c/Work/SDKs/Git_SDKs/sdk_6.2/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/flashloader/rtl_flash_download.c
make[1]: Leaving directory '/home/<skip>/Src/VVG/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk'

No hangs in both cases.

Unfortunately I can attach full log and server log too. I it can help you I can share those logs in other way.

Hi @Tuxford

Thanks for sharing more logs. From what I can see, it seems like make flash is running normally for both lp and hp. The various messages are not indications of any error.

So are you still having trouble uploading firmware?

Hi @wyy
I still have an issue. I can;t connect by JLink for debugging.

After power disconnect and connect it doesn’t seem that chip starts properly. I start server in the next was but it shows no connection to target.

 JLinkGDBServer -select USB -device Cortex-M33 -endian little -if SWD -speed 1000 -ir -noLocalhostOnly -nologtofile -scriptfile "/home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/jlink_script/AP2_KM4.JLinkScript" -port 2331 -SWOPort 2332 -TelnetPort 2333
SEGGER J-Link GDB Server V7.82d Command Line Version

JLinkARM.dll V7.82d (DLL compiled Nov 23 2022 16:09:15)

Command line: -select USB -device Cortex-M33 -endian little -if SWD -speed 1000 -ir -noLocalhostOnly -nologtofile -scriptfile /home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/jlink_script/AP2_KM4.JLinkScript -port 2331 -SWOPort 2332 -TelnetPort 2333
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      yes
Generate logfile:              off
Verify download:               off
Init regs on start:            on
Silent mode:                   off
Single run mode:               off
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 /home/<skip>/Src/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/jlink_script/AP2_KM4.JLinkScript
J-Link settings file:          none
------Target related settings------
Target device:                 Cortex-M33
Target device parameters:      none
Target interface:              SWD
Target interface speed:        1000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V9 compiled May  7 2021 16:26:12
Hardware: V9.60
S/N: 69653608
Feature(s): RDI, GDB, FlashDL, FlashBP, JFlash
Checking target voltage...
Target voltage: 3.33 V
Listening on TCP/IP port 2331
Connecting to target...
ERROR: Could not connect to target.
Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...
Shutting down...
Could not connect to target.
Please check power, connection and settings.

Also I connected USB2Serial adapter to PC and serial wires to TX/RX. I don’t see any activity.
Q: What serial port parameters has to be set? I use default 115200 8n1.

Hi @Tuxford

The serial port parameters are correct.
Can you describe what you see on the serial port? It should at least print a # sign on reset, and there may be more messages depending on which images are present.

Hi @wyy
There is nothing on TX/RX and LTX/RTX pins. What about EN pin. Should it be connected to VDD or GND during flashing and start? I don’t see any information in the datasheet.

On other chip that is connected to STM32L476RG nucleo board, it shows the terminals.

Hi @Tuxford

Are you using the chip directly, or using a module?

The pins you should be monitoring are PA7 and PA8 for LOG_UART TX and RX respectively.
CHIP_EN functions as a reset, pull low to put chip into reset mode, pull high to release from reset and boot.
Each reset should result in at least a # sign printed over LOG_UART TX.
To enter firmware download mode, PA7 should be pulled low when CHIP_EN is released from low. PA7 can be released afterwards to function as a UART TX.

Can you explain what this means? I did not understand.

Hi @wyy
I use RTL8720DN chip, not board. The first environment is for debugging by JLink. Everything is related to it.

In this case EN is always floating. Is it acceptable for flashing by jlink?

Second case is as it has to be implemented in production except nucleo board by STM32L476. I hadn’t mention it before my previous message. In this case before uploading it must enter to upload mode. Sequence in next.

  1. Connect LTX to GND. Q: us it the same as setting low level on directly connected STM32L PIN?
  2. Connect EN to GND., Q: us it the same as setting low level on directly connected STM32L PIN?
  3. Pause. Q: What the minimal value of timeout before lowering rising the value?
  4. Connect EN to 3.3V. Q: us it the same as setting high level on directly connected STM32L PIN?
  5. Disconnect LTX from GND. Q: must it be connected as serial port line again?
  6. Q: what telegram size? Min and max.
  7. Q: is there a reply if a telegram accepted bt RTL chip or not?


d

Hi @Tuxford

It should be better to pull up to 3.3v if not in reset.

Yes, it should be

The key point is that LTX is low when EN changes from low to high. After EN changes to high, LTX should be reconnected to as a serial TX, as it is used in firmware upload mode. While the chip is waiting in firmware upload mode, it will transmit 0x15 repeatedly.


Note that there are two methods to upload firmware:

  1. Firmware upload over LOG_UART.
    • In this case, you need to put chip in firmware upload mode first, LTX and EN to low, then EN high, then LTX as serial TX.
  2. Firmware upload over JLINK
    • In this case, you DO NOT need to put chip in firmware upload mode first. EN should be high to let the chip run.
1 Like

Hi @wyy ,

  1. Case with jlink.
    I connected EN to VCC and now it show next message after make flash.

#[MODULE_BOOT-LEVEL_ERROR]:IMG2 SIGN Invalid
I didn’t turn on any signatures.

  1. Case with Nucleo STM32+RTL8720DN.
    It give welcome message for update but after update there is an old image.

And beginning of an image.

Is there header of km0_km4_image2.bin correct or some extra data must be sent before?
Q: is there a response about accepting telegram?

Thank you!

Hi @Tuxford

  1. Case with jlink

    • #[MODULE_BOOT-LEVEL_ERROR]:IMG2 SIGN Invalid
    • Is this occurring after running make flash in both lp and hp?
  2. Case with Nucleo STM32+RTL8720DN

    • It give welcome message for update but after update there is an old image
    • I am not sure what you are trying to do here, are you using the STM32 to send km0_km4_image2.bin the entire file continuously into LOG_RX?

Can you rephrase this question? I do not understand the question

Hi @wyy

  1. What does this message mean? I didn’t use any signatures.
  2. I mean a response from on LTX line after telegram has been sent to RTL chip and it was accepted or not. Unfortunately I can’t find flash protocol via LOG serial definition in the docs.