hi,
I use RT1176 and i have to write flash (mapped to 0x30000000)
The FW is divided into two parts,
- a first part called the boot header exactly 8K in size
- a second part which is the actual application and starts at offset 0x2000.
For each of the two parts I have an elf file.
How do I write both parts into the flash using a script?
I tried the following script:
device MIMXRT1176xxxA_M7
if SWD
speed auto
connect
sleep 1
loadfile "FW/image/Ama_BootHdr.elf"
sleep 1
loadfile "FW/image/Ama.elf"
exit
But I get a timeout error when trying to write the second part:
SEGGER J-Link Commander V7.92n (Compiled Oct 31 2023 15:15:57)
DLL version V7.92n, compiled Oct 31 2023 15:15:34
J-Link Command File read successfully.
Processing script file...
J-Link>device MIMXRT1176xxxA_M7
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link Ultra V4 compiled Sep 22 2022 15:00:10
Hardware version: V4.00
J-Link uptime (since boot): N/A (Not supported by this model)
S/N: 504400379
License(s): RDI, FlashBP, FlashDL, JFlash, GDB
VTref=3.308V
J-Link>if SWD
Selecting SWD as current target interface.
J-Link>speed auto
Selecting auto as target interface speed
J-Link>connect
Device "MIMXRT1176XXXA_M7" selected.
Connecting to target via SWD
Found SW-DP with ID 0x6BA02477
DPIDR: 0x6BA02477
CoreSight SoC-400 or earlier
Scanning AP map to find all available APs
AP[3]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x84770001)
AP[1]: AHB-AP (IDR: 0x24770011)
AP[2]: APB-AP (IDR: 0x54770002)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FD000
CPUID register: 0x411FC272. Implementer code: 0x41 (ARM)
Cache: L1 I/D-cache present
Found Cortex-M7 r1p2, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
CoreSight components:
ROMTbl[0] @ E00FD000
[0][0]: E00FE000 CID B105100D PID 000BB4C8 ROM Table
ROMTbl[1] @ E00FE000
[1][0]: E00FF000 CID B105100D PID 000BB4C7 ROM Table
ROMTbl[2] @ E00FF000
[2][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7
[2][1]: E0001000 CID B105E00D PID 000BB002 DWT
[2][2]: E0002000 CID B105E00D PID 000BB00E FPB-M7
[2][3]: E0000000 CID B105E00D PID 000BB001 ITM
[1][1]: E0041000 CID B105900D PID 001BB975 ETM-M7
[1][2]: E0042000 CID B105900D PID 004BB906 CTI
[0][1]: E0043000 CID B105900D PID 001BB908 CSTF
I-Cache L1: 32 KB, 512 Sets, 32 Bytes/Line, 2-Way
D-Cache L1: 32 KB, 256 Sets, 32 Bytes/Line, 4-Way
Memory zones:
Zone: "Default" Description: Default access mode
Cortex-M7 identified.
J-Link>sleep 1
Sleep(1)
J-Link>loadfile "FW/image/Ama_BootHdr.elf"
'loadfile': Performing implicit reset & halt of MCU.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Core did not halt after reset, halting it manually.
AfterResetTarget() start
Valid application detected. Setting PC / SP manually.
Booting from FlexSPI1.
AfterResetTarget() end - Took 52.8ms
Downloading file [FW/image/Ama_BootHdr.elf]...
J-Link: Flash download: Bank 0 @ 0x30000000: 1 range affected (65536 bytes)
J-Link: Flash download: Total: 1.457s (Prepare: 0.277s, Compare: 0.212s, Erase: 0.467s, Program: 0.000s, Verify: 0.499s, Restore: 0.000s)
J-Link: Flash download: Program speed: 0 KB/s
****** Error: Verification failed @ address 0x30000000
Timeout while programming sector, RAMCode did not respond in time!
Error while programming flash: Verify failed.
J-Link>sleep 1
Sleep(1)
J-Link>loadfile "FW/image/Ama.elf"
'loadfile': Performing implicit reset & halt of MCU.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Reset: SYSRESETREQ has confused core.
Found SW-DP with ID 0x6BA02477
DPIDR: 0x6BA02477
CoreSight SoC-400 or earlier
AP map detection skipped. Manually configured AP map found.
AP[0]: AHB-AP (IDR: Not set)
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FD000
CPUID register: 0x411FC272. Implementer code: 0x41 (ARM)
Cache: L1 I/D-cache present
Found Cortex-M7 r1p2, Little endian.
Reset: Using fallback: VECTRESET.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.VECTRESET.
AfterResetTarget() start
AfterResetTarget() end - Took 159ms
Downloading file [FW/image/Ama.elf]...
****** Error: Timeout while get device description, RAMCode did not respond in time!
SEGGER_OPEN_GetFlashInfo(): RAMCode never stops. failed to determine dynamic flash info.
Error while determining flash info (Bank @ 0x30000000)
Unspecified error -1
J-Link>exit
Script processing completed.
Display More
in particular I notice that the affected ranges for the boot header is 64KB which corresponds to the largest erasable sector of my flash. In addition, I have a verification error.
I tried swapping the two files:
device MIMXRT1176xxxA_M7
if SWD
speed auto
connect
sleep 1
loadfile "FW/image/Ama.elf"
sleep 1
loadfile "FW/image/Ama_BootHdr.elf"
exit
the behavior changes, I no longer have timeouts:
SEGGER J-Link Commander V7.92n (Compiled Oct 31 2023 15:15:57)
DLL version V7.92n, compiled Oct 31 2023 15:15:34
J-Link Command File read successfully.
Processing script file...
J-Link>device MIMXRT1176xxxA_M7
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link Ultra V4 compiled Sep 22 2022 15:00:10
Hardware version: V4.00
J-Link uptime (since boot): N/A (Not supported by this model)
S/N: 504400379
License(s): RDI, FlashBP, FlashDL, JFlash, GDB
VTref=3.308V
J-Link>if SWD
Selecting SWD as current target interface.
J-Link>speed auto
Selecting auto as target interface speed
J-Link>connect
Device "MIMXRT1176XXXA_M7" selected.
Connecting to target via SWD
Found SW-DP with ID 0x6BA02477
DPIDR: 0x6BA02477
CoreSight SoC-400 or earlier
Scanning AP map to find all available APs
AP[3]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x84770001)
AP[1]: AHB-AP (IDR: 0x24770011)
AP[2]: APB-AP (IDR: 0x54770002)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FD000
CPUID register: 0x411FC272. Implementer code: 0x41 (ARM)
Cache: L1 I/D-cache present
Found Cortex-M7 r1p2, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
CoreSight components:
ROMTbl[0] @ E00FD000
[0][0]: E00FE000 CID B105100D PID 000BB4C8 ROM Table
ROMTbl[1] @ E00FE000
[1][0]: E00FF000 CID B105100D PID 000BB4C7 ROM Table
ROMTbl[2] @ E00FF000
[2][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7
[2][1]: E0001000 CID B105E00D PID 000BB002 DWT
[2][2]: E0002000 CID B105E00D PID 000BB00E FPB-M7
[2][3]: E0000000 CID B105E00D PID 000BB001 ITM
[1][1]: E0041000 CID B105900D PID 001BB975 ETM-M7
[1][2]: E0042000 CID B105900D PID 004BB906 CTI
[0][1]: E0043000 CID B105900D PID 001BB908 CSTF
I-Cache L1: 32 KB, 512 Sets, 32 Bytes/Line, 2-Way
D-Cache L1: 32 KB, 256 Sets, 32 Bytes/Line, 4-Way
Memory zones:
Zone: "Default" Description: Default access mode
Cortex-M7 identified.
J-Link>sleep 1
Sleep(1)
J-Link>loadfile "FW/image/Ama.elf"
'loadfile': Performing implicit reset & halt of MCU.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Core did not halt after reset, halting it manually.
AfterResetTarget() start
Valid application detected. Setting PC / SP manually.
Booting from FlexSPI1.
AfterResetTarget() end - Took 53.1ms
Downloading file [FW/image/Ama.elf]...
J-Link: Flash download: Bank 0 @ 0x30000000: 1 range affected (262144 bytes)
J-Link: Flash download: Total: 6.568s (Prepare: 0.326s, Compare: 1.632s, Erase: 1.835s, Program: 2.173s, Verify: 0.402s, Restore: 0.196s)
J-Link: Flash download: Program speed: 117 KB/s
****** Error: Verification failed @ address 0x30000000
Error while programming flash: Verify failed.
J-Link>sleep 1
Sleep(1)
J-Link>loadfile "FW/image/Ama_BootHdr.elf"
'loadfile': Performing implicit reset & halt of MCU.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Core did not halt after reset, halting it manually.
AfterResetTarget() start
Valid application detected. Setting PC / SP manually.
Booting from FlexSPI1.
AfterResetTarget() end - Took 53.0ms
Downloading file [FW/image/Ama_BootHdr.elf]...
J-Link: Flash download: Bank 0 @ 0x30000000: 1 range affected (262144 bytes)
J-Link: Flash download: Total: 6.592s (Prepare: 0.326s, Compare: 1.627s, Erase: 1.805s, Program: 2.234s, Verify: 0.402s, Restore: 0.195s)
J-Link: Flash download: Program speed: 114 KB/s
****** Error: Verification failed @ address 0x30000000
Error while programming flash: Verify failed.
J-Link>exit
Script processing completed.
Display More
for both parts I have the address 0x30000000, which is incorrect for the application, and the affected range is 262144 for both. They also both fail verification.
so how should the script be for me to write the two parts, verifying both?
best regards
Max