-
Notifications
You must be signed in to change notification settings - Fork 42
/
gdbOldRef
134 lines (109 loc) · 4.54 KB
/
gdbOldRef
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# TODO: Migrate this to gdbCustomCmds file (and add details for simulating all IRQs and callbacks there)
# Or will this not work because user-define commands defined in gdbCustomCmds cannot be called by commands defined in gdbCustomCmds??
# Related to main loop:
#------------------------------------------------------------------------------#
# This flag indicates that USB_Configure_Event has fired and will
# cause main loop to call WriteEP() to send HID update messages
set {char}0x10000344 = 1
# Write EP is using this as a buffer... Not setup properly due to some
# IRQ/callback/bootROM code not running?
set {int} 0x200040c0 = 0x20004700
#------------------------------------------------------------------------------#
# Setup watchpoint right after PMU:PCON write (and before wfi)
# Note that going past this loops us back to 0x10000074 check and so on...
watch $pc == 0x000043d0
# Execute until watchpoint
continue
# Remove watchpoint
delete
#------------------------------------------------------------------------------#
# USB_Configure_Event:
##set $lr = $pc
# arg0 = hUsb
##set $r0 = 0x20004118
# USB_Configure_Event
##set $pc = 0x00004e58
# USB_Reset_Event:
##set $lr = $pc
# arg0 = hUsb
##set $r0 = 0x20004118
# USB_Reset_Event
##set $pc = 0x00008d8a
# USB_Suspend_Event:
##set $lr = $pc
# arg0 = hUsb
##set $r0 = 0x20004118
# USB_Suspend_Event
##set $pc = 0x0000995c
# USB_Resume_Event:
##set $lr = $pc
# arg0 = hUsb
##set $r0 = 0x20004118
# Simulate USB_Suspend_Event has executed
##set {char}0x10000345 = 1
##set {int}0x100010dc = 0x00009989
##set {int}0x100010d8 = 0x00000001
# USB_Resume_Event
##set $pc = 0x00008de4
# Interrupt_3_PIN_INT3:
##
# PINT3: An interrupt is generated on rising edge of PIO0_23 (Data Read for Right Trackpad ASIC).
# NOTE: This is DESTRUCTIVE of processor state. Use only to obtain simulation of
# interrupt. Vector Table entry is 0x00000129.
##set $lr = $pc
##set $pc = 00000138
# TODO: Try adding watch for clearing IR once it's written? Or are we confident we have ISR mapped?
#TODO: Might want to try making not destructive (if need to simulate it or other
# interrupts in the future). See Fig 81 in UM10462 for what to save to stack,
# and update LR. Then when we get back to PC of wfi we manually pop off stack.
##
# Interrupt_15_I2C:
##
# NOTE: We don't need to simulate I2C interrupt as we can abstract
# communications at higher level since lpc_chip_11uxx_lib is being used
# for I2C comms. Leaving this here for history's sake.
#
# I2C: (IRQ15) An interrupt is generated by I2C controller when the I2C
# state changes.
# NOTE: This is DESTRUCTIVE of processor state. Use only to obtain simulation of
# interrupt. Vector Table entry is 0x00000199.
##set $lr = $pc
##set $pc = 0x00000198
# Set I2C STAT code: A START condition has been transmitted.
##set {int}0x40000004 = 0x08
##
# Interrupt_16_CT16B0:
##
# CT16B0: An interrupt is generated when MR0 matches the value in the TC.
# NOTE: This is DESTRUCTIVE of processor state. Use only to obtain simulation of
# interrupt. Vector Table entry is 0x00000129.
##set $lr = $pc
##set $pc = 0x000001a0
# Set Interrupt Register to indicate Interrupt flag for match channel 0
##set {int}0x4000c000 = 1
# TODO: Try adding watch for clearing IR once it's written? Or are we confident we have ISR mapped?
#TODO: Might want to try making not destructive (if need to simulate it or other
# interrupts in the future). See Fig 81 in UM10462 for what to save to stack,
# and update LR. Then when we get back to PC of wfi we manually pop off stack.
##
# Interrupt_24_ADC:
##
# ADC Interrupt Execution:
# NOTE: This is DESTRUCTIVE of processor state. Use only to obtain simulation of
# interrupt. Vector Table entry is 0x00000205.
##set $lr = $pc
##set $pc = 0x00000204
# Counter for how many times interrupt fires initially before AD values
# start being accumulated
set {int}0x10000014 = 0x0000012d
# Counter for how many times interrupt fires for accumulating AD6 values
set {int}0x10000018 = 0x00000007
# Set flag to indicate ADC ISR has served its purpose and ADC is shutdown
set {char}0x10000010 = 1
# Set value of 8 accumulated channel 6 ADC values
# ADC Chanel 6 reads ~0x03ac when polled via adcRead command in custom firmware.
set {short}0x10000f8c = 0x1d60
#TODO: Might want to try making not destructive (if need to simulate it or other
# interrupts in the future). See Fig 81 in UM10462 for what to save to stack,
# and update LR. Then when we get back to PC of wfi we manually pop off stack.
##