Melis4.0系统多媒体解码方案开发+调试环境搭建

关于Melis系统的介绍,可以参考以下帖子:

Melis3.0系统Quick Start

Melis4.0 架构以及V833-IPC开发QuickStart

F133方案是基于4.0架构开发的应用方案,主要应用领域是多媒体视频解码+显示。关于系统的介绍就是这些,下面开始介绍本方案开发环境以及调试环境的搭建过程.

1.SDK代码组织

方案的代码组织结构如下图所示,其中rtos-hal是类似于cmsis的一套BSP开发接口,用于屏蔽sunxi不同平台的差异,向上层驱动框架提供一致的接口。 rtos-hal目录会以软链接的方式成为melis-v3.0目录下的BSP目录。

.
├── melis-v3.0
│   ├── document
│   ├── source
│   ├── toolchain
│   └── tools
└── rtos-hal
    ├── hal
    └── include

8 directories

 2.编译&打包:

3.Phoenixsuilt烧录 

使用USB线连接PC和平台端的micro usb口,然后通过fel&reset按键的配合,使phinxsuilt进入烧录模式:

 4.启动系统

可以看到平台端已经启动桌面显示

控制台这边:

 5.搭建GDB裸机调试环境

由于使用的是平头哥的RISCV处理器,某宝购买平头哥的专用正品调试器.

然后安装平头哥Debugserver,作用相当于OpenOCD,有linux和windows版本,这里安装windows版本,图标是啥没看懂,感觉上挺魔幻的。

 接着,用USB线连接PC 和 ICE仿真器端,仿真器则通过排线连接到平台端的jtag口。

启动cskydebugserver,如下图所示:

 可以看到,cskydebugger已经正确连接到ICE并且识别到了平台,不仅如此,下面还给出了通过gdb连接的命令:

GDB connect command for CPU 0:
	target remote 192.168.56.1:1025
	target remote 172.25.11.99:1025

 6.GDB连接 debugserver.

 依次执行如下命令:

$ riscv64-unknown-elf-gdb
(gdb) target remote 172.25.11.99:1025
(gdb) file ekernel/melis30.elf
(gdb) b rt_tick_increase
(gdb) c

执行target命令后,调试器即已经attach上平台上正在运行的系统固件,attach成功后,目标即已进入STOP态,无需像WINGDB那样再次触发STOP指令停止CPU。此时系统已经处于STOP状态,等待进一步的输入调试命令:

过程逻辑有点类似于如下在ubuntu上用gdb调试native的程序一样:

 整个调试会话过程如下:

caozilong@AwExdroid65:~/WorkSpace/f133-develop/melis-v3.0/source$ riscv64-unknown-elf-gdb
GNU gdb (T-HEAD RISCV Tools V1.10.2 B20201104) 8.2.50.20190202-git
Copyright (C) 2019 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-gnu --target=riscv64-unknown-elf".
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".
(gdb) target remote 172.25.11.99:1025
Remote debugging using 172.25.11.99:1025
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0x000000004002a2ee in ?? ()
(gdb) file ekernel/melis30.elf 
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from ekernel/melis30.elf...
(gdb) b rt_tick_increase 
Breakpoint 1 at 0x4002be64: file ekernel/core/rt-thread/clock.c, line 72.
(gdb) c
Continuing.

Breakpoint 1, rt_tick_increase () at ekernel/core/rt-thread/clock.c:72
72	    ++ rt_tick;
(gdb) bt
#0  rt_tick_increase () at ekernel/core/rt-thread/clock.c:72
#1  0x000000004002a32a in riscv_timer_interrupt () at ekernel/arch/riscv/rv64gc/timer.c:41
#2  0x000000004002baf6 in riscv_cpu_handle_interrupt (scause=<optimized out>, sepc=<optimized out>, stval=<optimized out>, regs=
    <optimized out>) at ekernel/arch/riscv/plic/interrupt.c:702
#3  0x000000004002a1e8 in interrupt () at ekernel/arch/riscv/rv64gc/exception_s.S:97
Backtrace stopped: frame did not save the PC
(gdb) 

可以看到,成功的显示的调用堆栈信息。

接下来就可以进行交互调试了:

blob_input_sbi_start in section .sbi.text
(gdb) info symbol 0x40002000
blob_input_sbi_start + 8192 in section .sbi.text
(gdb) info line *0x4002a049
Line 104 of "ekernel/arch/riscv/sunxi/init.c" starts at address 0x4002a03e <awos_bsp_init+28> and ends at 0x4002a04e <start_kernel>.
(gdb) info target
Symbols from "/home1/caozilong/WorkSpace/f133-develop/melis-v3.0/source/ekernel/melis30.elf".
Remote serial target in gdb-specific protocol:
Debugging a target over a serial line.
	While running this, GDB does not access memory from...
Local exec file:
	`/home1/caozilong/WorkSpace/f133-develop/melis-v3.0/source/ekernel/melis30.elf', file type elf64-littleriscv.
	Entry point: 0x40010600
	0x0000000040000000 - 0x000000004000be00 is .sbi.text
	0x0000000040010000 - 0x0000000040010858 is .head.text
	0x0000000040010858 - 0x00000000400d61e8 is .dram_seg.text
	0x00000000400d61e8 - 0x000000004010b758 is .dram_seg.rodata
	0x000000004010b758 - 0x000000004010b7f8 is .dram_seg.initcall
	0x000000004010b7f8 - 0x000000004010b820 is .note.gnu.build-id
	0x000000004010b820 - 0x000000004010b830 is .dram_seg.ctors
	0x000000004010b830 - 0x000000004010b840 is .dram_seg.dtors
	0x000000004010b840 - 0x0000000040120038 is .dram_seg.data
	0x0000000040120038 - 0x0000000040123038 is .dram_seg.stack
	0x0000000040126038 - 0x0000000040152f68 is .dram_seg.bss
(gdb) info variables
All defined variables:

File ../../../../../../source/riscv/riscv-gcc/libgcc/libgcc2.c:
690:	const UQItype __clz_tab[256];

File ./ekernel/drivers/hal/source/usb/core/usb_gen_hub_base.h:
10:	static int blinkenlights;
14:	static struct usb_list_head hub_event_list;
12:	static hal_spinlock_t hub_event_lock;
31:	static struct hub_thread_context hub_thread_cont;

File ekernel/arch/common/initcall.c:
54:	static const char *initcall_level_names[8];
40:	static initcall_entry_t *initcall_levels[9];

File ekernel/arch/common/printf.c:
193:	int g_cli_direct_read;

File ekernel/arch/riscv/common/epos_hdr.c:
34:	const boot_head_t melis_head;



结束!

Guess you like

Origin blog.csdn.net/tugouxp/article/details/119033667