2009-08-21 09:01:00 +00:00
|
|
|
#use combined on interfaces or targets that can't set TRST/SRST separately
|
|
|
|
reset_config srst_only srst_pulls_trst
|
|
|
|
|
2009-09-21 18:48:22 +00:00
|
|
|
if { [info exists CHIPNAME] } {
|
2011-10-29 21:32:17 +00:00
|
|
|
set _CHIPNAME $CHIPNAME
|
2009-09-21 18:48:22 +00:00
|
|
|
} else {
|
2011-10-29 21:32:17 +00:00
|
|
|
set _CHIPNAME at91sam7s
|
2009-08-21 09:01:00 +00:00
|
|
|
}
|
|
|
|
|
2009-09-21 18:48:22 +00:00
|
|
|
if { [info exists ENDIAN] } {
|
2011-10-29 21:32:17 +00:00
|
|
|
set _ENDIAN $ENDIAN
|
2009-09-21 18:48:22 +00:00
|
|
|
} else {
|
2011-10-29 21:32:17 +00:00
|
|
|
set _ENDIAN little
|
2009-08-21 09:01:00 +00:00
|
|
|
}
|
|
|
|
|
2011-10-29 21:32:17 +00:00
|
|
|
if { [info exists CPUTAPID] } {
|
2009-08-21 09:01:00 +00:00
|
|
|
set _CPUTAPID $CPUTAPID
|
|
|
|
} else {
|
|
|
|
set _CPUTAPID 0x3f0f0f0f
|
|
|
|
}
|
|
|
|
|
|
|
|
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
|
|
|
|
|
2009-09-04 05:17:03 +00:00
|
|
|
set _TARGETNAME $_CHIPNAME.cpu
|
2009-08-21 09:01:00 +00:00
|
|
|
|
|
|
|
target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm7tdmi
|
2009-09-21 18:48:22 +00:00
|
|
|
$_TARGETNAME configure -event reset-init {
|
2009-08-21 09:01:00 +00:00
|
|
|
soft_reset_halt
|
|
|
|
# RSTC_CR : Reset peripherals
|
|
|
|
mww 0xfffffd00 0xa5000004
|
|
|
|
# disable watchdog
|
2009-09-21 18:48:22 +00:00
|
|
|
mww 0xfffffd44 0x00008000
|
2009-08-21 09:01:00 +00:00
|
|
|
# enable user reset
|
2009-09-21 18:48:22 +00:00
|
|
|
mww 0xfffffd08 0xa5000001
|
2009-08-21 09:01:00 +00:00
|
|
|
# CKGR_MOR : enable the main oscillator
|
2009-09-21 18:48:22 +00:00
|
|
|
mww 0xfffffc20 0x00000601
|
2009-08-21 09:01:00 +00:00
|
|
|
sleep 10
|
|
|
|
# CKGR_PLLR: 96.1097 MHz
|
2009-09-21 18:48:22 +00:00
|
|
|
mww 0xfffffc2c 0x00481c0e
|
2009-08-21 09:01:00 +00:00
|
|
|
sleep 10
|
|
|
|
# PMC_MCKR : MCK = PLL / 2 ~= 48 MHz
|
2009-09-21 18:48:22 +00:00
|
|
|
mww 0xfffffc30 0x00000007
|
2009-08-21 09:01:00 +00:00
|
|
|
sleep 10
|
|
|
|
# MC_FMR: flash mode (FWS=1,FMCN=73)
|
2009-09-21 18:48:22 +00:00
|
|
|
mww 0xffffff60 0x00490100
|
|
|
|
sleep 100
|
2009-08-21 09:01:00 +00:00
|
|
|
}
|
|
|
|
|
2009-11-08 16:52:40 +00:00
|
|
|
$_TARGETNAME configure -work-area-phys 0x00200000 -work-area-size 0x4000 -work-area-backup 0
|
2009-08-21 09:01:00 +00:00
|
|
|
|
|
|
|
#flash bank <driver> <base_addr> <size> <chip_width> <bus_width> <target_number> [<target_name> <banks> <sectors_per_bank> <pages_per_sector> <page_size> <num_nvmbits> <ext_freq_khz>]
|
2009-11-18 10:15:52 +00:00
|
|
|
set _FLASHNAME $_CHIPNAME.flash
|
2013-11-22 10:16:41 +00:00
|
|
|
flash bank $_FLASHNAME at91sam7 0 0 0 0 $_TARGETNAME 0 0 0 0 0 0 0 18432
|