-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgdb_smarc_g2l_uboot_simple
61 lines (49 loc) · 1.57 KB
/
gdb_smarc_g2l_uboot_simple
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# This script is meant to debug the SMARC RZ/G2L U-boot
# Please set the board boot mode to SCIF boot: SW11 ON-OFF-ON-OFF
# It must be copied in the u-boot source root folder
# It is assumed that ATF code is already programmed in QSPI
#
# This script works only if OpenOCD write memory functions are patched:
# http://openocd.zylin.com/#/c/6266/
# Connect to OpenOCD
# If the script is launched from GDB command line then the next line shall not be commented out
# In Eclipse it is not needed since the connection is attempted by Eclipse itself
#target remote localhost:3333
mon reset
# Re-examine after reset
mon r9a07g044l.a55.0 arp_examine 0
mon r9a07g044l.a55.0 arp_examine 1
mon halt
shell sleep 0.5
# Disable SMP
mon r9a07g044l.a55.0 aarch64 smp off
shell sleep 0.5
# Set Boot ROM and internal RAM to RO to force GDB using HW breakpoints
mem 0x0 0x2FFFF ro
# set PC to reset vector (Boot ROM)
set $pc=0x0
# Fake MD_BOOT value to QSPI (0x3 instead of 0x5)
hbreak *0x3620
c
shell sleep 0.5
set $x8=0x1203
shell sleep 0.5
# Break at U-boot entry point
hbreak *0x50000000
continue
shell sleep 1
# Add DDR memory region
mem 0x50000000 0xBFFFFFFF rw
# Load U-boot code (binary) and related symbols
# The load may take a while, ~ 50 seconds with J-link lite. Be patient.
restore u-boot.bin binary 0x50000000
shell sleep 1
symbol-file u-boot
shell sleep 1
# Set a Breakpoint to the start of the U-boot relocation routine
hb relocate_code
c
# Now we are ready to relocate U-boot symbols, note that "-o" requires a relatively new GDB (9.1 is OK).
symbol-file u-boot -o gd->reloc_off
hb run_main_loop
c