147 lines
2.9 KiB
Plaintext
147 lines
2.9 KiB
Plaintext
# These are some useful functions to add to your ~/.xt-gdbinit file
|
|
# Standard gdb debug settings
|
|
|
|
set history filename ~/.gdb_history
|
|
set history save on
|
|
set print pretty on
|
|
set print object on
|
|
set print vtbl on
|
|
set pagination off
|
|
set output-radix 16
|
|
|
|
set $new=1
|
|
|
|
######## mtd function ########
|
|
define emc_enable
|
|
# disable emc
|
|
set *(0x50019000 + 0x08) &= ~(1 << 11)
|
|
# reset emc
|
|
set *(0x50019000 + 0x04) |= (1 << 11)
|
|
set *(0x50019000 + 0x04) &= ~(1 << 11)
|
|
# enable emc
|
|
set *(0x50019000 + 0x08) |= (1 << 11)
|
|
end
|
|
|
|
define mtd_io_share_disable
|
|
end
|
|
|
|
define mtd_io_share_enable
|
|
end
|
|
|
|
define smc_init
|
|
# set qspi mode
|
|
set *(0x58080200 + 0x0c) = 0x01201102
|
|
set *(0x58080200 + 0x3c) |= 0x11
|
|
# enable smc and cfg clk
|
|
set *(0x58080200 + 0x10) |= 0x10
|
|
end
|
|
|
|
define psram_init
|
|
# enter qpi mode
|
|
set *(0x58080200 + 0x08) = (0x35 << 24) + 0x00
|
|
set *(0x58080200 + 0x04) &= 0xFE00FFFC
|
|
set *(0x58080200 + 0x0c) &= ~(1 << 12)
|
|
set *(0x58080200 + 0x04) |= (1 << 31)
|
|
end
|
|
|
|
define sfc_init
|
|
end
|
|
|
|
define flash_init
|
|
end
|
|
|
|
define cache_enable
|
|
# cache init step: disable, reset, enable, set space
|
|
# icache0
|
|
set *(0x50019000 + 0x04) |= (1 << 4)
|
|
set *(0x50019000 + 0x04) &= ~(1 << 4)
|
|
set *(0x50019000 + 0x08) |= (1 << 4)
|
|
set *(0x58000000 + 0x44) = 0x0404
|
|
while !((*(0x58000000 + 0x00)) & (1 << 6))
|
|
end
|
|
# icache1
|
|
set *(0x50019000 + 0x04) |= (1 << 5)
|
|
set *(0x50019000 + 0x04) &= ~(1 << 5)
|
|
set *(0x50019000 + 0x08) |= (1 << 5)
|
|
set *(0x58000000 + 0x44) = 0x0404
|
|
while !((*(0x58010000 + 0x00)) & (1 << 6))
|
|
end
|
|
# icache2
|
|
set *(0x50019000 + 0x04) |= (1 << 6)
|
|
set *(0x50019000 + 0x04) &= ~(1 << 6)
|
|
set *(0x50019000 + 0x08) |= (1 << 6)
|
|
set *(0x58000000 + 0x44) = 0x0404
|
|
while !((*(0x58020000 + 0x00)) & (1 << 6))
|
|
end
|
|
# dcache0
|
|
set *(0x50019000 + 0x04) |= (1 << 7)
|
|
set *(0x50019000 + 0x04) &= ~(1 << 7)
|
|
set *(0x50019000 + 0x08) |= (1 << 7)
|
|
set *(0x58030000 + 0x44) = 0x0404
|
|
while !((*(0x58030000 + 0x00)) & (1 << 6))
|
|
end
|
|
# dcache1
|
|
set *(0x50019000 + 0x04) |= (1 << 8)
|
|
set *(0x50019000 + 0x04) &= ~(1 << 8)
|
|
set *(0x50019000 + 0x08) |= (1 << 8)
|
|
set *(0x58030000 + 0x44) = 0x0404
|
|
while !((*(0x58040000 + 0x00)) & (1 << 6))
|
|
end
|
|
end
|
|
|
|
define mtd_init
|
|
emc_enable
|
|
psram_init
|
|
smc_init
|
|
cache_enable
|
|
sfc_init
|
|
flash_init
|
|
end
|
|
|
|
define disable_watchdog
|
|
set *0x40040080 = 0x57444750
|
|
set *0x40040008 = 0
|
|
set *0x40040080 = 0
|
|
set *0x40041080 = 0x57444750
|
|
set *0x40041008 = 0
|
|
set *0x40041080 = 0
|
|
set *0x40042080 = 0x57444750
|
|
set *0x40042008 = 0
|
|
set *0x40042080 = 0
|
|
end
|
|
|
|
define disable_tick_int
|
|
# disable tick int0
|
|
set *0x40030054 = 0x0
|
|
# clear tick int0
|
|
set *0x40030058 = 0x1
|
|
# disable tick int1
|
|
set *0x40031054 = 0x0
|
|
# clear tick int1
|
|
set *0x40031058 = 0x1
|
|
# disable tick int2
|
|
set *0x40032054 = 0x0
|
|
# clear tick int2
|
|
set *0x40032058 = 0x1
|
|
end
|
|
|
|
######## system function ########
|
|
|
|
define vm
|
|
target extended-remote:3333
|
|
disable_tick_int
|
|
disable_watchdog
|
|
end
|
|
|
|
define vm1
|
|
target extended-remote:3334
|
|
disable_tick_int
|
|
disable_watchdog
|
|
end
|
|
define vm2
|
|
target extended-remote:3335
|
|
disable_tick_int
|
|
disable_watchdog
|
|
end
|
|
|