-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgdb_smarc_g2l_uboot
97 lines (77 loc) · 2.56 KB
/
gdb_smarc_g2l_uboot
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# 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, binaries are expected in the .out folder
# It is assumed that ATF code (strictly required) resides at the same level as u-boot, e.g.:
# PATH/rzg_trusted-firmware-a
# PATH/renesas-u-boot-cip
#
# 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
# Load BL2 code and use related symbols
load ../rzg_trusted-firmware-a/build/rzg2l/debug/bl2/bl2.elf
shell sleep 1
symbol-file ../rzg_trusted-firmware-a/build/rzg2l/debug/bl2/bl2.elf
shell sleep 1
# Restore BOOT_ID to the expected value: 0x3 = QSPI boot
mon mww 0x10000 0x3
# Insert HW breakpoint. SW breakpoints are failing because EL3 MMU is enabled
# and apparently memory is set to read only in the corresponding page
hbreak bl2_main
continue
# Set internal RAM to RO to force GDB using HW breakpoints
mem 0x10000 0x2FFFF ro
# Break at BL31 entry point
hbreak *0x44000000
shell sleep 1
# Add DDR memory region
mem 0x40000000 0x4FFFFFFF rw
continue
shell sleep 1
clear bl2_main
# Load BL31 code and related symbols
load ../rzg_trusted-firmware-a/build/rzg2l/debug/bl31/bl31.elf
shell sleep 1
symbol-file ../rzg_trusted-firmware-a/build/rzg2l/debug/bl31/bl31.elf
shell sleep 1
hbreak bl31_main
# Set DDR BL31 region to RO to force GDB using HW breakpoints
delete mem 2
shell sleep 1
mem 0x40000000 0x4FFFFFFF ro
shell sleep 1
continue
# Break at U-boot entry point
hbreak *0x50000000
shell sleep 1
# Add DDR memory region
mem 0x50000000 0xBFFFFFFF rw
continue
shell sleep 1
clear bl31_main
# Load U-boot code (binary) and related symbols
# The load may take a while, ~ 50 seconds with J-link lite. Be patient.
#call memset(0x50000000, 0xCC, 0x10000)
restore .out/u-boot.bin binary 0x50000000
shell sleep 1
symbol-file .out/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 .out/u-boot -o gd->reloc_off
hb run_main_loop
c