HowTo:使用方法・手順説明

更新日:2024-12-03

RZ/G3S-EVKIT(Cortex-A55, 2x Cortex-M33)

J-Linkを利用してコマンドライン操作でRZ/G3SマイコンのIOアクセス及び外付けQSPIフラッシュへの書き込み方法を説明します。


コマンドラインからQSPIフラッシュに書込み

J-Linkソフトウエアパッケージの「J-Link Commander」コマンドラインツールからRZ/G3Sマイコンのレジスタ設定、IOメモリ空間、フラッシュROMアクセスが可能です。フラッシュローダ対応QSPIフラッシュメモリデバイスの場合は、コマンドライン操作でフラッシュ書込みも可能です。「J-Link Commander」ツール操作はすべてのJ-Link/Flasherモデル(最新版のHWバージョン)は使用可能です。

以下、RZ/G3S-EVKIT評価ボード環境での操作順を説明します。

評価ボードの「SW_MODE」DIP-SWをQSPIブートモード(Boot Mode #7)に設定します。

  • SW_MODE[1] :OFF
  • SW_MODE[2] :OFF
  • SW_MODE[3] :OFF

J-Linkを接続し評価ボードに電源を入れて、J-Link Softwareパッケージの「J-Link Commander」ツールを起動します。「connect」コマンドを実行してRZ/G3Sデバイス名「R9A08G045S33_M33_0」を選択します。又は、デバイスダイアログから「R9A08G045S33_M33_0」デバイスを選択します。「Device>」プロンプトに「?」を入力してENTERキーを押しますとデバイス選択ダイアログが表示されます。
コア1経由でのデバッグポート接続は「R9A08G045S33_M33_1」デバイスを指定します。ターゲットインターフェースモードにSWDを選択して、デバッグクロック(例:8000kHz)を設定してデバッグポート接続を確認します。

SEGGER J-Link Commander V8.10i (Compiled Nov 27 2024 12:19:45)
DLL version V8.10i, compiled Nov 27 2024 12:18:52

Connecting to J-Link via USB...O.K.
Firmware: J-Link V12 compiled Oct  9 2024 10:52:31
Hardware version: V12.00
J-Link uptime (since boot): 0d 00h 01m 34s
S/N: 60201xxxx
License(s): RDI, FlashBP, FlashDL, JFlash, GDB
USB speed mode: High speed (480 MBit/s)
VTref=1.793V


Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. : R9A07G074M04
Type '?' for selection dialog
Device>R9A08G045S33_M33_0
Please specify target interface:
  J) JTAG (Default)
  S) SWD
  T) cJTAG
TIF>S
Specify target interface speed [kHz]. : 4000 kHz
Speed>8000
Device "R9A08G045S33_M33_0" selected.


Connecting to target via SWD
ConfigTargetSettings() start
ConfigTargetSettings() end - Took 1.53ms
InitTarget() start
  Enabling CM33 clock if required...
    CM33 clock enable sequence executed
  Releasing CM33 from reset if required...
    CM33 release from reset sequence executed
InitTarget() end - Took 6.82ms
Found SW-DP with ID 0x6BA02477
DPIDR: 0x6BA02477
CoreSight SoC-400 or earlier
AP map detection skipped. Manually configured AP map found.
AP[0]: APB-AP (IDR: Not set, ADDR: 0x00000000)
AP[1]: AXI-AP (IDR: Not set, ADDR: 0x00000000)
AP[2]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
AP[3]: AHB-AP (IDR: Not set, ADDR: 0x00000000)
AP[4]: AHB-AP (IDR: Not set, ADDR: 0x00000000)
AP[3]: Core found
AP[3]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FD214. Implementer code: 0x41 (ARM)
Feature set: Mainline
Cache: No cache
Found Cortex-M33 r0p4, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
Security extension: implemented
Secure debug: enabled
CoreSight components:
ROMTbl[0] @ E00FF000
[0][0]: E000E000 CID B105900D PID 000BBD21 DEVARCH 47702A04 DEVTYPE 00 Cortex-M33
[0][1]: E0001000 CID B105900D PID 000BBD21 DEVARCH 47701A02 DEVTYPE 00 DWT
[0][2]: E0002000 CID B105900D PID 000BBD21 DEVARCH 47701A03 DEVTYPE 00 FPB
[0][3]: E0000000 CID B105900D PID 000BBD21 DEVARCH 47701A01 DEVTYPE 43 ITM
[0][5]: E0041000 CID B105900D PID 002BBD21 DEVARCH 47724A13 DEVTYPE 13 ETM
[0][6]: E0042000 CID B105900D PID 000BBD21 DEVARCH 47701A14 DEVTYPE 14 CSS600-CTI
Memory zones:
  Zone: "Default" Description: Default access mode
Cortex-M33 identified.
J-Link>

「r」コマンドでリセット処理を実行します。「h」コマンドでCPUを停止状態に設定してCPUレジスタ内容を確認します。

J-Link>r
Reset delay: 0 ms
ResetTarget() start
Executing reset via reset pin!
  Enabling CM33 clock if required...
    CM33 clock enable sequence executed
  Releasing CM33 from reset if required...
    CM33 release from reset sequence executed
