更新日:2021-05-03
J-Linkプロンプトから操作コマンドを実行:
デバッグポート経由でターゲットマイコンCPUに接続できましたら、J-Linkプロンプトからコマンドを実行してメモリアクセス、ファームウエアダウンロード、CPU実行、ステップ実行など可能です。
コマンド一覧はJ-Linkコンソールから「?」コマンドを実行して確認できます。
※最新版の情報はJ-Linkユーザマニュアルをご確認ください。
「regs」コマンドを入力してCPUレジスタ内容を確認します。CPUが実行中の場合は「h」コマンドでCPUを停止します。
● RXマイコンアクセス事例:
J-Link>regs CPU is not halted ! J-Link>h R0 = 0000B420, R1 = FFFFFFFF, R2 = 0008720A, R3 = 00000001 R4 = 00007C18, R5 = 0000B3DC, R6 = 00000000, R7 = 00000000 R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000 R12= 00000000, R13= 00000000, R14= 000000C0, R15= FFC00146 ISP 0000B838, USP 0000B420, INTB FFC00720, PC FFC01FEA, PSW 00030005, BPC 00000000, BPSW 80000000, FINTV 00000000, FPSW 40000100 J-Link>rreg 2 R2 = 0x0008720A J-Link>wreg R2 12345678 R2 = 0x12345678 J-Link>rreg 2 R2 = 0x12345678 J-Link>
● Cortex-Mマイコンアクセス事例:
J-Link>regs CPU is not halted ! J-Link>h PC = 0000105A, CycleCnt = E1F5C1FC R0 = 00000001, R1 = 2000FF98, R2 = 00000009, R3 = FFFFFC09 R4 = 00001238, R5 = 00000605, R6 = 00000000, R7 = 00000000 R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000 R12= 00000000 SP(R13)= 2000FFF0, MSP= 2000FFF0, PSP= 00000000, R14(LR) = 00001053 XPSR = 21000000: APSR = nzCvq, EPSR = 01000000, IPSR = 000 (NoException) CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00 FPS0 = 00000000, FPS1 = 00000000, FPS2 = 00000000, FPS3 = 00000000 FPS4 = 00000000, FPS5 = 00000000, FPS6 = 00000000, FPS7 = 00000000 FPS8 = 00000000, FPS9 = 00000000, FPS10= 00000000, FPS11= 00000000 FPS12= 00000000, FPS13= 00000000, FPS14= 00000000, FPS15= 00000000 FPS16= 00000000, FPS17= 00000000, FPS18= 00000000, FPS19= 00000000 FPS20= 00000000, FPS21= 00000000, FPS22= 00000000, FPS23= 00000000 FPS24= 00000000, FPS25= 00000000, FPS26= 00000000, FPS27= 00000000 FPS28= 00000000, FPS29= 00000000, FPS30= 00000000, FPS31= 00000000 FPSCR= 00000000 J-Link>rreg 8 R8 = 0x00000000 J-Link>wreg R8 12345678 R8 = 0x12345678 J-Link>rreg 8 R8 = 0x12345678 J-Link>
● RXマイコンアクセス事例:
J-Link>mem32 00001000, 8 00001000 = 00000000 00000000 00000000 00000000 00001010 = 00000000 00000000 00000000 00000000 J-Link>w4 00001010, 12345678 Writing 12345678 -> 00001010 J-Link>mem32 00001000, 8 00001000 = 00000000 00000000 00000000 00000000 00001010 = 12345678 00000000 00000000 00000000 J-Link>
● Cortex-Mマイコンアクセス事例:
J-Link>mem32 20000000, 8 20000000 = 03D09000 47474553 52205245 00005454 20000010 = 00000000 00000002 00000002 000011A0 J-Link>w4 20000010, 87654321 Writing 87654321 -> 20000010 J-Link>mem32 20000000, 8 20000000 = 03D09000 47474553 52205245 00005454 20000010 = 87654321 00000002 00000002 000011A0 J-Link>
● RXマイコンアクセス事例:
J-Link>erase Without any give address range, Erase Chip will be executed Erasing device... J-Link: Flash download: Total time needed: 1.279s (Prepare: 0.654s, Compare: 0.000s, Erase: 0.546s, Program: 0.000s, Verify: 0.000s, Restore: 0.077s) J-Link: Flash download: Total time needed: 12.029s (Prepare: 0.485s, Compare: 0.000s, Erase: 11.467s, Program: 0.000s, Verify: 0.000s, Restore: 0.076s) J-Link: Flash download: Total time needed: 0.672s (Prepare: 0.479s, Compare: 0.000s, Erase: 0.118s, Program: 0.000s, Verify: 0.000s, Restore: 0.075s) Erasing done. J-Link>loadfile C:\Workspace\RX\rx71m_fw.mot Downloading file [C:\Workspace\RX\rx71m_fw.mot]... J-Link: Flash download: Bank 1 @ 0xFFC00000: 2 ranges affected (73728 bytes) J-Link: Flash download: Total: 1.935s (Prepare: 0.519s, Compare: 0.350s, Erase: 0.250s, Program & Verify: 0.694s, Restore: 0.120s) J-Link: Flash download: Program & Verify speed: 104 KB/s J-Link: Flash download: Bank 2 @ 0x00120040: Skipped. Contents already match O.K. J-Link>
● Cortex-Mマイコンアクセス事例:
J-Link>erase Without any give address range, Erase Chip will be executed Erasing device... J-Link: Flash download: Total time needed: 0.065s (Prepare: 0.024s, Compare: 0.000s, Erase: 0.036s, Program: 0.000s, Verify: 0.000s, Restore: 0.004s) Erasing done.J-Link>loadfile Syntax: loadfile[ ] J-Link>loadfile C:\Workspace\nrf51_fw.bin 00000000 Downloading file [C:\Workspace\nrf51_fw.bin]... J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (122880 bytes) J-Link: Flash download: Total: 2.249s (Prepare: 0.050s, Compare: 0.029s, Erase: 0.000s, Program & Verify: 2.142s, Restore: 0.026s) J-Link: Flash download: Program & Verify speed: 56 KB/s O.K. J-Link>verifybin C:\Workspace\nrf51_fw.bin, 00000000 Loading binary file C:\Workspace\nrf51_fw.bin Reading 122880 bytes data from target memory @ 0x00000000. Verify successful. J-Link>
「r」コマンドを入力しCPUをリセットして、「go」コマンドで実行します。
● RXマイコンアクセス事例:
J-Link>r Reset delay: 0 ms Reset type NORMAL: Reset CPU via CPURST bit J-Link>go J-Link>
● Cortex-Mマイコンアクセス事例:
J-Link>r Reset delay: 0 ms Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit. Reset: Halt core after reset via DEMCR.VC_CORERESET. Reset: Reset device via AIRCR.SYSRESETREQ. T-bit of XPSR is 0 but should be 1. Changed to 1. J-Link>go J-Link>
J-Linkソフトウェアのインストール手順