页次: 1
关于在Linux系统下使用调试器调试的问题,可以通过安装Linux版T-Head-DebugServer来解决
本人Deepin系统,使用Cklink ite版调试器,亲测有效,与Windows版使用效果一样,但是只支持命令行。
1、T-Head-DebugServer-linux-x86_64-V5.18.0-20230926.sh.tar.gz为T-Head-DebugServer安装文件
T-Head-DebugServer-linux-x86_64-V5.18.0-20230926.sh.tar.gz
2、使用说明见T-Head+Debugger+Server+User+Guide.pdf第3章内容。
T-Head+Debugger+Server+User+Guide.pdf
感谢 海石生风 、Gentlepig 两位提供的信息,我总结了一个在Linux系统下,使用Eclipse一键自动下载的方法,
供大家参考,Deepin系统亲测有效,具体步骤如下:
1、将80-aicusb.rules文件复制到linux系统/etc/udev/rules.d文件夹中。当D133开发板处于下载模式时,
插入USB口,此时在系统/dev中可以发现aic0节点。此节点用于下载新固件。
2、确保D133 Eclipse工程可以在Linux系统中正常编译。
3、将auto_download_image.sh脚本复制到D133 Eclipse工程 ./tools/scripts文件夹下。
注:确保./tools/scripts文件夹中有upgcmd可执行程序,没有的话去官方SDK中拷贝。
4、打开D133 Eclipse工程,点击左侧工程目录,按F5刷新工程目录,确保./tools/scripts路径中
可以看到auto_download_image.sh脚本。
5、Eclipse界面下,点击Run-> External Tools-> External Tools Configurations...,新建配置项Download
(注:名称可自定义)
6、在配置项Download页面参数设置如下(根据实际工程配置),配置好后保存即可
Main选项卡-> Location: ${workspace_loc:/d13x/tools/scripts/auto_download_image.sh}
Main选项卡-> WorkingDirectory: ${workspace_loc:/d13x/tools/scripts}
Build选项卡->Build Before launch选项去掉(避免下载前重复编译,节约时间)
7、确保PC端与D133通信的串口是打开的。比如我使用的串口工具为CH340,在电脑上识别驱动是/dev/ttyUSB0,
我使用的Eclipse自带的Terminal终端工具打开/dev/ttyUSB0,打开串口通信,点击回车出现 " aic /> " 即可。
做到这一步,就可以通过脚本使D133自动进入升级模式。
注:如果D133因为某些原因不能进行串口调试,可以通过手动进入D133调试模式来跳过此步。
8、点击External Tools中的自定义Download选项,即可实现自动下载程序的操作。
80-aicusb.rules文件内容
SUBSYSTEMS=="usb", ATTRS{idVendor}=="33c3", ATTRS{idProduct}=="6677", MODE:="0666", SYMLINK+="aic0"
auto_download_image.sh文件内容
#!/bin/bash
#向D133串口发送升级指令aicupg,串口可根据实际修改
echo "aicupg" > /dev/ttyUSB0
sleep 2
#确保设备进入升级模式
#如果设备无法通过串口进入升级模式,就下拉串口TX线使其进入升级模式
#upgcmd是官方提供的下载工具,在SDK ./luban-lite/tools/scripts路径下
#"../../Debug/d13x_gateway-nor_v1.0.0.img"为要下载的固件路径
./upgcmd image ../../Debug/d13x_gateway-nor_v1.0.0.img
#下载完成,重启设备
./upgcmd shcmd reset
#有时一次不成功,需要再次启动才能正常下载成功
./upgcmd image ../../Debug/d13x_gateway-nor_v1.0.0.img
#下载完成,重启设备
./upgcmd shcmd reset
Eclipse下载时 Console打印日志
The Image file: ../../Debug/d13x_gateway-nor_v1.0.0.img, size 751616
Upgrade fwc: image.updater.spl, size 196368 ...
Send the rest 196368
[ERROR ]: aicupg_trans_recv_pkt()208: CSW size 0, No such device (it may have been disconnected)(-4)
[ERROR ]: aicupg_cmd_send_fwc_data_final()777: Recv resp failed, expect 16, got 0
[INFO ]: __do_fwc_upgrade()294: Switching to new stage, please ignore the error message.
[INFO ]: image_do_upgrade_inner()460: Try to recovery the connection ...
[ERROR ]: aicupg_trans_send_pkt()80: CBW tag 0x6b, size 0, No such device (it may have been disconnected)(-4)
[ERROR ]: aicupg_cmd_get_hwinfo()106: Send command failed. ret = 0, siz = 16
[INFO ]: image_do_upgrade_inner()463: Connection recovery failed ...
[ERROR ]: aicupg_trans_send_pkt()80: CBW tag 0x6c, size 0, No such device (it may have been disconnected)(-4)
[ERROR ]: aicupg_cmd_set_upg_end()535: Send command failed. ret = 0, siz = 16
[ERROR ]: image_do_upgrade_inner()492: Burn ../../Debug/d13x_gateway-nor_v1.0.0.img failed!, ret -4
[ERROR ]: upgcmd()1297: Open upg device failed.
The Image file: ../../Debug/d13x_gateway-nor_v1.0.0.img, size 751616
Upgrade fwc: image.updater.spl, size 196368 ...
Send the rest 196368
Upgrade fwc: image.info, size 2048 ...
Send the rest 2048
Upgrade fwc: image.target.spl, size 196368 ...
Send the rest 196608
Upgrade fwc: image.target.os, size 354304 ...
Send the rest 354304
Burn ../../Debug/d13x_gateway-nor_v1.0.0.img successfully!
Used time: 6.6 sec, Speed: 0.11 MB/s
[ERROR ]: aicupg_trans_send_pkt()104: CSW tag 0x2, size 0, No such device (it may have been disconnected)(-4)
官方SDK生成的D133的Eclipse工程只能在Windows环境下编译。使用Linux系统的小伙伴如果想编译调试,可以使用下边的方案解决。
本人使用Deepin做开发,亲测好使。具体步骤如下:
1、linux系统中先安装python3软件,编译时要用
2、先用scons --target=eclipse_sdk指令单独生成一个完整的 Eclipse SDK 软件包,即project_eclipse_sdk文件夹
注意:在执行eclipse_linux_check.sh脚本之前,不要挪动project_eclipse_sdk文件夹。
3、将eclipse_linux_check.sh脚本文件复制到project_eclipse_sdk文件夹中
4、执行eclipse_linux_check.sh脚本文件,该文件会对“.cproject”文件和“org.eclipse.cdt.core.prefs”进行修改
5、执行完脚本,即可在linux环境中编译eclipse工程了
eclipse_linux_check.sh 脚本内容如下,可以根据自己系统的环境做修改。
#!/bin/bash
#复制固件生成工具
cp -r $PWD/../../../tools/scripts/img2simg $PWD/tools/scripts
cp -r $PWD/../../../tools/scripts/mcopy $PWD/tools/scripts
cp -r $PWD/../../../tools/scripts/mformat $PWD/tools/scripts
cp -r $PWD/../../../tools/scripts/mkenvimage $PWD/tools/scripts
cp -r $PWD/../../../tools/scripts/mkimage $PWD/tools/scripts
cp -r $PWD/../../../tools/scripts/mkuffs $PWD/tools/scripts
cp -r $PWD/../../../tools/scripts/mtools $PWD/tools/scripts
cp -r $PWD/../../../tools/scripts/spienc $PWD/tools/scripts
cp -r $PWD/../../../tools/scripts/upgcmd $PWD/tools/scripts
cp -r $PWD/../../../tools/scripts/mklittlefs $PWD/tools/scripts
#修改工程PATH路径
PREFS="doxygen/doxygen_new_line_after_brief=true\n
doxygen/doxygen_use_brief_tag=false\n
doxygen/doxygen_use_javadoc_tags=true\n
doxygen/doxygen_use_pre_tag=false\n
doxygen/doxygen_use_structural_commands=false\n
eclipse.preferences.version=1\n
environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.319524623/PATH/delimiter=;\n
environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.319524623/PATH/operation=replace\n
environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.319524623/PATH/value=\${ProjDirPath}/toolchain/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin\n
environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.319524623/append=true\n
environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.319524623/appendContributed=true\n"
echo -e $PREFS > .settings/org.eclipse.cdt.core.prefs
#修改工程配置文件
sed -i 's/\\/\//g' ./.cproject #将文件中的"\"全部替换为"/"
sed -i 's/\${ProjDirPath}\/tools\/Python39\/python3/\/usr\/bin\/python3/g' .cproject #将"${ProjDirPath}/tools/Python39/python3"全部替换为"/usr/bin/python3"
sed -i 's/\${ProjDirPath}\/tools\/bin\/cp/\/usr\/bin\/cp/g' .cproject #將"${ProjDirPath}/tools/bin/cp"全部替換为"cp"
sed -i 's/*.pbp/d13x.pbp/g' .cproject #將"${ProjDirPath}/bsp/artinchip/sys/d13x/*.pbp" 全部替換为 "${ProjDirPath}/bsp/artinchip/sys/d13x/d13x.pbp"
sed -i 's/pack\/\*/pack\/bootloader.bin \${ProjDirPath}\/Debug\/;\/usr\/bin\/cp -r \${ProjDirPath}\/target\/d13x\/gateway88-nor\/pack\/image_cfg.json \${ProjDirPath}\/Debug\/;\/usr\/bin\/cp -r \${ProjDirPath}\/target\/d13x\/gateway88-nor\/pack\/pbp_cfg.json/g' .cproject #將"${ProjDirPath}/target/d13x/gateway88-nor/pack/*" 全部替換为 "${ProjDirPath}/target/d13x/gateway88-nor/pack/"
有问题欢迎大家交流学习!
页次: 1