ResetTarget() end - Took 111ms
Device specific reset executed.
J-Link>h
PC = 00120100, CycleCnt = 00000000
R0 = 00000000, R1 = 00000000, R2 = 00000000, R3 = 00000000
R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000
R8 = FFFFFFFF, R9 = FFFFFFFF, R10= FFFFFFFF, R11= FFFFFFFF
R12= FFFFFFFF
SP(R13)= 00121000, MSP= 00121000, PSP= 00000000, R14(LR) = FFFFFFFF
XPSR = F9000000: APSR = NZCVQ, EPSR = 01000000, IPSR = 000 (NoException)
CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
MSPLIM = 00000000
PSPLIM = 00000000

Security extension regs:
MSP_S = 00121000, MSP_NS = 00000000
MSPLIM_S = 00000000, MSPLIM_NS = 00000000
PSP_S = 00000000, PSP_NS = FFFFFFFC
PSPLIM_S = 00000000, PSPLIM_NS = 00000000
CONTROL_S  = 00, FAULTMASK_S  = 00, BASEPRI_S  = 00, PRIMASK_S  = 00
CONTROL_NS = 00, FAULTMASK_NS = 00, BASEPRI_NS = 00, PRIMASK_NS = 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>

J-Linkプロンプトから以下順にコマンドを実行してQSPIフラッシュメモリデータのERASE、ファイルデータの書き込み及びデータベリファイ処理を確認します。
※以下の事例に2MByteのバイナリデータをQSPI NORフラッシュに書き込みます。

  • exec EnableEraseAllFlashBanks
  • erase 0x80000000 0x801FFFFF
  • mem 0x80000000, 40
  • loadfile uboot.bin 0x80000000
  • verifybin uboot.bin 0x80000000
  • mem 0x80000000, 40
J-Link>exec EnableEraseAllFlashBanks
J-Link>erase 0x80000000 0x801FFFFF
'erase': Performing implicit reset & halt of MCU.
ResetTarget() start
Executing reset via reset pin!
  Enabling CM33 clock if required...
    CM33 clock enable sequence executed
  Releasing CM33 from reset if required...
    CM33 release from reset sequence executed
ResetTarget() end - Took 112ms
Device specific reset executed.
Erasing selected range...
J-Link: Flash download: Total time needed: 10.357s (Prepare: 0.283s, Compare: 0.000s, Erase: 10.018s, Program: 0.000s, Verify: 0.000s, Restore: 0.055s)
J-Link: Flash download:
Flash sectors within Range [0x80000000 - 0x801FFFFF] deleted.
Erasing done.
J-Link>mem 0x80000000, 40
80000000 = FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF  ................
80000010 = FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF  ................
80000020 = FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF  ................
80000030 = FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF  ................
J-Link>loadfile C:\Workspace\RZ\uboot-spi.bin 0x80000000
'loadfile': Performing implicit reset & halt of MCU.
ResetTarget() start
Executing reset via reset pin!
  Enabling CM33 clock if required...
    CM33 clock enable sequence executed
  Releasing CM33 from reset if required...
    CM33 release from reset sequence executed
ResetTarget() end - Took 110ms
Device specific reset executed.
Downloading file [C:\Workspace\RZ\uboot-spi.bin]...
J-Link: Flash download: Bank 0 @ 0x80000000: 3 ranges affected (1179648 bytes)
J-Link: Flash download: Total: 20.593s (Prepare: 0.106s, Compare: 8.617s, Erase: 5.924s, Program: 3.551s, Verify: 2.338s, Restore: 0.055s)
J-Link: Flash download: Program speed: 324 KB/s
O.K.
J-Link>verifybin C:\Workspace\RZ\uboot-spi.bin 0x80000000
Loading binary file C:\Workspace\RZ\uboot-spi.bin
Reading 2097152 bytes data from target memory @ 0x80000000.
Verify successful.
J-Link>mem 0x80000000, 40
80000000 = 34 DA 01 00 FF FF FF FF  FF FF FF FF FF FF FF FF  4...............
80000010 = 00 02 00 00 FF FF FF FF  FF FF FF FF FF FF FF FF  ................
80000020 = 00 30 0A 00 FF FF FF FF  FF FF FF FF FF FF FF FF  .0..............
80000030 = FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF  ................
J-Link>mem 0x80001000, 40
80001000 = 02 02 80 D2 21 00 80 52  B1 00 00 94 E0 02 00 35  ....!..R.......5
80001010 = F7 00 00 90 96 22 00 91  F7 76 0B 91 E0 23 40 F9  ....."...v...#@.
80001020 = E3 23 01 91 02 05 80 D2  E1 03 16 AA B6 00 00 94  .#..............
80001030 = F3 03 00 2A C0 01 00 35  02 02 80 D2 E1 03 18 AA  ...*...5........
J-Link>

※J-Link Commanderプロンプトから使用可能なコマンド一覧は以下URLのページからご確認ください。
https://wiki.segger.com/J-Link_Commander


前のTOPIC

RSK+RZT2M(Cortex-R52、RZ/T2M)