# Uncomment exactly one of the following lines to
# indicate which JTAG dongle you are using:

source [find interface/olimex-jtag-tiny.cfg]       ; # The ARM-USB-TINY dongle
#source [find interface/olimex-arm-usb-tiny-h.cfg] ; # The -H variant

source [find board/hp-20b-calculator.cfg]

# Disable the telnet port to avoid security concerns
telnet_port 0

proc write_flash {image} {
     reset init

     mww 0xffffff64  0x5a000009 ; # Clear lock bit 0
     mww 0xFFFFFF64  0x5a000005 ; # Erase all
     sleep 3
     
     # Write the image file
     flash write_image $image

     # Set GPNVM bit 1 to make the chip boot from flash instead of ROM
     at91sam7 gpnvm 1 set

     reset init
}
