Share
Embed
Transcript
22 slides
-
$ who • Name: Toshifumi NISHINAGA • Attribute: Hobby embedded
programmer • Activities: ◦ Google Summer of Code 2016(Linux Foundation) ▪ https://summerofcode.withgoogle.com/archive/2016/projects/6617849892175872/ ▪ Porting Linux to ARM Cortex-M7 microcontroller. ◦ U-Boot contributor(not active recently…) • link: ◦ https://github.com/tnishinaga ◦ https://speakerdeck.com/tnishinaga 2 -
What is SynQuacer(Linaro developerbox) • What’s this: ◦ ARM64 desktop
machine • Spec: ◦ Processor: ARM Cortex-A53 24 core ◦ Memory: DDR4 4 slot ◦ PCIe: x1 x 2, x16(actually x4) x 1 • Price: ◦ 130,000 JPY(chip1stop) 3 -
Survey: 1. SynQuacer allows JTAG access with ARM 20pin JTAG
port 2. OpenOCD(since version 0.11.0?) supports ARM64 a. example: hi6220(HiKey board) b. http://repo.or.cz/openocd.git/blob/HEAD:/tcl/target/hi6220.cfg 3. We can access ARM CoreSight(debug unit) specification a. it is not confidential b. http://infocenter.arm.com/help/topic/com.arm.doc.ddi0314h/DDI0314H_coresight_components _trm.pdf 4. SynQuacer has JTAG debug mode a. turn on SW2-8 b. it is not found in official documents 5. It seems possible to debug SynQuacer with JTAG 7 -
Topics 1. Pick-up the necessary values from hi6220 config 2.
Research the information about necessary values a. What is this? b. How to get this value? 3. Create config 4. Test it 5. Share it 9 -
1. Pick-up the necessary values from hi6220 config • http://repo.or.cz/openocd.git/blob/HEAD:/tcl/target/hi6220.cfg
• • I should create: ◦ TAP(Test Access Port) ◦ DAP(Debug Access Port) ◦ CTI(Cross Trigger Interface) ◦ TARGET 10 -
TAP(Test Access Port) • JTAGの機能。テストを行うロジックにアクセスするポート • OpenOCDではTAPデバイス作成のためにTAPコントローラーのIDCODEの指定 が必要 • OpenOCDはauto
probe機能でTAPの検査が自動で行われる ◦ http://openocd.org/doc/html/TAP-Declaration.html • 見つかったTAPIDを使ってTAPを作ればOK Info : JTAG tap: auto0.tap tap/device found: 0x6ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x6) Info : JTAG tap: auto1.tap tap/device found: 0x6ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x6) Warn : gdb services need one or more targets defined TapName Enabled IdCode Expected IrLen IrCap IrMask -- ------------------- -------- ---------- ---------- ----- ----- ------ 0 auto0.tap Y 0x6ba00477 0x6ba00477 4 0x01 0x03 1 auto1.tap Y 0x6ba00477 0x6ba00477 4 0x01 0x03 11 -
DAP(Debug Access Port) • ARM CoreSight のデバッグユニットにアクセスするポート • OpenOCDではTAPからDAPを生成できる ◦
dap create auto0.dap -chain-position auto0.tap 12 -
CTI(Cross Trigger Interface) • 調査中。 • hi6220のconfigより、CTIベースアドレスをCPUのコア数分調べる必要あり • 調べ方: ◦
DAPのROM TableにDAPにつながったデバイス情報が書かれている ▪ CoreSightのマニュアルより ▪ http://infocenter.arm.com/help/topic/com.arm.doc.ddi0314h/DDI0314H_coresight_compo nents_trm.pdf ◦ OpenOCDにてdap infoコマンドを発行すると ROMが読める ▪ http://openocd.org/doc/html/TAP-Declaration.html ▪ 参考: https://gist.github.com/tnishinaga/fe5555cd0370eae6baa0742c419bb5f5 ▪ Tips: すべてのコアを起こさないと全部は読めない。 Linux起動してからやると良い ◦ ROMの情報から “Processor-name CTI” で検索するとアドレスが見つかる 13 -
TARGET • デバッグ対象を作る • OpenOCDではCTIの情報を引数に作成する • hi6220のconfigでは以下のようにして作成 ◦ 引用元: http://repo.or.cz/openocd.git/blob/HEAD:/tcl/target/hi6220.cfg#l42
14 set _command "target create ${_TARGETNAME}$_core aarch64 \ -dap $_CHIPNAME.dap -coreid $_core -cti cti$_core" -
3. Create config • Target config for SynQuacer ◦ https://gist.github.com/tnishinaga/d2688aebff574be04238ba0e56e7db53
• How to use: ◦ openocd -f interface/ftdi/dp_busblaster_kt-link.cfg -f sc2a11_24core.cfg 15 -
4. Test • [1] tnishinaga@tx230> openocd -f interface/ftdi/dp_busblaster_kt-link.cfg -f sc2a11_24core.cfg
Open On-Chip Debugger 0.10.0+dev-00531-g2253a31fb (2018-09-12-01:37) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html adapter speed: 1000 kHz jtag_ntrst_delay: 100 trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst Info : Listening on port 6666 for tcl connections Info : Listening on port 4444 for telnet connections Info : clock speed 1000 kHz Info : JTAG tap: auto0.tap tap/device found: 0x6ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x6) Info : JTAG tap: auto1.tap tap/device found: 0x6ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x6) Info : sc2a11.a53.0: hardware has 6 breakpoints, 4 watchpoints Info : Listening on port 3333 for gdb connections 16 -
4. Test • Open On-Chip Debugger > targets TargetName Type
Endian TapName State -- ------------------ ---------- ------ ------------------ ------------ 0* sc2a11.a53.0 aarch64 little auto1.tap running 1 sc2a11.a53.1 aarch64 little auto1.tap examine deferred 2 sc2a11.a53.2 aarch64 little auto1.tap examine deferred 3 sc2a11.a53.3 aarch64 little auto1.tap examine deferred 4 sc2a11.a53.4 aarch64 little auto1.tap examine deferred 5 sc2a11.a53.5 aarch64 little auto1.tap examine deferred 6 sc2a11.a53.6 aarch64 little auto1.tap examine deferred 7 sc2a11.a53.7 aarch64 little auto1.tap examine deferred 8 sc2a11.a53.8 aarch64 little auto1.tap examine deferred … 23 sc2a11.a53.23 aarch64 little auto1.tap examine deferred 17 -
4. Test • (gdb) target remote :3333 Remote debugging using
:3333 warning: No executable has been specified and target does not support determining executable automatically. Try using the "file" command. 0xffff00000888b2a0 in ?? () (gdb) i r x0 0x2 2 x1 0xffff80087b9ae318 18446603372654682904 x2 0xffff80087b9ae308 18446603372654682888 x3 0x0 0 x4 0x0 0 …. x29 0xffff000009053d90 18446462598884179344 x30 0xffff000008159a8c 18446462598868474508 18