2008-04-23 08:10:27 -05:00
|
|
|
#Hilscher netX 500 CPU
|
2008-11-30 16:25:43 -06:00
|
|
|
|
2009-09-21 13:48:22 -05:00
|
|
|
if { [info exists CHIPNAME] } {
|
2011-10-29 16:32:17 -05:00
|
|
|
set _CHIPNAME $CHIPNAME
|
2009-09-21 13:48:22 -05:00
|
|
|
} else {
|
2011-10-29 16:32:17 -05:00
|
|
|
set _CHIPNAME netx500
|
2008-11-30 16:25:43 -06:00
|
|
|
}
|
|
|
|
|
2009-09-21 13:48:22 -05:00
|
|
|
if { [info exists ENDIAN] } {
|
2011-10-29 16:32:17 -05:00
|
|
|
set _ENDIAN $ENDIAN
|
2009-09-21 13:48:22 -05:00
|
|
|
} else {
|
2011-10-29 16:32:17 -05:00
|
|
|
set _ENDIAN little
|
2008-11-30 16:25:43 -06:00
|
|
|
}
|
|
|
|
|
2011-10-29 16:32:17 -05:00
|
|
|
if { [info exists CPUTAPID] } {
|
2008-11-30 16:25:43 -06:00
|
|
|
set _CPUTAPID $CPUTAPID
|
|
|
|
} else {
|
2009-11-20 14:21:00 -06:00
|
|
|
set _CPUTAPID 0x07926021
|
2008-11-30 16:25:43 -06:00
|
|
|
}
|
|
|
|
|
2009-11-20 14:21:00 -06:00
|
|
|
# jtag scan chain
|
|
|
|
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
|
|
|
|
|
|
|
|
# that TAP is associated with a target
|
2009-09-04 00:17:03 -05:00
|
|
|
set _TARGETNAME $_CHIPNAME.cpu
|
2009-11-20 14:21:00 -06:00
|
|
|
target create $_TARGETNAME arm926ejs -endian $_ENDIAN -chain-position $_TARGETNAME
|
2008-07-28 01:08:05 -05:00
|
|
|
|
2010-12-16 08:33:16 -06:00
|
|
|
proc mread32 {addr} {
|
|
|
|
set value(0) 0
|
|
|
|
mem2array value 32 $addr 1
|
|
|
|
return $value(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
# This function must be called on netX100/500 right after halt
|
|
|
|
# If it is called later the needed register cannot be written anymore
|
|
|
|
proc sdram_fix { } {
|
|
|
|
|
|
|
|
set accesskey [mread32 0x00100070]
|
2021-04-10 11:28:52 -05:00
|
|
|
mww 0x00100070 $accesskey
|
2011-10-29 16:32:17 -05:00
|
|
|
mww 0x0010002c 0x00000001
|
2010-12-16 08:33:16 -06:00
|
|
|
|
2021-04-10 11:28:52 -05:00
|
|
|
if {[expr {[mread32 0x0010002c] & 0x07}] == 0x07} {
|
2010-12-16 08:33:16 -06:00
|
|
|
puts "SDRAM Fix was not executed. Probably your CPU halted too late and the register is already locked!"
|
|
|
|
} else {
|
|
|
|
puts "SDRAM Fix succeeded!"
|
|
|
|
}
|
|
|
|
}
|