Flash problem on Ameba RTL8195AM Board

Hi,
I have a new Ameba RTL8195AM Board.
And I clone the example from GitHub - ambiot/amb1_sdk: SDK for Ameba1.
I’ve read the document UM0096 Realtek Ameba-1 build environment setup - gcc.pdf. And successfully built the .bin files.
The OpenOCD is installed and running, but I encountered a flash problem as following:

~/amb1_sdk/project/realtek_ameba1_va0_example/GCC-RELEASE$ make flash
if [ ! -d ../../../tools/arm-none-eabi-gcc/4_8-2014q3 ] ; then tar -jxf ../../../tools/arm-none-eabi-gcc/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2 -C ../../../tools/arm-none-eabi-gcc/ ; mv ../../../tools/arm-none-eabi-gcc/gcc-arm-none-eabi-4_8-2014q3 ../../../tools/arm-none-eabi-gcc/4_8-2014q3 ; fi
make[1]: Entering directory '/home/walker/Downloads/ITM1100/01_amb1_sdk/project/realtek_ameba1_va0_example/GCC-RELEASE'
cp	../../../component/soc/realtek/8195a/misc/gcc_utility//target_NORMALB.axf ../../../component/soc/realtek/8195a/misc/gcc_utility//target_NORMAL.axf
chmod 777 ../../../component/soc/realtek/8195a/misc/gcc_utility//target_NORMAL.axf
chmod +rx ../../../component/soc/realtek/8195a/misc/gcc_utility//SetupGDB_NORMAL.sh
../../../component/soc/realtek/8195a/misc/gcc_utility//SetupGDB_NORMAL.sh
...
/home/walker/Downloads/ITM1100/01_amb1_sdk/project/realtek_ameba1_va0_example/GCC-RELEASE
./application/Debug/bin/ram_all.bin
size 349348 --> 0x554A4
../../../tools/arm-none-eabi-gcc/4_8-2014q3/bin//arm-none-eabi-gdb -x ../../../component/soc/realtek/8195a/misc/gcc_utility//rtl_gdb_flash_write.txt
GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20140731-cvs
Copyright (C) 2013 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-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
0x00000000 in ?? ()
Notification of completion for asynchronous execution commands is off.
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00000100 msp: 0x1ffffffc
0x40000040: 00fcc702 
0x40005000: 0000000d 
-------------------------------
RamFileSize: 554a4
-------------------------------
Loading section .rom.text, size 0x30c64 lma 0x0
Loading section .rom.rodata, size 0x12b8c lma 0x30c68

The OpenOCD output:

~/amb1_sdk/project/realtek_ameba1_va0_example/GCC-RELEASE$ ./run_openocd.sh 
Found openocd running, Kill it
./run_openocd.sh: 9: kill: Illegal number: walker
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
adapter speed: 10 kHz
adapter_nsrst_delay: 200
cortex_m reset_config sysresetreq
ameba1_init
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.0
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 10 kHz
Info : SWD DPIDR 0x2ba01477
Info : rtl8195a.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection on tcp/3333
undefined debug reason 7 - target needs reset
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00000100 msp: 0x1ffffffc
0x40000040: 00fcc702 
0x40005000: 0000000d 

The OpenOCD said: undefined debug reason 7 - target needs reset

…My OS is Ubuntu 20.04

How to correct this problem?
Any pointers would be appreciated.

1 Like

Hi if you are using the development board of RTL8195AM, then you may consider download firmware using DAP port, which is easier and quicker

Hi @xidameng

I am sorry, I forgot to mention that I am actually using DAP to flash program. Is there any clue to identify the problem?

1 Like

I see, this is rare, let me take a look…

1 Like

problem updated:

I updated the DAP firmware and try again.
‘make flash’ did not hang. but produced many output as following:

