Page 1 of 1

How to detect external cfi flash

Posted: Tue May 10, 2016 1:01 am
by victorvdl
Hi all,

How can I detect 2 different cfi flashes which can be connected to my Atmel 91R40008 processor?
This is my configuration script now:
Code: Select all
tcl_port 6666
telnet_port 4444
gdb_port 3333

interface ft2232
ft2232_device_desc "Amontec JTAGkey A"
ft2232_layout jtagkey
ft2232_vid_pid 0x0403 0xcff8

jtag_nsrst_delay 200
jtag_ntrst_delay 200

reset_config srst_only srst_pulls_trst

jtag newtap AT91R40008 cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x1F0F0F0F
target create AT91R40008.cpu arm7tdmi -endian little -chain-position AT91R40008.cpu -variant arm7tdmi
AT91R40008.cpu configure -work-area-virt 0 -work-area-phys 0x0 -work-area-size 0x40000 -work-area-backup 0

flash bank cfi 0x10000000 0x02000000 2 2  AT91R40008.cpu 

init
reset
halt

mww 0xffe00000 0x1000253D
mww 0xffe00024 0x00000000
mww 0xffe00020 0x00000001

flash info AT91R40008.cpu                                       # get flash info

flash write_image erase Master.bin 0x10000000 bin              # erase and program flash

shutdown 
That is working fine.
Code: Select all
Flash info AT91R40008.cpu
shows me the correct manufacturer and product ID.

But for some devices with for me a well know manufacturer and product ID, I need to program twice, like this:
Code: Select all
flash write_image erase Master.bin 0x10000000 bin              # erase and program flash
flash write_image erase Master.bin 0x10400000 bin              # erase and program flash
And the line
Code: Select all
flash bank cfi 0x10000000 0x400000 2 2  AT91R40008.cpu 
must then be changed in
Code: Select all
flash bank cfi 0x10000000 0x02000000 2 2  AT91R40008.cpu 
for that device.

How can I change the script to detect the flash so that I can use 1 script file for both devices?
Is that possible?