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