~/amb1_sdk/project/realtek_ameba1_va0_example/GCC-RELEASE$ make flash
if [ ! -d ../../../tools/arm-none-eabi-gcc/4_8-2014q3 ] ; then tar -jxf ../../../tools/arm-none-eabi-gcc/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2 -C ../../../tools/arm-none-eabi-gcc/ ; mv ../../../tools/arm-none-eabi-gcc/gcc-arm-none-eabi-4_8-2014q3 ../../../tools/arm-none-eabi-gcc/4_8-2014q3 ; fi
make[1]: Entering directory '/home/walker/Downloads/ITM1100/01_amb1_sdk/project/realtek_ameba1_va0_example/GCC-RELEASE'
cp	../../../component/soc/realtek/8195a/misc/gcc_utility//target_NORMALB.axf ../../../component/soc/realtek/8195a/misc/gcc_utility//target_NORMAL.axf
chmod 777 ../../../component/soc/realtek/8195a/misc/gcc_utility//target_NORMAL.axf
chmod +rx ../../../component/soc/realtek/8195a/misc/gcc_utility//SetupGDB_NORMAL.sh
../../../component/soc/realtek/8195a/misc/gcc_utility//SetupGDB_NORMAL.sh
...
/home/walker/Downloads/ITM1100/01_amb1_sdk/project/realtek_ameba1_va0_example/GCC-RELEASE
./application/Debug/bin/ram_all.bin
size 349348 --> 0x554A4
../../../tools/arm-none-eabi-gcc/4_8-2014q3/bin//arm-none-eabi-gdb -x ../../../component/soc/realtek/8195a/misc/gcc_utility//rtl_gdb_flash_write.txt
GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20140731-cvs
Copyright (C) 2013 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-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
0x00000100 in ?? ()
Notification of completion for asynchronous execution commands is off.
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00000100 msp: 0x1ffffffc
0x40000040: 00fcc702 
0x40005000: 0000000d 
-------------------------------
RamFileSize: 554a4
-------------------------------
Loading section .rom.text, size 0x30c64 lma 0x0
Loading section .rom.rodata, size 0x12b8c lma 0x30c68
Loading section .vector_table, size 0x100 lma 0x10000000
Loading section .user_vector_table, size 0x100 lma 0x10000100
Loading section .user_data_table, size 0x100 lma 0x10000200
Loading section .rom.bss, size 0x8c8 lma 0x10000300
Loading section .ram.start.table, size 0x14 lma 0x10000bc8
Loading section .ram_image1.text, size 0x527c lma 0x10000bdc
Loading section .image2.start.table, size 0x18 lma 0x10005e58
Loading section .ram_image2.text, size 0x3cb8 lma 0x10005e70
Loading section .ram.data, size 0xc lma 0x10009b28
Loading section .bf_data, size 0x19800 lma 0x10009fc8
Start address 0x100, load size 420644
Transfer rate: 23 KB/sec, 12018 bytes/write.
Load flash controller.
$1 = 0x11157
$2 = 0x8011157
....
wakeup bit(40000210):8011157
LoopNum = aa
TailSize = 4a4
global variables
Breakpoint 1: file rtl_flash_download.c, line 489.
Breakpoint 2: file rtl_flash_download.c, line 524.

Breakpoint 1, RtlFlashProgram () at rtl_flash_download.c:489
489	rtl_flash_download.c: No such file or directory.
$3 = 1
$4 = 349348

Breakpoint 2, RtlFlashProgram () at rtl_flash_download.c:524
524	in rtl_flash_download.c
FlashDatSrc:10022fc8
FlashBlockWriteSize FlashBlockWriteSize:800
FlashAddrForWriteFlash write start...
$5 = 0x0
Restoring binary file ./application/Debug/bin/ram_all.bin into memory (0x10022fc8 to 0x100237c8)

Breakpoint 2, RtlFlashProgram () at rtl_flash_download.c:524
524	in rtl_flash_download.c
FILEENDADDR$6 = 0x800
$7 = 0x800
Restoring binary file ./application/Debug/bin/ram_all.bin into memory (0x10022fc8 to 0x100237c8)

Breakpoint 2, RtlFlashProgram () at rtl_flash_download.c:524
524	in rtl_flash_download.c
FILEENDADDR$8 = 0x1000
$9 = 0x1000
Restoring binary file ./application/Debug/bin/ram_all.bin into memory (0x10022fc8 to 0x100237c8)

Breakpoint 2, RtlFlashProgram () at rtl_flash_download.c:524
524	in rtl_flash_download.c
FILEENDADDR$10 = 0x1800
$11 = 0x1800
Restoring binary file ./application/Debug/bin/ram_all.bin into memory (0x10022fc8 to 0x100237c8)

Breakpoint 2, RtlFlashProgram () at rtl_flash_download.c:524
524	in rtl_flash_download.c
FILEENDADDR$12 = 0x2000
$13 = 0x2000
Restoring binary file ./application/Debug/bin/ram_all.bin into memory (0x10022fc8 to 0x100237c8)

..........  repeating debugging text  .....

Breakpoint 2, RtlFlashProgram () at rtl_flash_download.c:524
524	in rtl_flash_download.c
FILEENDADDR$344 = 0x55000
Restoring binary file ./application/Debug/bin/ram_all.bin into memory (0x10022fc8 to 0x1002346c)

Breakpoint 2, RtlFlashProgram () at rtl_flash_download.c:524
524	in rtl_flash_download.c
dump for check
start addr of dumping$345 = 0x98000000
end addr of dumping$346 = 0x980554a4
Breakpoint 3: file rtl_flash_download.c, line 556.

Breakpoint 3, RtlFlashProgram () at rtl_flash_download.c:556
556	in rtl_flash_download.c
make[1]: Leaving directory '/home/walker/Downloads/ITM1100/01_amb1_sdk/project/realtek_ameba1_va0_example/GCC-RELEASE'

It was very slow to flash, and there seems many breakpoints during the execution. Is it normal? How can I make it faster?

Any pointers would be appreciated.

@walkerfleck

If you just need to flash, an alternative would be to just copy the output binary ram_all.bin into the mbed drive.

Hi @wyy,

It worked perfectly! I can not find the words to express how happy I am. Thank you for such useful information! :laughing:

1 Like